repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
hayribakici/infiniteviewpager | infiniteviewpager/src/com/thehayro/view/InfinitePagerAdapter.java | InfinitePagerAdapter.instantiateItem | @Override
public final Object instantiateItem(final ViewGroup container, final int position) {
if (Constants.DEBUG) {
Log.i("InfiniteViewPager", String.format("instantiating position %s", position));
}
final PageModel<T> model = createPageModel(position);
mPageModels[position] = model;
container.addView(model.getParentView());
return model;
} | java | @Override
public final Object instantiateItem(final ViewGroup container, final int position) {
if (Constants.DEBUG) {
Log.i("InfiniteViewPager", String.format("instantiating position %s", position));
}
final PageModel<T> model = createPageModel(position);
mPageModels[position] = model;
container.addView(model.getParentView());
return model;
} | [
"@",
"Override",
"public",
"final",
"Object",
"instantiateItem",
"(",
"final",
"ViewGroup",
"container",
",",
"final",
"int",
"position",
")",
"{",
"if",
"(",
"Constants",
".",
"DEBUG",
")",
"{",
"Log",
".",
"i",
"(",
"\"InfiniteViewPager\"",
",",
"String",
... | This method is only called, when this pagerAdapter is initialized. | [
"This",
"method",
"is",
"only",
"called",
"when",
"this",
"pagerAdapter",
"is",
"initialized",
"."
] | train | https://github.com/hayribakici/infiniteviewpager/blob/cb3ca2a3833bbb3aeef02b9693787987b970bb89/infiniteviewpager/src/com/thehayro/view/InfinitePagerAdapter.java#L63-L72 |
jfinal/jfinal | src/main/java/com/jfinal/template/ext/spring/JFinalViewResolver.java | JFinalViewResolver.loadView | protected View loadView(String viewName, Locale locale) throws Exception {
String suffix = getSuffix();
if (".jsp".equals(suffix) || ".ftl".equals(suffix) || ".vm".equals(suffix)) {
return null;
} else {
return super.loadView(viewName, locale);
}
} | java | protected View loadView(String viewName, Locale locale) throws Exception {
String suffix = getSuffix();
if (".jsp".equals(suffix) || ".ftl".equals(suffix) || ".vm".equals(suffix)) {
return null;
} else {
return super.loadView(viewName, locale);
}
} | [
"protected",
"View",
"loadView",
"(",
"String",
"viewName",
",",
"Locale",
"locale",
")",
"throws",
"Exception",
"{",
"String",
"suffix",
"=",
"getSuffix",
"(",
")",
";",
"if",
"(",
"\".jsp\"",
".",
"equals",
"(",
"suffix",
")",
"||",
"\".ftl\"",
".",
"e... | 支持 jfinal enjoy、jsp、freemarker、velocity 四类模板共存于一个项目中
注意:这里采用识别 ".jsp"、".ftl"、".vm" 模板后缀名的方式来实现功能
所以 jfinal enjoy 模板不要采用上述三种后缀名,否则功能将失效
还要注意与 jsp、freemarker、velocity 以外类型模板共存使用时
需要改造该方法 | [
"支持",
"jfinal",
"enjoy、jsp、freemarker、velocity",
"四类模板共存于一个项目中"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/ext/spring/JFinalViewResolver.java#L262-L269 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.batchGetItem | public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(batchGetItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<BatchGetItemRequest> request = marshall(batchGetItemRequest,
new BatchGetItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<BatchGetItemResult, JsonUnmarshallerContext> unmarshaller = new BatchGetItemResultJsonUnmarshaller();
JsonResponseHandler<BatchGetItemResult> responseHandler = new JsonResponseHandler<BatchGetItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(batchGetItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<BatchGetItemRequest> request = marshall(batchGetItemRequest,
new BatchGetItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<BatchGetItemResult, JsonUnmarshallerContext> unmarshaller = new BatchGetItemResultJsonUnmarshaller();
JsonResponseHandler<BatchGetItemResult> responseHandler = new JsonResponseHandler<BatchGetItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"BatchGetItemResult",
"batchGetItem",
"(",
"BatchGetItemRequest",
"batchGetItemRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"batchGetItemRequest",
")",
... | <p>
Retrieves the attributes for multiple items from multiple tables using
their primary keys.
</p>
<p>
The maximum number of item attributes that can be retrieved for a
single operation is 100. Also, the number of items retrieved is
constrained by a 1 MB the size limit. If the response size limit is
exceeded or a partial result is returned due to an internal processing
failure, Amazon DynamoDB returns an <code>UnprocessedKeys</code> value
so you can retry the operation starting with the next item to get.
</p>
<p>
Amazon DynamoDB automatically adjusts the number of items returned per
page to enforce this limit. For example, even if you ask to retrieve
100 items, but each individual item is 50k in size, the system returns
20 items and an appropriate <code>UnprocessedKeys</code> value so you
can get the next page of results. If necessary, your application needs
its own logic to assemble the pages of results into one set.
</p>
@param batchGetItemRequest Container for the necessary parameters to
execute the BatchGetItem service method on AmazonDynamoDB.
@return The response from the BatchGetItem service method, as returned
by AmazonDynamoDB.
@throws ProvisionedThroughputExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Retrieves",
"the",
"attributes",
"for",
"multiple",
"items",
"from",
"multiple",
"tables",
"using",
"their",
"primary",
"keys",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"maximum",
"number",
"of",
"item",
"attributes",
"that",
"can",
"be",
"... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L908-L920 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/dao/InvoiceDaoHelper.java | InvoiceDaoHelper.createAdjustmentItem | public InvoiceItemModelDao createAdjustmentItem(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final UUID invoiceId, final UUID invoiceItemId,
final BigDecimal positiveAdjAmount, final Currency currency,
final LocalDate effectiveDate, final InternalCallContext context) throws InvoiceApiException {
// First, retrieve the invoice item in question
final InvoiceItemSqlDao invoiceItemSqlDao = entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class);
final InvoiceItemModelDao invoiceItemToBeAdjusted = invoiceItemSqlDao.getById(invoiceItemId.toString(), context);
if (invoiceItemToBeAdjusted == null) {
throw new InvoiceApiException(ErrorCode.INVOICE_ITEM_NOT_FOUND, invoiceItemId);
}
// Validate the invoice it belongs to
if (!invoiceItemToBeAdjusted.getInvoiceId().equals(invoiceId)) {
throw new InvoiceApiException(ErrorCode.INVOICE_INVALID_FOR_INVOICE_ITEM_ADJUSTMENT, invoiceItemId, invoiceId);
}
// Retrieve the amount and currency if needed
final BigDecimal amountToAdjust = MoreObjects.firstNonNull(positiveAdjAmount, invoiceItemToBeAdjusted.getAmount());
// TODO - should we enforce the currency (and respect the original one) here if the amount passed was null?
final Currency currencyForAdjustment = MoreObjects.firstNonNull(currency, invoiceItemToBeAdjusted.getCurrency());
// Finally, create the adjustment
// Note! The amount is negated here!
return new InvoiceItemModelDao(context.getCreatedDate(), InvoiceItemType.ITEM_ADJ, invoiceItemToBeAdjusted.getInvoiceId(), invoiceItemToBeAdjusted.getAccountId(),
null, null, null, invoiceItemToBeAdjusted.getProductName(), invoiceItemToBeAdjusted.getPlanName(), invoiceItemToBeAdjusted.getPhaseName(),
invoiceItemToBeAdjusted.getUsageName(), effectiveDate, effectiveDate, amountToAdjust.negate(), null, currencyForAdjustment, invoiceItemToBeAdjusted.getId());
} | java | public InvoiceItemModelDao createAdjustmentItem(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final UUID invoiceId, final UUID invoiceItemId,
final BigDecimal positiveAdjAmount, final Currency currency,
final LocalDate effectiveDate, final InternalCallContext context) throws InvoiceApiException {
// First, retrieve the invoice item in question
final InvoiceItemSqlDao invoiceItemSqlDao = entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class);
final InvoiceItemModelDao invoiceItemToBeAdjusted = invoiceItemSqlDao.getById(invoiceItemId.toString(), context);
if (invoiceItemToBeAdjusted == null) {
throw new InvoiceApiException(ErrorCode.INVOICE_ITEM_NOT_FOUND, invoiceItemId);
}
// Validate the invoice it belongs to
if (!invoiceItemToBeAdjusted.getInvoiceId().equals(invoiceId)) {
throw new InvoiceApiException(ErrorCode.INVOICE_INVALID_FOR_INVOICE_ITEM_ADJUSTMENT, invoiceItemId, invoiceId);
}
// Retrieve the amount and currency if needed
final BigDecimal amountToAdjust = MoreObjects.firstNonNull(positiveAdjAmount, invoiceItemToBeAdjusted.getAmount());
// TODO - should we enforce the currency (and respect the original one) here if the amount passed was null?
final Currency currencyForAdjustment = MoreObjects.firstNonNull(currency, invoiceItemToBeAdjusted.getCurrency());
// Finally, create the adjustment
// Note! The amount is negated here!
return new InvoiceItemModelDao(context.getCreatedDate(), InvoiceItemType.ITEM_ADJ, invoiceItemToBeAdjusted.getInvoiceId(), invoiceItemToBeAdjusted.getAccountId(),
null, null, null, invoiceItemToBeAdjusted.getProductName(), invoiceItemToBeAdjusted.getPlanName(), invoiceItemToBeAdjusted.getPhaseName(),
invoiceItemToBeAdjusted.getUsageName(), effectiveDate, effectiveDate, amountToAdjust.negate(), null, currencyForAdjustment, invoiceItemToBeAdjusted.getId());
} | [
"public",
"InvoiceItemModelDao",
"createAdjustmentItem",
"(",
"final",
"EntitySqlDaoWrapperFactory",
"entitySqlDaoWrapperFactory",
",",
"final",
"UUID",
"invoiceId",
",",
"final",
"UUID",
"invoiceItemId",
",",
"final",
"BigDecimal",
"positiveAdjAmount",
",",
"final",
"Curre... | Create an adjustment for a given invoice item. This just creates the object in memory, it doesn't write it to disk.
@param invoiceId the invoice id
@param invoiceItemId the invoice item id to adjust
@param effectiveDate adjustment effective date, in the account timezone
@param positiveAdjAmount the amount to adjust. Pass null to adjust the full amount of the original item
@param currency the currency of the amount. Pass null to default to the original currency used
@return the adjustment item | [
"Create",
"an",
"adjustment",
"for",
"a",
"given",
"invoice",
"item",
".",
"This",
"just",
"creates",
"the",
"object",
"in",
"memory",
"it",
"doesn",
"t",
"write",
"it",
"to",
"disk",
"."
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/dao/InvoiceDaoHelper.java#L199-L224 |
sahan/IckleBot | icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java | PermissionUtils.isGranted | public static boolean isGranted(Object context, String permission) {
if(ContextUtils.discover(context)
.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
return true;
}
else {
return false;
}
} | java | public static boolean isGranted(Object context, String permission) {
if(ContextUtils.discover(context)
.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
return true;
}
else {
return false;
}
} | [
"public",
"static",
"boolean",
"isGranted",
"(",
"Object",
"context",
",",
"String",
"permission",
")",
"{",
"if",
"(",
"ContextUtils",
".",
"discover",
"(",
"context",
")",
".",
"checkCallingOrSelfPermission",
"(",
"permission",
")",
"==",
"PackageManager",
"."... | <p>Takes a permission and determines if its's granted.</p>
<p>Use {@link Manifest.permission} to reference permission constants.</p>
@param context
the permissible {@link Context}
@param permissions
the {@link permission} to test
@return {@code true} if all the permissions are granted
@since 1.1.0 | [
"<p",
">",
"Takes",
"a",
"permission",
"and",
"determines",
"if",
"its",
"s",
"granted",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java#L120-L131 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java | Config.getProperty | public static String getProperty(Class<?> aClass, String key)
{
return getSettings().getProperty(aClass, key);
} | java | public static String getProperty(Class<?> aClass, String key)
{
return getSettings().getProperty(aClass, key);
} | [
"public",
"static",
"String",
"getProperty",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"key",
")",
"{",
"return",
"getSettings",
"(",
")",
".",
"getProperty",
"(",
"aClass",
",",
"key",
")",
";",
"}"
] | Retrieves a configuration property as a String object.
<p/>
Loads the file if not already initialized.
@param aClass the calling class
@param key property key
@return Value of the property as a string or null if no property found. | [
"Retrieves",
"a",
"configuration",
"property",
"as",
"a",
"String",
"object",
".",
"<p",
"/",
">",
"Loads",
"the",
"file",
"if",
"not",
"already",
"initialized",
"."
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java#L202-L205 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java | CLIUtils.generateArgline | public static String generateArgline(final String scriptpath, final String[] args) {
return generateArgline(scriptpath, args, " ", false);
} | java | public static String generateArgline(final String scriptpath, final String[] args) {
return generateArgline(scriptpath, args, " ", false);
} | [
"public",
"static",
"String",
"generateArgline",
"(",
"final",
"String",
"scriptpath",
",",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"return",
"generateArgline",
"(",
"scriptpath",
",",
"args",
",",
"\" \"",
",",
"false",
")",
";",
"}"
] | Create an appropriately quoted argline to use given the command (script path) and argument strings.
@param scriptpath path to command or script
@param args arguments to pass to the command
@return a String of the command followed by the arguments, where each item which has spaces is appropriately
quoted. Pre-quoted items are not changed during "unsafe" quoting.
At this point in time, default behavior is "unsafe" quoting. | [
"Create",
"an",
"appropriately",
"quoted",
"argline",
"to",
"use",
"given",
"the",
"command",
"(",
"script",
"path",
")",
"and",
"argument",
"strings",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java#L52-L54 |
phax/ph-commons | ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetDecoder.java | UTF7StyleCharsetDecoder._handleBase64 | @Nullable
private CoderResult _handleBase64 (final ByteBuffer in, final CharBuffer out, final byte lastRead)
{
CoderResult result = null;
final int sextet = m_aBase64.getSextet (lastRead);
if (sextet >= 0)
{
m_nBitsRead += 6;
if (m_nBitsRead < 16)
{
m_nTempChar += sextet << (16 - m_nBitsRead);
}
else
{
m_nBitsRead -= 16;
m_nTempChar += sextet >> (m_nBitsRead);
out.put ((char) m_nTempChar);
m_nTempChar = (sextet << (16 - m_nBitsRead)) & 0xFFFF;
}
}
else
{
if (m_bStrict)
return _malformed (in);
out.put ((char) lastRead);
if (_areBase64BitsWaiting ())
result = _malformed (in);
_setUnshifted ();
}
return result;
} | java | @Nullable
private CoderResult _handleBase64 (final ByteBuffer in, final CharBuffer out, final byte lastRead)
{
CoderResult result = null;
final int sextet = m_aBase64.getSextet (lastRead);
if (sextet >= 0)
{
m_nBitsRead += 6;
if (m_nBitsRead < 16)
{
m_nTempChar += sextet << (16 - m_nBitsRead);
}
else
{
m_nBitsRead -= 16;
m_nTempChar += sextet >> (m_nBitsRead);
out.put ((char) m_nTempChar);
m_nTempChar = (sextet << (16 - m_nBitsRead)) & 0xFFFF;
}
}
else
{
if (m_bStrict)
return _malformed (in);
out.put ((char) lastRead);
if (_areBase64BitsWaiting ())
result = _malformed (in);
_setUnshifted ();
}
return result;
} | [
"@",
"Nullable",
"private",
"CoderResult",
"_handleBase64",
"(",
"final",
"ByteBuffer",
"in",
",",
"final",
"CharBuffer",
"out",
",",
"final",
"byte",
"lastRead",
")",
"{",
"CoderResult",
"result",
"=",
"null",
";",
"final",
"int",
"sextet",
"=",
"m_aBase64",
... | <p>
Decodes a byte in <i>base 64 mode</i>. Will directly write a character to
the output buffer if completed.
</p>
@param in
The input buffer
@param out
The output buffer
@param lastRead
Last byte read from the input buffer
@return CoderResult.malformed if a non-base 64 character was encountered in
strict mode, null otherwise | [
"<p",
">",
"Decodes",
"a",
"byte",
"in",
"<i",
">",
"base",
"64",
"mode<",
"/",
"i",
">",
".",
"Will",
"directly",
"write",
"a",
"character",
"to",
"the",
"output",
"buffer",
"if",
"completed",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetDecoder.java#L131-L161 |
Impetus/Kundera | src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java | RedisClient.fetchColumn | private List fetchColumn(String columnName, Object connection, List results, Set<String> resultKeys)
{
for (String hashKey : resultKeys)
{
List columnValues = null;
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection).hmget(hashKey, columnName);
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
columnValues = (List) response.get();
}
else
{
columnValues = ((Jedis) connection).hmget(hashKey, columnName);
}
if (columnValues != null && !columnValues.isEmpty())
{
results.addAll(columnValues); // Currently returning list of
// string as known issue
// with
// joint table concept!
}
}
return results;
} | java | private List fetchColumn(String columnName, Object connection, List results, Set<String> resultKeys)
{
for (String hashKey : resultKeys)
{
List columnValues = null;
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection).hmget(hashKey, columnName);
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
columnValues = (List) response.get();
}
else
{
columnValues = ((Jedis) connection).hmget(hashKey, columnName);
}
if (columnValues != null && !columnValues.isEmpty())
{
results.addAll(columnValues); // Currently returning list of
// string as known issue
// with
// joint table concept!
}
}
return results;
} | [
"private",
"List",
"fetchColumn",
"(",
"String",
"columnName",
",",
"Object",
"connection",
",",
"List",
"results",
",",
"Set",
"<",
"String",
">",
"resultKeys",
")",
"{",
"for",
"(",
"String",
"hashKey",
":",
"resultKeys",
")",
"{",
"List",
"columnValues",
... | Fetch column.
@param columnName
the column name
@param connection
the connection
@param results
the results
@param resultKeys
the result keys
@return the list | [
"Fetch",
"column",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java#L689-L718 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/report/ReportThrowablePanel.java | ReportThrowablePanel.newDescription | protected LabeledTextAreaPanel<String, ReportThrowableModelBean> newDescription(final String id,
final IModel<ReportThrowableModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel("description.label",
this, "Please provide here any useful information");
final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel(
"global.enter.your.description.label", this, "Enter here any useful information");
final LabeledTextAreaPanel<String, ReportThrowableModelBean> description = new LabeledTextAreaPanel<String, ReportThrowableModelBean>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected TextArea<String> newTextArea(final String id,
final IModel<ReportThrowableModelBean> model)
{
final TextArea<String> textArea = super.newTextArea(id, model);
if (placeholderModel != null)
{
textArea.add(new AttributeAppender("placeholder", placeholderModel));
}
return super.newTextArea(id, model);
}
};
return description;
} | java | protected LabeledTextAreaPanel<String, ReportThrowableModelBean> newDescription(final String id,
final IModel<ReportThrowableModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel("description.label",
this, "Please provide here any useful information");
final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel(
"global.enter.your.description.label", this, "Enter here any useful information");
final LabeledTextAreaPanel<String, ReportThrowableModelBean> description = new LabeledTextAreaPanel<String, ReportThrowableModelBean>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected TextArea<String> newTextArea(final String id,
final IModel<ReportThrowableModelBean> model)
{
final TextArea<String> textArea = super.newTextArea(id, model);
if (placeholderModel != null)
{
textArea.add(new AttributeAppender("placeholder", placeholderModel));
}
return super.newTextArea(id, model);
}
};
return description;
} | [
"protected",
"LabeledTextAreaPanel",
"<",
"String",
",",
"ReportThrowableModelBean",
">",
"newDescription",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"ReportThrowableModelBean",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"label... | Factory method for create the new {@link LabeledTextAreaPanel}. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a new {@link LabeledTextAreaPanel}.
@param id
the id
@param model
the model
@return the new {@link LabeledTextAreaPanel} | [
"Factory",
"method",
"for",
"create",
"the",
"new",
"{",
"@link",
"LabeledTextAreaPanel",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"p... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/report/ReportThrowablePanel.java#L104-L134 |
mahjong4j/mahjong4j | src/main/java/org/mahjong4j/yaku/normals/PinfuResolver.java | PinfuResolver.isRyanmen | private boolean isRyanmen(Shuntsu shuntsu, Tile last) {
//ラスト牌と判定したい順子のtypeが違う場合はfalse
if (shuntsu.getTile().getType() != last.getType()) {
return false;
}
int shuntsuNum = shuntsu.getTile().getNumber();
int lastNum = last.getNumber();
if (shuntsuNum == 2 && lastNum == 1) {
return true;
}
if (shuntsuNum == 8 && lastNum == 9) {
return true;
}
int i = shuntsuNum - lastNum;
if (i == 1 || i == -1) {
return true;
}
return false;
} | java | private boolean isRyanmen(Shuntsu shuntsu, Tile last) {
//ラスト牌と判定したい順子のtypeが違う場合はfalse
if (shuntsu.getTile().getType() != last.getType()) {
return false;
}
int shuntsuNum = shuntsu.getTile().getNumber();
int lastNum = last.getNumber();
if (shuntsuNum == 2 && lastNum == 1) {
return true;
}
if (shuntsuNum == 8 && lastNum == 9) {
return true;
}
int i = shuntsuNum - lastNum;
if (i == 1 || i == -1) {
return true;
}
return false;
} | [
"private",
"boolean",
"isRyanmen",
"(",
"Shuntsu",
"shuntsu",
",",
"Tile",
"last",
")",
"{",
"//ラスト牌と判定したい順子のtypeが違う場合はfalse",
"if",
"(",
"shuntsu",
".",
"getTile",
"(",
")",
".",
"getType",
"(",
")",
"!=",
"last",
".",
"getType",
"(",
")",
")",
"{",
"re... | 両面待ちだったかを判定するため
一つ一つの順子と最後の牌について判定する
@param shuntsu 判定したい順子
@param last 最後の牌
@return 両面待ちだったか | [
"両面待ちだったかを判定するため",
"一つ一つの順子と最後の牌について判定する"
] | train | https://github.com/mahjong4j/mahjong4j/blob/caa75963286b631ad51953d0d8c71cf6bf79b8f4/src/main/java/org/mahjong4j/yaku/normals/PinfuResolver.java#L86-L108 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java | Descriptor.setCategories | public void setCategories(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null)
jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setCategories(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null)
jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setCategories",
"(",
"int",
"i",
",",
"Title",
"v",
")",
"{",
"if",
"(",
"Descriptor_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Descriptor_Type",
")",
"jcasType",
")",
".",
"casFeat_categories",
"==",
"null",
")",
"jcasType",
".",
"jcas",... | indexed setter for categories - sets an indexed value - List of Wikipedia categories associated with a Wikipedia page.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"categories",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"List",
"of",
"Wikipedia",
"categories",
"associated",
"with",
"a",
"Wikipedia",
"page",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java#L117-L121 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/AbstractParamContainerPanel.java | AbstractParamContainerPanel.showParamPanel | public void showParamPanel(String parent, String child) {
if (parent == null || child == null) {
return;
}
AbstractParamPanel panel = tablePanel.get(parent);
if (panel == null) {
return;
}
showParamPanel(panel, parent);
} | java | public void showParamPanel(String parent, String child) {
if (parent == null || child == null) {
return;
}
AbstractParamPanel panel = tablePanel.get(parent);
if (panel == null) {
return;
}
showParamPanel(panel, parent);
} | [
"public",
"void",
"showParamPanel",
"(",
"String",
"parent",
",",
"String",
"child",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
"||",
"child",
"==",
"null",
")",
"{",
"return",
";",
"}",
"AbstractParamPanel",
"panel",
"=",
"tablePanel",
".",
"get",
"("... | ZAP: Made public so that other classes can specify which panel is displayed | [
"ZAP",
":",
"Made",
"public",
"so",
"that",
"other",
"classes",
"can",
"specify",
"which",
"panel",
"is",
"displayed"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractParamContainerPanel.java#L448-L459 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxAPIResponse.java | BoxAPIResponse.getBody | public InputStream getBody(ProgressListener listener) {
if (this.inputStream == null) {
String contentEncoding = this.connection.getContentEncoding();
try {
if (this.rawInputStream == null) {
this.rawInputStream = this.connection.getInputStream();
}
if (listener == null) {
this.inputStream = this.rawInputStream;
} else {
this.inputStream = new ProgressInputStream(this.rawInputStream, listener,
this.getContentLength());
}
if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) {
this.inputStream = new GZIPInputStream(this.inputStream);
}
} catch (IOException e) {
throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
}
}
return this.inputStream;
} | java | public InputStream getBody(ProgressListener listener) {
if (this.inputStream == null) {
String contentEncoding = this.connection.getContentEncoding();
try {
if (this.rawInputStream == null) {
this.rawInputStream = this.connection.getInputStream();
}
if (listener == null) {
this.inputStream = this.rawInputStream;
} else {
this.inputStream = new ProgressInputStream(this.rawInputStream, listener,
this.getContentLength());
}
if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) {
this.inputStream = new GZIPInputStream(this.inputStream);
}
} catch (IOException e) {
throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
}
}
return this.inputStream;
} | [
"public",
"InputStream",
"getBody",
"(",
"ProgressListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"inputStream",
"==",
"null",
")",
"{",
"String",
"contentEncoding",
"=",
"this",
".",
"connection",
".",
"getContentEncoding",
"(",
")",
";",
"try",
"{... | Gets an InputStream for reading this response's body which will report its read progress to a ProgressListener.
@param listener a listener for monitoring the read progress of the body.
@return an InputStream for reading the response's body. | [
"Gets",
"an",
"InputStream",
"for",
"reading",
"this",
"response",
"s",
"body",
"which",
"will",
"report",
"its",
"read",
"progress",
"to",
"a",
"ProgressListener",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxAPIResponse.java#L145-L169 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getClassNameFromConfig | public static String getClassNameFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()))
throw new InvalidKerasConfigurationException(
"Field " + conf.getLAYER_FIELD_CLASS_NAME() + " missing from layer config");
return (String) layerConfig.get(conf.getLAYER_FIELD_CLASS_NAME());
} | java | public static String getClassNameFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()))
throw new InvalidKerasConfigurationException(
"Field " + conf.getLAYER_FIELD_CLASS_NAME() + " missing from layer config");
return (String) layerConfig.get(conf.getLAYER_FIELD_CLASS_NAME());
} | [
"public",
"static",
"String",
"getClassNameFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"if",
"(",
"!",
"layerConfig",
".",
"containsKey",
... | Get Keras layer class name from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return Keras layer class name
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"Keras",
"layer",
"class",
"name",
"from",
"Keras",
"layer",
"configuration",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L338-L344 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java | WaveformDetail.segmentHeight | @SuppressWarnings("WeakerAccess")
public int segmentHeight(final int segment, final int scale) {
final ByteBuffer waveBytes = getData();
final int limit = getFrameCount();
int sum = 0;
for (int i = segment; (i < segment + scale) && (i < limit); i++) {
if (isColor) {
sum += (getColorWaveformBits(waveBytes, segment) >> 2) & 0x1f;
} else {
sum += waveBytes.get(i) & 0x1f;
}
}
return sum / scale;
} | java | @SuppressWarnings("WeakerAccess")
public int segmentHeight(final int segment, final int scale) {
final ByteBuffer waveBytes = getData();
final int limit = getFrameCount();
int sum = 0;
for (int i = segment; (i < segment + scale) && (i < limit); i++) {
if (isColor) {
sum += (getColorWaveformBits(waveBytes, segment) >> 2) & 0x1f;
} else {
sum += waveBytes.get(i) & 0x1f;
}
}
return sum / scale;
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"int",
"segmentHeight",
"(",
"final",
"int",
"segment",
",",
"final",
"int",
"scale",
")",
"{",
"final",
"ByteBuffer",
"waveBytes",
"=",
"getData",
"(",
")",
";",
"final",
"int",
"limit",
"=",
... | Determine the height of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out,
so we determine an average height of {@code scale} segments starting with the specified one.
@param segment the index of the first waveform byte to examine
@param scale the number of wave segments being drawn as a single pixel column
@return a value from 0 to 31 representing the height of the waveform at that segment, which may be an average
of a number of values starting there, determined by the scale | [
"Determine",
"the",
"height",
"of",
"the",
"waveform",
"given",
"an",
"index",
"into",
"it",
".",
"If",
"{",
"@code",
"scale",
"}",
"is",
"larger",
"than",
"1",
"we",
"are",
"zoomed",
"out",
"so",
"we",
"determine",
"an",
"average",
"height",
"of",
"{"... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java#L225-L238 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValueAs | public <T> T getPropertyValueAs(final String propertyName, final Class<T> type) {
return convert(getPropertyValue(propertyName, DEFAULT_REQUIRED), type);
} | java | public <T> T getPropertyValueAs(final String propertyName, final Class<T> type) {
return convert(getPropertyValue(propertyName, DEFAULT_REQUIRED), type);
} | [
"public",
"<",
"T",
">",
"T",
"getPropertyValueAs",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"convert",
"(",
"getPropertyValue",
"(",
"propertyName",
",",
"DEFAULT_REQUIRED",
")",
",",
"type",
... | Gets the value of the configuration property identified by name as a value of the specified Class type.
The property is required to be declared and defined otherwise a ConfigurationException is thrown.
@param propertyName a String value indicating the name of the configuration property.
@param type the expected Class type of the configuration property value.
@return the value of the configuration property identified by name.
@throws ConfigurationException if the property value was undeclared or is undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
"as",
"a",
"value",
"of",
"the",
"specified",
"Class",
"type",
".",
"The",
"property",
"is",
"required",
"to",
"be",
"declared",
"and",
"defined",
"otherwise",
"a",... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L231-L233 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java | JedisUtils.newJedisPool | public static JedisPool newJedisPool(JedisPoolConfig poolConfig, String hostAndPort) {
return newJedisPool(poolConfig, hostAndPort, null, Protocol.DEFAULT_DATABASE,
Protocol.DEFAULT_TIMEOUT);
} | java | public static JedisPool newJedisPool(JedisPoolConfig poolConfig, String hostAndPort) {
return newJedisPool(poolConfig, hostAndPort, null, Protocol.DEFAULT_DATABASE,
Protocol.DEFAULT_TIMEOUT);
} | [
"public",
"static",
"JedisPool",
"newJedisPool",
"(",
"JedisPoolConfig",
"poolConfig",
",",
"String",
"hostAndPort",
")",
"{",
"return",
"newJedisPool",
"(",
"poolConfig",
",",
"hostAndPort",
",",
"null",
",",
"Protocol",
".",
"DEFAULT_DATABASE",
",",
"Protocol",
... | Create a new {@link JedisPool} with specified pool configs.
@param poolConfig
@param hostAndPort
format {@code host:port} or {@code host}, default Redis port is used if not
specified
@return | [
"Create",
"a",
"new",
"{",
"@link",
"JedisPool",
"}",
"with",
"specified",
"pool",
"configs",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java#L73-L76 |
line/armeria | zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java | HttpTracingClient.newDecorator | public static Function<Client<HttpRequest, HttpResponse>, HttpTracingClient> newDecorator(
Tracing tracing,
@Nullable String remoteServiceName) {
ensureScopeUsesRequestContext(tracing);
return delegate -> new HttpTracingClient(delegate, tracing, remoteServiceName);
} | java | public static Function<Client<HttpRequest, HttpResponse>, HttpTracingClient> newDecorator(
Tracing tracing,
@Nullable String remoteServiceName) {
ensureScopeUsesRequestContext(tracing);
return delegate -> new HttpTracingClient(delegate, tracing, remoteServiceName);
} | [
"public",
"static",
"Function",
"<",
"Client",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
",",
"HttpTracingClient",
">",
"newDecorator",
"(",
"Tracing",
"tracing",
",",
"@",
"Nullable",
"String",
"remoteServiceName",
")",
"{",
"ensureScopeUsesRequestContext",
"("... | Creates a new tracing {@link Client} decorator using the specified {@link Tracing} instance
and remote service name. | [
"Creates",
"a",
"new",
"tracing",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java#L68-L73 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/TableScan.java | TableScan.setVal | @Override
public void setVal(String fldName, Constant val) {
rf.setVal(fldName, val);
} | java | @Override
public void setVal(String fldName, Constant val) {
rf.setVal(fldName, val);
} | [
"@",
"Override",
"public",
"void",
"setVal",
"(",
"String",
"fldName",
",",
"Constant",
"val",
")",
"{",
"rf",
".",
"setVal",
"(",
"fldName",
",",
"val",
")",
";",
"}"
] | Sets the value of the specified field, as a Constant.
@param val
the constant to be set. Will be casted to the correct type
specified in the schema of the table.
@see UpdateScan#setVal(java.lang.String, Constant) | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"field",
"as",
"a",
"Constant",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/TableScan.java#L90-L93 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java | OneForOneStreamManager.registerStream | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | java | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | [
"public",
"long",
"registerStream",
"(",
"String",
"appId",
",",
"Iterator",
"<",
"ManagedBuffer",
">",
"buffers",
",",
"Channel",
"channel",
")",
"{",
"long",
"myStreamId",
"=",
"nextStreamId",
".",
"getAndIncrement",
"(",
")",
";",
"streams",
".",
"put",
"... | Registers a stream of ManagedBuffers which are served as individual chunks one at a time to
callers. Each ManagedBuffer will be release()'d after it is transferred on the wire. If a
client connection is closed before the iterator is fully drained, then the remaining buffers
will all be release()'d.
If an app ID is provided, only callers who've authenticated with the given app ID will be
allowed to fetch from this stream.
This method also associates the stream with a single client connection, which is guaranteed
to be the only reader of the stream. Once the connection is closed, the stream will never
be used again, enabling cleanup by `connectionTerminated`. | [
"Registers",
"a",
"stream",
"of",
"ManagedBuffers",
"which",
"are",
"served",
"as",
"individual",
"chunks",
"one",
"at",
"a",
"time",
"to",
"callers",
".",
"Each",
"ManagedBuffer",
"will",
"be",
"release",
"()",
"d",
"after",
"it",
"is",
"transferred",
"on",... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java#L198-L202 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java | NetworkMessageEntity.addAction | public void addAction(M element, boolean value)
{
actions.put(element, Boolean.valueOf(value));
} | java | public void addAction(M element, boolean value)
{
actions.put(element, Boolean.valueOf(value));
} | [
"public",
"void",
"addAction",
"(",
"M",
"element",
",",
"boolean",
"value",
")",
"{",
"actions",
".",
"put",
"(",
"element",
",",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Add an action.
@param element The action type.
@param value The action value. | [
"Add",
"an",
"action",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java#L111-L114 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.columnValueAsBytes | private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue)
{
CfDef columnFamilyDef = getCfDef(columnFamilyName);
AbstractType<?> defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
{
byte[] currentColumnName = columnDefinition.getName();
if (ByteBufferUtil.compare(currentColumnName, columnName) == 0)
{
try
{
String validationClass = columnDefinition.getValidation_class();
return getBytesAccordingToType(columnValue, getFormatType(validationClass));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
return defaultValidator.fromString(columnValue);
} | java | private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue)
{
CfDef columnFamilyDef = getCfDef(columnFamilyName);
AbstractType<?> defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
{
byte[] currentColumnName = columnDefinition.getName();
if (ByteBufferUtil.compare(currentColumnName, columnName) == 0)
{
try
{
String validationClass = columnDefinition.getValidation_class();
return getBytesAccordingToType(columnValue, getFormatType(validationClass));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
return defaultValidator.fromString(columnValue);
} | [
"private",
"ByteBuffer",
"columnValueAsBytes",
"(",
"ByteBuffer",
"columnName",
",",
"String",
"columnFamilyName",
",",
"String",
"columnValue",
")",
"{",
"CfDef",
"columnFamilyDef",
"=",
"getCfDef",
"(",
"columnFamilyName",
")",
";",
"AbstractType",
"<",
"?",
">",
... | Converts column value into byte[] according to validation class
@param columnName - column name to which value belongs
@param columnFamilyName - column family name
@param columnValue - actual column value
@return value in byte array representation | [
"Converts",
"column",
"value",
"into",
"byte",
"[]",
"according",
"to",
"validation",
"class"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2660-L2684 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.findGlobalType | Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name, RecoveryLoadClass recoveryLoadClass) {
Symbol bestSoFar = typeNotFound;
for (Symbol s : scope.getSymbolsByName(name)) {
Symbol sym = loadClass(env, s.flatName(), recoveryLoadClass);
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else
bestSoFar = bestOf(bestSoFar, sym);
}
return bestSoFar;
} | java | Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name, RecoveryLoadClass recoveryLoadClass) {
Symbol bestSoFar = typeNotFound;
for (Symbol s : scope.getSymbolsByName(name)) {
Symbol sym = loadClass(env, s.flatName(), recoveryLoadClass);
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else
bestSoFar = bestOf(bestSoFar, sym);
}
return bestSoFar;
} | [
"Symbol",
"findGlobalType",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Scope",
"scope",
",",
"Name",
"name",
",",
"RecoveryLoadClass",
"recoveryLoadClass",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"for",
"(",
"Symbol",
"s",
":",
"sco... | Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name. | [
"Find",
"a",
"global",
"type",
"in",
"given",
"scope",
"and",
"load",
"corresponding",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2239-L2250 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.nodeTypeMayHaveSideEffects | static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) {
if (isAssignmentOp(n)) {
return true;
}
switch (n.getToken()) {
case DELPROP:
case DEC:
case INC:
case YIELD:
case THROW:
case AWAIT:
case FOR_IN: // assigns to a loop LHS
case FOR_OF: // assigns to a loop LHS, runs an iterator
case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations.
return true;
case CALL:
case TAGGED_TEMPLATELIT:
return NodeUtil.functionCallHasSideEffects(n, compiler);
case NEW:
return NodeUtil.constructorCallHasSideEffects(n);
case NAME:
// A variable definition.
// TODO(b/129564961): Consider EXPORT declarations.
return n.hasChildren();
case REST:
case SPREAD:
return NodeUtil.iteratesImpureIterable(n);
default:
break;
}
return false;
} | java | static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) {
if (isAssignmentOp(n)) {
return true;
}
switch (n.getToken()) {
case DELPROP:
case DEC:
case INC:
case YIELD:
case THROW:
case AWAIT:
case FOR_IN: // assigns to a loop LHS
case FOR_OF: // assigns to a loop LHS, runs an iterator
case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations.
return true;
case CALL:
case TAGGED_TEMPLATELIT:
return NodeUtil.functionCallHasSideEffects(n, compiler);
case NEW:
return NodeUtil.constructorCallHasSideEffects(n);
case NAME:
// A variable definition.
// TODO(b/129564961): Consider EXPORT declarations.
return n.hasChildren();
case REST:
case SPREAD:
return NodeUtil.iteratesImpureIterable(n);
default:
break;
}
return false;
} | [
"static",
"boolean",
"nodeTypeMayHaveSideEffects",
"(",
"Node",
"n",
",",
"AbstractCompiler",
"compiler",
")",
"{",
"if",
"(",
"isAssignmentOp",
"(",
"n",
")",
")",
"{",
"return",
"true",
";",
"}",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",... | Returns true if the current node's type implies side effects.
<p>This is a non-recursive version of the may have side effects
check; used to check wherever the current node's type is one of
the reasons why a subtree has side effects. | [
"Returns",
"true",
"if",
"the",
"current",
"node",
"s",
"type",
"implies",
"side",
"effects",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L1549-L1582 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/event/SDKProgressPublisher.java | SDKProgressPublisher.publishProgress | public static Future<?> publishProgress(
final ProgressListener listener,
final ProgressEventType type) {
if (listener == ProgressListener.NOOP || listener == null
|| type == null) {
return null;
}
return deliverEvent(listener, new ProgressEvent(type));
} | java | public static Future<?> publishProgress(
final ProgressListener listener,
final ProgressEventType type) {
if (listener == ProgressListener.NOOP || listener == null
|| type == null) {
return null;
}
return deliverEvent(listener, new ProgressEvent(type));
} | [
"public",
"static",
"Future",
"<",
"?",
">",
"publishProgress",
"(",
"final",
"ProgressListener",
"listener",
",",
"final",
"ProgressEventType",
"type",
")",
"{",
"if",
"(",
"listener",
"==",
"ProgressListener",
".",
"NOOP",
"||",
"listener",
"==",
"null",
"||... | Used to deliver a progress event to the given listener.
@return the future of a submitted task; or null if the delivery is
synchronous with no future task involved. Note a listener should never
block, and therefore returning null is the typical case. | [
"Used",
"to",
"deliver",
"a",
"progress",
"event",
"to",
"the",
"given",
"listener",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/event/SDKProgressPublisher.java#L51-L59 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateDefaultSettings | private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException
{
properties.setDefaultDurationUnits(record.getTimeUnit(0));
properties.setDefaultDurationIsFixed(record.getNumericBoolean(1));
properties.setDefaultWorkUnits(record.getTimeUnit(2));
properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60));
properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60));
properties.setDefaultStandardRate(record.getRate(5));
properties.setDefaultOvertimeRate(record.getRate(6));
properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7));
properties.setSplitInProgressTasks(record.getNumericBoolean(8));
} | java | private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException
{
properties.setDefaultDurationUnits(record.getTimeUnit(0));
properties.setDefaultDurationIsFixed(record.getNumericBoolean(1));
properties.setDefaultWorkUnits(record.getTimeUnit(2));
properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60));
properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60));
properties.setDefaultStandardRate(record.getRate(5));
properties.setDefaultOvertimeRate(record.getRate(6));
properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7));
properties.setSplitInProgressTasks(record.getNumericBoolean(8));
} | [
"private",
"void",
"populateDefaultSettings",
"(",
"Record",
"record",
",",
"ProjectProperties",
"properties",
")",
"throws",
"MPXJException",
"{",
"properties",
".",
"setDefaultDurationUnits",
"(",
"record",
".",
"getTimeUnit",
"(",
"0",
")",
")",
";",
"properties"... | Populates default settings.
@param record MPX record
@param properties project properties
@throws MPXJException | [
"Populates",
"default",
"settings",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L509-L520 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java | GenericSignatureParser.parseForClass | public void parseForClass(GenericDeclaration genericDecl, String signature) {
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
} | java | public void parseForClass(GenericDeclaration genericDecl, String signature) {
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
} | [
"public",
"void",
"parseForClass",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"eof",
")",
"{",
"parseClassSignature",
"(",
")",
";",
"}",
"else",... | Parses the generic signature of a class and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class | [
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"class",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L123-L144 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.extractBuffered | public static BufferedImage extractBuffered(InterleavedU8 img) {
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
final int numBands = img.numBands;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height * numBands, 0);
ColorModel colorModel;
int[] bOffs = null;
if (numBands == 3) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8};
bOffs = new int[]{2, 1, 0};
colorModel = new ComponentColorModel(cs, nBits, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else if (numBands == 1) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
bOffs = new int[]{0};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else {
throw new IllegalArgumentException("Only 1 or 3 bands supported");
}
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, numBands, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
} | java | public static BufferedImage extractBuffered(InterleavedU8 img) {
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
final int numBands = img.numBands;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height * numBands, 0);
ColorModel colorModel;
int[] bOffs = null;
if (numBands == 3) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8};
bOffs = new int[]{2, 1, 0};
colorModel = new ComponentColorModel(cs, nBits, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else if (numBands == 1) {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
bOffs = new int[]{0};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
} else {
throw new IllegalArgumentException("Only 1 or 3 bands supported");
}
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, numBands, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
} | [
"public",
"static",
"BufferedImage",
"extractBuffered",
"(",
"InterleavedU8",
"img",
")",
"{",
"if",
"(",
"img",
".",
"isSubimage",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sub-images are not supported for this operation\"",
")",
";",
"final"... | Creates a new BufferedImage that internally uses the same data as the provided
{@link InterleavedU8}. If 3 bands then the image will be of type TYPE_3BYTE_BGR
or if 1 band TYPE_BYTE_GRAY.
@param img Input image who's data will be wrapped by the returned BufferedImage.
@return BufferedImage which shared data with the input image. | [
"Creates",
"a",
"new",
"BufferedImage",
"that",
"internally",
"uses",
"the",
"same",
"data",
"as",
"the",
"provided",
"{",
"@link",
"InterleavedU8",
"}",
".",
"If",
"3",
"bands",
"then",
"the",
"image",
"will",
"be",
"of",
"type",
"TYPE_3BYTE_BGR",
"or",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L181-L220 |
cdk/cdk | tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactory.java | GeometricCumulativeDoubleBondFactory.axial2DEncoder | private static StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
IAtom end, List<IBond> endBonds) {
Point2d[] ps = new Point2d[4];
int[] es = new int[4];
PermutationParity perm = new CombinedPermutationParity(fill2DCoordinates(container, start, startBonds, ps, es,
0), fill2DCoordinates(container, end, endBonds, ps, es, 2));
GeometricParity geom = new Tetrahedral2DParity(ps, es);
int u = container.indexOf(start);
int v = container.indexOf(end);
return new GeometryEncoder(new int[]{u, v}, perm, geom);
} | java | private static StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
IAtom end, List<IBond> endBonds) {
Point2d[] ps = new Point2d[4];
int[] es = new int[4];
PermutationParity perm = new CombinedPermutationParity(fill2DCoordinates(container, start, startBonds, ps, es,
0), fill2DCoordinates(container, end, endBonds, ps, es, 2));
GeometricParity geom = new Tetrahedral2DParity(ps, es);
int u = container.indexOf(start);
int v = container.indexOf(end);
return new GeometryEncoder(new int[]{u, v}, perm, geom);
} | [
"private",
"static",
"StereoEncoder",
"axial2DEncoder",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"start",
",",
"List",
"<",
"IBond",
">",
"startBonds",
",",
"IAtom",
"end",
",",
"List",
"<",
"IBond",
">",
"endBonds",
")",
"{",
"Point2d",
"[",
"]",
... | Create an encoder for axial 2D stereochemistry for the given start and
end atoms.
@param container the molecule
@param start start of the cumulated system
@param startBonds bonds connected to the start
@param end end of the cumulated system
@param endBonds bonds connected to the end
@return an encoder | [
"Create",
"an",
"encoder",
"for",
"axial",
"2D",
"stereochemistry",
"for",
"the",
"given",
"start",
"and",
"end",
"atoms",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactory.java#L171-L186 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewQuery.java | ViewQuery.includeDocsOrdered | public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
} | java | public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
} | [
"public",
"ViewQuery",
"includeDocsOrdered",
"(",
"boolean",
"includeDocs",
",",
"Class",
"<",
"?",
"extends",
"Document",
"<",
"?",
">",
">",
"target",
")",
"{",
"this",
".",
"includeDocs",
"=",
"includeDocs",
";",
"this",
".",
"retainOrder",
"=",
"includeD... | Proactively load the full document for the row returned, while strictly retaining view row order.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
@param includeDocs if it should be enabled or not.
@param target the custom document type target.
@return the {@link ViewQuery} DSL. | [
"Proactively",
"load",
"the",
"full",
"document",
"for",
"the",
"row",
"returned",
"while",
"strictly",
"retaining",
"view",
"row",
"order",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQuery.java#L141-L146 |
grpc/grpc-java | netty/src/main/java/io/grpc/netty/NettyServerBuilder.java | NettyServerBuilder.keepAliveTimeout | public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive");
keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout);
keepAliveTimeoutInNanos =
KeepAliveManager.clampKeepAliveTimeoutInNanos(keepAliveTimeoutInNanos);
if (keepAliveTimeoutInNanos < MIN_KEEPALIVE_TIMEOUT_NANO) {
// Bump keepalive timeout.
keepAliveTimeoutInNanos = MIN_KEEPALIVE_TIMEOUT_NANO;
}
return this;
} | java | public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive");
keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout);
keepAliveTimeoutInNanos =
KeepAliveManager.clampKeepAliveTimeoutInNanos(keepAliveTimeoutInNanos);
if (keepAliveTimeoutInNanos < MIN_KEEPALIVE_TIMEOUT_NANO) {
// Bump keepalive timeout.
keepAliveTimeoutInNanos = MIN_KEEPALIVE_TIMEOUT_NANO;
}
return this;
} | [
"public",
"NettyServerBuilder",
"keepAliveTimeout",
"(",
"long",
"keepAliveTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"checkArgument",
"(",
"keepAliveTimeout",
">",
"0L",
",",
"\"keepalive timeout must be positive\"",
")",
";",
"keepAliveTimeoutInNanos",
"=",
"timeU... | Sets a custom keepalive timeout, the timeout for keepalive ping requests. An unreasonably small
value might be increased.
@since 1.3.0 | [
"Sets",
"a",
"custom",
"keepalive",
"timeout",
"the",
"timeout",
"for",
"keepalive",
"ping",
"requests",
".",
"An",
"unreasonably",
"small",
"value",
"might",
"be",
"increased",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L392-L402 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java | FavoritesEditController.initializeView | @RenderMapping
public String initializeView(Model model, RenderRequest renderRequest) {
IUserInstance ui =
userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest());
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
IUserLayout userLayout = ulm.getUserLayout();
// TODO: the portlet could predicate including a non-null marketplace portlet fname
// on the accessing user having permission to render the portlet referenced by that fname
// so that portlet would gracefully degrade when configured with bad marketplace portlet
// fname
// and also gracefully degrade when the accessing user doesn't have permission to access an
// otherwise
// viable configured marketplace. This complexity may not be worth it. Anyway it is not
// yet implemented.
model.addAttribute("marketplaceFname", this.marketplaceFName);
List<IUserLayoutNodeDescription> collections =
favoritesUtils.getFavoriteCollections(userLayout);
model.addAttribute("collections", collections);
List<IUserLayoutNodeDescription> favorites =
favoritesUtils.getFavoritePortletLayoutNodes(userLayout);
model.addAttribute("favorites", favorites);
model.addAttribute("successMessageCode", renderRequest.getParameter("successMessageCode"));
model.addAttribute("errorMessageCode", renderRequest.getParameter("errorMessageCode"));
model.addAttribute(
"nameOfFavoriteActedUpon", renderRequest.getParameter("nameOfFavoriteActedUpon"));
// default to the regular old edit view
String viewName = "jsp/Favorites/edit";
if (collections.isEmpty() && favorites.isEmpty()) {
// use the special case view
viewName = "jsp/Favorites/edit_zero";
}
logger.trace(
"Favorites Portlet EDIT mode built model [{}] and selected view {}.",
model,
viewName);
return viewName;
} | java | @RenderMapping
public String initializeView(Model model, RenderRequest renderRequest) {
IUserInstance ui =
userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest());
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
IUserLayout userLayout = ulm.getUserLayout();
// TODO: the portlet could predicate including a non-null marketplace portlet fname
// on the accessing user having permission to render the portlet referenced by that fname
// so that portlet would gracefully degrade when configured with bad marketplace portlet
// fname
// and also gracefully degrade when the accessing user doesn't have permission to access an
// otherwise
// viable configured marketplace. This complexity may not be worth it. Anyway it is not
// yet implemented.
model.addAttribute("marketplaceFname", this.marketplaceFName);
List<IUserLayoutNodeDescription> collections =
favoritesUtils.getFavoriteCollections(userLayout);
model.addAttribute("collections", collections);
List<IUserLayoutNodeDescription> favorites =
favoritesUtils.getFavoritePortletLayoutNodes(userLayout);
model.addAttribute("favorites", favorites);
model.addAttribute("successMessageCode", renderRequest.getParameter("successMessageCode"));
model.addAttribute("errorMessageCode", renderRequest.getParameter("errorMessageCode"));
model.addAttribute(
"nameOfFavoriteActedUpon", renderRequest.getParameter("nameOfFavoriteActedUpon"));
// default to the regular old edit view
String viewName = "jsp/Favorites/edit";
if (collections.isEmpty() && favorites.isEmpty()) {
// use the special case view
viewName = "jsp/Favorites/edit_zero";
}
logger.trace(
"Favorites Portlet EDIT mode built model [{}] and selected view {}.",
model,
viewName);
return viewName;
} | [
"@",
"RenderMapping",
"public",
"String",
"initializeView",
"(",
"Model",
"model",
",",
"RenderRequest",
"renderRequest",
")",
"{",
"IUserInstance",
"ui",
"=",
"userInstanceManager",
".",
"getUserInstance",
"(",
"portalRequestUtils",
".",
"getCurrentPortalRequest",
"(",... | Handles all Favorites portlet EDIT mode renders. Populates model with user's favorites and
selects a view to display those favorites.
<p>View selection:
<p>Returns "jsp/Favorites/edit" in the normal case where the user has at least one favorited
portlet or favorited collection.
<p>Returns "jsp/Favorites/edit_zero" in the edge case where the user has zero favorited
portlets AND zero favorited collections.
<p>Model: marketPlaceFname --> String functional name of Marketplace portlet, or null if not
available. collections --> List of favorited collections (IUserLayoutNodeDescription s)
favorites --> List of favorited individual portlets (IUserLayoutNodeDescription s)
successMessageCode --> String success message bundle key, or null if none errorMessageCode
--> String error message bundle key, or null if none nameOfFavoriteActedUpon --> Name of
favorite acted upon, intended as parameter to success or error message
@param model . Spring model. This method adds five model attributes.
@return jsp/Favorites/edit[_zero] | [
"Handles",
"all",
"Favorites",
"portlet",
"EDIT",
"mode",
"renders",
".",
"Populates",
"model",
"with",
"user",
"s",
"favorites",
"and",
"selects",
"a",
"view",
"to",
"display",
"those",
"favorites",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java#L69-L118 |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java | MinorCompactionTask.compactEntries | private void compactEntries(Segment segment, Segment compactSegment) {
for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) {
checkEntry(i, segment, compactSegment);
}
} | java | private void compactEntries(Segment segment, Segment compactSegment) {
for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) {
checkEntry(i, segment, compactSegment);
}
} | [
"private",
"void",
"compactEntries",
"(",
"Segment",
"segment",
",",
"Segment",
"compactSegment",
")",
"{",
"for",
"(",
"long",
"i",
"=",
"segment",
".",
"firstIndex",
"(",
")",
";",
"i",
"<=",
"segment",
".",
"lastIndex",
"(",
")",
";",
"i",
"++",
")"... | Compacts entries from the given segment, rewriting them to the compact segment.
@param segment The segment to compact.
@param compactSegment The compact segment. | [
"Compacts",
"entries",
"from",
"the",
"given",
"segment",
"rewriting",
"them",
"to",
"the",
"compact",
"segment",
"."
] | train | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java#L99-L103 |
konvergeio/cofoja | src/main/java/com/google/java/contract/util/Predicates.java | Predicates.forValues | public static <K, V> Predicate<Map<K, V>> forValues(
final Predicate<? super Collection<V>> p) {
return new Predicate<Map<K, V>>() {
@Override
public boolean apply(Map<K, V> obj) {
return p.apply(obj.values());
}
};
} | java | public static <K, V> Predicate<Map<K, V>> forValues(
final Predicate<? super Collection<V>> p) {
return new Predicate<Map<K, V>>() {
@Override
public boolean apply(Map<K, V> obj) {
return p.apply(obj.values());
}
};
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Predicate",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"forValues",
"(",
"final",
"Predicate",
"<",
"?",
"super",
"Collection",
"<",
"V",
">",
">",
"p",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Ma... | Returns a predicate that evaluates to {@code true} if the value
collection of its argument satisfies {@code p}. | [
"Returns",
"a",
"predicate",
"that",
"evaluates",
"to",
"{"
] | train | https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/util/Predicates.java#L268-L276 |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java | ClientProxyProvider.getClientProxy | public <T> T getClientProxy(final Bean<T> bean, Type requestedType) {
// let's first try to use the proxy that implements all the bean types
T proxy = beanTypeClosureProxyPool.getCastValue(bean);
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
/*
* the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable
* type is not in the type closure of the requested type
* https://issues.jboss.org/browse/WELD-1052
*/
proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean));
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
throw Proxies.getUnproxyableTypeException(requestedType, services());
}
}
BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean);
return proxy;
} | java | public <T> T getClientProxy(final Bean<T> bean, Type requestedType) {
// let's first try to use the proxy that implements all the bean types
T proxy = beanTypeClosureProxyPool.getCastValue(bean);
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
/*
* the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable
* type is not in the type closure of the requested type
* https://issues.jboss.org/browse/WELD-1052
*/
proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean));
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
throw Proxies.getUnproxyableTypeException(requestedType, services());
}
}
BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean);
return proxy;
} | [
"public",
"<",
"T",
">",
"T",
"getClientProxy",
"(",
"final",
"Bean",
"<",
"T",
">",
"bean",
",",
"Type",
"requestedType",
")",
"{",
"// let's first try to use the proxy that implements all the bean types",
"T",
"proxy",
"=",
"beanTypeClosureProxyPool",
".",
"getCastV... | Gets a client proxy for a bean
<p/>
Looks for a proxy in the pool. If not found, one is created and added to
the pool if the create argument is true.
@param bean The bean to get a proxy to
@return the client proxy for the bean | [
"Gets",
"a",
"client",
"proxy",
"for",
"a",
"bean",
"<p",
"/",
">",
"Looks",
"for",
"a",
"proxy",
"in",
"the",
"pool",
".",
"If",
"not",
"found",
"one",
"is",
"created",
"and",
"added",
"to",
"the",
"pool",
"if",
"the",
"create",
"argument",
"is",
... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java#L227-L243 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java | NullResourceLocksHolder.addLock | public String addLock(Session session, String path) throws LockException
{
String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;
if (!nullResourceLocks.containsKey(repoPath))
{
String newLockToken = IdGenerator.generate();
session.addLockToken(newLockToken);
nullResourceLocks.put(repoPath, newLockToken);
return newLockToken;
}
// check if lock owned by this session
String currentToken = nullResourceLocks.get(repoPath);
for (String t : session.getLockTokens())
{
if (t.equals(currentToken))
return t;
}
throw new LockException("Resource already locked " + repoPath);
} | java | public String addLock(Session session, String path) throws LockException
{
String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;
if (!nullResourceLocks.containsKey(repoPath))
{
String newLockToken = IdGenerator.generate();
session.addLockToken(newLockToken);
nullResourceLocks.put(repoPath, newLockToken);
return newLockToken;
}
// check if lock owned by this session
String currentToken = nullResourceLocks.get(repoPath);
for (String t : session.getLockTokens())
{
if (t.equals(currentToken))
return t;
}
throw new LockException("Resource already locked " + repoPath);
} | [
"public",
"String",
"addLock",
"(",
"Session",
"session",
",",
"String",
"path",
")",
"throws",
"LockException",
"{",
"String",
"repoPath",
"=",
"session",
".",
"getRepository",
"(",
")",
".",
"hashCode",
"(",
")",
"+",
"\"/\"",
"+",
"session",
".",
"getWo... | Locks the node.
@param session current session
@param path node path
@return thee lock token key
@throws LockException {@link LockException} | [
"Locks",
"the",
"node",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L60-L81 |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/flow/OmsLeastCostFlowDirections.java | OmsLeastCostFlowDirections.assignFlowDirection | private boolean assignFlowDirection( GridNode current, GridNode diagonal, GridNode node1, GridNode node2 ) {
double diagonalSlope = abs(current.getSlopeTo(diagonal));
if (node1 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node1));
if (diagonalSlope < tmpSlope) {
return false;
}
}
if (node2 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node2));
if (diagonalSlope < tmpSlope) {
return false;
}
}
return true;
} | java | private boolean assignFlowDirection( GridNode current, GridNode diagonal, GridNode node1, GridNode node2 ) {
double diagonalSlope = abs(current.getSlopeTo(diagonal));
if (node1 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node1));
if (diagonalSlope < tmpSlope) {
return false;
}
}
if (node2 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node2));
if (diagonalSlope < tmpSlope) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"assignFlowDirection",
"(",
"GridNode",
"current",
",",
"GridNode",
"diagonal",
",",
"GridNode",
"node1",
",",
"GridNode",
"node2",
")",
"{",
"double",
"diagonalSlope",
"=",
"abs",
"(",
"current",
".",
"getSlopeTo",
"(",
"diagonal",
")",
... | Checks if the path from the current to the first node is steeper than to the others.
@param current the current node.
@param diagonal the diagonal node to check.
@param node1 the first other node to check.
@param node2 the second other node to check.
@return <code>true</code> if the path to the first node is steeper in module than
that to the others. | [
"Checks",
"if",
"the",
"path",
"from",
"the",
"current",
"to",
"the",
"first",
"node",
"is",
"steeper",
"than",
"to",
"the",
"others",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/flow/OmsLeastCostFlowDirections.java#L339-L354 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java | RpcWrapper.handleRpcException | private void handleRpcException(RpcException e, int attemptNumber) throws IOException {
String messageStart;
if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) {
messageStart = "rpc";
} else {
// check whether to retry
if (attemptNumber + 1 < _maximumRetries) {
try {
int waitTime = _retryWait * (attemptNumber + 1);
Thread.sleep(waitTime);
} catch (InterruptedException ie) {
// restore the interrupt status
Thread.currentThread().interrupt();
}
LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber });
return;
}
messageStart = "network";
}
throw new NfsException(NfsStatus.NFS3ERR_IO,
String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e);
} | java | private void handleRpcException(RpcException e, int attemptNumber) throws IOException {
String messageStart;
if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) {
messageStart = "rpc";
} else {
// check whether to retry
if (attemptNumber + 1 < _maximumRetries) {
try {
int waitTime = _retryWait * (attemptNumber + 1);
Thread.sleep(waitTime);
} catch (InterruptedException ie) {
// restore the interrupt status
Thread.currentThread().interrupt();
}
LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber });
return;
}
messageStart = "network";
}
throw new NfsException(NfsStatus.NFS3ERR_IO,
String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e);
} | [
"private",
"void",
"handleRpcException",
"(",
"RpcException",
"e",
",",
"int",
"attemptNumber",
")",
"throws",
"IOException",
"{",
"String",
"messageStart",
";",
"if",
"(",
"!",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"equals",
"(",
"RpcStatus",
".",
"N... | Decide whether to retry or throw an exception.
@param e
The exception.
@param attemptNumber
The number of attempts so far.
@throws IOException | [
"Decide",
"whether",
"to",
"retry",
"or",
"throw",
"an",
"exception",
"."
] | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L288-L312 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDocument.java | MutableDocument.setArray | @NonNull
@Override
public MutableDocument setArray(@NonNull String key, Array value) {
return setValue(key, value);
} | java | @NonNull
@Override
public MutableDocument setArray(@NonNull String key, Array value) {
return setValue(key, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDocument",
"setArray",
"(",
"@",
"NonNull",
"String",
"key",
",",
"Array",
"value",
")",
"{",
"return",
"setValue",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set an Array value for the given key
@param key the key.
@param key the Array value.
@return this MutableDocument instance | [
"Set",
"an",
"Array",
"value",
"for",
"the",
"given",
"key"
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L275-L279 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/system_settings.java | system_settings.update | public static system_settings update(nitro_service client, system_settings resource) throws Exception
{
resource.validate("modify");
return ((system_settings[]) resource.update_resource(client))[0];
} | java | public static system_settings update(nitro_service client, system_settings resource) throws Exception
{
resource.validate("modify");
return ((system_settings[]) resource.update_resource(client))[0];
} | [
"public",
"static",
"system_settings",
"update",
"(",
"nitro_service",
"client",
",",
"system_settings",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"modify\"",
")",
";",
"return",
"(",
"(",
"system_settings",
"[",
"]",
")",
... | <pre>
Use this operation to modify SDX system settings.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"modify",
"SDX",
"system",
"settings",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/system_settings.java#L221-L225 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/entity/CmsEntityBackend.java | CmsEntityBackend.createFromNativeWrapper | public static CmsEntity createFromNativeWrapper(JavaScriptObject entityWrapper) {
CmsEntity result = new CmsEntity(null, getEntityType(entityWrapper));
String[] simpleAttr = getSimpleAttributeNames(entityWrapper);
for (int i = 0; i < simpleAttr.length; i++) {
String[] simpleAttrValues = getSimpleAttributeValues(entityWrapper, simpleAttr[i]);
for (int j = 0; j < simpleAttrValues.length; j++) {
result.addAttributeValue(simpleAttr[i], simpleAttrValues[j]);
}
}
String[] complexAttr = getComplexAttributeNames(entityWrapper);
for (int i = 0; i < complexAttr.length; i++) {
JavaScriptObject[] complexAttrValues = getComplexAttributeValues(entityWrapper, complexAttr[i]);
for (int j = 0; j < complexAttrValues.length; j++) {
result.addAttributeValue(complexAttr[i], createFromNativeWrapper(complexAttrValues[j]));
}
}
return result;
} | java | public static CmsEntity createFromNativeWrapper(JavaScriptObject entityWrapper) {
CmsEntity result = new CmsEntity(null, getEntityType(entityWrapper));
String[] simpleAttr = getSimpleAttributeNames(entityWrapper);
for (int i = 0; i < simpleAttr.length; i++) {
String[] simpleAttrValues = getSimpleAttributeValues(entityWrapper, simpleAttr[i]);
for (int j = 0; j < simpleAttrValues.length; j++) {
result.addAttributeValue(simpleAttr[i], simpleAttrValues[j]);
}
}
String[] complexAttr = getComplexAttributeNames(entityWrapper);
for (int i = 0; i < complexAttr.length; i++) {
JavaScriptObject[] complexAttrValues = getComplexAttributeValues(entityWrapper, complexAttr[i]);
for (int j = 0; j < complexAttrValues.length; j++) {
result.addAttributeValue(complexAttr[i], createFromNativeWrapper(complexAttrValues[j]));
}
}
return result;
} | [
"public",
"static",
"CmsEntity",
"createFromNativeWrapper",
"(",
"JavaScriptObject",
"entityWrapper",
")",
"{",
"CmsEntity",
"result",
"=",
"new",
"CmsEntity",
"(",
"null",
",",
"getEntityType",
"(",
"entityWrapper",
")",
")",
";",
"String",
"[",
"]",
"simpleAttr"... | Method to create an entity object from a wrapped instance.<p>
@param entityWrapper the wrappe entity
@return the entity | [
"Method",
"to",
"create",
"an",
"entity",
"object",
"from",
"a",
"wrapped",
"instance",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/entity/CmsEntityBackend.java#L79-L97 |
j-a-w-r/jawr-main-repo | jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java | BundleProcessor.getImageFinalPath | public String getImageFinalPath(String path, JawrConfig jawrConfig) {
String finalPath = path;
// Remove servlet mapping if it exists.
finalPath = removeServletMappingFromPath(finalPath,
jawrConfig.getServletMapping());
if (finalPath.startsWith("/")) {
finalPath = finalPath.substring(1);
}
// remove cache prefix
int idx = finalPath.indexOf("/");
finalPath = finalPath.substring(idx + 1);
return finalPath;
} | java | public String getImageFinalPath(String path, JawrConfig jawrConfig) {
String finalPath = path;
// Remove servlet mapping if it exists.
finalPath = removeServletMappingFromPath(finalPath,
jawrConfig.getServletMapping());
if (finalPath.startsWith("/")) {
finalPath = finalPath.substring(1);
}
// remove cache prefix
int idx = finalPath.indexOf("/");
finalPath = finalPath.substring(idx + 1);
return finalPath;
} | [
"public",
"String",
"getImageFinalPath",
"(",
"String",
"path",
",",
"JawrConfig",
"jawrConfig",
")",
"{",
"String",
"finalPath",
"=",
"path",
";",
"// Remove servlet mapping if it exists.",
"finalPath",
"=",
"removeServletMappingFromPath",
"(",
"finalPath",
",",
"jawrC... | Retrieves the image final path, where the servlet mapping and the cache
prefix have been removed
@param path
the path
@param jawrConfig
the jawr config
@return the final path | [
"Retrieves",
"the",
"image",
"final",
"path",
"where",
"the",
"servlet",
"mapping",
"and",
"the",
"cache",
"prefix",
"have",
"been",
"removed"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java#L956-L972 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_match | public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches;
}
return matches;
} | java | public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches;
}
return matches;
} | [
"public",
"static",
"int",
"preg_match",
"(",
"Pattern",
"pattern",
",",
"String",
"subject",
")",
"{",
"int",
"matches",
"=",
"0",
";",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"subject",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",
")... | Matches a string with a pattern.
@param pattern
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"pattern",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L149-L156 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.beginUpdate | public DataLakeAnalyticsAccountInner beginUpdate(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | java | public DataLakeAnalyticsAccountInner beginUpdate(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | [
"public",
"DataLakeAnalyticsAccountInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"DataLakeAnalyticsAccountInner",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"p... | Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param name The name of the Data Lake Analytics account to update.
@param parameters Parameters supplied to the update Data Lake Analytics account operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataLakeAnalyticsAccountInner object if successful. | [
"Updates",
"the",
"Data",
"Lake",
"Analytics",
"account",
"object",
"specified",
"by",
"the",
"accountName",
"with",
"the",
"contents",
"of",
"the",
"account",
"object",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L2847-L2849 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java | ComponentAction.addBestValuesToMeasures | private static void addBestValuesToMeasures(List<LiveMeasureDto> measures, ComponentDto component, Collection<MetricDto> metrics) {
if (!QUALIFIERS_ELIGIBLE_FOR_BEST_VALUE.contains(component.qualifier())) {
return;
}
List<MetricDtoWithBestValue> metricWithBestValueList = metrics.stream()
.filter(MetricDtoFunctions.isOptimizedForBestValue())
.map(MetricDtoWithBestValue::new)
.collect(MoreCollectors.toList(metrics.size()));
Map<Integer, LiveMeasureDto> measuresByMetricId = Maps.uniqueIndex(measures, LiveMeasureDto::getMetricId);
for (MetricDtoWithBestValue metricWithBestValue : metricWithBestValueList) {
if (measuresByMetricId.get(metricWithBestValue.getMetric().getId()) == null) {
measures.add(metricWithBestValue.getBestValue());
}
}
} | java | private static void addBestValuesToMeasures(List<LiveMeasureDto> measures, ComponentDto component, Collection<MetricDto> metrics) {
if (!QUALIFIERS_ELIGIBLE_FOR_BEST_VALUE.contains(component.qualifier())) {
return;
}
List<MetricDtoWithBestValue> metricWithBestValueList = metrics.stream()
.filter(MetricDtoFunctions.isOptimizedForBestValue())
.map(MetricDtoWithBestValue::new)
.collect(MoreCollectors.toList(metrics.size()));
Map<Integer, LiveMeasureDto> measuresByMetricId = Maps.uniqueIndex(measures, LiveMeasureDto::getMetricId);
for (MetricDtoWithBestValue metricWithBestValue : metricWithBestValueList) {
if (measuresByMetricId.get(metricWithBestValue.getMetric().getId()) == null) {
measures.add(metricWithBestValue.getBestValue());
}
}
} | [
"private",
"static",
"void",
"addBestValuesToMeasures",
"(",
"List",
"<",
"LiveMeasureDto",
">",
"measures",
",",
"ComponentDto",
"component",
",",
"Collection",
"<",
"MetricDto",
">",
"metrics",
")",
"{",
"if",
"(",
"!",
"QUALIFIERS_ELIGIBLE_FOR_BEST_VALUE",
".",
... | Conditions for best value measure:
<ul>
<li>component is a production file or test file</li>
<li>metric is optimized for best value</li>
</ul> | [
"Conditions",
"for",
"best",
"value",
"measure",
":",
"<ul",
">",
"<li",
">",
"component",
"is",
"a",
"production",
"file",
"or",
"test",
"file<",
"/",
"li",
">",
"<li",
">",
"metric",
"is",
"optimized",
"for",
"best",
"value<",
"/",
"li",
">",
"<",
... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java#L218-L234 |
eldur/jwbf | src/main/java/net/sourceforge/jwbf/mediawiki/actions/editing/GetApiToken.java | GetApiToken.generateTokenRequest | private static Get generateTokenRequest(Intoken intoken, String title) {
return new ApiRequestBuilder() //
.action("query") //
.formatXml() //
.param("prop", "info") //
.param("intoken", intoken.toString().toLowerCase()) //
.param("titles", MediaWiki.urlEncode(title)) //
.buildGet();
} | java | private static Get generateTokenRequest(Intoken intoken, String title) {
return new ApiRequestBuilder() //
.action("query") //
.formatXml() //
.param("prop", "info") //
.param("intoken", intoken.toString().toLowerCase()) //
.param("titles", MediaWiki.urlEncode(title)) //
.buildGet();
} | [
"private",
"static",
"Get",
"generateTokenRequest",
"(",
"Intoken",
"intoken",
",",
"String",
"title",
")",
"{",
"return",
"new",
"ApiRequestBuilder",
"(",
")",
"//",
".",
"action",
"(",
"\"query\"",
")",
"//",
".",
"formatXml",
"(",
")",
"//",
".",
"param... | Generates the next MediaWiki API urlEncodedToken and adds it to <code>msgs</code>.
@param intoken type to get the urlEncodedToken for
@param title title of the article to generate the urlEncodedToken for | [
"Generates",
"the",
"next",
"MediaWiki",
"API",
"urlEncodedToken",
"and",
"adds",
"it",
"to",
"<code",
">",
"msgs<",
"/",
"code",
">",
"."
] | train | https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/actions/editing/GetApiToken.java#L123-L131 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheEventListenerConfigurationBuilder.java | CacheEventListenerConfigurationBuilder.newEventListenerConfiguration | public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(
CacheEventListener<?, ?> listener, EventType eventType, EventType... eventTypes){
return new CacheEventListenerConfigurationBuilder(EnumSet.of(eventType, eventTypes), listener);
} | java | public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(
CacheEventListener<?, ?> listener, EventType eventType, EventType... eventTypes){
return new CacheEventListenerConfigurationBuilder(EnumSet.of(eventType, eventTypes), listener);
} | [
"public",
"static",
"CacheEventListenerConfigurationBuilder",
"newEventListenerConfiguration",
"(",
"CacheEventListener",
"<",
"?",
",",
"?",
">",
"listener",
",",
"EventType",
"eventType",
",",
"EventType",
"...",
"eventTypes",
")",
"{",
"return",
"new",
"CacheEventLis... | Creates a new builder instance using the given {@link CacheEventListener} instance and the {@link EventType}s it
will listen to.
<p>
<ul>
<li>{@link EventOrdering} defaults to {@link EventOrdering#UNORDERED}</li>
<li>{@link EventFiring} defaults to {@link EventFiring#ASYNCHRONOUS}</li>
</ul>
@param listener the {@code CacheEventListener} instance
@param eventType the mandatory event type to listen to
@param eventTypes optional additional event types to listen to
@return the new builder instance | [
"Creates",
"a",
"new",
"builder",
"instance",
"using",
"the",
"given",
"{",
"@link",
"CacheEventListener",
"}",
"instance",
"and",
"the",
"{",
"@link",
"EventType",
"}",
"s",
"it",
"will",
"listen",
"to",
".",
"<p",
">",
"<ul",
">",
"<li",
">",
"{",
"@... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheEventListenerConfigurationBuilder.java#L100-L103 |
Stratio/Decision | api/src/main/scala/com/stratio/decision/api/partitioner/JenkinsHash.java | JenkinsHash.gatherPartialLongLE | private static final long gatherPartialLongLE(final byte[] data, final int index, final int available) {
if(available >= 4) {
int i = gatherIntLE(data, index);
long l = uintToLong(i);
int left = available - 4;
if(left == 0) {
return l;
}
int i2 = gatherPartialIntLE(data, index + 4, left);
l <<= (left << 3);
l |= (long) i2;
return l;
} else {
return (long) gatherPartialIntLE(data, index, available);
}
} | java | private static final long gatherPartialLongLE(final byte[] data, final int index, final int available) {
if(available >= 4) {
int i = gatherIntLE(data, index);
long l = uintToLong(i);
int left = available - 4;
if(left == 0) {
return l;
}
int i2 = gatherPartialIntLE(data, index + 4, left);
l <<= (left << 3);
l |= (long) i2;
return l;
} else {
return (long) gatherPartialIntLE(data, index, available);
}
} | [
"private",
"static",
"final",
"long",
"gatherPartialLongLE",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"int",
"index",
",",
"final",
"int",
"available",
")",
"{",
"if",
"(",
"available",
">=",
"4",
")",
"{",
"int",
"i",
"=",
"gatherIntLE",
... | gather a partial long from the specified index using the specified number
of bytes into the byte array | [
"gather",
"a",
"partial",
"long",
"from",
"the",
"specified",
"index",
"using",
"the",
"specified",
"number",
"of",
"bytes",
"into",
"the",
"byte",
"array"
] | train | https://github.com/Stratio/Decision/blob/675eb4f005031bfcaa6cf43200f37aa5ba288139/api/src/main/scala/com/stratio/decision/api/partitioner/JenkinsHash.java#L434-L454 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.getColumnMetadata | private ColumnDef getColumnMetadata(ColumnInfo columnInfo, TableInfo tableInfo)
{
ColumnDef columnDef = new ColumnDef();
columnDef.setName(columnInfo.getColumnName().getBytes());
columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnInfo.getType(),
isCql3Enabled(tableInfo)));
if (columnInfo.isIndexable())
{
IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName());
columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType()));
// if (!indexInfo.getIndexName().equals(indexInfo.getColumnName()))
// {
// columnDef.setIndex_name(indexInfo.getIndexName());
// }
}
return columnDef;
} | java | private ColumnDef getColumnMetadata(ColumnInfo columnInfo, TableInfo tableInfo)
{
ColumnDef columnDef = new ColumnDef();
columnDef.setName(columnInfo.getColumnName().getBytes());
columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnInfo.getType(),
isCql3Enabled(tableInfo)));
if (columnInfo.isIndexable())
{
IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName());
columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType()));
// if (!indexInfo.getIndexName().equals(indexInfo.getColumnName()))
// {
// columnDef.setIndex_name(indexInfo.getIndexName());
// }
}
return columnDef;
} | [
"private",
"ColumnDef",
"getColumnMetadata",
"(",
"ColumnInfo",
"columnInfo",
",",
"TableInfo",
"tableInfo",
")",
"{",
"ColumnDef",
"columnDef",
"=",
"new",
"ColumnDef",
"(",
")",
";",
"columnDef",
".",
"setName",
"(",
"columnInfo",
".",
"getColumnName",
"(",
")... | getColumnMetadata use for getting column metadata for specific
columnInfo.
@param columnInfo
the column info
@param tableInfo
the table info
@return the column metadata | [
"getColumnMetadata",
"use",
"for",
"getting",
"column",
"metadata",
"for",
"specific",
"columnInfo",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2130-L2147 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java | DefaultSources.getDiscoveredSources | public static ArrayList<ConfigSource> getDiscoveredSources(ClassLoader classloader) {
ArrayList<ConfigSource> sources = new ArrayList<>();
//load config sources using the service loader
try {
ServiceLoader<ConfigSource> sl = ServiceLoader.load(ConfigSource.class, classloader);
for (ConfigSource source : sl) {
sources.add(source);
}
} catch (ServiceConfigurationError e) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.sources.CWMCG0010E", e), e);
}
try {
//load config source providers using the service loader
ServiceLoader<ConfigSourceProvider> providerSL = ServiceLoader.load(ConfigSourceProvider.class, classloader);
for (ConfigSourceProvider provider : providerSL) {
for (ConfigSource source : provider.getConfigSources(classloader)) {
sources.add(source);
}
}
} catch (ServiceConfigurationError e) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.source.providers.CWMCG0011E", e), e);
}
return sources;
} | java | public static ArrayList<ConfigSource> getDiscoveredSources(ClassLoader classloader) {
ArrayList<ConfigSource> sources = new ArrayList<>();
//load config sources using the service loader
try {
ServiceLoader<ConfigSource> sl = ServiceLoader.load(ConfigSource.class, classloader);
for (ConfigSource source : sl) {
sources.add(source);
}
} catch (ServiceConfigurationError e) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.sources.CWMCG0010E", e), e);
}
try {
//load config source providers using the service loader
ServiceLoader<ConfigSourceProvider> providerSL = ServiceLoader.load(ConfigSourceProvider.class, classloader);
for (ConfigSourceProvider provider : providerSL) {
for (ConfigSource source : provider.getConfigSources(classloader)) {
sources.add(source);
}
}
} catch (ServiceConfigurationError e) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.source.providers.CWMCG0011E", e), e);
}
return sources;
} | [
"public",
"static",
"ArrayList",
"<",
"ConfigSource",
">",
"getDiscoveredSources",
"(",
"ClassLoader",
"classloader",
")",
"{",
"ArrayList",
"<",
"ConfigSource",
">",
"sources",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"//load config sources using the service loa... | Get ConfigSources found using the ServiceLoader pattern - both directly
as found ConfigSources and those found via found ConfigSourceProviders'
getConfigSources method.
@param classloader
@return | [
"Get",
"ConfigSources",
"found",
"using",
"the",
"ServiceLoader",
"pattern",
"-",
"both",
"directly",
"as",
"found",
"ConfigSources",
"and",
"those",
"found",
"via",
"found",
"ConfigSourceProviders",
"getConfigSources",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java#L86-L112 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java | ManagedInstanceEncryptionProtectorsInner.getAsync | public Observable<ManagedInstanceEncryptionProtectorInner> getAsync(String resourceGroupName, String managedInstanceName) {
return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() {
@Override
public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedInstanceEncryptionProtectorInner> getAsync(String resourceGroupName, String managedInstanceName) {
return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() {
@Override
public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedInstanceEncryptionProtectorInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
")",
"... | Gets a managed instance encryption protector.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedInstanceEncryptionProtectorInner object | [
"Gets",
"a",
"managed",
"instance",
"encryption",
"protector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java#L243-L250 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.getOrCreateInfo | @SuppressWarnings("unchecked")
private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) {
final Class<?> itemType = getType(item);
final T info;
// details holder allows to implicitly filter by type and avoid duplicate registration
if (detailsHolder.containsKey(itemType)) {
// no duplicate registration
info = (T) detailsHolder.get(itemType);
} else {
itemsHolder.put(type, item);
info = type.newContainer(itemType);
detailsHolder.put(itemType, info);
}
return info;
} | java | @SuppressWarnings("unchecked")
private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) {
final Class<?> itemType = getType(item);
final T info;
// details holder allows to implicitly filter by type and avoid duplicate registration
if (detailsHolder.containsKey(itemType)) {
// no duplicate registration
info = (T) detailsHolder.get(itemType);
} else {
itemsHolder.put(type, item);
info = type.newContainer(itemType);
detailsHolder.put(itemType, info);
}
return info;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
"extends",
"ItemInfoImpl",
">",
"T",
"getOrCreateInfo",
"(",
"final",
"ConfigItem",
"type",
",",
"final",
"Object",
"item",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"itemType",
"=",
... | Disabled items may not be actually registered. In order to register disable info in uniform way
dummy container is created.
@param type item type
@param item item object
@param <T> expected container type
@return info container instance | [
"Disabled",
"items",
"may",
"not",
"be",
"actually",
"registered",
".",
"In",
"order",
"to",
"register",
"disable",
"info",
"in",
"uniform",
"way",
"dummy",
"container",
"is",
"created",
"."
] | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L675-L689 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java | FileWriter.write | public File write(String content, boolean isAppend) throws IORuntimeException {
BufferedWriter writer = null;
try {
writer = getWriter(isAppend);
writer.write(content);
writer.flush();
}catch(IOException e){
throw new IORuntimeException(e);
}finally {
IoUtil.close(writer);
}
return file;
} | java | public File write(String content, boolean isAppend) throws IORuntimeException {
BufferedWriter writer = null;
try {
writer = getWriter(isAppend);
writer.write(content);
writer.flush();
}catch(IOException e){
throw new IORuntimeException(e);
}finally {
IoUtil.close(writer);
}
return file;
} | [
"public",
"File",
"write",
"(",
"String",
"content",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"BufferedWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"getWriter",
"(",
"isAppend",
")",
";",
"writer",
".",
"write"... | 将String写入文件
@param content 写入的内容
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将String写入文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L113-L125 |
requery/requery | requery/src/main/java/io/requery/proxy/EntityProxy.java | EntityProxy.setState | public void setState(Attribute<E, ?> attribute, PropertyState state) {
if (!stateless) {
attribute.getPropertyState().set(entity, state);
}
} | java | public void setState(Attribute<E, ?> attribute, PropertyState state) {
if (!stateless) {
attribute.getPropertyState().set(entity, state);
}
} | [
"public",
"void",
"setState",
"(",
"Attribute",
"<",
"E",
",",
"?",
">",
"attribute",
",",
"PropertyState",
"state",
")",
"{",
"if",
"(",
"!",
"stateless",
")",
"{",
"attribute",
".",
"getPropertyState",
"(",
")",
".",
"set",
"(",
"entity",
",",
"state... | Sets the current {@link PropertyState} of a given {@link Attribute}.
@param attribute to set
@param state state to set | [
"Sets",
"the",
"current",
"{",
"@link",
"PropertyState",
"}",
"of",
"a",
"given",
"{",
"@link",
"Attribute",
"}",
"."
] | train | https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery/src/main/java/io/requery/proxy/EntityProxy.java#L219-L223 |
WASdev/standards.jsr352.jbatch | com.ibm.jbatch.spi/src/main/java/com/ibm/jbatch/spi/ServiceRegistry.java | ServiceRegistry.getSystemPropertyOverrides | public static Properties getSystemPropertyOverrides() {
final String PROP_PREFIX = sourceClass;
Properties props = new Properties();
for (String propName : getAllServicePropertyNames()) {
final String key = PROP_PREFIX + "." + propName;
final String val = System.getProperty(key);
if (val != null) {
logger.fine("Found override property from system properties (key,value) = (" + propName + "," + val + ")");
props.setProperty(propName, val);
}
}
return props;
} | java | public static Properties getSystemPropertyOverrides() {
final String PROP_PREFIX = sourceClass;
Properties props = new Properties();
for (String propName : getAllServicePropertyNames()) {
final String key = PROP_PREFIX + "." + propName;
final String val = System.getProperty(key);
if (val != null) {
logger.fine("Found override property from system properties (key,value) = (" + propName + "," + val + ")");
props.setProperty(propName, val);
}
}
return props;
} | [
"public",
"static",
"Properties",
"getSystemPropertyOverrides",
"(",
")",
"{",
"final",
"String",
"PROP_PREFIX",
"=",
"sourceClass",
";",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"String",
"propName",
":",
"getAllServicePropertyN... | If a system property is found with key equal to:
A.B
where A is the current classname and B is some constant
String defined in ServicePropertyNames, then the value V
of this system property will be included in a new property
added to the return value Properties object. The return
value will include a property with key B and value V.
E.g. a system property (key=value) of:
(com.ibm.jbatch.spi.ServiceRegistry.TRANSACTION_SERVICE=XXXX)
will result in the return value including a property of:
(TRANSACTION_SERVICE=XXXX)
@return Properties object as defined above. | [
"If",
"a",
"system",
"property",
"is",
"found",
"with",
"key",
"equal",
"to",
":",
"A",
".",
"B",
"where",
"A",
"is",
"the",
"current",
"classname",
"and",
"B",
"is",
"some",
"constant",
"String",
"defined",
"in",
"ServicePropertyNames",
"then",
"the",
"... | train | https://github.com/WASdev/standards.jsr352.jbatch/blob/e267e79dccd4f0bd4bf9c2abc41a8a47b65be28f/com.ibm.jbatch.spi/src/main/java/com/ibm/jbatch/spi/ServiceRegistry.java#L168-L181 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsCore.java | OpenCmsCore.initCmsObject | private CmsObject initCmsObject(CmsContextInfo contextInfo) throws CmsException {
CmsUser user = contextInfo.getUser();
if (user == null) {
user = m_securityManager.readUser(null, contextInfo.getUserName());
}
CmsProject project = contextInfo.getProject();
if (project == null) {
project = m_securityManager.readProject(contextInfo.getProjectName());
}
// first create the request context
CmsRequestContext context = new CmsRequestContext(
user,
project,
contextInfo.getRequestedUri(),
contextInfo.getRequestMatcher(),
contextInfo.getSiteRoot(),
contextInfo.isSecureRequest(),
contextInfo.getLocale(),
contextInfo.getEncoding(),
contextInfo.getRemoteAddr(),
contextInfo.getRequestTime(),
m_resourceManager.getFolderTranslator(),
m_resourceManager.getFileTranslator(),
contextInfo.getOuFqn());
context.setDetailResource(contextInfo.getDetailResource());
// now initialize and return the CmsObject
return new CmsObject(m_securityManager, context);
} | java | private CmsObject initCmsObject(CmsContextInfo contextInfo) throws CmsException {
CmsUser user = contextInfo.getUser();
if (user == null) {
user = m_securityManager.readUser(null, contextInfo.getUserName());
}
CmsProject project = contextInfo.getProject();
if (project == null) {
project = m_securityManager.readProject(contextInfo.getProjectName());
}
// first create the request context
CmsRequestContext context = new CmsRequestContext(
user,
project,
contextInfo.getRequestedUri(),
contextInfo.getRequestMatcher(),
contextInfo.getSiteRoot(),
contextInfo.isSecureRequest(),
contextInfo.getLocale(),
contextInfo.getEncoding(),
contextInfo.getRemoteAddr(),
contextInfo.getRequestTime(),
m_resourceManager.getFolderTranslator(),
m_resourceManager.getFileTranslator(),
contextInfo.getOuFqn());
context.setDetailResource(contextInfo.getDetailResource());
// now initialize and return the CmsObject
return new CmsObject(m_securityManager, context);
} | [
"private",
"CmsObject",
"initCmsObject",
"(",
"CmsContextInfo",
"contextInfo",
")",
"throws",
"CmsException",
"{",
"CmsUser",
"user",
"=",
"contextInfo",
".",
"getUser",
"(",
")",
";",
"if",
"(",
"user",
"==",
"null",
")",
"{",
"user",
"=",
"m_securityManager"... | Initializes a CmsObject with the given context information.<p>
@param contextInfo the information for the CmsObject context to create
@return the initialized CmsObject
@throws CmsException if something goes wrong | [
"Initializes",
"a",
"CmsObject",
"with",
"the",
"given",
"context",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L2778-L2809 |
alkacon/opencms-core | src/org/opencms/configuration/CmsConfigurationManager.java | CmsConfigurationManager.loadXmlConfiguration | public void loadXmlConfiguration() throws SAXException, IOException {
URL baseUrl = m_baseFolder.toURI().toURL();
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_BASE_URL_1, baseUrl));
}
// first load the base configuration
loadXmlConfiguration(baseUrl, this);
// now iterate all sub-configurations
Iterator<I_CmsXmlConfiguration> i = m_configurations.iterator();
while (i.hasNext()) {
loadXmlConfiguration(baseUrl, i.next());
}
// remove the old backups
removeOldBackups(MAX_BACKUP_DAYS);
} | java | public void loadXmlConfiguration() throws SAXException, IOException {
URL baseUrl = m_baseFolder.toURI().toURL();
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_BASE_URL_1, baseUrl));
}
// first load the base configuration
loadXmlConfiguration(baseUrl, this);
// now iterate all sub-configurations
Iterator<I_CmsXmlConfiguration> i = m_configurations.iterator();
while (i.hasNext()) {
loadXmlConfiguration(baseUrl, i.next());
}
// remove the old backups
removeOldBackups(MAX_BACKUP_DAYS);
} | [
"public",
"void",
"loadXmlConfiguration",
"(",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"URL",
"baseUrl",
"=",
"m_baseFolder",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{"... | Loads the OpenCms configuration from the given XML file.<p>
@throws SAXException in case of XML parse errors
@throws IOException in case of file IO errors | [
"Loads",
"the",
"OpenCms",
"configuration",
"from",
"the",
"given",
"XML",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsConfigurationManager.java#L352-L370 |
apereo/cas | core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java | AbstractCentralAuthenticationService.verifyTicketState | @Synchronized
protected void verifyTicketState(final Ticket ticket, final String id, final Class clazz) {
if (ticket == null) {
LOGGER.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", id, clazz != null ? clazz.getSimpleName() : "unspecified");
throw new InvalidTicketException(id);
}
if (ticket.isExpired()) {
deleteTicket(id);
LOGGER.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticket);
throw new InvalidTicketException(id);
}
} | java | @Synchronized
protected void verifyTicketState(final Ticket ticket, final String id, final Class clazz) {
if (ticket == null) {
LOGGER.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", id, clazz != null ? clazz.getSimpleName() : "unspecified");
throw new InvalidTicketException(id);
}
if (ticket.isExpired()) {
deleteTicket(id);
LOGGER.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticket);
throw new InvalidTicketException(id);
}
} | [
"@",
"Synchronized",
"protected",
"void",
"verifyTicketState",
"(",
"final",
"Ticket",
"ticket",
",",
"final",
"String",
"id",
",",
"final",
"Class",
"clazz",
")",
"{",
"if",
"(",
"ticket",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Ticket [{}... | Validate ticket expiration policy and throws exception if ticket is no longer valid.
Expired tickets are also deleted from the registry immediately on demand.
@param ticket the ticket
@param id the original id
@param clazz the clazz | [
"Validate",
"ticket",
"expiration",
"policy",
"and",
"throws",
"exception",
"if",
"ticket",
"is",
"no",
"longer",
"valid",
".",
"Expired",
"tickets",
"are",
"also",
"deleted",
"from",
"the",
"registry",
"immediately",
"on",
"demand",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java#L211-L222 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java | ComponentCollision.addPoint | private void addPoint(Point point, Collidable collidable)
{
final Integer group = collidable.getGroup();
if (!collidables.containsKey(group))
{
collidables.put(group, new HashMap<Point, Set<Collidable>>());
}
final Map<Point, Set<Collidable>> elements = collidables.get(group);
if (!elements.containsKey(point))
{
elements.put(point, new HashSet<Collidable>());
}
elements.get(point).add(collidable);
} | java | private void addPoint(Point point, Collidable collidable)
{
final Integer group = collidable.getGroup();
if (!collidables.containsKey(group))
{
collidables.put(group, new HashMap<Point, Set<Collidable>>());
}
final Map<Point, Set<Collidable>> elements = collidables.get(group);
if (!elements.containsKey(point))
{
elements.put(point, new HashSet<Collidable>());
}
elements.get(point).add(collidable);
} | [
"private",
"void",
"addPoint",
"(",
"Point",
"point",
",",
"Collidable",
"collidable",
")",
"{",
"final",
"Integer",
"group",
"=",
"collidable",
".",
"getGroup",
"(",
")",
";",
"if",
"(",
"!",
"collidables",
".",
"containsKey",
"(",
"group",
")",
")",
"{... | Add point. Create empty list of not existing.
@param point The point to remove.
@param collidable The associated collidable. | [
"Add",
"point",
".",
"Create",
"empty",
"list",
"of",
"not",
"existing",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L108-L121 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Sources.java | Sources.asReader | public static BufferedReader asReader(InputStream is, Charset charset) {
try {
return new BufferedReader(new InputStreamReader(is, charset.toString()));
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | java | public static BufferedReader asReader(InputStream is, Charset charset) {
try {
return new BufferedReader(new InputStreamReader(is, charset.toString()));
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"BufferedReader",
"asReader",
"(",
"InputStream",
"is",
",",
"Charset",
"charset",
")",
"{",
"try",
"{",
"return",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
",",
"charset",
".",
"toString",
"(",
")",
")",
")",
... | Convert {@link InputStream} to {@link BufferedReader}
@param is
@return | [
"Convert",
"{",
"@link",
"InputStream",
"}",
"to",
"{",
"@link",
"BufferedReader",
"}"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Sources.java#L218-L226 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.regenerateKeyAsync | public Observable<RedisAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, name, keyType).map(new Func1<ServiceResponse<RedisAccessKeysInner>, RedisAccessKeysInner>() {
@Override
public RedisAccessKeysInner call(ServiceResponse<RedisAccessKeysInner> response) {
return response.body();
}
});
} | java | public Observable<RedisAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String name, RedisKeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, name, keyType).map(new Func1<ServiceResponse<RedisAccessKeysInner>, RedisAccessKeysInner>() {
@Override
public RedisAccessKeysInner call(ServiceResponse<RedisAccessKeysInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RedisAccessKeysInner",
">",
"regenerateKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"RedisKeyType",
"keyType",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
... | Regenerate Redis cache's access keys. This operation requires write permission to the cache resource.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param keyType The Redis access key to regenerate. Possible values include: 'Primary', 'Secondary'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisAccessKeysInner object | [
"Regenerate",
"Redis",
"cache",
"s",
"access",
"keys",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1176-L1183 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java | DataFrameJoiner.leftOuter | public Table leftOuter(boolean allowDuplicateColumnNames, Table... tables) {
Table joined = table;
for (Table table2 : tables) {
joined = leftOuter(table2, allowDuplicateColumnNames, columnNames);
}
return joined;
} | java | public Table leftOuter(boolean allowDuplicateColumnNames, Table... tables) {
Table joined = table;
for (Table table2 : tables) {
joined = leftOuter(table2, allowDuplicateColumnNames, columnNames);
}
return joined;
} | [
"public",
"Table",
"leftOuter",
"(",
"boolean",
"allowDuplicateColumnNames",
",",
"Table",
"...",
"tables",
")",
"{",
"Table",
"joined",
"=",
"table",
";",
"for",
"(",
"Table",
"table2",
":",
"tables",
")",
"{",
"joined",
"=",
"leftOuter",
"(",
"table2",
"... | Joins to the given tables assuming that they have a column of the name we're joining on
@param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name
if {@code true} the join will succeed and duplicate columns are renamed*
@param tables The tables to join with
@return The resulting table | [
"Joins",
"to",
"the",
"given",
"tables",
"assuming",
"that",
"they",
"have",
"a",
"column",
"of",
"the",
"name",
"we",
"re",
"joining",
"on"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L498-L504 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.drawImage | public void drawImage(Image img, Rectangle rect, Rectangle clipRect, float opacity) {
try {
template.saveState();
// opacity
PdfGState state = new PdfGState();
state.setFillOpacity(opacity);
state.setBlendMode(PdfGState.BM_NORMAL);
template.setGState(state);
// clipping code
if (clipRect != null) {
template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(),
clipRect.getHeight());
template.clip();
template.newPath();
}
template.addImage(img, rect.getWidth(), 0, 0, rect.getHeight(), origX + rect.getLeft(), origY
+ rect.getBottom());
} catch (DocumentException e) {
log.warn("could not draw image", e);
} finally {
template.restoreState();
}
} | java | public void drawImage(Image img, Rectangle rect, Rectangle clipRect, float opacity) {
try {
template.saveState();
// opacity
PdfGState state = new PdfGState();
state.setFillOpacity(opacity);
state.setBlendMode(PdfGState.BM_NORMAL);
template.setGState(state);
// clipping code
if (clipRect != null) {
template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(),
clipRect.getHeight());
template.clip();
template.newPath();
}
template.addImage(img, rect.getWidth(), 0, 0, rect.getHeight(), origX + rect.getLeft(), origY
+ rect.getBottom());
} catch (DocumentException e) {
log.warn("could not draw image", e);
} finally {
template.restoreState();
}
} | [
"public",
"void",
"drawImage",
"(",
"Image",
"img",
",",
"Rectangle",
"rect",
",",
"Rectangle",
"clipRect",
",",
"float",
"opacity",
")",
"{",
"try",
"{",
"template",
".",
"saveState",
"(",
")",
";",
"// opacity",
"PdfGState",
"state",
"=",
"new",
"PdfGSta... | Draws the specified image with the first rectangle's bounds, clipping with the second one.
@param img image
@param rect rectangle
@param clipRect clipping bounds
@param opacity opacity of the image (1 = opaque, 0= transparent) | [
"Draws",
"the",
"specified",
"image",
"with",
"the",
"first",
"rectangle",
"s",
"bounds",
"clipping",
"with",
"the",
"second",
"one",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L401-L423 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java | EntityManagerFactoryImpl.configurePersistenceUnit | private void configurePersistenceUnit(PersistenceUnitInfo puInfo, Map props)
{
// Invoke Persistence unit MetaData
if (puInfo.getPersistenceUnitName() == null)
{
throw new KunderaException("Persistence unit name should not be null");
}
if (logger.isInfoEnabled())
{
logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.",
puInfo.getPersistenceUnitName());
}
String[] persistenceUnits = puInfo.getPersistenceUnitName().split(Constants.PERSISTENCE_UNIT_SEPARATOR);
new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(puInfo);
} | java | private void configurePersistenceUnit(PersistenceUnitInfo puInfo, Map props)
{
// Invoke Persistence unit MetaData
if (puInfo.getPersistenceUnitName() == null)
{
throw new KunderaException("Persistence unit name should not be null");
}
if (logger.isInfoEnabled())
{
logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.",
puInfo.getPersistenceUnitName());
}
String[] persistenceUnits = puInfo.getPersistenceUnitName().split(Constants.PERSISTENCE_UNIT_SEPARATOR);
new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(puInfo);
} | [
"private",
"void",
"configurePersistenceUnit",
"(",
"PersistenceUnitInfo",
"puInfo",
",",
"Map",
"props",
")",
"{",
"// Invoke Persistence unit MetaData\r",
"if",
"(",
"puInfo",
".",
"getPersistenceUnitName",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"Kunder... | One time initialization for persistence unit metadata.
@param persistenceUnit
Persistence Unit/ Comma separated persistence units | [
"One",
"time",
"initialization",
"for",
"persistence",
"unit",
"metadata",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java#L668-L684 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/BaseFont.java | BaseFont.createFont | public static BaseFont createFont() throws DocumentException, IOException {
return createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
} | java | public static BaseFont createFont() throws DocumentException, IOException {
return createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
} | [
"public",
"static",
"BaseFont",
"createFont",
"(",
")",
"throws",
"DocumentException",
",",
"IOException",
"{",
"return",
"createFont",
"(",
"BaseFont",
".",
"HELVETICA",
",",
"BaseFont",
".",
"WINANSI",
",",
"BaseFont",
".",
"NOT_EMBEDDED",
")",
";",
"}"
] | Creates a new font. This will always be the default Helvetica font (not embedded).
This method is introduced because Helvetica is used in many examples.
@return a BaseFont object (Helvetica, Winansi, not embedded)
@throws IOException This shouldn't occur ever
@throws DocumentException This shouldn't occur ever
@since 2.1.1 | [
"Creates",
"a",
"new",
"font",
".",
"This",
"will",
"always",
"be",
"the",
"default",
"Helvetica",
"font",
"(",
"not",
"embedded",
")",
".",
"This",
"method",
"is",
"introduced",
"because",
"Helvetica",
"is",
"used",
"in",
"many",
"examples",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BaseFont.java#L385-L387 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanOFactory.java | BeanOFactory.create | public final BeanO create(EJSContainer c, EJSHome h, boolean reactivate) // d623673.1
throws RemoteException, InvocationTargetException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "create: " + h);
BeanO beanO = newInstance(c, h);
boolean success = false;
try
{
beanO.initialize(reactivate);
success = true;
} finally
{
if (!success)
{
beanO.discard();
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "create: " + beanO + ", success=" + success);
}
return beanO;
} | java | public final BeanO create(EJSContainer c, EJSHome h, boolean reactivate) // d623673.1
throws RemoteException, InvocationTargetException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "create: " + h);
BeanO beanO = newInstance(c, h);
boolean success = false;
try
{
beanO.initialize(reactivate);
success = true;
} finally
{
if (!success)
{
beanO.discard();
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "create: " + beanO + ", success=" + success);
}
return beanO;
} | [
"public",
"final",
"BeanO",
"create",
"(",
"EJSContainer",
"c",
",",
"EJSHome",
"h",
",",
"boolean",
"reactivate",
")",
"// d623673.1",
"throws",
"RemoteException",
",",
"InvocationTargetException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
... | Changed EnterpriseBean to Object. d366807.1 | [
"Changed",
"EnterpriseBean",
"to",
"Object",
".",
"d366807",
".",
"1"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanOFactory.java#L91-L117 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPreferences.java | CmsPreferences.buildSelect | String buildSelect(String htmlAttributes, SelectOptions options) {
return buildSelect(htmlAttributes, options.getOptions(), options.getValues(), options.getSelectedIndex());
} | java | String buildSelect(String htmlAttributes, SelectOptions options) {
return buildSelect(htmlAttributes, options.getOptions(), options.getValues(), options.getSelectedIndex());
} | [
"String",
"buildSelect",
"(",
"String",
"htmlAttributes",
",",
"SelectOptions",
"options",
")",
"{",
"return",
"buildSelect",
"(",
"htmlAttributes",
",",
"options",
".",
"getOptions",
"(",
")",
",",
"options",
".",
"getValues",
"(",
")",
",",
"options",
".",
... | Builds the HTML code for a select widget given a bean containing the select options
@param htmlAttributes html attributes for the select widget
@param options the bean containing the select options
@return the HTML for the select box | [
"Builds",
"the",
"HTML",
"code",
"for",
"a",
"select",
"widget",
"given",
"a",
"bean",
"containing",
"the",
"select",
"options"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L2257-L2260 |
vipshop/vjtools | vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java | Formats.shortName | public static String shortName(String str, int length, int rightLength) {
if (str.length() > length) {
int leftIndex = length - 3 - rightLength;
str = str.substring(0, Math.max(0, leftIndex)) + "..."
+ str.substring(Math.max(0, str.length() - rightLength), str.length());
}
return str;
} | java | public static String shortName(String str, int length, int rightLength) {
if (str.length() > length) {
int leftIndex = length - 3 - rightLength;
str = str.substring(0, Math.max(0, leftIndex)) + "..."
+ str.substring(Math.max(0, str.length() - rightLength), str.length());
}
return str;
} | [
"public",
"static",
"String",
"shortName",
"(",
"String",
"str",
",",
"int",
"length",
",",
"int",
"rightLength",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
">",
"length",
")",
"{",
"int",
"leftIndex",
"=",
"length",
"-",
"3",
"-",
"rightLe... | shortName("123456789", 8, 3) = "12...789"
shortName("123456789", 8, 2) = "123...89" | [
"shortName",
"(",
"123456789",
"8",
"3",
")",
"=",
"12",
"...",
"789"
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java#L201-L208 |
js-lib-com/template.xhtml | src/main/java/js/template/xhtml/Content.java | Content.isEmpty | boolean isEmpty(Object scope, String propertyPath) throws TemplateException
{
return Types.asBoolean(getValue(scope, propertyPath)) == false;
} | java | boolean isEmpty(Object scope, String propertyPath) throws TemplateException
{
return Types.asBoolean(getValue(scope, propertyPath)) == false;
} | [
"boolean",
"isEmpty",
"(",
"Object",
"scope",
",",
"String",
"propertyPath",
")",
"throws",
"TemplateException",
"{",
"return",
"Types",
".",
"asBoolean",
"(",
"getValue",
"(",
"scope",
",",
"propertyPath",
")",
")",
"==",
"false",
";",
"}"
] | Test if value is empty. Delegates {@link #getValue(Object, String)} and returns true if found value fulfill one of
the next conditions:
<ul>
<li>null
<li>boolean false
<li>number equals with 0
<li>empty string
<li>array of length 0
<li>collection of size 0
<li>map of size 0
<li>undefined character
</ul>
Note that undefined value, that is, field or method getter not found, is not considered empty value.
@param scope scope object,
@param propertyPath property path.
@return true if value is empty.
@throws TemplateException if requested value is undefined. | [
"Test",
"if",
"value",
"is",
"empty",
".",
"Delegates",
"{",
"@link",
"#getValue",
"(",
"Object",
"String",
")",
"}",
"and",
"returns",
"true",
"if",
"found",
"value",
"fulfill",
"one",
"of",
"the",
"next",
"conditions",
":",
"<ul",
">",
"<li",
">",
"n... | train | https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L215-L218 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java | ClustersInner.beginStop | public void beginStop(String resourceGroupName, String clusterName) {
beginStopWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public void beginStop(String resourceGroupName, String clusterName) {
beginStopWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"void",
"beginStop",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"beginStopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
... | Stops a Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@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 | [
"Stops",
"a",
"Kusto",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L796-L798 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.countNodes | private NumberReplicas countNodes(Block b,
Iterator<DatanodeDescriptor> nodeIter) {
int count = 0;
int live = 0;
int corrupt = 0;
int excess = 0;
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.next();
if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) {
corrupt++;
} else if (node.isDecommissionInProgress() || node.isDecommissioned()) {
count++;
} else {
Collection<Block> blocksExcess = initializedReplQueues ?
excessReplicateMap.get(node.getStorageID()) : null;
if (blocksExcess != null && blocksExcess.contains(b)) {
excess++;
} else {
live++;
}
}
}
return new NumberReplicas(live, count, corrupt, excess);
} | java | private NumberReplicas countNodes(Block b,
Iterator<DatanodeDescriptor> nodeIter) {
int count = 0;
int live = 0;
int corrupt = 0;
int excess = 0;
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.next();
if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) {
corrupt++;
} else if (node.isDecommissionInProgress() || node.isDecommissioned()) {
count++;
} else {
Collection<Block> blocksExcess = initializedReplQueues ?
excessReplicateMap.get(node.getStorageID()) : null;
if (blocksExcess != null && blocksExcess.contains(b)) {
excess++;
} else {
live++;
}
}
}
return new NumberReplicas(live, count, corrupt, excess);
} | [
"private",
"NumberReplicas",
"countNodes",
"(",
"Block",
"b",
",",
"Iterator",
"<",
"DatanodeDescriptor",
">",
"nodeIter",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"live",
"=",
"0",
";",
"int",
"corrupt",
"=",
"0",
";",
"int",
"excess",
"=",
"0"... | Counts the number of nodes in the given list into active and
decommissioned counters. | [
"Counts",
"the",
"number",
"of",
"nodes",
"in",
"the",
"given",
"list",
"into",
"active",
"and",
"decommissioned",
"counters",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8076-L8100 |
augustd/burp-suite-utils | src/main/java/com/codemagi/burp/Utils.java | Utils.getSelection | public static String getSelection(byte[] message, int[] offsets) {
if (offsets == null || message == null) return "";
if (offsets.length < 2 || offsets[0] == offsets[1]) return "";
byte[] selection = Arrays.copyOfRange(message, offsets[0], offsets[1]);
return new String(selection);
} | java | public static String getSelection(byte[] message, int[] offsets) {
if (offsets == null || message == null) return "";
if (offsets.length < 2 || offsets[0] == offsets[1]) return "";
byte[] selection = Arrays.copyOfRange(message, offsets[0], offsets[1]);
return new String(selection);
} | [
"public",
"static",
"String",
"getSelection",
"(",
"byte",
"[",
"]",
"message",
",",
"int",
"[",
"]",
"offsets",
")",
"{",
"if",
"(",
"offsets",
"==",
"null",
"||",
"message",
"==",
"null",
")",
"return",
"\"\"",
";",
"if",
"(",
"offsets",
".",
"leng... | Returns the user-selected text in the passed array.
@param message The array of bytes to get the selection from
@param offsets The offsets within the array that indicate the start and end points of the selection
@return A String representing the selected bytes. If offsets is null or if both values are the same, "" is returned. | [
"Returns",
"the",
"user",
"-",
"selected",
"text",
"in",
"the",
"passed",
"array",
"."
] | train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/Utils.java#L71-L79 |
windup/windup | utils/src/main/java/org/jboss/windup/util/ServiceLogger.java | ServiceLogger.logLoadedServices | public static void logLoadedServices(Logger log, Class<?> type, List<?> services)
{
log.info("Loaded [" + services.size() + "] " + type.getName() + " [" + NEWLINE
+ joinTypeNames(new ArrayList<>(services)) + "]");
} | java | public static void logLoadedServices(Logger log, Class<?> type, List<?> services)
{
log.info("Loaded [" + services.size() + "] " + type.getName() + " [" + NEWLINE
+ joinTypeNames(new ArrayList<>(services)) + "]");
} | [
"public",
"static",
"void",
"logLoadedServices",
"(",
"Logger",
"log",
",",
"Class",
"<",
"?",
">",
"type",
",",
"List",
"<",
"?",
">",
"services",
")",
"{",
"log",
".",
"info",
"(",
"\"Loaded [\"",
"+",
"services",
".",
"size",
"(",
")",
"+",
"\"] \... | Log the list of service implementations to the given {@link Logger}. | [
"Log",
"the",
"list",
"of",
"service",
"implementations",
"to",
"the",
"given",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/ServiceLogger.java#L21-L25 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/UserZoneEventHandler.java | UserZoneEventHandler.notifyHandler | private void notifyHandler(ZoneHandlerClass handler, ApiZone apiZone, Object userAgent) {
Object instance = handler.newInstance();
callHandleMethod(handler.getHandleMethod(), instance, apiZone, userAgent);
} | java | private void notifyHandler(ZoneHandlerClass handler, ApiZone apiZone, Object userAgent) {
Object instance = handler.newInstance();
callHandleMethod(handler.getHandleMethod(), instance, apiZone, userAgent);
} | [
"private",
"void",
"notifyHandler",
"(",
"ZoneHandlerClass",
"handler",
",",
"ApiZone",
"apiZone",
",",
"Object",
"userAgent",
")",
"{",
"Object",
"instance",
"=",
"handler",
".",
"newInstance",
"(",
")",
";",
"callHandleMethod",
"(",
"handler",
".",
"getHandleM... | Propagate event to handler
@param handler
structure of handler class
@param apiZone
api zone reference
@param userAgent
user agent reference | [
"Propagate",
"event",
"to",
"handler"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/UserZoneEventHandler.java#L106-L109 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/hwid/SignInApi.java | SignInApi.onConnect | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onSignInResult(rst, null);
return;
}
Activity curActivity = ActivityMgr.INST.getLastActivity();
if (curActivity == null) {
HMSAgentLog.e("activity is null");
onSignInResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE, null);
return;
}
PendingResult<SignInResult> signInResult = HuaweiId.HuaweiIdApi.signIn(curActivity, client);
signInResult.setResultCallback(new ResultCallback<SignInResult>() {
@Override
public void onResult(SignInResult result) {
disposeSignInResult(result);
}
});
} | java | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onSignInResult(rst, null);
return;
}
Activity curActivity = ActivityMgr.INST.getLastActivity();
if (curActivity == null) {
HMSAgentLog.e("activity is null");
onSignInResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE, null);
return;
}
PendingResult<SignInResult> signInResult = HuaweiId.HuaweiIdApi.signIn(curActivity, client);
signInResult.setResultCallback(new ResultCallback<SignInResult>() {
@Override
public void onResult(SignInResult result) {
disposeSignInResult(result);
}
});
} | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"int",
"rst",
",",
"HuaweiApiClient",
"client",
")",
"{",
"if",
"(",
"client",
"==",
"null",
"||",
"!",
"ApiClientMgr",
".",
"INST",
".",
"isConnect",
"(",
"client",
")",
")",
"{",
"HMSAgentLog",
".",
... | HuaweiApiClient 连接结果回调
@param rst 结果码
@param client HuaweiApiClient 实例 | [
"HuaweiApiClient",
"连接结果回调"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/hwid/SignInApi.java#L64-L86 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.deleteStorageAccountAsync | public Observable<Void> deleteStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName) {
return deleteStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName) {
return deleteStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteStorageAccountAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
")",
"{",
"return",
"deleteStorageAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Updates the specified Data Lake Analytics account to remove an Azure Storage account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account from which to remove the Azure Storage account.
@param storageAccountName The name of the Azure Storage account to remove
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"remove",
"an",
"Azure",
"Storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L311-L318 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/matcher/LegacyMatchingPointConfigPatternMatcher.java | LegacyMatchingPointConfigPatternMatcher.getMatchingPoint | private int getMatchingPoint(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return -1;
}
String firstPart = pattern.substring(0, index);
int indexFirstPart = itemName.indexOf(firstPart, 0);
if (indexFirstPart == -1) {
return -1;
}
String secondPart = pattern.substring(index + 1);
int indexSecondPart = itemName.indexOf(secondPart, index + 1);
if (indexSecondPart == -1) {
return -1;
}
return firstPart.length() + secondPart.length();
} | java | private int getMatchingPoint(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return -1;
}
String firstPart = pattern.substring(0, index);
int indexFirstPart = itemName.indexOf(firstPart, 0);
if (indexFirstPart == -1) {
return -1;
}
String secondPart = pattern.substring(index + 1);
int indexSecondPart = itemName.indexOf(secondPart, index + 1);
if (indexSecondPart == -1) {
return -1;
}
return firstPart.length() + secondPart.length();
} | [
"private",
"int",
"getMatchingPoint",
"(",
"String",
"pattern",
",",
"String",
"itemName",
")",
"{",
"int",
"index",
"=",
"pattern",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}"... | This method returns higher values the better the matching is.
@param pattern configuration pattern to match with
@param itemName item name to match
@return -1 if name does not match at all, zero or positive otherwise | [
"This",
"method",
"returns",
"higher",
"values",
"the",
"better",
"the",
"matching",
"is",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/matcher/LegacyMatchingPointConfigPatternMatcher.java#L58-L77 |
52inc/android-52Kit | library-winds/src/main/java/com/ftinc/kit/winds/Winds.java | Winds.openChangelogDialog | public static void openChangelogDialog(Activity ctx, @XmlRes int configId){
ChangeLogDialog dialog = ChangeLogDialog.createInstance(configId);
dialog.show(ctx.getFragmentManager(), null);
} | java | public static void openChangelogDialog(Activity ctx, @XmlRes int configId){
ChangeLogDialog dialog = ChangeLogDialog.createInstance(configId);
dialog.show(ctx.getFragmentManager(), null);
} | [
"public",
"static",
"void",
"openChangelogDialog",
"(",
"Activity",
"ctx",
",",
"@",
"XmlRes",
"int",
"configId",
")",
"{",
"ChangeLogDialog",
"dialog",
"=",
"ChangeLogDialog",
".",
"createInstance",
"(",
"configId",
")",
";",
"dialog",
".",
"show",
"(",
"ctx"... | Open the changelog dialog
@param ctx the activity to launch the dialog fragment with
@param configId the changelog configuration resource id | [
"Open",
"the",
"changelog",
"dialog"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/Winds.java#L101-L104 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/data/impl/SimpleTransformer.java | SimpleTransformer.transformObject | protected SFSDataWrapper transformObject(Object value) {
ResponseParamsClass struct = null;
if(context != null) struct = context.getResponseParamsClass(value.getClass());
if(struct == null) struct = new ResponseParamsClass(value.getClass());
ISFSObject sfsObject = new ResponseParamSerializer().object2params(struct, value);
return new SFSDataWrapper(SFSDataType.SFS_OBJECT, sfsObject);
} | java | protected SFSDataWrapper transformObject(Object value) {
ResponseParamsClass struct = null;
if(context != null) struct = context.getResponseParamsClass(value.getClass());
if(struct == null) struct = new ResponseParamsClass(value.getClass());
ISFSObject sfsObject = new ResponseParamSerializer().object2params(struct, value);
return new SFSDataWrapper(SFSDataType.SFS_OBJECT, sfsObject);
} | [
"protected",
"SFSDataWrapper",
"transformObject",
"(",
"Object",
"value",
")",
"{",
"ResponseParamsClass",
"struct",
"=",
"null",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"struct",
"=",
"context",
".",
"getResponseParamsClass",
"(",
"value",
".",
"getClass"... | Transform a java pojo object to sfsobject
@param value pojo java object
@return a SFSDataWrapper object | [
"Transform",
"a",
"java",
"pojo",
"object",
"to",
"sfsobject"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/data/impl/SimpleTransformer.java#L128-L134 |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFAuthn.java | AAFAuthn.validate | public String validate(String user, String password) throws IOException, CadiException {
User<AAFPermission> usr = getUser(user);
if(password.startsWith("enc:???")) {
password = access.decrypt(password, true);
}
byte[] bytes = password.getBytes();
if(usr != null && usr.principal != null && usr.principal.getName().equals(user)
&& usr.principal instanceof GetCred) {
if(Hash.isEqual(((GetCred)usr.principal).getCred(),bytes)) {
return null;
} else {
remove(usr);
usr = null;
}
}
AAFCachedPrincipal cp = new AAFCachedPrincipal(this,con.app, user, bytes, con.cleanInterval);
// Since I've relocated the Validation piece in the Principal, just revalidate, then do Switch
// Statement
switch(cp.revalidate()) {
case REVALIDATED:
if(usr!=null) {
usr.principal = cp;
} else {
addUser(new User<AAFPermission>(cp,con.timeout));
}
return null;
case INACCESSIBLE:
return "AAF Inaccessible";
case UNVALIDATED:
return "User/Pass combo invalid for " + user;
case DENIED:
return "AAF denies API for " + user;
default:
return "AAFAuthn doesn't handle Principal " + user;
}
} | java | public String validate(String user, String password) throws IOException, CadiException {
User<AAFPermission> usr = getUser(user);
if(password.startsWith("enc:???")) {
password = access.decrypt(password, true);
}
byte[] bytes = password.getBytes();
if(usr != null && usr.principal != null && usr.principal.getName().equals(user)
&& usr.principal instanceof GetCred) {
if(Hash.isEqual(((GetCred)usr.principal).getCred(),bytes)) {
return null;
} else {
remove(usr);
usr = null;
}
}
AAFCachedPrincipal cp = new AAFCachedPrincipal(this,con.app, user, bytes, con.cleanInterval);
// Since I've relocated the Validation piece in the Principal, just revalidate, then do Switch
// Statement
switch(cp.revalidate()) {
case REVALIDATED:
if(usr!=null) {
usr.principal = cp;
} else {
addUser(new User<AAFPermission>(cp,con.timeout));
}
return null;
case INACCESSIBLE:
return "AAF Inaccessible";
case UNVALIDATED:
return "User/Pass combo invalid for " + user;
case DENIED:
return "AAF denies API for " + user;
default:
return "AAFAuthn doesn't handle Principal " + user;
}
} | [
"public",
"String",
"validate",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"IOException",
",",
"CadiException",
"{",
"User",
"<",
"AAFPermission",
">",
"usr",
"=",
"getUser",
"(",
"user",
")",
";",
"if",
"(",
"password",
".",
"startsW... | Returns null if ok, or an Error String;
@param user
@param password
@return
@throws IOException
@throws CadiException
@throws Exception | [
"Returns",
"null",
"if",
"ok",
"or",
"an",
"Error",
"String",
";"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFAuthn.java#L104-L142 |
jimmoores/quandl4j | core/src/main/java/com/jimmoores/quandl/util/PrettyPrinter.java | PrettyPrinter.toPrettyPrintedString | public static String toPrettyPrintedString(final JSONObject jsonObject) {
ArgumentChecker.notNull(jsonObject, "jsonObject");
try {
return jsonObject.toString(JSON_INDENT) + LINE_SEPARATOR;
} catch (JSONException ex) {
s_logger.error("Problem converting JSONObject to String", ex);
throw new QuandlRuntimeException("Problem converting JSONObject to String", ex);
}
} | java | public static String toPrettyPrintedString(final JSONObject jsonObject) {
ArgumentChecker.notNull(jsonObject, "jsonObject");
try {
return jsonObject.toString(JSON_INDENT) + LINE_SEPARATOR;
} catch (JSONException ex) {
s_logger.error("Problem converting JSONObject to String", ex);
throw new QuandlRuntimeException("Problem converting JSONObject to String", ex);
}
} | [
"public",
"static",
"String",
"toPrettyPrintedString",
"(",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"ArgumentChecker",
".",
"notNull",
"(",
"jsonObject",
",",
"\"jsonObject\"",
")",
";",
"try",
"{",
"return",
"jsonObject",
".",
"toString",
"(",
"JSON_INDENT... | Pretty print a JSONObject as an indented piece of JSON code. Throws a QuandlRuntimeException if it can't render the JSONObject to a
String.
@param jsonObject the pre-parsed JSON object to pretty-print, not null
@return a String representation of the object, probably multi-line. | [
"Pretty",
"print",
"a",
"JSONObject",
"as",
"an",
"indented",
"piece",
"of",
"JSON",
"code",
".",
"Throws",
"a",
"QuandlRuntimeException",
"if",
"it",
"can",
"t",
"render",
"the",
"JSONObject",
"to",
"a",
"String",
"."
] | train | https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/util/PrettyPrinter.java#L60-L68 |
google/closure-compiler | src/com/google/javascript/jscomp/ReplaceMessages.java | ReplaceMessages.updateFunctionNode | private void updateFunctionNode(JsMessage message, Node functionNode)
throws MalformedException {
checkNode(functionNode, Token.FUNCTION);
Node nameNode = functionNode.getFirstChild();
checkNode(nameNode, Token.NAME);
Node argListNode = nameNode.getNext();
checkNode(argListNode, Token.PARAM_LIST);
Node oldBlockNode = argListNode.getNext();
checkNode(oldBlockNode, Token.BLOCK);
Iterator<CharSequence> iterator = message.parts().iterator();
Node valueNode = constructAddOrStringNode(iterator, argListNode);
Node newBlockNode = IR.block(IR.returnNode(valueNode));
if (!newBlockNode.isEquivalentTo(
oldBlockNode,
/* compareType= */ false,
/* recurse= */ true,
/* jsDoc= */ false,
/* sideEffect= */ false)) {
newBlockNode.useSourceInfoIfMissingFromForTree(oldBlockNode);
functionNode.replaceChild(oldBlockNode, newBlockNode);
compiler.reportChangeToEnclosingScope(newBlockNode);
}
} | java | private void updateFunctionNode(JsMessage message, Node functionNode)
throws MalformedException {
checkNode(functionNode, Token.FUNCTION);
Node nameNode = functionNode.getFirstChild();
checkNode(nameNode, Token.NAME);
Node argListNode = nameNode.getNext();
checkNode(argListNode, Token.PARAM_LIST);
Node oldBlockNode = argListNode.getNext();
checkNode(oldBlockNode, Token.BLOCK);
Iterator<CharSequence> iterator = message.parts().iterator();
Node valueNode = constructAddOrStringNode(iterator, argListNode);
Node newBlockNode = IR.block(IR.returnNode(valueNode));
if (!newBlockNode.isEquivalentTo(
oldBlockNode,
/* compareType= */ false,
/* recurse= */ true,
/* jsDoc= */ false,
/* sideEffect= */ false)) {
newBlockNode.useSourceInfoIfMissingFromForTree(oldBlockNode);
functionNode.replaceChild(oldBlockNode, newBlockNode);
compiler.reportChangeToEnclosingScope(newBlockNode);
}
} | [
"private",
"void",
"updateFunctionNode",
"(",
"JsMessage",
"message",
",",
"Node",
"functionNode",
")",
"throws",
"MalformedException",
"{",
"checkNode",
"(",
"functionNode",
",",
"Token",
".",
"FUNCTION",
")",
";",
"Node",
"nameNode",
"=",
"functionNode",
".",
... | Updates the descendants of a FUNCTION node to represent a message's value.
<p>
The tree looks something like:
<pre>
function
|-- name
|-- lp
| |-- name <arg1>
| -- name <arg2>
-- block
|
--return
|
--add
|-- string foo
-- name <arg1>
</pre>
@param message a message
@param functionNode the message's original FUNCTION value node
@throws MalformedException if the passed node's subtree structure is
not as expected | [
"Updates",
"the",
"descendants",
"of",
"a",
"FUNCTION",
"node",
"to",
"represent",
"a",
"message",
"s",
"value",
".",
"<p",
">",
"The",
"tree",
"looks",
"something",
"like",
":",
"<pre",
">",
"function",
"|",
"--",
"name",
"|",
"--",
"lp",
"|",
"|",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ReplaceMessages.java#L172-L196 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/ZipUtils.java | ZipUtils.zipDir | public static void zipDir( File zipFile, File directoryToZip )
throws Exception {
if ( !directoryToZip.isDirectory() ) {
throw new IllegalArgumentException( "Directory to zip is not a directory" );
}
try {
ZipOutputStream out = new ZipOutputStream( new FileOutputStream( zipFile ) );
File parentDir = new File( directoryToZip.toURI().resolve( ".." ) );
for ( File file : directoryToZip.listFiles() ) {
zip( parentDir, file, out );
}
out.flush();
out.close();
} catch ( IOException e ) {
throw new Exception( e.getMessage() );
}
} | java | public static void zipDir( File zipFile, File directoryToZip )
throws Exception {
if ( !directoryToZip.isDirectory() ) {
throw new IllegalArgumentException( "Directory to zip is not a directory" );
}
try {
ZipOutputStream out = new ZipOutputStream( new FileOutputStream( zipFile ) );
File parentDir = new File( directoryToZip.toURI().resolve( ".." ) );
for ( File file : directoryToZip.listFiles() ) {
zip( parentDir, file, out );
}
out.flush();
out.close();
} catch ( IOException e ) {
throw new Exception( e.getMessage() );
}
} | [
"public",
"static",
"void",
"zipDir",
"(",
"File",
"zipFile",
",",
"File",
"directoryToZip",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"directoryToZip",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Director... | Zips the directory and all of it's sub directories
@param zipFile
the file to write the files into, never <code>null</code>
@param directoryToZip
the directory to zip, never <code>null</code>
@throws Exception
if the zip file could not be created
@throws IllegalArgumentException
if the directoryToZip is not a directory | [
"Zips",
"the",
"directory",
"and",
"all",
"of",
"it",
"s",
"sub",
"directories"
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/ZipUtils.java#L24-L41 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java | UiCompat.getColor | public static int getColor(Resources resources, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return resources.getColor(id, null);
} else {
return resources.getColor(id);
}
} | java | public static int getColor(Resources resources, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return resources.getColor(id, null);
} else {
return resources.getColor(id);
}
} | [
"public",
"static",
"int",
"getColor",
"(",
"Resources",
"resources",
",",
"int",
"id",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"M",
")",
"{",
"return",
"resources",
".",
"getColor",
"(",
... | Returns a themed color integer associated with a particular resource ID.
If the resource holds a complex {@link ColorStateList}, then the default
color from the set is returned.
@param resources Resources
@param id The desired resource identifier, as generated by the aapt
tool. This integer encodes the package, type, and resource
entry. The value 0 is an invalid identifier.
@return A single color value in the form 0xAARRGGBB. | [
"Returns",
"a",
"themed",
"color",
"integer",
"associated",
"with",
"a",
"particular",
"resource",
"ID",
".",
"If",
"the",
"resource",
"holds",
"a",
"complex",
"{",
"@link",
"ColorStateList",
"}",
"then",
"the",
"default",
"color",
"from",
"the",
"set",
"is"... | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java#L110-L116 |
groovy/groovy-core | src/main/groovy/lang/Binding.java | Binding.setVariable | public void setVariable(String name, Object value) {
if (variables == null)
variables = new LinkedHashMap();
variables.put(name, value);
} | java | public void setVariable(String name, Object value) {
if (variables == null)
variables = new LinkedHashMap();
variables.put(name, value);
} | [
"public",
"void",
"setVariable",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"variables",
"==",
"null",
")",
"variables",
"=",
"new",
"LinkedHashMap",
"(",
")",
";",
"variables",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
... | Sets the value of the given variable
@param name the name of the variable to set
@param value the new value for the given variable | [
"Sets",
"the",
"value",
"of",
"the",
"given",
"variable"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/Binding.java#L76-L80 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.beginDelete | public void beginDelete(String resourceGroupName, String expressRoutePortName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRoutePortName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String expressRoutePortName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRoutePortName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRoutePortName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")... | Deletes the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L191-L193 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getReader | public static BufferedReader getReader(String path, Charset charset) throws IORuntimeException {
return getReader(file(path), charset);
} | java | public static BufferedReader getReader(String path, Charset charset) throws IORuntimeException {
return getReader(file(path), charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"String",
"path",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"getReader",
"(",
"file",
"(",
"path",
")",
",",
"charset",
")",
";",
"}"
] | 获得一个文件读取器
@param path 绝对路径
@param charset 字符集
@return BufferedReader对象
@throws IORuntimeException IO异常 | [
"获得一个文件读取器"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2029-L2031 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.findByG_E | @Override
public List<CommerceNotificationTemplate> findByG_E(long groupId,
boolean enabled, int start, int end,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
return findByG_E(groupId, enabled, start, end, orderByComparator, true);
} | java | @Override
public List<CommerceNotificationTemplate> findByG_E(long groupId,
boolean enabled, int start, int end,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
return findByG_E(groupId, enabled, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationTemplate",
">",
"findByG_E",
"(",
"long",
"groupId",
",",
"boolean",
"enabled",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CommerceNotificationTemplate",
">",
"orderByComparato... | Returns an ordered range of all the commerce notification templates where groupId = ? and enabled = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationTemplateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param enabled the enabled
@param start the lower bound of the range of commerce notification templates
@param end the upper bound of the range of commerce notification templates (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce notification templates | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"templates",
"where",
"groupId",
"=",
"?",
";",
"and",
"enabled",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L2472-L2477 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_internalNatIp_GET | public String loadBalancing_serviceName_internalNatIp_GET(String serviceName, OvhLoadBalancingZoneEnum zone) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/internalNatIp";
StringBuilder sb = path(qPath, serviceName);
query(sb, "zone", zone);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, String.class);
} | java | public String loadBalancing_serviceName_internalNatIp_GET(String serviceName, OvhLoadBalancingZoneEnum zone) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/internalNatIp";
StringBuilder sb = path(qPath, serviceName);
query(sb, "zone", zone);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, String.class);
} | [
"public",
"String",
"loadBalancing_serviceName_internalNatIp_GET",
"(",
"String",
"serviceName",
",",
"OvhLoadBalancingZoneEnum",
"zone",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/internalNatIp\"",
";",
"StringBuilder",
"sb",
... | Ip subnet used by OVH to nat requests on your ip lb to your backends. You must ensure that your backends are not part of a network that overlap with this one.
REST: GET /ip/loadBalancing/{serviceName}/internalNatIp
@param zone [required] one of your ip loadbalancing's zone
@param serviceName [required] The internal name of your IP load balancing | [
"Ip",
"subnet",
"used",
"by",
"OVH",
"to",
"nat",
"requests",
"on",
"your",
"ip",
"lb",
"to",
"your",
"backends",
".",
"You",
"must",
"ensure",
"that",
"your",
"backends",
"are",
"not",
"part",
"of",
"a",
"network",
"that",
"overlap",
"with",
"this",
"... | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1347-L1353 |
jingwei/krati | krati-main/src/main/java/krati/core/StoreConfig.java | StoreConfig.getClass | public Class<?> getClass(String pName, Class<?> defaultValue) {
String pValue = _properties.getProperty(pName);
return parseClass(pName, pValue, defaultValue);
} | java | public Class<?> getClass(String pName, Class<?> defaultValue) {
String pValue = _properties.getProperty(pName);
return parseClass(pName, pValue, defaultValue);
} | [
"public",
"Class",
"<",
"?",
">",
"getClass",
"(",
"String",
"pName",
",",
"Class",
"<",
"?",
">",
"defaultValue",
")",
"{",
"String",
"pValue",
"=",
"_properties",
".",
"getProperty",
"(",
"pName",
")",
";",
"return",
"parseClass",
"(",
"pName",
",",
... | Gets a class property via a string property name.
@param pName - the property name
@param defaultValue - the default property value
@return a {@link Class} property | [
"Gets",
"a",
"class",
"property",
"via",
"a",
"string",
"property",
"name",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L471-L474 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java | BeanAccess.getPropertyInfoDirectly | public static IPropertyInfo getPropertyInfoDirectly( IType classBean, String strProperty ) throws ParseException
{
return getPropertyInfo( classBean, classBean, strProperty, null, null, null );
} | java | public static IPropertyInfo getPropertyInfoDirectly( IType classBean, String strProperty ) throws ParseException
{
return getPropertyInfo( classBean, classBean, strProperty, null, null, null );
} | [
"public",
"static",
"IPropertyInfo",
"getPropertyInfoDirectly",
"(",
"IType",
"classBean",
",",
"String",
"strProperty",
")",
"throws",
"ParseException",
"{",
"return",
"getPropertyInfo",
"(",
"classBean",
",",
"classBean",
",",
"strProperty",
",",
"null",
",",
"nul... | Resolves the property directly, as if the type were requesting it, giving access to all properties | [
"Resolves",
"the",
"property",
"directly",
"as",
"if",
"the",
"type",
"were",
"requesting",
"it",
"giving",
"access",
"to",
"all",
"properties"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java#L354-L357 |
unbescape/unbescape | src/main/java/org/unbescape/html/HtmlEscapeUtil.java | HtmlEscapeUtil.parseIntFromReference | static int parseIntFromReference(final String text, final int start, final int end, final int radix) {
int result = 0;
for (int i = start; i < end; i++) {
final char c = text.charAt(i);
int n = -1;
for (int j = 0; j < HEXA_CHARS_UPPER.length; j++) {
if (c == HEXA_CHARS_UPPER[j] || c == HEXA_CHARS_LOWER[j]) {
n = j;
break;
}
}
result *= radix;
if (result < 0) {
return 0xFFFD;
}
result += n;
if (result < 0) {
return 0xFFFD;
}
}
return result;
} | java | static int parseIntFromReference(final String text, final int start, final int end, final int radix) {
int result = 0;
for (int i = start; i < end; i++) {
final char c = text.charAt(i);
int n = -1;
for (int j = 0; j < HEXA_CHARS_UPPER.length; j++) {
if (c == HEXA_CHARS_UPPER[j] || c == HEXA_CHARS_LOWER[j]) {
n = j;
break;
}
}
result *= radix;
if (result < 0) {
return 0xFFFD;
}
result += n;
if (result < 0) {
return 0xFFFD;
}
}
return result;
} | [
"static",
"int",
"parseIntFromReference",
"(",
"final",
"String",
"text",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
",",
"final",
"int",
"radix",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i"... | /*
This methods (the two versions) are used instead of Integer.parseInt(str,radix) in order to avoid the need
to create substrings of the text being unescaped to feed such method.
- No need to check all chars are within the radix limits - reference parsing code will already have done so. | [
"/",
"*",
"This",
"methods",
"(",
"the",
"two",
"versions",
")",
"are",
"used",
"instead",
"of",
"Integer",
".",
"parseInt",
"(",
"str",
"radix",
")",
"in",
"order",
"to",
"avoid",
"the",
"need",
"to",
"create",
"substrings",
"of",
"the",
"text",
"bein... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscapeUtil.java#L557-L578 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java | AccessibilityNodeInfoUtils.getSelfOrMatchingAncestor | public static AccessibilityNodeInfoCompat getSelfOrMatchingAncestor(
Context context, AccessibilityNodeInfoCompat node, NodeFilter filter) {
if (node == null) {
return null;
}
if (filter.accept(context, node)) {
return AccessibilityNodeInfoCompat.obtain(node);
}
return getMatchingAncestor(context, node, filter);
} | java | public static AccessibilityNodeInfoCompat getSelfOrMatchingAncestor(
Context context, AccessibilityNodeInfoCompat node, NodeFilter filter) {
if (node == null) {
return null;
}
if (filter.accept(context, node)) {
return AccessibilityNodeInfoCompat.obtain(node);
}
return getMatchingAncestor(context, node, filter);
} | [
"public",
"static",
"AccessibilityNodeInfoCompat",
"getSelfOrMatchingAncestor",
"(",
"Context",
"context",
",",
"AccessibilityNodeInfoCompat",
"node",
",",
"NodeFilter",
"filter",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if... | Returns the {@code node} if it matches the {@code filter}, or the first
matching ancestor. Returns {@code null} if no nodes match. | [
"Returns",
"the",
"{"
] | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java#L424-L435 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.beginRunCommandAsync | public Observable<RunCommandResultInner> beginRunCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<RunCommandResultInner>, RunCommandResultInner>() {
@Override
public RunCommandResultInner call(ServiceResponse<RunCommandResultInner> response) {
return response.body();
}
});
} | java | public Observable<RunCommandResultInner> beginRunCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<RunCommandResultInner>, RunCommandResultInner>() {
@Override
public RunCommandResultInner call(ServiceResponse<RunCommandResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RunCommandResultInner",
">",
"beginRunCommandAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
",",
"RunCommandInput",
"parameters",
")",
"{",
"return",
"beginRunCommandWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | Run command on the VM.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@param parameters Parameters supplied to the Run command operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RunCommandResultInner object | [
"Run",
"command",
"on",
"the",
"VM",
"."
] | 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/VirtualMachinesInner.java#L2730-L2737 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/collections/Matrix.java | Matrix.get | public E get(int x, int y) {
if (columns.size() < x) {
columns.set(x, new ArrayList<>());
}
ArrayList<E> columnList = columns.get(x);
if (columnList.size() < y) {
columnList.set(y, this.defaultElement);
}
return columnList.get(y);
} | java | public E get(int x, int y) {
if (columns.size() < x) {
columns.set(x, new ArrayList<>());
}
ArrayList<E> columnList = columns.get(x);
if (columnList.size() < y) {
columnList.set(y, this.defaultElement);
}
return columnList.get(y);
} | [
"public",
"E",
"get",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"columns",
".",
"size",
"(",
")",
"<",
"x",
")",
"{",
"columns",
".",
"set",
"(",
"x",
",",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"}",
"ArrayList",
"<",
"E... | Returns the element in column {@code x} and y {@code y}
@param x The column of the element
@param y The row of the element
@return the element at (x, y) | [
"Returns",
"the",
"element",
"in",
"column",
"{",
"@code",
"x",
"}",
"and",
"y",
"{",
"@code",
"y",
"}"
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/collections/Matrix.java#L126-L135 |
google/auto | value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java | AutoValueOrOneOfProcessor.checkReturnType | final void checkReturnType(TypeElement autoValueClass, ExecutableElement getter) {
TypeMirror type = getter.getReturnType();
if (type.getKind() == TypeKind.ARRAY) {
TypeMirror componentType = ((ArrayType) type).getComponentType();
if (componentType.getKind().isPrimitive()) {
warnAboutPrimitiveArrays(autoValueClass, getter);
} else {
errorReporter.reportError(
"An @"
+ simpleAnnotationName
+ " class cannot define an array-valued property unless it is a primitive array",
getter);
}
}
} | java | final void checkReturnType(TypeElement autoValueClass, ExecutableElement getter) {
TypeMirror type = getter.getReturnType();
if (type.getKind() == TypeKind.ARRAY) {
TypeMirror componentType = ((ArrayType) type).getComponentType();
if (componentType.getKind().isPrimitive()) {
warnAboutPrimitiveArrays(autoValueClass, getter);
} else {
errorReporter.reportError(
"An @"
+ simpleAnnotationName
+ " class cannot define an array-valued property unless it is a primitive array",
getter);
}
}
} | [
"final",
"void",
"checkReturnType",
"(",
"TypeElement",
"autoValueClass",
",",
"ExecutableElement",
"getter",
")",
"{",
"TypeMirror",
"type",
"=",
"getter",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"type",
".",
"getKind",
"(",
")",
"==",
"TypeKind",
"... | Checks that the return type of the given property method is allowed. Currently, this means that
it cannot be an array, unless it is a primitive array. | [
"Checks",
"that",
"the",
"return",
"type",
"of",
"the",
"given",
"property",
"method",
"is",
"allowed",
".",
"Currently",
"this",
"means",
"that",
"it",
"cannot",
"be",
"an",
"array",
"unless",
"it",
"is",
"a",
"primitive",
"array",
"."
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java#L738-L752 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java | ContextManager.checkWritePermission | public void checkWritePermission(TimedDirContext ctx) throws OperationNotSupportedException {
if (!iWriteToSecondary) {
String providerURL = getProviderURL(ctx);
if (!getPrimaryURL().equalsIgnoreCase(providerURL)) {
String msg = Tr.formatMessage(tc, WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, WIMMessageHelper.generateMsgParms(providerURL));
throw new OperationNotSupportedException(WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, msg);
}
}
} | java | public void checkWritePermission(TimedDirContext ctx) throws OperationNotSupportedException {
if (!iWriteToSecondary) {
String providerURL = getProviderURL(ctx);
if (!getPrimaryURL().equalsIgnoreCase(providerURL)) {
String msg = Tr.formatMessage(tc, WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, WIMMessageHelper.generateMsgParms(providerURL));
throw new OperationNotSupportedException(WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, msg);
}
}
} | [
"public",
"void",
"checkWritePermission",
"(",
"TimedDirContext",
"ctx",
")",
"throws",
"OperationNotSupportedException",
"{",
"if",
"(",
"!",
"iWriteToSecondary",
")",
"{",
"String",
"providerURL",
"=",
"getProviderURL",
"(",
"ctx",
")",
";",
"if",
"(",
"!",
"g... | Check whether we can write on the LDAP server the context is currently connected to. It is not
permissible to write to a fail-over server if write to secondary is disabled.
@param ctx The context with a connection to the current LDAP server.
@throws OperationNotSupportedException If write to secondary is disabled and the context
is not connected to the primary LDAP server. | [
"Check",
"whether",
"we",
"can",
"write",
"on",
"the",
"LDAP",
"server",
"the",
"context",
"is",
"currently",
"connected",
"to",
".",
"It",
"is",
"not",
"permissible",
"to",
"write",
"to",
"a",
"fail",
"-",
"over",
"server",
"if",
"write",
"to",
"seconda... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java#L248-L256 |
JodaOrg/joda-time | src/main/java/org/joda/time/convert/DateConverter.java | DateConverter.getInstantMillis | public long getInstantMillis(Object object, Chronology chrono) {
Date date = (Date) object;
return date.getTime();
} | java | public long getInstantMillis(Object object, Chronology chrono) {
Date date = (Date) object;
return date.getTime();
} | [
"public",
"long",
"getInstantMillis",
"(",
"Object",
"object",
",",
"Chronology",
"chrono",
")",
"{",
"Date",
"date",
"=",
"(",
"Date",
")",
"object",
";",
"return",
"date",
".",
"getTime",
"(",
")",
";",
"}"
] | Gets the millis, which is the Date millis value.
@param object the Date to convert, must not be null
@param chrono the non-null result of getChronology
@return the millisecond value
@throws NullPointerException if the object is null
@throws ClassCastException if the object is an invalid type | [
"Gets",
"the",
"millis",
"which",
"is",
"the",
"Date",
"millis",
"value",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/DateConverter.java#L54-L57 |
allengeorge/libraft | libraft-agent/src/main/java/io/libraft/agent/RaftAgent.java | RaftAgent.fromConfigurationFile | public static RaftAgent fromConfigurationFile(String configFile, RaftListener raftListener) throws IOException {
RaftConfiguration configuration = RaftConfigurationLoader.loadFromFile(configFile);
return fromConfigurationObject(configuration, raftListener);
} | java | public static RaftAgent fromConfigurationFile(String configFile, RaftListener raftListener) throws IOException {
RaftConfiguration configuration = RaftConfigurationLoader.loadFromFile(configFile);
return fromConfigurationObject(configuration, raftListener);
} | [
"public",
"static",
"RaftAgent",
"fromConfigurationFile",
"(",
"String",
"configFile",
",",
"RaftListener",
"raftListener",
")",
"throws",
"IOException",
"{",
"RaftConfiguration",
"configuration",
"=",
"RaftConfigurationLoader",
".",
"loadFromFile",
"(",
"configFile",
")"... | Create an instance of {@code RaftAgent} from a configuration file.
@param configFile location of the JSON configuration file. The
configuration in this file will be validated.
See the project README.md for more on the configuration file
@param raftListener instance of {@code RaftListener} that will be notified of events from the Raft cluster
@return valid {@code RaftAgent} that can be used to connect to, and (if leader),
replicate {@link Command} instances to the Raft cluster
@throws IOException if the configuration file cannot be loaded or processed (i.e. contains invalid JSON) | [
"Create",
"an",
"instance",
"of",
"{",
"@code",
"RaftAgent",
"}",
"from",
"a",
"configuration",
"file",
"."
] | train | https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/RaftAgent.java#L141-L144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.