repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.findByCommerceOrderId | @Override
public List<CommerceOrderItem> findByCommerceOrderId(long commerceOrderId,
int start, int end) {
return findByCommerceOrderId(commerceOrderId, start, end, null);
} | java | @Override
public List<CommerceOrderItem> findByCommerceOrderId(long commerceOrderId,
int start, int end) {
return findByCommerceOrderId(commerceOrderId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderItem",
">",
"findByCommerceOrderId",
"(",
"long",
"commerceOrderId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceOrderId",
"(",
"commerceOrderId",
",",
"start",
",",
"end",
",",... | Returns a range of all the commerce order items where commerceOrderId = ?.
<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 CommerceOrderItemModelImpl}. 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 commerceOrderId the commerce order ID
@param start the lower bound of the range of commerce order items
@param end the upper bound of the range of commerce order items (not inclusive)
@return the range of matching commerce order items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"order",
"items",
"where",
"commerceOrderId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L143-L147 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/concurrent/ParallelUtils.java | ParallelUtils.getStartBlock | public static int getStartBlock(int N, int ID, int P)
{
int rem = N%P;
int start = (N/P)*ID+min(rem, ID);
return start;
} | java | public static int getStartBlock(int N, int ID, int P)
{
int rem = N%P;
int start = (N/P)*ID+min(rem, ID);
return start;
} | [
"public",
"static",
"int",
"getStartBlock",
"(",
"int",
"N",
",",
"int",
"ID",
",",
"int",
"P",
")",
"{",
"int",
"rem",
"=",
"N",
"%",
"P",
";",
"int",
"start",
"=",
"(",
"N",
"/",
"P",
")",
"*",
"ID",
"+",
"min",
"(",
"rem",
",",
"ID",
")"... | Gets the starting index (inclusive) for splitting up a list of items into
{@code P} evenly sized blocks. In the event that {@code N} is not evenly
divisible by {@code P}, the size of ranges will differ by at most 1.
@param N the number of items to split up
@param ID the block number in [0, {@code P})
@param P the number of blocks to break up the items into
@return the starting index (inclusive) of the blocks owned by the
{@code ID}'th process. | [
"Gets",
"the",
"starting",
"index",
"(",
"inclusive",
")",
"for",
"splitting",
"up",
"a",
"list",
"of",
"items",
"into",
"{"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/ParallelUtils.java#L287-L292 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.getTypeImageDescriptor | public ImageDescriptor getTypeImageDescriptor(
SarlElementType type,
boolean isInner) {
return getTypeImageDescriptor(type, isInner, false, 0, USE_LIGHT_ICONS);
} | java | public ImageDescriptor getTypeImageDescriptor(
SarlElementType type,
boolean isInner) {
return getTypeImageDescriptor(type, isInner, false, 0, USE_LIGHT_ICONS);
} | [
"public",
"ImageDescriptor",
"getTypeImageDescriptor",
"(",
"SarlElementType",
"type",
",",
"boolean",
"isInner",
")",
"{",
"return",
"getTypeImageDescriptor",
"(",
"type",
",",
"isInner",
",",
"false",
",",
"0",
",",
"USE_LIGHT_ICONS",
")",
";",
"}"
] | Replies the image descriptor for the given element.
@param type the type of the SARL element, or <code>null</code> if unknown.
@param isInner indicates if the element is inner.
@return the image descriptor. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"given",
"element",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L100-L104 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/StringUtils.java | StringUtils.replace | public static String replace(String str, int start, int end, String rp) {
if (str == null || start < 0 || start > end || end >= str.length()) {
throw new IllegalArgumentException("参数非法");
}
return str.substring(0, start) + rp + str.substring(end + 1);
} | java | public static String replace(String str, int start, int end, String rp) {
if (str == null || start < 0 || start > end || end >= str.length()) {
throw new IllegalArgumentException("参数非法");
}
return str.substring(0, start) + rp + str.substring(end + 1);
} | [
"public",
"static",
"String",
"replace",
"(",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
",",
"String",
"rp",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"start",
"<",
"0",
"||",
"start",
">",
"end",
"||",
"end",
">=",
"str",
".... | 替换指定区间位置的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param end 要替换的结束位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换1,3,*,结果为1*56 | [
"替换指定区间位置的所有字符"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L106-L112 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/protocol/TagValTextParser.java | TagValTextParser.getValueWithDefault | public String getValueWithDefault(String keyMsgType, String defaultVal) {
return keyToValue.getOrDefault(keyMsgType, defaultVal);
} | java | public String getValueWithDefault(String keyMsgType, String defaultVal) {
return keyToValue.getOrDefault(keyMsgType, defaultVal);
} | [
"public",
"String",
"getValueWithDefault",
"(",
"String",
"keyMsgType",
",",
"String",
"defaultVal",
")",
"{",
"return",
"keyToValue",
".",
"getOrDefault",
"(",
"keyMsgType",
",",
"defaultVal",
")",
";",
"}"
] | Gets the value associated with the key from the message if it exists in the underlying map.
This version returns the default value if it does not exist.
@param keyMsgType the key to obtain
@return the associated value or the default | [
"Gets",
"the",
"value",
"associated",
"with",
"the",
"key",
"from",
"the",
"message",
"if",
"it",
"exists",
"in",
"the",
"underlying",
"map",
".",
"This",
"version",
"returns",
"the",
"default",
"value",
"if",
"it",
"does",
"not",
"exist",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/protocol/TagValTextParser.java#L92-L94 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java | FileSystemShellUtils.getAlluxioURIs | public static List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI)
throws IOException {
if (!inputURI.getPath().contains(AlluxioURI.WILDCARD)) {
return Lists.newArrayList(inputURI);
} else {
String inputPath = inputURI.getPath();
AlluxioURI parentURI = new AlluxioURI(inputURI.getScheme(), inputURI.getAuthority(),
inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1),
inputURI.getQueryMap()).getParent();
return getAlluxioURIs(alluxioClient, inputURI, parentURI);
}
} | java | public static List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI)
throws IOException {
if (!inputURI.getPath().contains(AlluxioURI.WILDCARD)) {
return Lists.newArrayList(inputURI);
} else {
String inputPath = inputURI.getPath();
AlluxioURI parentURI = new AlluxioURI(inputURI.getScheme(), inputURI.getAuthority(),
inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1),
inputURI.getQueryMap()).getParent();
return getAlluxioURIs(alluxioClient, inputURI, parentURI);
}
} | [
"public",
"static",
"List",
"<",
"AlluxioURI",
">",
"getAlluxioURIs",
"(",
"FileSystem",
"alluxioClient",
",",
"AlluxioURI",
"inputURI",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"inputURI",
".",
"getPath",
"(",
")",
".",
"contains",
"(",
"AlluxioURI"... | Gets all the {@link AlluxioURI}s that match inputURI. If the path is a regular path, the
returned list only contains the corresponding URI; Else if the path contains wildcards, the
returned list contains all the matched URIs It supports any number of wildcards in inputURI
@param alluxioClient the client used to fetch information of Alluxio files
@param inputURI the input URI (could contain wildcards)
@return a list of {@link AlluxioURI}s that matches the inputURI | [
"Gets",
"all",
"the",
"{",
"@link",
"AlluxioURI",
"}",
"s",
"that",
"match",
"inputURI",
".",
"If",
"the",
"path",
"is",
"a",
"regular",
"path",
"the",
"returned",
"list",
"only",
"contains",
"the",
"corresponding",
"URI",
";",
"Else",
"if",
"the",
"path... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L108-L119 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java | EvaluateBeanshell.evaluateCondition | protected boolean evaluateCondition( String script, Log log )
throws EnforcerRuleException
{
Boolean evaluation = Boolean.FALSE;
try
{
evaluation = (Boolean) bsh.eval( script );
log.debug( "Echo evaluating : " + evaluation );
}
catch ( EvalError ex )
{
throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex );
}
return evaluation.booleanValue();
} | java | protected boolean evaluateCondition( String script, Log log )
throws EnforcerRuleException
{
Boolean evaluation = Boolean.FALSE;
try
{
evaluation = (Boolean) bsh.eval( script );
log.debug( "Echo evaluating : " + evaluation );
}
catch ( EvalError ex )
{
throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex );
}
return evaluation.booleanValue();
} | [
"protected",
"boolean",
"evaluateCondition",
"(",
"String",
"script",
",",
"Log",
"log",
")",
"throws",
"EnforcerRuleException",
"{",
"Boolean",
"evaluation",
"=",
"Boolean",
".",
"FALSE",
";",
"try",
"{",
"evaluation",
"=",
"(",
"Boolean",
")",
"bsh",
".",
... | Evaluate expression using Beanshell.
@param script the expression to be evaluated
@param log the logger
@return boolean the evaluation of the expression
@throws EnforcerRuleException if the script could not be evaluated | [
"Evaluate",
"expression",
"using",
"Beanshell",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java#L103-L117 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuMemRangeGetAttributes | public static int cuMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, CUdeviceptr devPtr, long count)
{
return checkResult(cuMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count));
} | java | public static int cuMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, CUdeviceptr devPtr, long count)
{
return checkResult(cuMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count));
} | [
"public",
"static",
"int",
"cuMemRangeGetAttributes",
"(",
"Pointer",
"data",
"[",
"]",
",",
"long",
"dataSizes",
"[",
"]",
",",
"int",
"attributes",
"[",
"]",
",",
"long",
"numAttributes",
",",
"CUdeviceptr",
"devPtr",
",",
"long",
"count",
")",
"{",
"ret... | Query attributes of a given memory range.<br>
<br>
Query attributes of the memory range starting at devPtr with a size of
count bytes. The memory range must refer to managed memory allocated via
cuMemAllocManaged or declared via __managed__ variables. The attributes
array will be interpreted to have numAttributes entries. The dataSizes
array will also be interpreted to have numAttributes entries. The results
of the query will be stored in data.<br>
<br>
<br>
The list of supported attributes are given below. Please refer to
{@link JCudaDriver#cuMemRangeGetAttribute} for attribute descriptions and
restrictions.
<ul>
<li>CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION</li>
<li>CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION</li>
</ul>
@param data A two-dimensional array containing pointers to memory
locations where the result of each attribute query will be written
to.
@param dataSizes Array containing the sizes of each result
@param attributes An array of attributes to query (numAttributes and the
number of attributes in this array should match)
@param numAttributes Number of attributes to query
@param devPtr Start of the range to query
@param count Size of the range to query
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_INVALID_DEVICE | [
"Query",
"attributes",
"of",
"a",
"given",
"memory",
"range",
".",
"<br",
">",
"<br",
">",
"Query",
"attributes",
"of",
"the",
"memory",
"range",
"starting",
"at",
"devPtr",
"with",
"a",
"size",
"of",
"count",
"bytes",
".",
"The",
"memory",
"range",
"mus... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L14251-L14254 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withSizeOfMaxObjectSize | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(size, unit, e.getMaxObjectGraphSize()))
.orElse(new DefaultSizeOfEngineConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} | java | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(size, unit, e.getMaxObjectGraphSize()))
.orElse(new DefaultSizeOfEngineConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withSizeOfMaxObjectSize",
"(",
"long",
"size",
",",
"MemoryUnit",
"unit",
")",
"{",
"return",
"mapServiceConfiguration",
"(",
"DefaultSizeOfEngineConfiguration",
".",
"class",
",",
"existing",
"->",
"o... | Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified maximum mapping size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum mapping size
@param unit the memory unit
@return a new builder with the added / updated configuration | [
"Adds",
"or",
"updates",
"the",
"{",
"@link",
"DefaultSizeOfEngineConfiguration",
"}",
"with",
"the",
"specified",
"maximum",
"mapping",
"size",
"to",
"the",
"configured",
"builder",
".",
"<p",
">",
"{",
"@link",
"SizeOfEngine",
"}",
"is",
"what",
"enables",
"... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L555-L559 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/DailyTimeIntervalScheduleBuilder.java | DailyTimeIntervalScheduleBuilder.withInterval | public DailyTimeIntervalScheduleBuilder withInterval (final int timeInterval, final EIntervalUnit unit)
{
if (unit == null ||
!(unit.equals (EIntervalUnit.SECOND) || unit.equals (EIntervalUnit.MINUTE) || unit.equals (EIntervalUnit.HOUR)))
throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
_validateInterval (timeInterval);
m_nInterval = timeInterval;
m_eIntervalUnit = unit;
return this;
} | java | public DailyTimeIntervalScheduleBuilder withInterval (final int timeInterval, final EIntervalUnit unit)
{
if (unit == null ||
!(unit.equals (EIntervalUnit.SECOND) || unit.equals (EIntervalUnit.MINUTE) || unit.equals (EIntervalUnit.HOUR)))
throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
_validateInterval (timeInterval);
m_nInterval = timeInterval;
m_eIntervalUnit = unit;
return this;
} | [
"public",
"DailyTimeIntervalScheduleBuilder",
"withInterval",
"(",
"final",
"int",
"timeInterval",
",",
"final",
"EIntervalUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"==",
"null",
"||",
"!",
"(",
"unit",
".",
"equals",
"(",
"EIntervalUnit",
".",
"SECOND",
")"... | Specify the time unit and interval for the Trigger to be produced.
@param timeInterval
the interval at which the trigger should repeat.
@param unit
the time unit (IntervalUnit) of the interval. The only intervals
that are valid for this type of trigger are
{@link EIntervalUnit#SECOND}, {@link EIntervalUnit#MINUTE}, and
{@link EIntervalUnit#HOUR}.
@return the updated DailyTimeIntervalScheduleBuilder
@see IDailyTimeIntervalTrigger#getRepeatInterval()
@see IDailyTimeIntervalTrigger#getRepeatIntervalUnit() | [
"Specify",
"the",
"time",
"unit",
"and",
"interval",
"for",
"the",
"Trigger",
"to",
"be",
"produced",
"."
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/DailyTimeIntervalScheduleBuilder.java#L176-L185 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.addRevisionToRevHistory | private void addRevisionToRevHistory(final Node revHistory, final Node revision) {
if (revHistory.hasChildNodes()) {
revHistory.insertBefore(revision, revHistory.getFirstChild());
} else {
revHistory.appendChild(revision);
}
} | java | private void addRevisionToRevHistory(final Node revHistory, final Node revision) {
if (revHistory.hasChildNodes()) {
revHistory.insertBefore(revision, revHistory.getFirstChild());
} else {
revHistory.appendChild(revision);
}
} | [
"private",
"void",
"addRevisionToRevHistory",
"(",
"final",
"Node",
"revHistory",
",",
"final",
"Node",
"revision",
")",
"{",
"if",
"(",
"revHistory",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"revHistory",
".",
"insertBefore",
"(",
"revision",
",",
"revHistor... | Adds a revision element to the list of revisions in a revhistory element. This method ensures that the new revision is at
the top of the revhistory list.
@param revHistory The revhistory element to add the revision to.
@param revision The revision element to be added into the revisionhistory element. | [
"Adds",
"a",
"revision",
"element",
"to",
"the",
"list",
"of",
"revisions",
"in",
"a",
"revhistory",
"element",
".",
"This",
"method",
"ensures",
"that",
"the",
"new",
"revision",
"is",
"at",
"the",
"top",
"of",
"the",
"revhistory",
"list",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L3148-L3154 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/customfieldservice/CreateCustomFieldsAndOptions.java | CreateCustomFieldsAndOptions.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the CustomFieldService.
CustomFieldServiceInterface customFieldService =
adManagerServices.get(session, CustomFieldServiceInterface.class);
// Create a number custom field that can be used for an external ID in the
// API.
CustomField numberCustomField = new CustomField();
numberCustomField.setName("External ID #" + new Random().nextInt(Integer.MAX_VALUE));
numberCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
numberCustomField.setDataType(CustomFieldDataType.NUMBER);
numberCustomField.setVisibility(CustomFieldVisibility.API_ONLY);
// Create a drop-down custom field that can be used in the UI.
CustomField dropDownCustomField = new CustomField();
dropDownCustomField.setName(
"Internal approval status #" + new Random().nextInt(Integer.MAX_VALUE));
dropDownCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
dropDownCustomField.setDataType(CustomFieldDataType.DROP_DOWN);
dropDownCustomField.setVisibility(CustomFieldVisibility.FULL);
// Create the custom fields on the server.
CustomField[] customFields =
customFieldService.createCustomFields(
new CustomField[] {numberCustomField, dropDownCustomField});
for (CustomField createdCustomField : customFields) {
System.out.printf(
"A custom field with ID %d and name '%s' was created.%n",
createdCustomField.getId(), createdCustomField.getName());
}
// Set the created drop-down custom field.
dropDownCustomField = customFields[1];
// Create approved custom field option.
CustomFieldOption approvedCustomFieldOption = new CustomFieldOption();
approvedCustomFieldOption.setDisplayName("APPROVED");
approvedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create unapproved custom field option.
CustomFieldOption unapprovedCustomFieldOption = new CustomFieldOption();
unapprovedCustomFieldOption.setDisplayName("UNAPPROVED");
unapprovedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create the custom field options on the server.
CustomFieldOption[] customFieldOptions =
customFieldService.createCustomFieldOptions(
new CustomFieldOption[] {approvedCustomFieldOption, unapprovedCustomFieldOption});
for (CustomFieldOption createdCustomFieldOption : customFieldOptions) {
System.out.printf(
"A custom field option with ID %d and display name '%s' was created.%n",
createdCustomFieldOption.getId(), createdCustomFieldOption.getDisplayName());
}
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the CustomFieldService.
CustomFieldServiceInterface customFieldService =
adManagerServices.get(session, CustomFieldServiceInterface.class);
// Create a number custom field that can be used for an external ID in the
// API.
CustomField numberCustomField = new CustomField();
numberCustomField.setName("External ID #" + new Random().nextInt(Integer.MAX_VALUE));
numberCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
numberCustomField.setDataType(CustomFieldDataType.NUMBER);
numberCustomField.setVisibility(CustomFieldVisibility.API_ONLY);
// Create a drop-down custom field that can be used in the UI.
CustomField dropDownCustomField = new CustomField();
dropDownCustomField.setName(
"Internal approval status #" + new Random().nextInt(Integer.MAX_VALUE));
dropDownCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
dropDownCustomField.setDataType(CustomFieldDataType.DROP_DOWN);
dropDownCustomField.setVisibility(CustomFieldVisibility.FULL);
// Create the custom fields on the server.
CustomField[] customFields =
customFieldService.createCustomFields(
new CustomField[] {numberCustomField, dropDownCustomField});
for (CustomField createdCustomField : customFields) {
System.out.printf(
"A custom field with ID %d and name '%s' was created.%n",
createdCustomField.getId(), createdCustomField.getName());
}
// Set the created drop-down custom field.
dropDownCustomField = customFields[1];
// Create approved custom field option.
CustomFieldOption approvedCustomFieldOption = new CustomFieldOption();
approvedCustomFieldOption.setDisplayName("APPROVED");
approvedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create unapproved custom field option.
CustomFieldOption unapprovedCustomFieldOption = new CustomFieldOption();
unapprovedCustomFieldOption.setDisplayName("UNAPPROVED");
unapprovedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create the custom field options on the server.
CustomFieldOption[] customFieldOptions =
customFieldService.createCustomFieldOptions(
new CustomFieldOption[] {approvedCustomFieldOption, unapprovedCustomFieldOption});
for (CustomFieldOption createdCustomFieldOption : customFieldOptions) {
System.out.printf(
"A custom field option with ID %d and display name '%s' was created.%n",
createdCustomFieldOption.getId(), createdCustomFieldOption.getDisplayName());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the CustomFieldService.",
"CustomFieldServiceInterface",
"customFieldService",
"=",
"adManagerServices",
"... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/customfieldservice/CreateCustomFieldsAndOptions.java#L55-L111 |
Azure/azure-sdk-for-java | common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java | AzureProxy.createDefaultPipeline | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, HttpPipelinePolicy credentialsPolicy) {
// Order in which policies applied will be the order in which they appear in the array
//
List<HttpPipelinePolicy> policies = new ArrayList<HttpPipelinePolicy>();
policies.add(new UserAgentPolicy(getDefaultUserAgentString(swaggerInterface)));
policies.add(new RetryPolicy());
policies.add(new CookiePolicy());
if (credentialsPolicy != null) {
policies.add(credentialsPolicy);
}
return new HttpPipeline(policies.toArray(new HttpPipelinePolicy[policies.size()]));
} | java | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, HttpPipelinePolicy credentialsPolicy) {
// Order in which policies applied will be the order in which they appear in the array
//
List<HttpPipelinePolicy> policies = new ArrayList<HttpPipelinePolicy>();
policies.add(new UserAgentPolicy(getDefaultUserAgentString(swaggerInterface)));
policies.add(new RetryPolicy());
policies.add(new CookiePolicy());
if (credentialsPolicy != null) {
policies.add(credentialsPolicy);
}
return new HttpPipeline(policies.toArray(new HttpPipelinePolicy[policies.size()]));
} | [
"public",
"static",
"HttpPipeline",
"createDefaultPipeline",
"(",
"Class",
"<",
"?",
">",
"swaggerInterface",
",",
"HttpPipelinePolicy",
"credentialsPolicy",
")",
"{",
"// Order in which policies applied will be the order in which they appear in the array",
"//",
"List",
"<",
"... | Create the default HttpPipeline.
@param swaggerInterface The interface that the pipeline will use to generate a user-agent
string.
@param credentialsPolicy The credentials policy factory to use to apply authentication to the
pipeline.
@return the default HttpPipeline. | [
"Create",
"the",
"default",
"HttpPipeline",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java#L192-L203 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.sub2Ind | public static long sub2Ind(int[] shape, int[] indices) {
long index = 0;
int shift = 1;
for (int i = 0; i < shape.length; i++) {
index += shift * indices[i];
shift *= shape[i];
}
return index;
} | java | public static long sub2Ind(int[] shape, int[] indices) {
long index = 0;
int shift = 1;
for (int i = 0; i < shape.length; i++) {
index += shift * indices[i];
shift *= shape[i];
}
return index;
} | [
"public",
"static",
"long",
"sub2Ind",
"(",
"int",
"[",
"]",
"shape",
",",
"int",
"[",
"]",
"indices",
")",
"{",
"long",
"index",
"=",
"0",
";",
"int",
"shift",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shape",
".",
"le... | Convert the given index (such as 1,1)
to a linear index
@param shape the shape of the indexes to convert
@param indices the index to convert
@return the linear index given the shape
and indices | [
"Convert",
"the",
"given",
"index",
"(",
"such",
"as",
"1",
"1",
")",
"to",
"a",
"linear",
"index"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2245-L2253 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.createMediaResource | public CreateMediaResourceResponse createMediaResource(
String title,
String description,
File file,
String transcodingPresetGroupName,
int priority)
throws FileNotFoundException {
return createMediaResource(title, description, file, transcodingPresetGroupName, priority, null);
} | java | public CreateMediaResourceResponse createMediaResource(
String title,
String description,
File file,
String transcodingPresetGroupName,
int priority)
throws FileNotFoundException {
return createMediaResource(title, description, file, transcodingPresetGroupName, priority, null);
} | [
"public",
"CreateMediaResourceResponse",
"createMediaResource",
"(",
"String",
"title",
",",
"String",
"description",
",",
"File",
"file",
",",
"String",
"transcodingPresetGroupName",
",",
"int",
"priority",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"create... | Uploads the specified file to Bos under the specified bucket and key name.
@param title media title.
@param description media description.
@param file The file containing the data to be uploaded to VOD.
@param transcodingPresetGroupName set transcoding presetgroup name, if NULL, use default
@param priority set transcoding priority[0,9], lowest priority is 0. Only effect your own task
@return A PutObjectResponse object containing the information returned by Bos for the newly created object.
@throws FileNotFoundException | [
"Uploads",
"the",
"specified",
"file",
"to",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L206-L214 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeSetter | public static void invokeSetter(Object object, String fieldName, Object value, boolean ignoreNonExisting)
{
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
if(null == field) {
if (ignoreNonExisting) {
return;
} else {
throw new NullPointerException("no field with name " + fieldName + " found on output object. ignoreNonExisting was " + ignoreNonExisting);
}
}
invokeSetter(object, field, value, ignoreNonExisting);
} | java | public static void invokeSetter(Object object, String fieldName, Object value, boolean ignoreNonExisting)
{
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
if(null == field) {
if (ignoreNonExisting) {
return;
} else {
throw new NullPointerException("no field with name " + fieldName + " found on output object. ignoreNonExisting was " + ignoreNonExisting);
}
}
invokeSetter(object, field, value, ignoreNonExisting);
} | [
"public",
"static",
"void",
"invokeSetter",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Object",
"value",
",",
"boolean",
"ignoreNonExisting",
")",
"{",
"Field",
"field",
"=",
"ReflectionUtils",
".",
"findField",
"(",
"object",
".",
"getClass",
... | invokes the setter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"setter",
"on",
"the",
"filed"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L180-L191 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java | NullNotificationService.batchUpdate | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) { //CCC
// nothing to do for NullNotification
} | java | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) { //CCC
// nothing to do for NullNotification
} | [
"public",
"void",
"batchUpdate",
"(",
"HashMap",
"invalidateIdEvents",
",",
"HashMap",
"invalidateTemplateEvents",
",",
"ArrayList",
"pushEntryEvents",
",",
"ArrayList",
"aliasEntryEvents",
",",
"CacheUnit",
"cacheUnit",
")",
"{",
"//CCC",
"// nothing to do for NullNotifica... | This applies a set of invalidations and new entries to this CacheUnit,
including the local internal cache and external caches registered
with this CacheUnit.
@param invalidateIdEvents A Vector of invalidate by id events.
@param invalidateTemplateEvents A Vector of invalidate by template events.
@param pushEntryEvents A Vector of cache entries. | [
"This",
"applies",
"a",
"set",
"of",
"invalidations",
"and",
"new",
"entries",
"to",
"this",
"CacheUnit",
"including",
"the",
"local",
"internal",
"cache",
"and",
"external",
"caches",
"registered",
"with",
"this",
"CacheUnit",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java#L35-L37 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java | Preconditions.checkNotNull | public static <T> T checkNotNull(T reference, String message) {
if (reference == null) {
throw new NullPointerException(message);
}
return reference;
} | java | public static <T> T checkNotNull(T reference, String message) {
if (reference == null) {
throw new NullPointerException(message);
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"String",
"message",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
")",
";",
"}",
"return",
"reference... | Checks that the given object reference is not {@code null} and throws a customized
{@link NullPointerException} if it is. Intended for doing parameter validation in methods and
constructors, e.g.:
<blockquote><pre>
public void foo(Bar bar, Baz baz) {
this.bar = Preconditions.checkNotNull(bar, "bar must not be null.");
Preconditions.checkNotBull(baz, "baz must not be null.");
}
</pre></blockquote>
@param reference the object reference to check for being {@code null}
@param message the detail message to be used in the event that an exception is thrown
@param <T> the type of the reference
@return {@code reference} if not {@code null}
@throws NullPointerException if {@code reference} is {@code null} | [
"Checks",
"that",
"the",
"given",
"object",
"reference",
"is",
"not",
"{",
"@code",
"null",
"}",
"and",
"throws",
"a",
"customized",
"{",
"@link",
"NullPointerException",
"}",
"if",
"it",
"is",
".",
"Intended",
"for",
"doing",
"parameter",
"validation",
"in"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L110-L115 |
carewebframework/carewebframework-vista | org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayRenderer.java | DocumentDisplayRenderer.renderItem | @Override
public void renderItem(final Listitem item, final Document doc) {
final Listcell cell = new Listcell();
item.appendChild(cell);
final Div sep = new Div();
sep.setSclass("vista-documents-sep");
cell.appendChild(sep);
final Div div = new Div();
div.setSclass(Constants.SCLASS_TEXT_REPORT_TITLE);
cell.appendChild(div);
final Hbox boxHeader = new Hbox();
final Label header = new Label(doc.getTitle());
header.setZclass(Constants.SCLASS_TEXT_REPORT_TITLE);
boxHeader.appendChild(header);
div.appendChild(boxHeader);
Label body = new Label(doc.getBody());
body.setMultiline(true);
body.setPre(true);
cell.appendChild(body);
} | java | @Override
public void renderItem(final Listitem item, final Document doc) {
final Listcell cell = new Listcell();
item.appendChild(cell);
final Div sep = new Div();
sep.setSclass("vista-documents-sep");
cell.appendChild(sep);
final Div div = new Div();
div.setSclass(Constants.SCLASS_TEXT_REPORT_TITLE);
cell.appendChild(div);
final Hbox boxHeader = new Hbox();
final Label header = new Label(doc.getTitle());
header.setZclass(Constants.SCLASS_TEXT_REPORT_TITLE);
boxHeader.appendChild(header);
div.appendChild(boxHeader);
Label body = new Label(doc.getBody());
body.setMultiline(true);
body.setPre(true);
cell.appendChild(body);
} | [
"@",
"Override",
"public",
"void",
"renderItem",
"(",
"final",
"Listitem",
"item",
",",
"final",
"Document",
"doc",
")",
"{",
"final",
"Listcell",
"cell",
"=",
"new",
"Listcell",
"(",
")",
";",
"item",
".",
"appendChild",
"(",
"cell",
")",
";",
"final",
... | Render the list item for the specified document.
@param item List item to render.
@param doc The document associated with the list item. | [
"Render",
"the",
"list",
"item",
"for",
"the",
"specified",
"document",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayRenderer.java#L52-L71 |
camunda/camunda-bpm-jbehave | camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java | Guards.checkIsSetLocal | public static void checkIsSetLocal(final DelegateExecution execution, final String variableName) {
Preconditions.checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);
final Object variableLocal = execution.getVariableLocal(variableName);
Preconditions.checkState(variableLocal != null,
String.format("Condition of task '%s' is violated: Local variable '%s' is not set.", new Object[] { execution.getCurrentActivityId(), variableName }));
} | java | public static void checkIsSetLocal(final DelegateExecution execution, final String variableName) {
Preconditions.checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);
final Object variableLocal = execution.getVariableLocal(variableName);
Preconditions.checkState(variableLocal != null,
String.format("Condition of task '%s' is violated: Local variable '%s' is not set.", new Object[] { execution.getCurrentActivityId(), variableName }));
} | [
"public",
"static",
"void",
"checkIsSetLocal",
"(",
"final",
"DelegateExecution",
"execution",
",",
"final",
"String",
"variableName",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"variableName",
"!=",
"null",
",",
"VARIABLE_NAME_MUST_BE_NOT_NULL",
")",
";",
... | Checks, if a local variable with specified name is set.
@param execution
process execution.
@param variableName
name of the variable to check. | [
"Checks",
"if",
"a",
"local",
"variable",
"with",
"specified",
"name",
"is",
"set",
"."
] | train | https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java#L62-L68 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java | CmsContainerpageController.getElements | public void getElements(Set<String> clientIds, I_CmsSimpleCallback<Map<String, CmsContainerElementData>> callback) {
MultiElementAction action = new MultiElementAction(clientIds, callback);
action.execute();
} | java | public void getElements(Set<String> clientIds, I_CmsSimpleCallback<Map<String, CmsContainerElementData>> callback) {
MultiElementAction action = new MultiElementAction(clientIds, callback);
action.execute();
} | [
"public",
"void",
"getElements",
"(",
"Set",
"<",
"String",
">",
"clientIds",
",",
"I_CmsSimpleCallback",
"<",
"Map",
"<",
"String",
",",
"CmsContainerElementData",
">",
">",
"callback",
")",
"{",
"MultiElementAction",
"action",
"=",
"new",
"MultiElementAction",
... | Requests the data for container elements specified by the client id. The data will be provided to the given call-back function.<p>
@param clientIds the element id's
@param callback the call-back to execute with the requested data | [
"Requests",
"the",
"data",
"for",
"container",
"elements",
"specified",
"by",
"the",
"client",
"id",
".",
"The",
"data",
"will",
"be",
"provided",
"to",
"the",
"given",
"call",
"-",
"back",
"function",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1523-L1527 |
belaban/JGroups | src/org/jgroups/protocols/KeyExchange.java | KeyExchange.setSecretKeyAbove | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | java | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | [
"protected",
"void",
"setSecretKeyAbove",
"(",
"Tuple",
"<",
"SecretKey",
",",
"byte",
"[",
"]",
">",
"key",
")",
"{",
"up_prot",
".",
"up",
"(",
"new",
"Event",
"(",
"Event",
".",
"SET_SECRET_KEY",
",",
"key",
")",
")",
";",
"}"
] | Sets the secret key in a protocol above us
@param key The secret key and its version | [
"Sets",
"the",
"secret",
"key",
"in",
"a",
"protocol",
"above",
"us"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/KeyExchange.java#L63-L65 |
akquinet/needle | src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java | TransactionHelper.executeInTransaction | public final <T> T executeInTransaction(final Runnable<T> runnable, final boolean clearAfterCommit)
throws Exception {
T result;
try {
entityManager.getTransaction().begin();
result = runnable.run(entityManager);
entityManager.flush();
entityManager.getTransaction().commit();
if (clearAfterCommit) {
entityManager.clear();
}
} finally {
if (entityManager.getTransaction().isActive()) {
entityManager.getTransaction().rollback();
}
}
return result;
} | java | public final <T> T executeInTransaction(final Runnable<T> runnable, final boolean clearAfterCommit)
throws Exception {
T result;
try {
entityManager.getTransaction().begin();
result = runnable.run(entityManager);
entityManager.flush();
entityManager.getTransaction().commit();
if (clearAfterCommit) {
entityManager.clear();
}
} finally {
if (entityManager.getTransaction().isActive()) {
entityManager.getTransaction().rollback();
}
}
return result;
} | [
"public",
"final",
"<",
"T",
">",
"T",
"executeInTransaction",
"(",
"final",
"Runnable",
"<",
"T",
">",
"runnable",
",",
"final",
"boolean",
"clearAfterCommit",
")",
"throws",
"Exception",
"{",
"T",
"result",
";",
"try",
"{",
"entityManager",
".",
"getTransa... | Encapsulates execution of runnable.run() in transactions.
@param <T>
result type of runnable.run()
@param runnable
algorithm to execute
@param clearAfterCommit
<tt>true</tt> triggers entityManager.clear() after transaction
commit
@return return value of runnable.run()
@throws Exception
execution failed | [
"Encapsulates",
"execution",
"of",
"runnable",
".",
"run",
"()",
"in",
"transactions",
"."
] | train | https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java#L107-L127 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java | TemporaryFilesystem.createTempDir | public File createTempDir(String prefix, String suffix) {
try {
// Create a tempfile, and delete it.
File file = File.createTempFile(prefix, suffix, baseDir);
file.delete();
// Create it as a directory.
File dir = new File(file.getAbsolutePath());
if (!dir.mkdirs()) {
throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
}
// Create the directory and mark it writable.
FileHandler.createDir(dir);
temporaryFiles.add(dir);
return dir;
} catch (IOException e) {
throw new WebDriverException(
"Unable to create temporary file at " + baseDir.getAbsolutePath());
}
} | java | public File createTempDir(String prefix, String suffix) {
try {
// Create a tempfile, and delete it.
File file = File.createTempFile(prefix, suffix, baseDir);
file.delete();
// Create it as a directory.
File dir = new File(file.getAbsolutePath());
if (!dir.mkdirs()) {
throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
}
// Create the directory and mark it writable.
FileHandler.createDir(dir);
temporaryFiles.add(dir);
return dir;
} catch (IOException e) {
throw new WebDriverException(
"Unable to create temporary file at " + baseDir.getAbsolutePath());
}
} | [
"public",
"File",
"createTempDir",
"(",
"String",
"prefix",
",",
"String",
"suffix",
")",
"{",
"try",
"{",
"// Create a tempfile, and delete it.",
"File",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"prefix",
",",
"suffix",
",",
"baseDir",
")",
";",
"file... | Create a temporary directory, and track it for deletion.
@param prefix the prefix to use when creating the temporary directory
@param suffix the suffix to use when creating the temporary directory
@return the temporary directory to create | [
"Create",
"a",
"temporary",
"directory",
"and",
"track",
"it",
"for",
"deletion",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java#L90-L111 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java | UtilMath.wrapDouble | public static double wrapDouble(double value, double min, double max)
{
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step;
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step;
}
}
return newValue;
} | java | public static double wrapDouble(double value, double min, double max)
{
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step;
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step;
}
}
return newValue;
} | [
"public",
"static",
"double",
"wrapDouble",
"(",
"double",
"value",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"double",
"newValue",
"=",
"value",
";",
"final",
"double",
"step",
"=",
"max",
"-",
"min",
";",
"if",
"(",
"Double",
".",
"compar... | Wrap value (keep value between min and max). Useful to keep an angle between 0 and 360 for example.
@param value The input value.
@param min The minimum value (included).
@param max The maximum value (excluded).
@return The wrapped value. | [
"Wrap",
"value",
"(",
"keep",
"value",
"between",
"min",
"and",
"max",
")",
".",
"Useful",
"to",
"keep",
"an",
"angle",
"between",
"0",
"and",
"360",
"for",
"example",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L275-L295 |
groupe-sii/ogham | ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java | MapContentHandler.addContentHandler | public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) {
map.put(clazz, handler);
} | java | public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) {
map.put(clazz, handler);
} | [
"public",
"void",
"addContentHandler",
"(",
"Class",
"<",
"?",
"extends",
"Content",
">",
"clazz",
",",
"JavaMailContentHandler",
"handler",
")",
"{",
"map",
".",
"put",
"(",
"clazz",
",",
"handler",
")",
";",
"}"
] | Register a new content handler.
@param clazz
the class of the content
@param handler
the content handler | [
"Register",
"a",
"new",
"content",
"handler",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java#L61-L63 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java | ManagedInstancesInner.getByResourceGroup | public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
} | java | public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
} | [
"public",
"ManagedInstanceInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
")",
".",
"toBlocking",
"(... | Gets a managed instance.
@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
@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 ManagedInstanceInner object if successful. | [
"Gets",
"a",
"managed",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java#L347-L349 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTierPriceEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}... | Returns all the commerce tier price entries where groupId = ?.
@param groupId the group ID
@return the matching commerce tier price entries | [
"Returns",
"all",
"the",
"commerce",
"tier",
"price",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L1527-L1530 |
l0s/fernet-java8 | fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java | SecretsManager.getSecretStage | public ByteBuffer getSecretStage(final String secretId, final Stage stage) {
final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest();
getSecretValueRequest.setSecretId(secretId);
getSecretValueRequest.setVersionStage(stage.getAwsName());
final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest);
return result.getSecretBinary();
} | java | public ByteBuffer getSecretStage(final String secretId, final Stage stage) {
final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest();
getSecretValueRequest.setSecretId(secretId);
getSecretValueRequest.setVersionStage(stage.getAwsName());
final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest);
return result.getSecretBinary();
} | [
"public",
"ByteBuffer",
"getSecretStage",
"(",
"final",
"String",
"secretId",
",",
"final",
"Stage",
"stage",
")",
"{",
"final",
"GetSecretValueRequest",
"getSecretValueRequest",
"=",
"new",
"GetSecretValueRequest",
"(",
")",
";",
"getSecretValueRequest",
".",
"setSec... | Retrieve a specific stage of the secret.
@param secretId the ARN of the secret
@param stage the stage of the secret to retrieve
@return the Fernet key or keys in binary form | [
"Retrieve",
"a",
"specific",
"stage",
"of",
"the",
"secret",
"."
] | train | https://github.com/l0s/fernet-java8/blob/427244bc1af605ffca0ac2469d66b297ea9f77b3/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java#L107-L113 |
nightcode/yaranga | core/src/org/nightcode/common/base/Objects.java | Objects.validArgument | public static void validArgument(boolean expression, String message, Object... messageArgs) {
if (!expression) {
throw new IllegalArgumentException(format(message, messageArgs));
}
} | java | public static void validArgument(boolean expression, String message, Object... messageArgs) {
if (!expression) {
throw new IllegalArgumentException(format(message, messageArgs));
}
} | [
"public",
"static",
"void",
"validArgument",
"(",
"boolean",
"expression",
",",
"String",
"message",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"message... | Checks boolean expression.
@param expression a boolean expression
@param message error message
@param messageArgs array of parameters to the message
@throws IllegalArgumentException if boolean expression is false | [
"Checks",
"boolean",
"expression",
"."
] | train | https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Objects.java#L49-L53 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java | BigtableTableAdminClient.dropRowRange | @SuppressWarnings("WeakerAccess")
public void dropRowRange(String tableId, String rowKeyPrefix) {
ApiExceptions.callAndTranslateApiException(dropRowRangeAsync(tableId, rowKeyPrefix));
} | java | @SuppressWarnings("WeakerAccess")
public void dropRowRange(String tableId, String rowKeyPrefix) {
ApiExceptions.callAndTranslateApiException(dropRowRangeAsync(tableId, rowKeyPrefix));
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"void",
"dropRowRange",
"(",
"String",
"tableId",
",",
"String",
"rowKeyPrefix",
")",
"{",
"ApiExceptions",
".",
"callAndTranslateApiException",
"(",
"dropRowRangeAsync",
"(",
"tableId",
",",
"rowKeyPref... | Drops rows by the specified key prefix and tableId
<p>Please note that this method is considered part of the admin API and is rate limited.
<p>Sample code:
<pre>{@code
client.dropRowRange("my-table", "prefix");
}</pre> | [
"Drops",
"rows",
"by",
"the",
"specified",
"key",
"prefix",
"and",
"tableId"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java#L614-L617 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java | OAuth20HandlerInterceptorAdapter.isDeviceTokenRequest | protected boolean isDeviceTokenRequest(final HttpServletRequest request, final HttpServletResponse response) {
val requestPath = request.getRequestURI();
val pattern = String.format("(%s)", OAuth20Constants.DEVICE_AUTHZ_URL);
return doesUriMatchPattern(requestPath, pattern);
} | java | protected boolean isDeviceTokenRequest(final HttpServletRequest request, final HttpServletResponse response) {
val requestPath = request.getRequestURI();
val pattern = String.format("(%s)", OAuth20Constants.DEVICE_AUTHZ_URL);
return doesUriMatchPattern(requestPath, pattern);
} | [
"protected",
"boolean",
"isDeviceTokenRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"val",
"requestPath",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"val",
"pattern",
"=",
"String",
".... | Is device token request boolean.
@param request the request
@param response the response
@return the boolean | [
"Is",
"device",
"token",
"request",
"boolean",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java#L75-L79 |
IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/ServiceAccount.java | ServiceAccount.getInstance | public static ServiceAccount getInstance(String url, String instanceId,
TokenManager tokenManager) {
if (url.endsWith("/")) {
// trim off trailing slash
url = url.substring(0, url.length() - 1);
}
return new ServiceAccount(url, instanceId, tokenManager);
} | java | public static ServiceAccount getInstance(String url, String instanceId,
TokenManager tokenManager) {
if (url.endsWith("/")) {
// trim off trailing slash
url = url.substring(0, url.length() - 1);
}
return new ServiceAccount(url, instanceId, tokenManager);
} | [
"public",
"static",
"ServiceAccount",
"getInstance",
"(",
"String",
"url",
",",
"String",
"instanceId",
",",
"TokenManager",
"tokenManager",
")",
"{",
"if",
"(",
"url",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"// trim off trailing slash",
"url",
"=",
"ur... | Returns an instance of ServiceAccount for the specified IBM Globalization
Pipeline service URL and credentials.
<p>
All arguments must no be null.
@param url
The service URL of Globlization Pipeline service. (e.g.
https://gp-rest.ng.bluemix.net/translate/rest)
@param instanceId
The instance ID of the service instance. (e.g.
d3f537cd617f34c86ac6b270f3065e73)
@param tokenManager
IAM Token Manager.
@return An instance of ServiceAccount | [
"Returns",
"an",
"instance",
"of",
"ServiceAccount",
"for",
"the",
"specified",
"IBM",
"Globalization",
"Pipeline",
"service",
"URL",
"and",
"credentials",
".",
"<p",
">",
"All",
"arguments",
"must",
"no",
"be",
"null",
"."
] | train | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/ServiceAccount.java#L206-L215 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Setter.java | Setter.setDatePicker | public void setDatePicker(final DatePicker datePicker, final int year, final int monthOfYear, final int dayOfMonth) {
if(datePicker != null){
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null){
activity.runOnUiThread(new Runnable()
{
public void run()
{
try{
datePicker.updateDate(year, monthOfYear, dayOfMonth);
}catch (Exception ignored){}
}
});
}
}
} | java | public void setDatePicker(final DatePicker datePicker, final int year, final int monthOfYear, final int dayOfMonth) {
if(datePicker != null){
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null){
activity.runOnUiThread(new Runnable()
{
public void run()
{
try{
datePicker.updateDate(year, monthOfYear, dayOfMonth);
}catch (Exception ignored){}
}
});
}
}
} | [
"public",
"void",
"setDatePicker",
"(",
"final",
"DatePicker",
"datePicker",
",",
"final",
"int",
"year",
",",
"final",
"int",
"monthOfYear",
",",
"final",
"int",
"dayOfMonth",
")",
"{",
"if",
"(",
"datePicker",
"!=",
"null",
")",
"{",
"Activity",
"activity"... | Sets the date in a given {@link DatePicker}.
@param datePicker the {@code DatePicker} object.
@param year the year e.g. 2011
@param monthOfYear the month which is starting from zero e.g. 03
@param dayOfMonth the day e.g. 10 | [
"Sets",
"the",
"date",
"in",
"a",
"given",
"{",
"@link",
"DatePicker",
"}",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Setter.java#L54-L69 |
radkovo/jStyleParser | src/main/java/org/fit/net/DataURLHandler.java | DataURLHandler.createURL | public static URL createURL(URL base, String urlstring) throws MalformedURLException
{
if (urlstring.startsWith("data:"))
return new URL(null, urlstring, new DataURLHandler());
else
{
URL ret = new URL(base, urlstring);
//fix the incorrect absolute URLs that contain ./ or ../
String path = ret.getPath();
if (path.startsWith("/./") || path.startsWith("/../"))
{
path = path.substring(1);
while (path.startsWith("./") || path.startsWith("../"))
{
if (path.startsWith("./"))
path = path.substring(2);
else
path = path.substring(3);
}
URL fixed = new URL(base, "/" + path);
log.warn("Normalized non-standard URL %s to %s", ret.toString(), fixed.toString());
ret = fixed;
}
return ret;
}
} | java | public static URL createURL(URL base, String urlstring) throws MalformedURLException
{
if (urlstring.startsWith("data:"))
return new URL(null, urlstring, new DataURLHandler());
else
{
URL ret = new URL(base, urlstring);
//fix the incorrect absolute URLs that contain ./ or ../
String path = ret.getPath();
if (path.startsWith("/./") || path.startsWith("/../"))
{
path = path.substring(1);
while (path.startsWith("./") || path.startsWith("../"))
{
if (path.startsWith("./"))
path = path.substring(2);
else
path = path.substring(3);
}
URL fixed = new URL(base, "/" + path);
log.warn("Normalized non-standard URL %s to %s", ret.toString(), fixed.toString());
ret = fixed;
}
return ret;
}
} | [
"public",
"static",
"URL",
"createURL",
"(",
"URL",
"base",
",",
"String",
"urlstring",
")",
"throws",
"MalformedURLException",
"{",
"if",
"(",
"urlstring",
".",
"startsWith",
"(",
"\"data:\"",
")",
")",
"return",
"new",
"URL",
"(",
"null",
",",
"urlstring",... | Creates an URL from string while considering the data: scheme.
@param base the base URL used for relative URLs
@param urlstring the URL string
@return resulting URL
@throws MalformedURLException | [
"Creates",
"an",
"URL",
"from",
"string",
"while",
"considering",
"the",
"data",
":",
"scheme",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/org/fit/net/DataURLHandler.java#L90-L115 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java | ElephasModelImport.importElephasSequentialModelAndWeights | public static SparkDl4jMultiLayer importElephasSequentialModelAndWeights(JavaSparkContext sparkContext,
String modelHdf5Filename)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights(
modelHdf5Filename, true);
Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename);
TrainingMaster tm = getTrainingMaster(distributedProperties);
return new SparkDl4jMultiLayer(sparkContext, model, tm);
} | java | public static SparkDl4jMultiLayer importElephasSequentialModelAndWeights(JavaSparkContext sparkContext,
String modelHdf5Filename)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights(
modelHdf5Filename, true);
Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename);
TrainingMaster tm = getTrainingMaster(distributedProperties);
return new SparkDl4jMultiLayer(sparkContext, model, tm);
} | [
"public",
"static",
"SparkDl4jMultiLayer",
"importElephasSequentialModelAndWeights",
"(",
"JavaSparkContext",
"sparkContext",
",",
"String",
"modelHdf5Filename",
")",
"throws",
"IOException",
",",
"UnsupportedKerasConfigurationException",
",",
"InvalidKerasConfigurationException",
... | Load Elephas model stored using model.save(...) in case that the underlying Keras
model is a functional `Sequential` instance, which corresponds to a DL4J SparkDl4jMultiLayer.
@param sparkContext Java SparkContext
@param modelHdf5Filename Path to HDF5 archive storing Elephas model
@return SparkDl4jMultiLayer Spark computation graph
@throws IOException IO exception
@throws InvalidKerasConfigurationException Invalid Keras config
@throws UnsupportedKerasConfigurationException Unsupported Keras config
@see SparkDl4jMultiLayer | [
"Load",
"Elephas",
"model",
"stored",
"using",
"model",
".",
"save",
"(",
"...",
")",
"in",
"case",
"that",
"the",
"underlying",
"Keras",
"model",
"is",
"a",
"functional",
"Sequential",
"instance",
"which",
"corresponds",
"to",
"a",
"DL4J",
"SparkDl4jMultiLaye... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java#L92-L102 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmLineBreakpointPropertyPage.java | VdmLineBreakpointPropertyPage.createConditionEditor | private void createConditionEditor(Composite parent) throws CoreException
{
IVdmLineBreakpoint breakpoint = (IVdmLineBreakpoint) getBreakpoint();
String label = null;
// if (BreakpointUtils.getType(breakpoint) != null) {
// IBindingService bindingService =
// (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
// if(bindingService != null) {
// TriggerSequence keyBinding =
// bindingService.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// if (keyBinding != null) {
// label = MessageFormat.format("messageFormat", new String[] {keyBinding.format()});
// }
// }
// }
if (label == null)
{
label = "Enable Condition";
}
Composite conditionComposite = SWTFactory.createGroup(parent, EMPTY_STRING, 1, 1, GridData.FILL_BOTH);
fEnableConditionButton = createCheckButton(conditionComposite, label);
fEnableConditionButton.setSelection(breakpoint.getExpressionState());
fEnableConditionButton.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
setConditionEnabled(fEnableConditionButton.getSelection());
}
});
fConditionEditor = new BreakpointConditionEditor(conditionComposite, this);
fSuspendWhenLabel = createLabel(conditionComposite, "Suspend when:");
fConditionIsTrue = createRadioButton(conditionComposite, "condition is 'true'");
fConditionHasChanged = createRadioButton(conditionComposite, "value of condition changes");
// if (breakpoint.isConditionSuspendOnTrue()) {
// fConditionIsTrue.setSelection(true);
// }
// else {
fConditionHasChanged.setSelection(true);
// }
setConditionEnabled(fEnableConditionButton.getSelection());
} | java | private void createConditionEditor(Composite parent) throws CoreException
{
IVdmLineBreakpoint breakpoint = (IVdmLineBreakpoint) getBreakpoint();
String label = null;
// if (BreakpointUtils.getType(breakpoint) != null) {
// IBindingService bindingService =
// (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
// if(bindingService != null) {
// TriggerSequence keyBinding =
// bindingService.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// if (keyBinding != null) {
// label = MessageFormat.format("messageFormat", new String[] {keyBinding.format()});
// }
// }
// }
if (label == null)
{
label = "Enable Condition";
}
Composite conditionComposite = SWTFactory.createGroup(parent, EMPTY_STRING, 1, 1, GridData.FILL_BOTH);
fEnableConditionButton = createCheckButton(conditionComposite, label);
fEnableConditionButton.setSelection(breakpoint.getExpressionState());
fEnableConditionButton.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
setConditionEnabled(fEnableConditionButton.getSelection());
}
});
fConditionEditor = new BreakpointConditionEditor(conditionComposite, this);
fSuspendWhenLabel = createLabel(conditionComposite, "Suspend when:");
fConditionIsTrue = createRadioButton(conditionComposite, "condition is 'true'");
fConditionHasChanged = createRadioButton(conditionComposite, "value of condition changes");
// if (breakpoint.isConditionSuspendOnTrue()) {
// fConditionIsTrue.setSelection(true);
// }
// else {
fConditionHasChanged.setSelection(true);
// }
setConditionEnabled(fEnableConditionButton.getSelection());
} | [
"private",
"void",
"createConditionEditor",
"(",
"Composite",
"parent",
")",
"throws",
"CoreException",
"{",
"IVdmLineBreakpoint",
"breakpoint",
"=",
"(",
"IVdmLineBreakpoint",
")",
"getBreakpoint",
"(",
")",
";",
"String",
"label",
"=",
"null",
";",
"// if (Breakpo... | Creates the controls that allow the user to specify the breakpoint's condition
@param parent
the composite in which the condition editor should be created
@throws CoreException
if an exception occurs accessing the breakpoint | [
"Creates",
"the",
"controls",
"that",
"allow",
"the",
"user",
"to",
"specify",
"the",
"breakpoint",
"s",
"condition"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmLineBreakpointPropertyPage.java#L218-L259 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getBoolean | public boolean getBoolean(String name, boolean defaultValue) {
JsonValue value = get(name);
return value != null ? value.asBoolean() : defaultValue;
} | java | public boolean getBoolean(String name, boolean defaultValue) {
JsonValue value = get(name);
return value != null ? value.asBoolean() : defaultValue;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asBoolean",
"(",
")",
":",
"defaultValue",
"... | Returns the <code>boolean</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one will be picked. If this
member's value does not represent a JSON <code>true</code> or <code>false</code> value, an
exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"boolean<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L657-L660 |
OpenTSDB/opentsdb | src/tsd/PutDataPointRpc.java | PutDataPointRpc.execute | @Override
public void execute(final TSDB tsdb, final HttpQuery query)
throws IOException {
http_requests.incrementAndGet();
// only accept POST
if (query.method() != HttpMethod.POST) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
final List<IncomingDataPoint> dps;
//noinspection TryWithIdenticalCatches
try {
checkAuthorization(tsdb, query);
dps = query.serializer()
.parsePutV1(IncomingDataPoint.class, HttpJsonSerializer.TR_INCOMING);
} catch (BadRequestException e) {
illegal_arguments.incrementAndGet();
throw e;
} catch (IllegalArgumentException e) {
illegal_arguments.incrementAndGet();
throw e;
}
processDataPoint(tsdb, query, dps);
} | java | @Override
public void execute(final TSDB tsdb, final HttpQuery query)
throws IOException {
http_requests.incrementAndGet();
// only accept POST
if (query.method() != HttpMethod.POST) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
final List<IncomingDataPoint> dps;
//noinspection TryWithIdenticalCatches
try {
checkAuthorization(tsdb, query);
dps = query.serializer()
.parsePutV1(IncomingDataPoint.class, HttpJsonSerializer.TR_INCOMING);
} catch (BadRequestException e) {
illegal_arguments.incrementAndGet();
throw e;
} catch (IllegalArgumentException e) {
illegal_arguments.incrementAndGet();
throw e;
}
processDataPoint(tsdb, query, dps);
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpQuery",
"query",
")",
"throws",
"IOException",
"{",
"http_requests",
".",
"incrementAndGet",
"(",
")",
";",
"// only accept POST",
"if",
"(",
"query",
".",
"method",... | Handles HTTP RPC put requests
@param tsdb The TSDB to which we belong
@param query The HTTP query from the user
@throws IOException if there is an error parsing the query or formatting
the output
@throws BadRequestException if the user supplied bad data
@since 2.0 | [
"Handles",
"HTTP",
"RPC",
"put",
"requests"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/PutDataPointRpc.java#L271-L297 |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.getAttribute | public static Object getAttribute(String name)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return getAttribute(name, loader);
} | java | public static Object getAttribute(String name)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return getAttribute(name, loader);
} | [
"public",
"static",
"Object",
"getAttribute",
"(",
"String",
"name",
")",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"return",
"getAttribute",
"(",
"name",
",",
"loader",
")",
";"... | Gets a local variable for the current environment.
@param name the attribute name
@return the attribute value | [
"Gets",
"a",
"local",
"variable",
"for",
"the",
"current",
"environment",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L528-L533 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/GetTokenApi.java | GetTokenApi.onConnect | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onPushTokenResult(rst, null);
return;
}
PendingResult<TokenResult> tokenResult = HuaweiPush.HuaweiPushApi.getToken(client);
tokenResult.setResultCallback(new ResultCallback<TokenResult>() {
@Override
public void onResult(TokenResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onPushTokenResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onPushTokenResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else {
onPushTokenResult(rstCode, result);
}
}
});
} | java | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onPushTokenResult(rst, null);
return;
}
PendingResult<TokenResult> tokenResult = HuaweiPush.HuaweiPushApi.getToken(client);
tokenResult.setResultCallback(new ResultCallback<TokenResult>() {
@Override
public void onResult(TokenResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onPushTokenResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onPushTokenResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else {
onPushTokenResult(rstCode, 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/push/GetTokenApi.java#L47-L84 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/BatchObjectUpdater.java | BatchObjectUpdater.buildErrorStatus | private void buildErrorStatus(BatchResult result, Throwable ex) {
result.setStatus(BatchResult.Status.ERROR);
result.setErrorMessage(ex.getLocalizedMessage());
if (ex instanceof IllegalArgumentException) {
m_logger.debug("Batch update error: {}", ex.toString());
} else {
result.setStackTrace(Utils.getStackTrace(ex));
m_logger.debug("Batch update error: {} stacktrace: {}",
ex.toString(), Utils.getStackTrace(ex));
}
} | java | private void buildErrorStatus(BatchResult result, Throwable ex) {
result.setStatus(BatchResult.Status.ERROR);
result.setErrorMessage(ex.getLocalizedMessage());
if (ex instanceof IllegalArgumentException) {
m_logger.debug("Batch update error: {}", ex.toString());
} else {
result.setStackTrace(Utils.getStackTrace(ex));
m_logger.debug("Batch update error: {} stacktrace: {}",
ex.toString(), Utils.getStackTrace(ex));
}
} | [
"private",
"void",
"buildErrorStatus",
"(",
"BatchResult",
"result",
",",
"Throwable",
"ex",
")",
"{",
"result",
".",
"setStatus",
"(",
"BatchResult",
".",
"Status",
".",
"ERROR",
")",
";",
"result",
".",
"setErrorMessage",
"(",
"ex",
".",
"getLocalizedMessage... | Add error fields to the given BatchResult due to the given exception. | [
"Add",
"error",
"fields",
"to",
"the",
"given",
"BatchResult",
"due",
"to",
"the",
"given",
"exception",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/BatchObjectUpdater.java#L223-L233 |
auth0/auth0-java | src/main/java/com/auth0/client/auth/AuthAPI.java | AuthAPI.logoutUrl | public LogoutUrlBuilder logoutUrl(String returnToUrl, boolean setClientId) {
Asserts.assertValidUrl(returnToUrl, "return to url");
return LogoutUrlBuilder.newInstance(baseUrl, clientId, returnToUrl, setClientId);
} | java | public LogoutUrlBuilder logoutUrl(String returnToUrl, boolean setClientId) {
Asserts.assertValidUrl(returnToUrl, "return to url");
return LogoutUrlBuilder.newInstance(baseUrl, clientId, returnToUrl, setClientId);
} | [
"public",
"LogoutUrlBuilder",
"logoutUrl",
"(",
"String",
"returnToUrl",
",",
"boolean",
"setClientId",
")",
"{",
"Asserts",
".",
"assertValidUrl",
"(",
"returnToUrl",
",",
"\"return to url\"",
")",
";",
"return",
"LogoutUrlBuilder",
".",
"newInstance",
"(",
"baseUr... | Creates an instance of the {@link LogoutUrlBuilder} with the given return-to url.
i.e.:
<pre>
{@code
AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne");
String url = auth.logoutUrl("https://me.auth0.com/home", true)
.useFederated(true)
.withAccessToken("A9CvPwFojaBIA9CvI");
}
</pre>
@param returnToUrl the redirect_uri value to set, white-listed in the Application settings. Must be already URL Encoded.
@param setClientId whether the client_id value must be set or not. This affects the white-list that the Auth0's Dashboard uses to validate the returnTo url.
@return a new instance of the {@link LogoutUrlBuilder} to configure. | [
"Creates",
"an",
"instance",
"of",
"the",
"{",
"@link",
"LogoutUrlBuilder",
"}",
"with",
"the",
"given",
"return",
"-",
"to",
"url",
".",
"i",
".",
"e",
".",
":",
"<pre",
">",
"{",
"@code",
"AuthAPI",
"auth",
"=",
"new",
"AuthAPI",
"(",
"me",
".",
... | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L153-L157 |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addHeaderEntry | public void addHeaderEntry( final Tag tag, final String value) {
format.getHeader().createEntry(tag, value);
} | java | public void addHeaderEntry( final Tag tag, final String value) {
format.getHeader().createEntry(tag, value);
} | [
"public",
"void",
"addHeaderEntry",
"(",
"final",
"Tag",
"tag",
",",
"final",
"String",
"value",
")",
"{",
"format",
".",
"getHeader",
"(",
")",
".",
"createEntry",
"(",
"tag",
",",
"value",
")",
";",
"}"
] | Adds a header entry value to the header. For example use this to set the source RPM package
name on your RPM
@param tag the header tag to set
@param value the value to set the header entry with | [
"Adds",
"a",
"header",
"entry",
"value",
"to",
"the",
"header",
".",
"For",
"example",
"use",
"this",
"to",
"set",
"the",
"source",
"RPM",
"package",
"name",
"on",
"your",
"RPM"
] | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L220-L222 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/CmsPrincipalSelectConnector.java | CmsPrincipalSelectConnector.setPrincipal | void setPrincipal(int type, String principalName) {
m_rpc.setPrincipal(type, principalName);
// forcing the RPC to be executed immediately
getConnection().getHeartbeat().send();
} | java | void setPrincipal(int type, String principalName) {
m_rpc.setPrincipal(type, principalName);
// forcing the RPC to be executed immediately
getConnection().getHeartbeat().send();
} | [
"void",
"setPrincipal",
"(",
"int",
"type",
",",
"String",
"principalName",
")",
"{",
"m_rpc",
".",
"setPrincipal",
"(",
"type",
",",
"principalName",
")",
";",
"// forcing the RPC to be executed immediately",
"getConnection",
"(",
")",
".",
"getHeartbeat",
"(",
"... | Sets the principal.<p>
@param type the principal type
@param principalName the principal name | [
"Sets",
"the",
"principal",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsPrincipalSelectConnector.java#L81-L86 |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/JsoupCssInliner.java | JsoupCssInliner.internStyles | private void internStyles(Document doc, List<ExternalCss> cssContents) {
Elements els = doc.select(CSS_LINKS_SELECTOR);
for (Element e : els) {
if (!TRUE_VALUE.equals(e.attr(SKIP_INLINE))) {
String path = e.attr(HREF_ATTR);
Element style = new Element(Tag.valueOf(STYLE_TAG), "");
style.appendChild(new DataNode(getCss(cssContents, path), ""));
e.replaceWith(style);
}
}
} | java | private void internStyles(Document doc, List<ExternalCss> cssContents) {
Elements els = doc.select(CSS_LINKS_SELECTOR);
for (Element e : els) {
if (!TRUE_VALUE.equals(e.attr(SKIP_INLINE))) {
String path = e.attr(HREF_ATTR);
Element style = new Element(Tag.valueOf(STYLE_TAG), "");
style.appendChild(new DataNode(getCss(cssContents, path), ""));
e.replaceWith(style);
}
}
} | [
"private",
"void",
"internStyles",
"(",
"Document",
"doc",
",",
"List",
"<",
"ExternalCss",
">",
"cssContents",
")",
"{",
"Elements",
"els",
"=",
"doc",
".",
"select",
"(",
"CSS_LINKS_SELECTOR",
")",
";",
"for",
"(",
"Element",
"e",
":",
"els",
")",
"{",... | Replace link tags with style tags in order to keep the same inclusion
order
@param doc
the html document
@param cssContents
the list of external css files with their content | [
"Replace",
"link",
"tags",
"with",
"style",
"tags",
"in",
"order",
"to",
"keep",
"the",
"same",
"inclusion",
"order"
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/JsoupCssInliner.java#L68-L78 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java | CPOptionValuePersistenceImpl.fetchByC_ERC | @Override
public CPOptionValue fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CPOptionValue fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CPOptionValue",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the cp option value where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp option value, or <code>null</code> if a matching cp option value could not be found | [
"Returns",
"the",
"cp",
"option",
"value",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L3308-L3312 |
alkacon/opencms-core | src/org/opencms/ui/contextmenu/CmsContextMenu.java | CmsContextMenu.openForTree | public void openForTree(ItemClickEvent event, Tree tree) {
fireEvent(new ContextMenuOpenedOnTreeItemEvent(this, tree, event.getItemId()));
open(event.getClientX(), event.getClientY());
} | java | public void openForTree(ItemClickEvent event, Tree tree) {
fireEvent(new ContextMenuOpenedOnTreeItemEvent(this, tree, event.getItemId()));
open(event.getClientX(), event.getClientY());
} | [
"public",
"void",
"openForTree",
"(",
"ItemClickEvent",
"event",
",",
"Tree",
"tree",
")",
"{",
"fireEvent",
"(",
"new",
"ContextMenuOpenedOnTreeItemEvent",
"(",
"this",
",",
"tree",
",",
"event",
".",
"getItemId",
"(",
")",
")",
")",
";",
"open",
"(",
"ev... | Opens the context menu of the given tree.<p>
@param event the click event
@param tree the tree | [
"Opens",
"the",
"context",
"menu",
"of",
"the",
"given",
"tree",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1161-L1165 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeWriter.java | DiskTreeWriter.writeGeometries | public void writeGeometries( Geometry[] geometries ) throws IOException {
File file = new File(path);
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(file, "rw");
int major = JTSVersion.MAJOR;
int minor = JTSVersion.MINOR;
raf.writeChars("jts");
raf.writeInt(major);
raf.writeInt(minor);
long geometriesStart = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE + INDEX_LENGTH_SIZE;
raf.seek(geometriesStart);
System.out.println("geometriesStart: " + geometriesStart);
long fileIndex = geometriesStart;
STRtree tree = new STRtree(geometries.length);
for( int i = 0; i < geometries.length; i++ ) {
Geometry geometry = geometries[i];
if (geometry.isEmpty()) {
continue;
}
Envelope envelope = geometry.getEnvelopeInternal();
byte[] geomBytes = serialize(geometry);
raf.write(geomBytes);
/*
* the tree contains the envelope of a geometry
* and the array with the exact position in the file where the
* geometry bytes start + the length.
*/
tree.insert(envelope, new long[]{fileIndex, geomBytes.length});
fileIndex = fileIndex + geomBytes.length;
System.out.println("geom: " + i + " finished at: " + fileIndex);
}
raf.seek(INDEX_ADDRESS_POSITION);
raf.writeLong(fileIndex);
System.out.println("INDEX_ADDRESS_POSITION: " + fileIndex);
/*
* serialize index
*/
byte[] treeBytes = serialize(tree);
long treeSize = treeBytes.length;
raf.seek(fileIndex);
raf.write(treeBytes, 0, (int) treeSize);
System.out.println("treeSize: " + treeSize);
raf.seek(INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE);
raf.writeLong(treeSize);
long length = raf.length();
System.out.println(length);
} finally {
System.out.println("close");
if (raf != null)
raf.close();
}
} | java | public void writeGeometries( Geometry[] geometries ) throws IOException {
File file = new File(path);
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(file, "rw");
int major = JTSVersion.MAJOR;
int minor = JTSVersion.MINOR;
raf.writeChars("jts");
raf.writeInt(major);
raf.writeInt(minor);
long geometriesStart = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE + INDEX_LENGTH_SIZE;
raf.seek(geometriesStart);
System.out.println("geometriesStart: " + geometriesStart);
long fileIndex = geometriesStart;
STRtree tree = new STRtree(geometries.length);
for( int i = 0; i < geometries.length; i++ ) {
Geometry geometry = geometries[i];
if (geometry.isEmpty()) {
continue;
}
Envelope envelope = geometry.getEnvelopeInternal();
byte[] geomBytes = serialize(geometry);
raf.write(geomBytes);
/*
* the tree contains the envelope of a geometry
* and the array with the exact position in the file where the
* geometry bytes start + the length.
*/
tree.insert(envelope, new long[]{fileIndex, geomBytes.length});
fileIndex = fileIndex + geomBytes.length;
System.out.println("geom: " + i + " finished at: " + fileIndex);
}
raf.seek(INDEX_ADDRESS_POSITION);
raf.writeLong(fileIndex);
System.out.println("INDEX_ADDRESS_POSITION: " + fileIndex);
/*
* serialize index
*/
byte[] treeBytes = serialize(tree);
long treeSize = treeBytes.length;
raf.seek(fileIndex);
raf.write(treeBytes, 0, (int) treeSize);
System.out.println("treeSize: " + treeSize);
raf.seek(INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE);
raf.writeLong(treeSize);
long length = raf.length();
System.out.println(length);
} finally {
System.out.println("close");
if (raf != null)
raf.close();
}
} | [
"public",
"void",
"writeGeometries",
"(",
"Geometry",
"[",
"]",
"geometries",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"RandomAccessFile",
"raf",
"=",
"null",
";",
"try",
"{",
"raf",
"=",
"new",
"Rando... | Writes an array of {@link Geometry}s to the disk.
@param geometries the array of geoms to write.
@throws IOException | [
"Writes",
"an",
"array",
"of",
"{",
"@link",
"Geometry",
"}",
"s",
"to",
"the",
"disk",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeWriter.java#L56-L124 |
DDTH/ddth-tsc | ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/CounterMetadata.java | CounterMetadata.fromJsonString | @SuppressWarnings("unchecked")
public static CounterMetadata fromJsonString(String jsonString) {
try {
return fromMap(SerializationUtils.fromJsonString(jsonString, Map.class));
} catch (Exception e) {
return null;
}
} | java | @SuppressWarnings("unchecked")
public static CounterMetadata fromJsonString(String jsonString) {
try {
return fromMap(SerializationUtils.fromJsonString(jsonString, Map.class));
} catch (Exception e) {
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"CounterMetadata",
"fromJsonString",
"(",
"String",
"jsonString",
")",
"{",
"try",
"{",
"return",
"fromMap",
"(",
"SerializationUtils",
".",
"fromJsonString",
"(",
"jsonString",
",",
"Map",
".... | Creates a {@link CounterMetadata} object from a JSON string.
@param jsonString
@return | [
"Creates",
"a",
"{",
"@link",
"CounterMetadata",
"}",
"object",
"from",
"a",
"JSON",
"string",
"."
] | train | https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/CounterMetadata.java#L62-L69 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getTargetProfilePackageLink | public Content getTargetProfilePackageLink(PackageDoc pd, String target,
Content label, String profileName) {
return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
label, "", target);
} | java | public Content getTargetProfilePackageLink(PackageDoc pd, String target,
Content label, String profileName) {
return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
label, "", target);
} | [
"public",
"Content",
"getTargetProfilePackageLink",
"(",
"PackageDoc",
"pd",
",",
"String",
"target",
",",
"Content",
"label",
",",
"String",
"profileName",
")",
"{",
"return",
"getHyperLink",
"(",
"pathString",
"(",
"pd",
",",
"DocPaths",
".",
"profilePackageSumm... | Get Profile Package link, with target frame.
@param pd the packageDoc object
@param target name of the target frame
@param label tag for the link
@param profileName the name of the profile being documented
@return a content for the target profile packages link | [
"Get",
"Profile",
"Package",
"link",
"with",
"target",
"frame",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L291-L295 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/CopticDate.java | CopticDate.ofEpochDay | static CopticDate ofEpochDay(final long epochDay) {
EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds
long copticED = epochDay + EPOCH_DAY_DIFFERENCE;
int adjustment = 0;
if (copticED < 0) {
copticED = copticED + (1461L * (1_000_000L / 4));
adjustment = -1_000_000;
}
int prolepticYear = (int) (((copticED * 4) + 1463) / 1461);
int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4);
int doy0 = (int) (copticED - startYearEpochDay);
int month = doy0 / 30 + 1;
int dom = doy0 % 30 + 1;
return new CopticDate(prolepticYear + adjustment, month, dom);
} | java | static CopticDate ofEpochDay(final long epochDay) {
EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds
long copticED = epochDay + EPOCH_DAY_DIFFERENCE;
int adjustment = 0;
if (copticED < 0) {
copticED = copticED + (1461L * (1_000_000L / 4));
adjustment = -1_000_000;
}
int prolepticYear = (int) (((copticED * 4) + 1463) / 1461);
int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4);
int doy0 = (int) (copticED - startYearEpochDay);
int month = doy0 / 30 + 1;
int dom = doy0 % 30 + 1;
return new CopticDate(prolepticYear + adjustment, month, dom);
} | [
"static",
"CopticDate",
"ofEpochDay",
"(",
"final",
"long",
"epochDay",
")",
"{",
"EPOCH_DAY",
".",
"range",
"(",
")",
".",
"checkValidValue",
"(",
"epochDay",
",",
"EPOCH_DAY",
")",
";",
"// validate outer bounds",
"long",
"copticED",
"=",
"epochDay",
"+",
"E... | Obtains a {@code CopticDate} representing a date in the Coptic calendar
system from the epoch-day.
@param epochDay the epoch day to convert based on 1970-01-01 (ISO)
@return the date in Coptic calendar system, not null
@throws DateTimeException if the epoch-day is out of range | [
"Obtains",
"a",
"{",
"@code",
"CopticDate",
"}",
"representing",
"a",
"date",
"in",
"the",
"Coptic",
"calendar",
"system",
"from",
"the",
"epoch",
"-",
"day",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/CopticDate.java#L218-L232 |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java | AbstractJpaEventStore.setJpqlParameters | protected final void setJpqlParameters(final Query query, final StreamId streamId) {
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
params.add(new KeyValue("streamName", streamId.getName()));
}
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
query.setParameter(param.getKey(), param.getValue());
}
} | java | protected final void setJpqlParameters(final Query query, final StreamId streamId) {
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
params.add(new KeyValue("streamName", streamId.getName()));
}
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
query.setParameter(param.getKey(), param.getValue());
}
} | [
"protected",
"final",
"void",
"setJpqlParameters",
"(",
"final",
"Query",
"query",
",",
"final",
"StreamId",
"streamId",
")",
"{",
"final",
"List",
"<",
"KeyValue",
">",
"params",
"=",
"new",
"ArrayList",
"<>",
"(",
"streamId",
".",
"getParameters",
"(",
")"... | Sets parameters in a query.
@param query
Query to set parameters for.
@param streamId
Unique stream identifier that has the parameter values. | [
"Sets",
"parameters",
"in",
"a",
"query",
"."
] | train | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L451-L460 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.ensureEndsWith | @Nullable
public static String ensureEndsWith(@CheckForNull String subject, @CheckForNull String suffix) {
if (subject == null) return null;
if (subject.endsWith(suffix)) return subject;
return subject + suffix;
} | java | @Nullable
public static String ensureEndsWith(@CheckForNull String subject, @CheckForNull String suffix) {
if (subject == null) return null;
if (subject.endsWith(suffix)) return subject;
return subject + suffix;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"ensureEndsWith",
"(",
"@",
"CheckForNull",
"String",
"subject",
",",
"@",
"CheckForNull",
"String",
"suffix",
")",
"{",
"if",
"(",
"subject",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"subject",
".... | Ensure string ends with suffix
@param subject Examined string
@param suffix Desired suffix
@return Original subject in case it already ends with suffix, null in
case subject was null and subject + suffix otherwise.
@since 1.505 | [
"Ensure",
"string",
"ends",
"with",
"suffix"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L578-L586 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Type.java | Type.getTypeArgument | protected static Type getTypeArgument(GenericType type, int index) {
GenericType arg = type.getTypeArgument(index);
if (arg != null) {
return new Type(arg);
}
// unknown type, so return object
return Type.OBJECT_TYPE;
} | java | protected static Type getTypeArgument(GenericType type, int index) {
GenericType arg = type.getTypeArgument(index);
if (arg != null) {
return new Type(arg);
}
// unknown type, so return object
return Type.OBJECT_TYPE;
} | [
"protected",
"static",
"Type",
"getTypeArgument",
"(",
"GenericType",
"type",
",",
"int",
"index",
")",
"{",
"GenericType",
"arg",
"=",
"type",
".",
"getTypeArgument",
"(",
"index",
")",
";",
"if",
"(",
"arg",
"!=",
"null",
")",
"{",
"return",
"new",
"Ty... | Get the associated type of the generic type based on the generic type
parameters. If the type is not generic or has no resolvable type params,
then {@link Type#OBJECT_TYPE} is returned.
@param type The generic type
@param index The index of the type argument
@return The element type | [
"Get",
"the",
"associated",
"type",
"of",
"the",
"generic",
"type",
"based",
"on",
"the",
"generic",
"type",
"parameters",
".",
"If",
"the",
"type",
"is",
"not",
"generic",
"or",
"has",
"no",
"resolvable",
"type",
"params",
"then",
"{",
"@link",
"Type#OBJE... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Type.java#L789-L797 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopFactory.java | ScopFactory.getSCOP | public static ScopDatabase getSCOP(String version, boolean forceLocalData){
if( version == null ) {
version = defaultVersion;
}
ScopDatabase scop = versionedScopDBs.get(version);
if ( forceLocalData) {
// Use a local installation
if( scop == null || !(scop instanceof LocalScopDatabase) ) {
logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version);
BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation();
berkeley.setScopVersion(version);
versionedScopDBs.put(version,berkeley);
return berkeley;
}
return scop;
} else {
// Use a remote installation
if( scop == null ) {
logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version);
scop = new RemoteScopInstallation();
scop.setScopVersion(version);
versionedScopDBs.put(version,scop);
}
return scop;
}
} | java | public static ScopDatabase getSCOP(String version, boolean forceLocalData){
if( version == null ) {
version = defaultVersion;
}
ScopDatabase scop = versionedScopDBs.get(version);
if ( forceLocalData) {
// Use a local installation
if( scop == null || !(scop instanceof LocalScopDatabase) ) {
logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version);
BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation();
berkeley.setScopVersion(version);
versionedScopDBs.put(version,berkeley);
return berkeley;
}
return scop;
} else {
// Use a remote installation
if( scop == null ) {
logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version);
scop = new RemoteScopInstallation();
scop.setScopVersion(version);
versionedScopDBs.put(version,scop);
}
return scop;
}
} | [
"public",
"static",
"ScopDatabase",
"getSCOP",
"(",
"String",
"version",
",",
"boolean",
"forceLocalData",
")",
"{",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"version",
"=",
"defaultVersion",
";",
"}",
"ScopDatabase",
"scop",
"=",
"versionedScopDBs",
".",... | Gets an instance of the specified scop version.
<p>
The particular implementation returned is influenced by the <tt>forceLocalData</tt>
parameter. When false, the instance returned will generally be a
{@link RemoteScopInstallation}, although this may be influenced by
previous calls to this class. When true, the result is guaranteed to
implement {@link LocalScopDatabase} (generally a {@link BerkeleyScopInstallation}).
<p>
Note that
@param version A version number, such as {@link #VERSION_1_75A}
@param forceLocalData Whether to use a local installation or a remote installation
@return an | [
"Gets",
"an",
"instance",
"of",
"the",
"specified",
"scop",
"version",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopFactory.java#L136-L161 |
logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.newVariable | public Variable newVariable() {
if (this.miniSat == null && this.cleaneLing == null)
return this.f.newCCVariable();
else if (this.miniSat != null) {
final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index;
this.miniSat.underlyingSolver().addName(name, index);
return new EncodingAuxiliaryVariable(name, false);
} else
return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false);
} | java | public Variable newVariable() {
if (this.miniSat == null && this.cleaneLing == null)
return this.f.newCCVariable();
else if (this.miniSat != null) {
final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index;
this.miniSat.underlyingSolver().addName(name, index);
return new EncodingAuxiliaryVariable(name, false);
} else
return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false);
} | [
"public",
"Variable",
"newVariable",
"(",
")",
"{",
"if",
"(",
"this",
".",
"miniSat",
"==",
"null",
"&&",
"this",
".",
"cleaneLing",
"==",
"null",
")",
"return",
"this",
".",
"f",
".",
"newCCVariable",
"(",
")",
";",
"else",
"if",
"(",
"this",
".",
... | Returns a new auxiliary variable.
@return a new auxiliary variable | [
"Returns",
"a",
"new",
"auxiliary",
"variable",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L192-L202 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PhoneNumberValidator.java | PhoneNumberValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
// empty field is ok
return true;
}
return allowDin5008 && valueAsString.matches(PHONE_NUMBER_DIN5008) //
|| allowE123 && valueAsString.matches(PHONE_NUMBER_E123) //
|| allowUri && valueAsString.matches(PHONE_NUMBER_URI) //
|| allowMs && valueAsString.matches(PHONE_NUMBER_MS) //
|| allowCommon && valueAsString.matches(PHONE_NUMBER_COMMON);
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
// empty field is ok
return true;
}
return allowDin5008 && valueAsString.matches(PHONE_NUMBER_DIN5008) //
|| allowE123 && valueAsString.matches(PHONE_NUMBER_E123) //
|| allowUri && valueAsString.matches(PHONE_NUMBER_URI) //
|| allowMs && valueAsString.matches(PHONE_NUMBER_MS) //
|| allowCommon && valueAsString.matches(PHONE_NUMBER_COMMON);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"final",
"String",
"valueAsString",
"=",
"Objects",
".",
"toString",
"(",
"pvalue",
",",
"null",
")",
... | {@inheritDoc} check if given string is a valid gln.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"gln",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PhoneNumberValidator.java#L107-L120 |
windup/windup | rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java | FileContent.allInput | private void allInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store)
{
if (StringUtils.isBlank(getInputVariablesName()) && this.filenamePattern == null)
{
FileService fileModelService = new FileService(event.getGraphContext());
for (FileModel fileModel : fileModelService.findAll())
{
vertices.add(fileModel);
}
}
} | java | private void allInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store)
{
if (StringUtils.isBlank(getInputVariablesName()) && this.filenamePattern == null)
{
FileService fileModelService = new FileService(event.getGraphContext());
for (FileModel fileModel : fileModelService.findAll())
{
vertices.add(fileModel);
}
}
} | [
"private",
"void",
"allInput",
"(",
"List",
"<",
"FileModel",
">",
"vertices",
",",
"GraphRewrite",
"event",
",",
"ParameterStore",
"store",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"getInputVariablesName",
"(",
")",
")",
"&&",
"this",
".",
... | Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices
based on the attribute specified in specific order. This method generates all the vertices if there is no other way how to handle
the input. | [
"Generating",
"the",
"input",
"vertices",
"is",
"quite",
"complex",
".",
"Therefore",
"there",
"are",
"multiple",
"methods",
"that",
"handles",
"the",
"input",
"vertices",
"based",
"on",
"the",
"attribute",
"specified",
"in",
"specific",
"order",
".",
"This",
... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java#L330-L340 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java | ExecutorsUtils.newThreadFactory | public static ThreadFactory newThreadFactory(Optional<Logger> logger, Optional<String> nameFormat) {
return newThreadFactory(new ThreadFactoryBuilder(), logger, nameFormat);
} | java | public static ThreadFactory newThreadFactory(Optional<Logger> logger, Optional<String> nameFormat) {
return newThreadFactory(new ThreadFactoryBuilder(), logger, nameFormat);
} | [
"public",
"static",
"ThreadFactory",
"newThreadFactory",
"(",
"Optional",
"<",
"Logger",
">",
"logger",
",",
"Optional",
"<",
"String",
">",
"nameFormat",
")",
"{",
"return",
"newThreadFactory",
"(",
"new",
"ThreadFactoryBuilder",
"(",
")",
",",
"logger",
",",
... | Get a new {@link java.util.concurrent.ThreadFactory} that uses a {@link LoggingUncaughtExceptionHandler}
to handle uncaught exceptions and the given thread name format.
@param logger an {@link com.google.common.base.Optional} wrapping the {@link org.slf4j.Logger} that the
{@link LoggingUncaughtExceptionHandler} uses to log uncaught exceptions thrown in threads
@param nameFormat an {@link com.google.common.base.Optional} wrapping a thread naming format
@return a new {@link java.util.concurrent.ThreadFactory} | [
"Get",
"a",
"new",
"{",
"@link",
"java",
".",
"util",
".",
"concurrent",
".",
"ThreadFactory",
"}",
"that",
"uses",
"a",
"{",
"@link",
"LoggingUncaughtExceptionHandler",
"}",
"to",
"handle",
"uncaught",
"exceptions",
"and",
"the",
"given",
"thread",
"name",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java#L89-L91 |
alkacon/opencms-core | src-modules/org/opencms/workplace/list/A_CmsListDialog.java | A_CmsListDialog.setSearchAction | protected void setSearchAction(CmsListMetadata metadata, String columnId) {
CmsListColumnDefinition col = metadata.getColumnDefinition(columnId);
if ((columnId != null) && (col != null)) {
if (metadata.getSearchAction() == null) {
// makes the list searchable
CmsListSearchAction searchAction = new CmsListSearchAction(col);
searchAction.useDefaultShowAllAction();
metadata.setSearchAction(searchAction);
}
}
} | java | protected void setSearchAction(CmsListMetadata metadata, String columnId) {
CmsListColumnDefinition col = metadata.getColumnDefinition(columnId);
if ((columnId != null) && (col != null)) {
if (metadata.getSearchAction() == null) {
// makes the list searchable
CmsListSearchAction searchAction = new CmsListSearchAction(col);
searchAction.useDefaultShowAllAction();
metadata.setSearchAction(searchAction);
}
}
} | [
"protected",
"void",
"setSearchAction",
"(",
"CmsListMetadata",
"metadata",
",",
"String",
"columnId",
")",
"{",
"CmsListColumnDefinition",
"col",
"=",
"metadata",
".",
"getColumnDefinition",
"(",
"columnId",
")",
";",
"if",
"(",
"(",
"columnId",
"!=",
"null",
"... | Creates the default search action.<p>
Can be overridden for more sophisticated search.<p>
@param metadata the metadata of the list to do searchable
@param columnId the if of the column to search into | [
"Creates",
"the",
"default",
"search",
"action",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListDialog.java#L1117-L1128 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.buildRuns | public Collection<BuildRun> buildRuns(BuildRunFilter filter) {
return get(BuildRun.class, (filter != null) ? filter : new BuildRunFilter());
} | java | public Collection<BuildRun> buildRuns(BuildRunFilter filter) {
return get(BuildRun.class, (filter != null) ? filter : new BuildRunFilter());
} | [
"public",
"Collection",
"<",
"BuildRun",
">",
"buildRuns",
"(",
"BuildRunFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"BuildRun",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"BuildRunFilter",
"(",
")",
")",
";",
... | Get Build Runs filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"Build",
"Runs",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L294-L296 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.calculateScore | public double calculateScore(JavaRDD<DataSet> data, boolean average, int minibatchSize) {
JavaRDD<Tuple2<Integer, Double>> rdd = data.mapPartitions(new ScoreFlatMapFunctionCGDataSet(conf.toJson(),
sc.broadcast(network.params(false)), minibatchSize));
//Reduce to a single tuple, with example count + sum of scores
Tuple2<Integer, Double> countAndSumScores = rdd.reduce(new IntDoubleReduceFunction());
if (average) {
return countAndSumScores._2() / countAndSumScores._1();
} else {
return countAndSumScores._2();
}
} | java | public double calculateScore(JavaRDD<DataSet> data, boolean average, int minibatchSize) {
JavaRDD<Tuple2<Integer, Double>> rdd = data.mapPartitions(new ScoreFlatMapFunctionCGDataSet(conf.toJson(),
sc.broadcast(network.params(false)), minibatchSize));
//Reduce to a single tuple, with example count + sum of scores
Tuple2<Integer, Double> countAndSumScores = rdd.reduce(new IntDoubleReduceFunction());
if (average) {
return countAndSumScores._2() / countAndSumScores._1();
} else {
return countAndSumScores._2();
}
} | [
"public",
"double",
"calculateScore",
"(",
"JavaRDD",
"<",
"DataSet",
">",
"data",
",",
"boolean",
"average",
",",
"int",
"minibatchSize",
")",
"{",
"JavaRDD",
"<",
"Tuple2",
"<",
"Integer",
",",
"Double",
">",
">",
"rdd",
"=",
"data",
".",
"mapPartitions"... | Calculate the score for all examples in the provided {@code JavaRDD<DataSet>}, either by summing
or averaging over the entire data set. To calculate a score for each example individually, use {@link #scoreExamples(JavaPairRDD, boolean)}
or one of the similar methods
@param data Data to score
@param average Whether to sum the scores, or average them
@param minibatchSize The number of examples to use in each minibatch when scoring. If more examples are in a partition than
this, multiple scoring operations will be done (to avoid using too much memory by doing the whole partition
in one go) | [
"Calculate",
"the",
"score",
"for",
"all",
"examples",
"in",
"the",
"provided",
"{",
"@code",
"JavaRDD<DataSet",
">",
"}",
"either",
"by",
"summing",
"or",
"averaging",
"over",
"the",
"entire",
"data",
"set",
".",
"To",
"calculate",
"a",
"score",
"for",
"e... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L376-L387 |
gresrun/jesque | src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java | ReflectionUtils.createObject | public static <T> T createObject(final Class<T> clazz, final Object[] args, final Map<String,Object> vars)
throws NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException {
return invokeSetters(findConstructor(clazz, args).newInstance(args), vars);
} | java | public static <T> T createObject(final Class<T> clazz, final Object[] args, final Map<String,Object> vars)
throws NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException {
return invokeSetters(findConstructor(clazz, args).newInstance(args), vars);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createObject",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"vars",
")",
"throws",
"NoSuchConstructorException",
... | Create an object of the given type using a constructor that matches the
supplied arguments and invoke the setters with the supplied variables.
@param <T> the object type
@param clazz
the type to create
@param args
the arguments to the constructor
@param vars
the named arguments for setters
@return a new object of the given type, initialized with the given
arguments
@throws NoSuchConstructorException
if there is not a constructor that matches the given
arguments
@throws AmbiguousConstructorException
if there is more than one constructor that matches the given
arguments
@throws ReflectiveOperationException
if any of the reflective operations throw an exception | [
"Create",
"an",
"object",
"of",
"the",
"given",
"type",
"using",
"a",
"constructor",
"that",
"matches",
"the",
"supplied",
"arguments",
"and",
"invoke",
"the",
"setters",
"with",
"the",
"supplied",
"variables",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java#L145-L148 |
rometools/rome | rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java | ConverterForOPML10.copyInto | @Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
final Opml opml = (Opml) feed;
syndFeed.setTitle(opml.getTitle());
addOwner(opml, syndFeed);
syndFeed.setPublishedDate(opml.getModified() != null ? opml.getModified() : opml.getCreated());
syndFeed.setFeedType(opml.getFeedType());
syndFeed.setModules(opml.getModules());
syndFeed.setFeedType(getType());
createEntries(new Stack<Integer>(), syndFeed.getEntries(), opml.getOutlines());
} | java | @Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
final Opml opml = (Opml) feed;
syndFeed.setTitle(opml.getTitle());
addOwner(opml, syndFeed);
syndFeed.setPublishedDate(opml.getModified() != null ? opml.getModified() : opml.getCreated());
syndFeed.setFeedType(opml.getFeedType());
syndFeed.setModules(opml.getModules());
syndFeed.setFeedType(getType());
createEntries(new Stack<Integer>(), syndFeed.getEntries(), opml.getOutlines());
} | [
"@",
"Override",
"public",
"void",
"copyInto",
"(",
"final",
"WireFeed",
"feed",
",",
"final",
"SyndFeed",
"syndFeed",
")",
"{",
"final",
"Opml",
"opml",
"=",
"(",
"Opml",
")",
"feed",
";",
"syndFeed",
".",
"setTitle",
"(",
"opml",
".",
"getTitle",
"(",
... | Makes a deep copy/conversion of the values of a real feed into a SyndFeedImpl.
<p>
It assumes the given SyndFeedImpl has no properties set.
<p>
@param feed real feed to copy/convert.
@param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real feed. | [
"Makes",
"a",
"deep",
"copy",
"/",
"conversion",
"of",
"the",
"values",
"of",
"a",
"real",
"feed",
"into",
"a",
"SyndFeedImpl",
".",
"<p",
">",
"It",
"assumes",
"the",
"given",
"SyndFeedImpl",
"has",
"no",
"properties",
"set",
".",
"<p",
">"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java#L73-L84 |
graphql-java/graphql-java | src/main/java/graphql/execution/ExecutionStrategy.java | ExecutionStrategy.completeValueForScalar | protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLScalarType scalarType, Object result) {
Object serialized;
try {
serialized = scalarType.getCoercing().serialize(result);
} catch (CoercingSerializeException e) {
serialized = handleCoercionProblem(executionContext, parameters, e);
}
// TODO: fix that: this should not be handled here
//6.6.1 http://facebook.github.io/graphql/#sec-Field-entries
if (serialized instanceof Double && ((Double) serialized).isNaN()) {
serialized = null;
}
try {
serialized = parameters.getNonNullFieldValidator().validate(parameters.getPath(), serialized);
} catch (NonNullableFieldWasNullException e) {
return exceptionallyCompletedFuture(e);
}
return completedFuture(new ExecutionResultImpl(serialized, null));
} | java | protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLScalarType scalarType, Object result) {
Object serialized;
try {
serialized = scalarType.getCoercing().serialize(result);
} catch (CoercingSerializeException e) {
serialized = handleCoercionProblem(executionContext, parameters, e);
}
// TODO: fix that: this should not be handled here
//6.6.1 http://facebook.github.io/graphql/#sec-Field-entries
if (serialized instanceof Double && ((Double) serialized).isNaN()) {
serialized = null;
}
try {
serialized = parameters.getNonNullFieldValidator().validate(parameters.getPath(), serialized);
} catch (NonNullableFieldWasNullException e) {
return exceptionallyCompletedFuture(e);
}
return completedFuture(new ExecutionResultImpl(serialized, null));
} | [
"protected",
"CompletableFuture",
"<",
"ExecutionResult",
">",
"completeValueForScalar",
"(",
"ExecutionContext",
"executionContext",
",",
"ExecutionStrategyParameters",
"parameters",
",",
"GraphQLScalarType",
"scalarType",
",",
"Object",
"result",
")",
"{",
"Object",
"seri... | Called to turn an object into a scalar value according to the {@link GraphQLScalarType} by asking that scalar type to coerce the object
into a valid value
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@param scalarType the type of the scalar
@param result the result to be coerced
@return a promise to an {@link ExecutionResult} | [
"Called",
"to",
"turn",
"an",
"object",
"into",
"a",
"scalar",
"value",
"according",
"to",
"the",
"{",
"@link",
"GraphQLScalarType",
"}",
"by",
"asking",
"that",
"scalar",
"type",
"to",
"coerce",
"the",
"object",
"into",
"a",
"valid",
"value"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L558-L577 |
lets-blade/blade | src/main/java/com/blade/kit/PatternKit.java | PatternKit.isImage | public static boolean isImage(String suffix) {
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | java | public static boolean isImage(String suffix) {
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | [
"public",
"static",
"boolean",
"isImage",
"(",
"String",
"suffix",
")",
"{",
"if",
"(",
"null",
"!=",
"suffix",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"suffix",
")",
"&&",
"suffix",
".",
"contains",
"(",
"\".\"",
")",
")",
"{",
"String",
"regex",
"="... | Verify that the suffix is a picture format.
@param suffix filename suffix
@return verify that success returns true, and the failure returns false. | [
"Verify",
"that",
"the",
"suffix",
"is",
"a",
"picture",
"format",
"."
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/PatternKit.java#L61-L67 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java | CollectionUtils.asMultiValueMap | public static MultiValueMap asMultiValueMap(final String key, final Object value) {
return org.springframework.util.CollectionUtils.toMultiValueMap(wrap(key, value));
} | java | public static MultiValueMap asMultiValueMap(final String key, final Object value) {
return org.springframework.util.CollectionUtils.toMultiValueMap(wrap(key, value));
} | [
"public",
"static",
"MultiValueMap",
"asMultiValueMap",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"org",
".",
"springframework",
".",
"util",
".",
"CollectionUtils",
".",
"toMultiValueMap",
"(",
"wrap",
"(",
"key",
","... | As multi value map.
@param key the key
@param value the value
@return the multi value map | [
"As",
"multi",
"value",
"map",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java#L458-L460 |
zanata/openprops | src/main/java/org/fedorahosted/openprops/Properties.java | Properties.setRawComment | public void setRawComment(String key, String rawComment) {
if (rawComment == null)
throw new NullPointerException();
Entry entry = props.get(key);
if (entry == null) {
entry = new Entry(rawComment, null);
props.put(key, entry);
} else {
entry.setRawComment(rawComment);
}
} | java | public void setRawComment(String key, String rawComment) {
if (rawComment == null)
throw new NullPointerException();
Entry entry = props.get(key);
if (entry == null) {
entry = new Entry(rawComment, null);
props.put(key, entry);
} else {
entry.setRawComment(rawComment);
}
} | [
"public",
"void",
"setRawComment",
"(",
"String",
"key",
",",
"String",
"rawComment",
")",
"{",
"if",
"(",
"rawComment",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"Entry",
"entry",
"=",
"props",
".",
"get",
"(",
"key",
")"... | Sets the "raw" comment for the specified key. Each line of the
comment must be either empty, whitespace-only, or preceded by a
comment marker ("#" or "!"). This is not enforced by this class.
<br>
Note: if you set a comment, you must set a corresponding value before
calling store or storeToXML.
@param key property key whose comment should be set
@param rawComment raw comment to go with property key, "" for no comment | [
"Sets",
"the",
"raw",
"comment",
"for",
"the",
"specified",
"key",
".",
"Each",
"line",
"of",
"the",
"comment",
"must",
"be",
"either",
"empty",
"whitespace",
"-",
"only",
"or",
"preceded",
"by",
"a",
"comment",
"marker",
"(",
"#",
"or",
"!",
")",
".",... | train | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/src/main/java/org/fedorahosted/openprops/Properties.java#L1253-L1263 |
savoirtech/eos | core/src/main/java/com/savoirtech/eos/util/ServiceProperties.java | ServiceProperties.getProperty | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, T defaultValue) {
T value = (T) serviceReference.getProperty(key);
return value == null ? defaultValue : value;
} | java | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, T defaultValue) {
T value = (T) serviceReference.getProperty(key);
return value == null ? defaultValue : value;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getProperty",
"(",
"String",
"key",
",",
"T",
"defaultValue",
")",
"{",
"T",
"value",
"=",
"(",
"T",
")",
"serviceReference",
".",
"getProperty",
"(",
"key",
")",
";",
"... | Returns the service property value or the default value if the property is not present.
@param key the service property key
@param defaultValue the default value
@param <T> the property type
@return the property value or the default value
@throws ClassCastException if the service property is not of the specified type | [
"Returns",
"the",
"service",
"property",
"value",
"or",
"the",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"present",
"."
] | train | https://github.com/savoirtech/eos/blob/76c5c6b149d64adb15c5b85b9f0d75620117f54b/core/src/main/java/com/savoirtech/eos/util/ServiceProperties.java#L64-L68 |
jamesagnew/hapi-fhir | hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java | FhirServerImpl.unregisterOsgiProviders | @Override
public void unregisterOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
if (null == providers) {
throw new NullPointerException("FHIR Provider list cannot be null");
}
try {
for (Object provider : providers) {
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
this.serverProviders.remove(provider);
}
super.unregisterProvider(providers);
} catch (Exception e) {
log.error("Error unregistering FHIR Providers", e);
throw new FhirConfigurationException("Error unregistering FHIR Providers", e);
}
} | java | @Override
public void unregisterOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
if (null == providers) {
throw new NullPointerException("FHIR Provider list cannot be null");
}
try {
for (Object provider : providers) {
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
this.serverProviders.remove(provider);
}
super.unregisterProvider(providers);
} catch (Exception e) {
log.error("Error unregistering FHIR Providers", e);
throw new FhirConfigurationException("Error unregistering FHIR Providers", e);
}
} | [
"@",
"Override",
"public",
"void",
"unregisterOsgiProviders",
"(",
"Collection",
"<",
"Object",
">",
"providers",
")",
"throws",
"FhirConfigurationException",
"{",
"if",
"(",
"null",
"==",
"providers",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"FHIR... | Dynamically unregisters a list of providers with the RestfulServer
@param provider the providers to be unregistered
@throws FhirConfigurationException | [
"Dynamically",
"unregisters",
"a",
"list",
"of",
"providers",
"with",
"the",
"RestfulServer"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java#L125-L140 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/Minimap.java | Minimap.computeSheet | private void computeSheet(Map<TileRef, ColorRgba> colors, Integer sheet)
{
final SpriteTiled tiles = map.getSheet(sheet);
final ImageBuffer tilesSurface = tiles.getSurface();
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
int number = 0;
for (int i = 0; i < tilesSurface.getWidth(); i += tw)
{
for (int j = 0; j < tilesSurface.getHeight(); j += th)
{
final int h = number * tw % tiles.getWidth();
final int v = number / tiles.getTilesHorizontal() * th;
final ColorRgba color = UtilColor.getWeightedColor(tilesSurface, h, v, tw, th);
if (!(NO_TILE.equals(color) || color.getAlpha() == 0))
{
colors.put(new TileRef(sheet, number), color);
}
number++;
}
}
} | java | private void computeSheet(Map<TileRef, ColorRgba> colors, Integer sheet)
{
final SpriteTiled tiles = map.getSheet(sheet);
final ImageBuffer tilesSurface = tiles.getSurface();
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
int number = 0;
for (int i = 0; i < tilesSurface.getWidth(); i += tw)
{
for (int j = 0; j < tilesSurface.getHeight(); j += th)
{
final int h = number * tw % tiles.getWidth();
final int v = number / tiles.getTilesHorizontal() * th;
final ColorRgba color = UtilColor.getWeightedColor(tilesSurface, h, v, tw, th);
if (!(NO_TILE.equals(color) || color.getAlpha() == 0))
{
colors.put(new TileRef(sheet, number), color);
}
number++;
}
}
} | [
"private",
"void",
"computeSheet",
"(",
"Map",
"<",
"TileRef",
",",
"ColorRgba",
">",
"colors",
",",
"Integer",
"sheet",
")",
"{",
"final",
"SpriteTiled",
"tiles",
"=",
"map",
".",
"getSheet",
"(",
"sheet",
")",
";",
"final",
"ImageBuffer",
"tilesSurface",
... | Compute the current sheet.
@param colors The colors data.
@param sheet The sheet number. | [
"Compute",
"the",
"current",
"sheet",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/Minimap.java#L162-L185 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.addCache | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
assert size == found.entrySize;
assert localPath.equals(found.localPath);
found.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numAddExisting++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache updating path " + hdfsPath);
}
} else {
// We just inserted an entry in the cache. Increment the
// recorded size of the cache.
cacheSize.addAndGet(size);
localMetrics.numAddNew++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache add new path:" + hdfsPath +
" cachedPath:" + localPath +
" size " + size);
}
}
// check if we need to evict because cache is full
if (cacheSize.get() > cacheSizeMax) {
checkEvict();
}
} | java | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
assert size == found.entrySize;
assert localPath.equals(found.localPath);
found.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numAddExisting++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache updating path " + hdfsPath);
}
} else {
// We just inserted an entry in the cache. Increment the
// recorded size of the cache.
cacheSize.addAndGet(size);
localMetrics.numAddNew++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache add new path:" + hdfsPath +
" cachedPath:" + localPath +
" size " + size);
}
}
// check if we need to evict because cache is full
if (cacheSize.get() > cacheSizeMax) {
checkEvict();
}
} | [
"void",
"addCache",
"(",
"Path",
"hdfsPath",
",",
"Path",
"localPath",
",",
"long",
"size",
")",
"throws",
"IOException",
"{",
"localMetrics",
".",
"numAdd",
"++",
";",
"CacheEntry",
"c",
"=",
"new",
"CacheEntry",
"(",
"hdfsPath",
",",
"localPath",
",",
"s... | Adds an entry into the cache.
The size is the virtual size of this entry. | [
"Adds",
"an",
"entry",
"into",
"the",
"cache",
".",
"The",
"size",
"is",
"the",
"virtual",
"size",
"of",
"this",
"entry",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L199-L227 |
apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/view/attributes/DefaultCas30ProtocolAttributesRenderer.java | DefaultCas30ProtocolAttributesRenderer.buildSingleAttributeDefinitionLine | protected String buildSingleAttributeDefinitionLine(final String attributeName, final Object value) {
return new StringBuilder()
.append("<cas:".concat(attributeName).concat(">"))
.append(encodeAttributeValue(value))
.append("</cas:".concat(attributeName).concat(">"))
.toString();
} | java | protected String buildSingleAttributeDefinitionLine(final String attributeName, final Object value) {
return new StringBuilder()
.append("<cas:".concat(attributeName).concat(">"))
.append(encodeAttributeValue(value))
.append("</cas:".concat(attributeName).concat(">"))
.toString();
} | [
"protected",
"String",
"buildSingleAttributeDefinitionLine",
"(",
"final",
"String",
"attributeName",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"<cas:\"",
".",
"concat",
"(",
"attributeName",
")",
... | Build single attribute definition line.
@param attributeName the attribute name
@param value the value
@return the string | [
"Build",
"single",
"attribute",
"definition",
"line",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/view/attributes/DefaultCas30ProtocolAttributesRenderer.java#L45-L51 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateCompositeEntity | public OperationStatus updateCompositeEntity(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
return updateCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId, compositeModelUpdateObject).toBlocking().single().body();
} | java | public OperationStatus updateCompositeEntity(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
return updateCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId, compositeModelUpdateObject).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateCompositeEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"CompositeEntityModel",
"compositeModelUpdateObject",
")",
"{",
"return",
"updateCompositeEntityWithServiceResponseAsync",
"(",
"appId",
",... | Updates the composite entity extractor.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param compositeModelUpdateObject A model object containing the new entity extractor name and children.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"the",
"composite",
"entity",
"extractor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4029-L4031 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java | AbstractTTTLearner.refineHypothesisSingle | protected boolean refineHypothesisSingle(DefaultQuery<I, D> ceQuery) {
TTTState<I, D> state = getAnyState(ceQuery.getPrefix());
D out = computeHypothesisOutput(state, ceQuery.getSuffix());
if (Objects.equals(out, ceQuery.getOutput())) {
return false;
}
OutputInconsistency<I, D> outIncons =
new OutputInconsistency<>(state, ceQuery.getSuffix(), ceQuery.getOutput());
do {
splitState(outIncons);
closeTransitions();
while (finalizeAny()) {
closeTransitions();
}
outIncons = findOutputInconsistency();
} while (outIncons != null);
assert allNodesFinal();
return true;
} | java | protected boolean refineHypothesisSingle(DefaultQuery<I, D> ceQuery) {
TTTState<I, D> state = getAnyState(ceQuery.getPrefix());
D out = computeHypothesisOutput(state, ceQuery.getSuffix());
if (Objects.equals(out, ceQuery.getOutput())) {
return false;
}
OutputInconsistency<I, D> outIncons =
new OutputInconsistency<>(state, ceQuery.getSuffix(), ceQuery.getOutput());
do {
splitState(outIncons);
closeTransitions();
while (finalizeAny()) {
closeTransitions();
}
outIncons = findOutputInconsistency();
} while (outIncons != null);
assert allNodesFinal();
return true;
} | [
"protected",
"boolean",
"refineHypothesisSingle",
"(",
"DefaultQuery",
"<",
"I",
",",
"D",
">",
"ceQuery",
")",
"{",
"TTTState",
"<",
"I",
",",
"D",
">",
"state",
"=",
"getAnyState",
"(",
"ceQuery",
".",
"getPrefix",
"(",
")",
")",
";",
"D",
"out",
"="... | Performs a single refinement of the hypothesis, i.e., without repeated counterexample evaluation. The parameter
and return value have the same significance as in {@link #refineHypothesis(DefaultQuery)}.
@param ceQuery
the counterexample (query) to be used for refinement
@return {@code true} if the hypothesis was refined, {@code false} otherwise | [
"Performs",
"a",
"single",
"refinement",
"of",
"the",
"hypothesis",
"i",
".",
"e",
".",
"without",
"repeated",
"counterexample",
"evaluation",
".",
"The",
"parameter",
"and",
"return",
"value",
"have",
"the",
"same",
"significance",
"as",
"in",
"{",
"@link",
... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java#L200-L223 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForSubscriptionLevelPolicyAssignment | public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | java | public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | [
"public",
"SummarizeResultsInner",
"summarizeForSubscriptionLevelPolicyAssignment",
"(",
"String",
"subscriptionId",
",",
"String",
"policyAssignmentName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync",
... | Summarizes policy states for the subscription level policy assignment.
@param subscriptionId Microsoft Azure subscription ID.
@param policyAssignmentName Policy assignment name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2773-L2775 |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java | HelpView.initTopicTree | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | java | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | [
"private",
"void",
"initTopicTree",
"(",
"HelpTopicNode",
"htnParent",
",",
"TreeNode",
"ttnParent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ttnParent",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"TreeNode",
"ttnChild",... | Duplicates JavaHelp topic tree into HelpTopicNode-based tree.
@param htnParent Current parent for HelpTopicNode-based tree.
@param ttnParent Current parent for JavaHelp TreeNode-based tree. | [
"Duplicates",
"JavaHelp",
"topic",
"tree",
"into",
"HelpTopicNode",
"-",
"based",
"tree",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java#L83-L93 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/DateUtil.java | DateUtil.getFormatDate | public static String getFormatDate(String format, Date date, String zoneId) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
return dateTimeFormatter
.format(date.toInstant().atZone(ZoneId.of(zoneId)).toLocalDateTime());
} | java | public static String getFormatDate(String format, Date date, String zoneId) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
return dateTimeFormatter
.format(date.toInstant().atZone(ZoneId.of(zoneId)).toLocalDateTime());
} | [
"public",
"static",
"String",
"getFormatDate",
"(",
"String",
"format",
",",
"Date",
"date",
",",
"String",
"zoneId",
")",
"{",
"DateTimeFormatter",
"dateTimeFormatter",
"=",
"DateTimeFormatter",
".",
"ofPattern",
"(",
"format",
")",
";",
"return",
"dateTimeFormat... | 获取指定日期的指定格式的字符串,指定时区
@param format 日期格式
@param date 指定日期
@param zoneId 时区ID,例如GMT
@return 指定日期的指定格式的字符串 | [
"获取指定日期的指定格式的字符串,指定时区"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/DateUtil.java#L204-L208 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.arrayAppend | public <T> AsyncMutateInBuilder arrayAppend(String path, T value) {
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_LAST, path, value));
return this;
} | java | public <T> AsyncMutateInBuilder arrayAppend(String path, T value) {
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_LAST, path, value));
return this;
} | [
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"arrayAppend",
"(",
"String",
"path",
",",
"T",
"value",
")",
"{",
"this",
".",
"mutationSpecs",
".",
"add",
"(",
"new",
"MutationSpec",
"(",
"Mutation",
".",
"ARRAY_PUSH_LAST",
",",
"path",
",",
"value",
")... | Append to an existing array, pushing the value to the back/last position in
the array.
@param path the path of the array.
@param value the value to insert at the back of the array. | [
"Append",
"to",
"an",
"existing",
"array",
"pushing",
"the",
"value",
"to",
"the",
"back",
"/",
"last",
"position",
"in",
"the",
"array",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L984-L987 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.setPassword | public void setPassword(CmsDbContext dbc, String username, String newPassword)
throws CmsException, CmsIllegalArgumentException {
validatePassword(newPassword);
// read the user as a system user to verify that the specified old password is correct
CmsUser user = getUserDriver(dbc).readUser(dbc, username);
// only continue if not found and read user from web might succeed
getUserDriver(dbc).writePassword(dbc, username, null, newPassword);
user.getAdditionalInfo().put(
CmsUserSettings.ADDITIONAL_INFO_LAST_PASSWORD_CHANGE,
"" + System.currentTimeMillis());
getUserDriver(dbc).writeUser(dbc, user);
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD);
eventData.put(
I_CmsEventListener.KEY_USER_CHANGES,
Integer.valueOf(CmsUser.FLAG_CORE_DATA | CmsUser.FLAG_CORE_DATA));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
} | java | public void setPassword(CmsDbContext dbc, String username, String newPassword)
throws CmsException, CmsIllegalArgumentException {
validatePassword(newPassword);
// read the user as a system user to verify that the specified old password is correct
CmsUser user = getUserDriver(dbc).readUser(dbc, username);
// only continue if not found and read user from web might succeed
getUserDriver(dbc).writePassword(dbc, username, null, newPassword);
user.getAdditionalInfo().put(
CmsUserSettings.ADDITIONAL_INFO_LAST_PASSWORD_CHANGE,
"" + System.currentTimeMillis());
getUserDriver(dbc).writeUser(dbc, user);
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD);
eventData.put(
I_CmsEventListener.KEY_USER_CHANGES,
Integer.valueOf(CmsUser.FLAG_CORE_DATA | CmsUser.FLAG_CORE_DATA));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
} | [
"public",
"void",
"setPassword",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"username",
",",
"String",
"newPassword",
")",
"throws",
"CmsException",
",",
"CmsIllegalArgumentException",
"{",
"validatePassword",
"(",
"newPassword",
")",
";",
"// read the user as a system ... | Sets the password for a user.<p>
@param dbc the current database context
@param username the name of the user
@param newPassword the new password
@throws CmsException if operation was not successful
@throws CmsIllegalArgumentException if the user with the <code>username</code> was not found | [
"Sets",
"the",
"password",
"for",
"a",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8988-L9010 |
beanshell/beanshell | src/main/java/bsh/Reflect.java | Reflect.constructObject | static Object constructObject( Class<?> clas, Object[] args )
throws ReflectError, InvocationTargetException {
return constructObject(clas, null, args);
} | java | static Object constructObject( Class<?> clas, Object[] args )
throws ReflectError, InvocationTargetException {
return constructObject(clas, null, args);
} | [
"static",
"Object",
"constructObject",
"(",
"Class",
"<",
"?",
">",
"clas",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"ReflectError",
",",
"InvocationTargetException",
"{",
"return",
"constructObject",
"(",
"clas",
",",
"null",
",",
"args",
")",
";",
... | Primary object constructor
This method is simpler than those that must resolve general method
invocation because constructors are not inherited.
<p/>
This method determines whether to attempt to use non-public constructors
based on Capabilities.haveAccessibility() and will set the accessibilty
flag on the method as necessary.
<p/> | [
"Primary",
"object",
"constructor",
"This",
"method",
"is",
"simpler",
"than",
"those",
"that",
"must",
"resolve",
"general",
"method",
"invocation",
"because",
"constructors",
"are",
"not",
"inherited",
".",
"<p",
"/",
">",
"This",
"method",
"determines",
"whet... | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Reflect.java#L383-L386 |
maestrano/maestrano-java | src/main/java/com/maestrano/Maestrano.java | Maestrano.reloadConfiguration | public static Preset reloadConfiguration(String marketplace, Properties props) throws MnoConfigurationException {
Preset preset = new Preset(marketplace, props);
configurations.put(marketplace, preset);
return preset;
} | java | public static Preset reloadConfiguration(String marketplace, Properties props) throws MnoConfigurationException {
Preset preset = new Preset(marketplace, props);
configurations.put(marketplace, preset);
return preset;
} | [
"public",
"static",
"Preset",
"reloadConfiguration",
"(",
"String",
"marketplace",
",",
"Properties",
"props",
")",
"throws",
"MnoConfigurationException",
"{",
"Preset",
"preset",
"=",
"new",
"Preset",
"(",
"marketplace",
",",
"props",
")",
";",
"configurations",
... | reload the configuration for the given preset and overload the existing one if any
@throws MnoConfigurationException | [
"reload",
"the",
"configuration",
"for",
"the",
"given",
"preset",
"and",
"overload",
"the",
"existing",
"one",
"if",
"any"
] | train | https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/Maestrano.java#L144-L148 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java | SheetBindingErrors.pushNestedPath | public void pushNestedPath(final String subPath, final int index) {
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notMin(index, -1, "index");
pushNestedPath(String.format("%s[%d]", canonicalPath, index));
} | java | public void pushNestedPath(final String subPath, final int index) {
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notMin(index, -1, "index");
pushNestedPath(String.format("%s[%d]", canonicalPath, index));
} | [
"public",
"void",
"pushNestedPath",
"(",
"final",
"String",
"subPath",
",",
"final",
"int",
"index",
")",
"{",
"final",
"String",
"canonicalPath",
"=",
"normalizePath",
"(",
"subPath",
")",
";",
"ArgUtils",
".",
"notEmpty",
"(",
"subPath",
",",
"\"subPath\"",
... | 配列やリストなどのインデックス付きのパスを1つ下位に移動します。
@param subPath ネストするパス
@param index インデックス番号(0から始まります。)
@throws IllegalArgumentException {@literal subPath is empty or index < 0} | [
"配列やリストなどのインデックス付きのパスを1つ下位に移動します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L318-L324 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.objectFromClause | public static <T> T objectFromClause(Class<T> type, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectFromClause(c, type, clause, args));
} | java | public static <T> T objectFromClause(Class<T> type, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectFromClause(c, type, clause, args));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"objectFromClause",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"clause",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"objectFromClause"... | Gets an object using a from clause.
@param type The type of the desired object.
@param clause The WHERE clause.
@param args The arguments for the WHERE clause.
@param <T> The type of the object.
@return The object or {@code null} | [
"Gets",
"an",
"object",
"using",
"a",
"from",
"clause",
"."
] | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L56-L59 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L1_L4 | @Pure
public static Point2d L1_L4(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_4_N,
LAMBERT_4_C,
LAMBERT_4_XS,
LAMBERT_4_YS);
} | java | @Pure
public static Point2d L1_L4(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_4_N,
LAMBERT_4_C,
LAMBERT_4_XS,
LAMBERT_4_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"L1_L4",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_1_N",
",",
"LAMBERT_1_C",
",",
"LAMBERT_1_XS",
",",
... | This function convert France Lambert I coordinate to
France Lambert IV coordinate.
@param x is the coordinate in France Lambert I
@param y is the coordinate in France Lambert I
@return the France Lambert IV coordinate. | [
"This",
"function",
"convert",
"France",
"Lambert",
"I",
"coordinate",
"to",
"France",
"Lambert",
"IV",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L374-L387 |
josueeduardo/snappy | plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/util/SystemPropertyUtils.java | SystemPropertyUtils.resolvePlaceholders | public static String resolvePlaceholders(Properties properties, String text) {
if (text == null) {
return text;
}
return parseStringValue(properties, text, text, new HashSet<String>());
} | java | public static String resolvePlaceholders(Properties properties, String text) {
if (text == null) {
return text;
}
return parseStringValue(properties, text, text, new HashSet<String>());
} | [
"public",
"static",
"String",
"resolvePlaceholders",
"(",
"Properties",
"properties",
",",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
"text",
";",
"}",
"return",
"parseStringValue",
"(",
"properties",
",",
"text",
",",
... | Resolve ${...} placeholders in the given text, replacing them with corresponding
system property values.
@param properties a properties instance to use in addition to System
@param text the String to resolve
@return the resolved String
@throws IllegalArgumentException if there is an unresolvable placeholder
@see #PLACEHOLDER_PREFIX
@see #PLACEHOLDER_SUFFIX | [
"Resolve",
"$",
"{",
"...",
"}",
"placeholders",
"in",
"the",
"given",
"text",
"replacing",
"them",
"with",
"corresponding",
"system",
"property",
"values",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/util/SystemPropertyUtils.java#L84-L89 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.getDoubleParam | protected Double getDoubleParam(String paramName, String errorMessage) throws IOException {
return getDoubleParam(paramName, errorMessage, (Map<String, Object>) inputParams.get());
} | java | protected Double getDoubleParam(String paramName, String errorMessage) throws IOException {
return getDoubleParam(paramName, errorMessage, (Map<String, Object>) inputParams.get());
} | [
"protected",
"Double",
"getDoubleParam",
"(",
"String",
"paramName",
",",
"String",
"errorMessage",
")",
"throws",
"IOException",
"{",
"return",
"getDoubleParam",
"(",
"paramName",
",",
"errorMessage",
",",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"... | Convenience method for subclasses. Retrieves a double with the given parametername, even if that
parametercontent is actually a string containing a number or a long or an int or... Anything that
can be converted to a double is returned. uses the default parameterhashmap from this deserializer.
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided. | [
"Convenience",
"method",
"for",
"subclasses",
".",
"Retrieves",
"a",
"double",
"with",
"the",
"given",
"parametername",
"even",
"if",
"that",
"parametercontent",
"is",
"actually",
"a",
"string",
"containing",
"a",
"number",
"or",
"a",
"long",
"or",
"an",
"int"... | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L166-L168 |
phax/peppol-directory | peppol-directory-indexer/src/main/java/com/helger/pd/indexer/mgr/PDIndexerManager.java | PDIndexerManager.queueWorkItem | @Nonnull
public EChange queueWorkItem (@Nonnull final IParticipantIdentifier aParticipantID,
@Nonnull final EIndexerWorkItemType eType,
@Nonnull @Nonempty final String sOwnerID,
@Nonnull @Nonempty final String sRequestingHost)
{
// Build item
final IIndexerWorkItem aWorkItem = new IndexerWorkItem (aParticipantID, eType, sOwnerID, sRequestingHost);
// And queue it
return _queueUniqueWorkItem (aWorkItem);
} | java | @Nonnull
public EChange queueWorkItem (@Nonnull final IParticipantIdentifier aParticipantID,
@Nonnull final EIndexerWorkItemType eType,
@Nonnull @Nonempty final String sOwnerID,
@Nonnull @Nonempty final String sRequestingHost)
{
// Build item
final IIndexerWorkItem aWorkItem = new IndexerWorkItem (aParticipantID, eType, sOwnerID, sRequestingHost);
// And queue it
return _queueUniqueWorkItem (aWorkItem);
} | [
"@",
"Nonnull",
"public",
"EChange",
"queueWorkItem",
"(",
"@",
"Nonnull",
"final",
"IParticipantIdentifier",
"aParticipantID",
",",
"@",
"Nonnull",
"final",
"EIndexerWorkItemType",
"eType",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sOwnerID",
",",
... | Queue a new work item
@param aParticipantID
Participant ID to use.
@param eType
Action type.
@param sOwnerID
Owner of this action
@param sRequestingHost
Requesting host (IP address)
@return {@link EChange#UNCHANGED} if the item was queued,
{@link EChange#UNCHANGED} if this item is already in the queue! | [
"Queue",
"a",
"new",
"work",
"item"
] | train | https://github.com/phax/peppol-directory/blob/98da26da29fb7178371d6b029516cbf01be223fb/peppol-directory-indexer/src/main/java/com/helger/pd/indexer/mgr/PDIndexerManager.java#L256-L266 |
stratosphere/stratosphere | stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java | ExecutionEnvironment.generateSequence | public DataSource<Long> generateSequence(long from, long to) {
return fromParallelCollection(new NumberSequenceIterator(from, to), BasicTypeInfo.LONG_TYPE_INFO);
} | java | public DataSource<Long> generateSequence(long from, long to) {
return fromParallelCollection(new NumberSequenceIterator(from, to), BasicTypeInfo.LONG_TYPE_INFO);
} | [
"public",
"DataSource",
"<",
"Long",
">",
"generateSequence",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"return",
"fromParallelCollection",
"(",
"new",
"NumberSequenceIterator",
"(",
"from",
",",
"to",
")",
",",
"BasicTypeInfo",
".",
"LONG_TYPE_INFO",
... | Creates a new data set that contains a sequence of numbers. The data set will be created in parallel,
so there is no guarantee about the oder of the elements.
@param from The number to start at (inclusive).
@param to The number to stop at (inclusive).
@return A DataSet, containing all number in the {@code [from, to]} interval. | [
"Creates",
"a",
"new",
"data",
"set",
"that",
"contains",
"a",
"sequence",
"of",
"numbers",
".",
"The",
"data",
"set",
"will",
"be",
"created",
"in",
"parallel",
"so",
"there",
"is",
"no",
"guarantee",
"about",
"the",
"oder",
"of",
"the",
"elements",
"."... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java#L494-L496 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.loadMithraCache | public void loadMithraCache(List<MithraObjectPortal> portals, int threads) throws MithraBusinessException
{
this.configManager.loadMithraCache(portals, threads);
} | java | public void loadMithraCache(List<MithraObjectPortal> portals, int threads) throws MithraBusinessException
{
this.configManager.loadMithraCache(portals, threads);
} | [
"public",
"void",
"loadMithraCache",
"(",
"List",
"<",
"MithraObjectPortal",
">",
"portals",
",",
"int",
"threads",
")",
"throws",
"MithraBusinessException",
"{",
"this",
".",
"configManager",
".",
"loadMithraCache",
"(",
"portals",
",",
"threads",
")",
";",
"}"... | This method will load the cache of the object already initialized. A Collection is used
to keep track of the objects to load.
@param portals list of portals to load caches for
@param threads number of parallel threads to load
@throws MithraBusinessException if something goes wrong during the load | [
"This",
"method",
"will",
"load",
"the",
"cache",
"of",
"the",
"object",
"already",
"initialized",
".",
"A",
"Collection",
"is",
"used",
"to",
"keep",
"track",
"of",
"the",
"objects",
"to",
"load",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L735-L738 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/nativeio/NativeIO.java | NativeIO.ioprioSetIfPossible | public static void ioprioSetIfPossible(int classOfService, int data)
throws IOException {
if (nativeLoaded && ioprioPossible) {
if (classOfService == IOPRIO_CLASS_NONE) {
// ioprio is disabled.
return;
}
try {
ioprio_set(classOfService, data);
} catch (UnsupportedOperationException uoe) {
LOG.warn("ioprioSetIfPossible() failed", uoe);
ioprioPossible = false;
} catch (UnsatisfiedLinkError ule) {
LOG.warn("ioprioSetIfPossible() failed", ule);
ioprioPossible = false;
} catch (NativeIOException nie) {
LOG.warn("ioprioSetIfPossible() failed", nie);
throw nie;
}
}
} | java | public static void ioprioSetIfPossible(int classOfService, int data)
throws IOException {
if (nativeLoaded && ioprioPossible) {
if (classOfService == IOPRIO_CLASS_NONE) {
// ioprio is disabled.
return;
}
try {
ioprio_set(classOfService, data);
} catch (UnsupportedOperationException uoe) {
LOG.warn("ioprioSetIfPossible() failed", uoe);
ioprioPossible = false;
} catch (UnsatisfiedLinkError ule) {
LOG.warn("ioprioSetIfPossible() failed", ule);
ioprioPossible = false;
} catch (NativeIOException nie) {
LOG.warn("ioprioSetIfPossible() failed", nie);
throw nie;
}
}
} | [
"public",
"static",
"void",
"ioprioSetIfPossible",
"(",
"int",
"classOfService",
",",
"int",
"data",
")",
"throws",
"IOException",
"{",
"if",
"(",
"nativeLoaded",
"&&",
"ioprioPossible",
")",
"{",
"if",
"(",
"classOfService",
"==",
"IOPRIO_CLASS_NONE",
")",
"{",... | Call ioprio_set(class, data) for this thread.
@throws NativeIOException
if there is an error with the syscall | [
"Call",
"ioprio_set",
"(",
"class",
"data",
")",
"for",
"this",
"thread",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/nativeio/NativeIO.java#L289-L309 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java | Options.isLintSet | public boolean isLintSet(String s) {
// return true if either the specific option is enabled, or
// they are all enabled without the specific one being
// disabled
return
isSet(XLINT_CUSTOM, s) ||
(isSet(XLINT) || isSet(XLINT_CUSTOM, "all")) && isUnset(XLINT_CUSTOM, "-" + s);
} | java | public boolean isLintSet(String s) {
// return true if either the specific option is enabled, or
// they are all enabled without the specific one being
// disabled
return
isSet(XLINT_CUSTOM, s) ||
(isSet(XLINT) || isSet(XLINT_CUSTOM, "all")) && isUnset(XLINT_CUSTOM, "-" + s);
} | [
"public",
"boolean",
"isLintSet",
"(",
"String",
"s",
")",
"{",
"// return true if either the specific option is enabled, or",
"// they are all enabled without the specific one being",
"// disabled",
"return",
"isSet",
"(",
"XLINT_CUSTOM",
",",
"s",
")",
"||",
"(",
"isSet",
... | Check if the value for a lint option has been explicitly set, either with -Xlint:opt
or if all lint options have enabled and this one not disabled with -Xlint:-opt. | [
"Check",
"if",
"the",
"value",
"for",
"a",
"lint",
"option",
"has",
"been",
"explicitly",
"set",
"either",
"with",
"-",
"Xlint",
":",
"opt",
"or",
"if",
"all",
"lint",
"options",
"have",
"enabled",
"and",
"this",
"one",
"not",
"disabled",
"with",
"-",
... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java#L118-L125 |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java | ImageIOUtil.writeImage | public static boolean writeImage(BufferedImage image, String filename,
int dpi, float quality) throws IOException
{
File file = new File(filename);
FileOutputStream output = new FileOutputStream(file);
try
{
String formatName = filename.substring(filename.lastIndexOf('.') + 1);
return writeImage(image, formatName, output, dpi, quality);
}
finally
{
output.close();
}
} | java | public static boolean writeImage(BufferedImage image, String filename,
int dpi, float quality) throws IOException
{
File file = new File(filename);
FileOutputStream output = new FileOutputStream(file);
try
{
String formatName = filename.substring(filename.lastIndexOf('.') + 1);
return writeImage(image, formatName, output, dpi, quality);
}
finally
{
output.close();
}
} | [
"public",
"static",
"boolean",
"writeImage",
"(",
"BufferedImage",
"image",
",",
"String",
"filename",
",",
"int",
"dpi",
",",
"float",
"quality",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"filename",
")",
";",
"FileOutputSt... | Writes a buffered image to a file using the given image format.
See {@link #writeImage(BufferedImage image, String formatName,
OutputStream output, int dpi, float quality)} for more details.
@param image the image to be written
@param filename used to construct the filename for the individual image. Its suffix will be
used as the image format.
@param dpi the resolution in dpi (dots per inch) to be used in metadata
@param quality quality to be used when compressing the image (0 < quality < 1.0f)
@return true if the image file was produced, false if there was an error.
@throws IOException if an I/O error occurs | [
"Writes",
"a",
"buffered",
"image",
"to",
"a",
"file",
"using",
"the",
"given",
"image",
"format",
".",
"See",
"{",
"@link",
"#writeImage",
"(",
"BufferedImage",
"image",
"String",
"formatName",
"OutputStream",
"output",
"int",
"dpi",
"float",
"quality",
")",
... | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java#L81-L95 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java | JSField.copyValue | public Object copyValue(Object val, int indirect)
throws JMFSchemaViolationException {
if (indirect == 0)
return copy(val, 0);
else
return coder.copy(val, indirect - 1);
} | java | public Object copyValue(Object val, int indirect)
throws JMFSchemaViolationException {
if (indirect == 0)
return copy(val, 0);
else
return coder.copy(val, indirect - 1);
} | [
"public",
"Object",
"copyValue",
"(",
"Object",
"val",
",",
"int",
"indirect",
")",
"throws",
"JMFSchemaViolationException",
"{",
"if",
"(",
"indirect",
"==",
"0",
")",
"return",
"copy",
"(",
"val",
",",
"0",
")",
";",
"else",
"return",
"coder",
".",
"co... | Create a copy of the value of this JSField's type
@param val the value to be copied
@param indirect the list indirection that applies to the object or -1 if the
JSField's maximum list indirection (based on the number of JSRepeated nodes that
dominate it in the schema) is to be used: this, of course, includes the possibility
that it isn't a list at all.
@return a copy of val. This can be the original if the type for this field is immutable. | [
"Create",
"a",
"copy",
"of",
"the",
"value",
"of",
"this",
"JSField",
"s",
"type"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java#L239-L245 |
yidongnan/grpc-spring-boot-starter | grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java | CallCredentialsHelper.basicAuth | public static CallCredentials basicAuth(final String username, final String password) {
final Metadata extraHeaders = new Metadata();
extraHeaders.put(AUTHORIZATION_HEADER, encodeBasicAuth(username, password));
return new StaticSecurityHeaderCallCredentials(extraHeaders);
} | java | public static CallCredentials basicAuth(final String username, final String password) {
final Metadata extraHeaders = new Metadata();
extraHeaders.put(AUTHORIZATION_HEADER, encodeBasicAuth(username, password));
return new StaticSecurityHeaderCallCredentials(extraHeaders);
} | [
"public",
"static",
"CallCredentials",
"basicAuth",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"{",
"final",
"Metadata",
"extraHeaders",
"=",
"new",
"Metadata",
"(",
")",
";",
"extraHeaders",
".",
"put",
"(",
"AUTHORIZATION_HEAD... | Creates a new call credential with the given username and password for basic auth.
<p>
<b>Note:</b> This method uses experimental grpc-java-API features.
</p>
@param username The username to use.
@param password The password to use.
@return The newly created basic auth credentials. | [
"Creates",
"a",
"new",
"call",
"credential",
"with",
"the",
"given",
"username",
"and",
"password",
"for",
"basic",
"auth",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java#L187-L191 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/GeometrySerializer.java | GeometrySerializer.writeCrs | protected void writeCrs(JsonGenerator jgen, Geometry shape)
throws IOException {
/*
"crs": {
"type": "name",
"properties": {
"name": "EPSG:xxxx"
}
}
*/
if (shape.getSRID() > 0) {
jgen.writeFieldName("crs");
jgen.writeStartObject();
jgen.writeStringField("type", "name");
jgen.writeFieldName("properties");
jgen.writeStartObject();
jgen.writeStringField("name", "EPSG:" + shape.getSRID());
jgen.writeEndObject();
jgen.writeEndObject();
}
} | java | protected void writeCrs(JsonGenerator jgen, Geometry shape)
throws IOException {
/*
"crs": {
"type": "name",
"properties": {
"name": "EPSG:xxxx"
}
}
*/
if (shape.getSRID() > 0) {
jgen.writeFieldName("crs");
jgen.writeStartObject();
jgen.writeStringField("type", "name");
jgen.writeFieldName("properties");
jgen.writeStartObject();
jgen.writeStringField("name", "EPSG:" + shape.getSRID());
jgen.writeEndObject();
jgen.writeEndObject();
}
} | [
"protected",
"void",
"writeCrs",
"(",
"JsonGenerator",
"jgen",
",",
"Geometry",
"shape",
")",
"throws",
"IOException",
"{",
"/*\n \"crs\": {\n \"type\": \"name\",\n \"properties\": {\n \"name\": \"EPSG:xxxx\"\n }\n }... | Writes out the crs information in the GeoJSON string
@param jgen the jsongenerator used for the geojson construction
@param shape the geometry for which the contents is to be retrieved
@throws java.io.IOException If the underlying jsongenerator fails writing the contents | [
"Writes",
"out",
"the",
"crs",
"information",
"in",
"the",
"GeoJSON",
"string"
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometrySerializer.java#L125-L145 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/EJBWrapper.java | EJBWrapper.addAfterDeliveryMethod | private static void addAfterDeliveryMethod(ClassWriter cw,
String implClassName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, INDENT + "adding method : afterDelivery ()V");
// -----------------------------------------------------------------------
// public void afterDelivery() throws ResourceException
// {
// -----------------------------------------------------------------------
final String desc = "()V";
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "afterDelivery", desc, null, new String[] { "javax/resource/ResourceException" });
GeneratorAdapter mg = new GeneratorAdapter(mv, ACC_PUBLIC, "afterDelivery", desc);
mg.visitCode();
// -----------------------------------------------------------------------
// this.ivMessageEndpointBase.afterDelivery();
// -----------------------------------------------------------------------
mg.loadThis();
mg.visitFieldInsn(GETFIELD, implClassName, MESSAGE_ENDPOINT_BASE_FIELD,
MESSAGE_ENDPOINT_BASE_FIELD_TYPE);
mg.visitMethodInsn(INVOKEVIRTUAL, MESSAGE_ENDPOINT_BASE_STRING,
"afterDelivery",
desc);
mg.returnValue();
// -----------------------------------------------------------------------
// }
// -----------------------------------------------------------------------
mg.endMethod();
mg.visitEnd();
} | java | private static void addAfterDeliveryMethod(ClassWriter cw,
String implClassName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, INDENT + "adding method : afterDelivery ()V");
// -----------------------------------------------------------------------
// public void afterDelivery() throws ResourceException
// {
// -----------------------------------------------------------------------
final String desc = "()V";
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "afterDelivery", desc, null, new String[] { "javax/resource/ResourceException" });
GeneratorAdapter mg = new GeneratorAdapter(mv, ACC_PUBLIC, "afterDelivery", desc);
mg.visitCode();
// -----------------------------------------------------------------------
// this.ivMessageEndpointBase.afterDelivery();
// -----------------------------------------------------------------------
mg.loadThis();
mg.visitFieldInsn(GETFIELD, implClassName, MESSAGE_ENDPOINT_BASE_FIELD,
MESSAGE_ENDPOINT_BASE_FIELD_TYPE);
mg.visitMethodInsn(INVOKEVIRTUAL, MESSAGE_ENDPOINT_BASE_STRING,
"afterDelivery",
desc);
mg.returnValue();
// -----------------------------------------------------------------------
// }
// -----------------------------------------------------------------------
mg.endMethod();
mg.visitEnd();
} | [
"private",
"static",
"void",
"addAfterDeliveryMethod",
"(",
"ClassWriter",
"cw",
",",
"String",
"implClassName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
... | Adds a definition for an afterDelivery() wrapper method that invokes
MessageEndpointBase.afterDelivery(). It is only needed for no-method
Interface MDB's. Otherwise, MessageEndpointBase.afterDelivery()
is inherited.
@param cw ASM ClassWriter to add the method to.
@param implClassName name of the wrapper class being generated. | [
"Adds",
"a",
"definition",
"for",
"an",
"afterDelivery",
"()",
"wrapper",
"method",
"that",
"invokes",
"MessageEndpointBase",
".",
"afterDelivery",
"()",
".",
"It",
"is",
"only",
"needed",
"for",
"no",
"-",
"method",
"Interface",
"MDB",
"s",
".",
"Otherwise",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/EJBWrapper.java#L811-L842 |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.addThread | @Deprecated
protected void addThread(Runnable command) {
Worker worker;
if (_isDecoratedZOS) // 331761A
worker = new DecoratedZOSWorker(command, threadid++); // 331761A
else
// 331761A
worker = new Worker(command, threadid++); // LIDB1855-58
// D527355.3 - If the current thread is an application thread, then the
// creation of a new thread will copy the application class loader as the
// context class loader. If the new thread is long-lived in this pool, the
// application class loader will be leaked.
if (contextClassLoader != null && THREAD_CONTEXT_ACCESSOR.getContextClassLoader(worker) != contextClassLoader) {
THREAD_CONTEXT_ACCESSOR.setContextClassLoader(worker, contextClassLoader);
}
Thread.interrupted(); // PK27301
threads_.put(worker, worker);
++poolSize_;
++activeThreads;
// PK77809 Tell the buffer that we have created a new thread waiting for
// work
if (command == null) {
requestBuffer.incrementWaitingThreads();
}
// must fire before it is started
fireThreadCreated(poolSize_);
try {
worker.start();
} catch (OutOfMemoryError error) {
// 394200 - If an OutOfMemoryError is thrown because too many threads
// have already been created, undo everything we've done.
// Alex Ffdc.log(error, this, ThreadPool.class.getName(), "626"); //
// D477704.2
threads_.remove(worker);
--poolSize_;
--activeThreads;
fireThreadDestroyed(poolSize_);
throw error;
}
} | java | @Deprecated
protected void addThread(Runnable command) {
Worker worker;
if (_isDecoratedZOS) // 331761A
worker = new DecoratedZOSWorker(command, threadid++); // 331761A
else
// 331761A
worker = new Worker(command, threadid++); // LIDB1855-58
// D527355.3 - If the current thread is an application thread, then the
// creation of a new thread will copy the application class loader as the
// context class loader. If the new thread is long-lived in this pool, the
// application class loader will be leaked.
if (contextClassLoader != null && THREAD_CONTEXT_ACCESSOR.getContextClassLoader(worker) != contextClassLoader) {
THREAD_CONTEXT_ACCESSOR.setContextClassLoader(worker, contextClassLoader);
}
Thread.interrupted(); // PK27301
threads_.put(worker, worker);
++poolSize_;
++activeThreads;
// PK77809 Tell the buffer that we have created a new thread waiting for
// work
if (command == null) {
requestBuffer.incrementWaitingThreads();
}
// must fire before it is started
fireThreadCreated(poolSize_);
try {
worker.start();
} catch (OutOfMemoryError error) {
// 394200 - If an OutOfMemoryError is thrown because too many threads
// have already been created, undo everything we've done.
// Alex Ffdc.log(error, this, ThreadPool.class.getName(), "626"); //
// D477704.2
threads_.remove(worker);
--poolSize_;
--activeThreads;
fireThreadDestroyed(poolSize_);
throw error;
}
} | [
"@",
"Deprecated",
"protected",
"void",
"addThread",
"(",
"Runnable",
"command",
")",
"{",
"Worker",
"worker",
";",
"if",
"(",
"_isDecoratedZOS",
")",
"// 331761A",
"worker",
"=",
"new",
"DecoratedZOSWorker",
"(",
"command",
",",
"threadid",
"++",
")",
";",
... | Create and start a thread to handle a new command. Call only
when holding lock.
@deprecated This will be private in a future release. | [
"Create",
"and",
"start",
"a",
"thread",
"to",
"handle",
"a",
"new",
"command",
".",
"Call",
"only",
"when",
"holding",
"lock",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L633-L676 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java | Long.remainderUnsigned | public static long remainderUnsigned(long dividend, long divisor) {
if (dividend > 0 && divisor > 0) { // signed comparisons
return dividend % divisor;
} else {
if (compareUnsigned(dividend, divisor) < 0) // Avoid explicit check for 0 divisor
return dividend;
else
return toUnsignedBigInteger(dividend).
remainder(toUnsignedBigInteger(divisor)).longValue();
}
} | java | public static long remainderUnsigned(long dividend, long divisor) {
if (dividend > 0 && divisor > 0) { // signed comparisons
return dividend % divisor;
} else {
if (compareUnsigned(dividend, divisor) < 0) // Avoid explicit check for 0 divisor
return dividend;
else
return toUnsignedBigInteger(dividend).
remainder(toUnsignedBigInteger(divisor)).longValue();
}
} | [
"public",
"static",
"long",
"remainderUnsigned",
"(",
"long",
"dividend",
",",
"long",
"divisor",
")",
"{",
"if",
"(",
"dividend",
">",
"0",
"&&",
"divisor",
">",
"0",
")",
"{",
"// signed comparisons",
"return",
"dividend",
"%",
"divisor",
";",
"}",
"else... | Returns the unsigned remainder from dividing the first argument
by the second where each argument and the result is interpreted
as an unsigned value.
@param dividend the value to be divided
@param divisor the value doing the dividing
@return the unsigned remainder of the first argument divided by
the second argument
@see #divideUnsigned
@since 1.8 | [
"Returns",
"the",
"unsigned",
"remainder",
"from",
"dividing",
"the",
"first",
"argument",
"by",
"the",
"second",
"where",
"each",
"argument",
"and",
"the",
"result",
"is",
"interpreted",
"as",
"an",
"unsigned",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L1171-L1181 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.