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 |
|---|---|---|---|---|---|---|---|---|---|---|
matthewhorridge/binaryowl | src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java | BinaryOWLMetadata.getValue | private <O> O getValue(Map<String, O> nameValueMap, String attributeName, O defaultValue) {
if(attributeName == null) {
throw new NullPointerException("name must not be null");
}
if(nameValueMap == null) {
return defaultValue;
}
O value = nameValueMap.get(attributeName);
if(value == null) {
return defaultValue;
}
return value;
} | java | private <O> O getValue(Map<String, O> nameValueMap, String attributeName, O defaultValue) {
if(attributeName == null) {
throw new NullPointerException("name must not be null");
}
if(nameValueMap == null) {
return defaultValue;
}
O value = nameValueMap.get(attributeName);
if(value == null) {
return defaultValue;
}
return value;
} | [
"private",
"<",
"O",
">",
"O",
"getValue",
"(",
"Map",
"<",
"String",
",",
"O",
">",
"nameValueMap",
",",
"String",
"attributeName",
",",
"O",
"defaultValue",
")",
"{",
"if",
"(",
"attributeName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExcep... | Gets the value, or default value, of an attribute.
@param nameValueMap The name attribute value map which maps attribute names to attribute values.
@param attributeName The name of the attribute to retrieve.
@param defaultValue A default value, which will be returned if there is no set value for the specified attribute
name in the specified attribute name value map.
@param <O> The type of attribute value
@return The attribute value that is set for the specified name in the specified map, or the value specified by
the defaultValue parameter if no attribute with the specified name is set in the specified map. | [
"Gets",
"the",
"value",
"or",
"default",
"value",
"of",
"an",
"attribute",
"."
] | train | https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L178-L190 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/executors/ScalingThreadPoolExecutor.java | ScalingThreadPoolExecutor.newScalingThreadPool | public static ScalingThreadPoolExecutor newScalingThreadPool(int min, int max, long keepAliveTime,
ThreadFactory threadFactory) {
ScalingQueue queue = new ScalingQueue();
ScalingThreadPoolExecutor executor =
new ScalingThreadPoolExecutor(min, max, keepAliveTime, TimeUnit.MILLISECONDS, queue, threadFactory);
executor.setRejectedExecutionHandler(new ForceQueuePolicy());
queue.setThreadPoolExecutor(executor);
return executor;
} | java | public static ScalingThreadPoolExecutor newScalingThreadPool(int min, int max, long keepAliveTime,
ThreadFactory threadFactory) {
ScalingQueue queue = new ScalingQueue();
ScalingThreadPoolExecutor executor =
new ScalingThreadPoolExecutor(min, max, keepAliveTime, TimeUnit.MILLISECONDS, queue, threadFactory);
executor.setRejectedExecutionHandler(new ForceQueuePolicy());
queue.setThreadPoolExecutor(executor);
return executor;
} | [
"public",
"static",
"ScalingThreadPoolExecutor",
"newScalingThreadPool",
"(",
"int",
"min",
",",
"int",
"max",
",",
"long",
"keepAliveTime",
",",
"ThreadFactory",
"threadFactory",
")",
"{",
"ScalingQueue",
"queue",
"=",
"new",
"ScalingQueue",
"(",
")",
";",
"Scali... | Creates a {@link ScalingThreadPoolExecutor}.
@param min Core thread pool size.
@param max Max number of threads allowed.
@param keepAliveTime Keep alive time for unused threads in milliseconds.
@param threadFactory thread factory to use.
@return A {@link ScalingThreadPoolExecutor}. | [
"Creates",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/executors/ScalingThreadPoolExecutor.java#L52-L60 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.compileStatement | public SQLiteStatement compileStatement(String sql) throws SQLException {
acquireReference();
try {
return new SQLiteStatement(this, sql, null);
} finally {
releaseReference();
}
} | java | public SQLiteStatement compileStatement(String sql) throws SQLException {
acquireReference();
try {
return new SQLiteStatement(this, sql, null);
} finally {
releaseReference();
}
} | [
"public",
"SQLiteStatement",
"compileStatement",
"(",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"acquireReference",
"(",
")",
";",
"try",
"{",
"return",
"new",
"SQLiteStatement",
"(",
"this",
",",
"sql",
",",
"null",
")",
";",
"}",
"finally",
"{",... | Compiles an SQL statement into a reusable pre-compiled statement object.
The parameters are identical to {@link #execSQL(String)}. You may put ?s in the
statement and fill in those values with {@link SQLiteProgram#bindString}
and {@link SQLiteProgram#bindLong} each time you want to run the
statement. Statements may not return result sets larger than 1x1.
<p>
No two threads should be using the same {@link SQLiteStatement} at the same time.
@param sql The raw SQL statement, may contain ? for unknown values to be
bound later.
@return A pre-compiled {@link SQLiteStatement} object. Note that
{@link SQLiteStatement}s are not synchronized, see the documentation for more details. | [
"Compiles",
"an",
"SQL",
"statement",
"into",
"a",
"reusable",
"pre",
"-",
"compiled",
"statement",
"object",
".",
"The",
"parameters",
"are",
"identical",
"to",
"{",
"@link",
"#execSQL",
"(",
"String",
")",
"}",
".",
"You",
"may",
"put",
"?s",
"in",
"th... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L995-L1002 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Parameters.java | Parameters.setArray | @NonNull
public Parameters setArray(@NonNull String name, Array value) {
return setValue(name, value);
} | java | @NonNull
public Parameters setArray(@NonNull String name, Array value) {
return setValue(name, value);
} | [
"@",
"NonNull",
"public",
"Parameters",
"setArray",
"(",
"@",
"NonNull",
"String",
"name",
",",
"Array",
"value",
")",
"{",
"return",
"setValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the Array value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The Array value.
@return The self object. | [
"Set",
"the",
"Array",
"value",
"to",
"the",
"query",
"parameter",
"referenced",
"by",
"the",
"given",
"name",
".",
"A",
"query",
"parameter",
"is",
"defined",
"by",
"using",
"the",
"Expression",
"s",
"parameter",
"(",
"String",
"name",
")",
"function",
".... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L209-L212 |
SonarSource/sonarqube | server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java | SQProcess.stop | public void stop(long timeout, TimeUnit timeoutUnit) {
if (lifecycle.tryToMoveTo(Lifecycle.State.STOPPING)) {
stopGracefully(timeout, timeoutUnit);
if (process != null && process.isAlive()) {
LOG.info("{} failed to stop in a timely fashion. Killing it.", processId.getKey());
}
// enforce stop and clean-up even if process has been gracefully stopped
stopForcibly();
} else {
// already stopping or stopped
waitForDown();
}
} | java | public void stop(long timeout, TimeUnit timeoutUnit) {
if (lifecycle.tryToMoveTo(Lifecycle.State.STOPPING)) {
stopGracefully(timeout, timeoutUnit);
if (process != null && process.isAlive()) {
LOG.info("{} failed to stop in a timely fashion. Killing it.", processId.getKey());
}
// enforce stop and clean-up even if process has been gracefully stopped
stopForcibly();
} else {
// already stopping or stopped
waitForDown();
}
} | [
"public",
"void",
"stop",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeoutUnit",
")",
"{",
"if",
"(",
"lifecycle",
".",
"tryToMoveTo",
"(",
"Lifecycle",
".",
"State",
".",
"STOPPING",
")",
")",
"{",
"stopGracefully",
"(",
"timeout",
",",
"timeoutUnit",
")... | Sends kill signal and awaits termination. No guarantee that process is gracefully terminated (=shutdown hooks
executed). It depends on OS. | [
"Sends",
"kill",
"signal",
"and",
"awaits",
"termination",
".",
"No",
"guarantee",
"that",
"process",
"is",
"gracefully",
"terminated",
"(",
"=",
"shutdown",
"hooks",
"executed",
")",
".",
"It",
"depends",
"on",
"OS",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java#L98-L110 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_instanceId_resume_POST | public void project_serviceName_instance_instanceId_resume_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/resume";
StringBuilder sb = path(qPath, serviceName, instanceId);
exec(qPath, "POST", sb.toString(), null);
} | java | public void project_serviceName_instance_instanceId_resume_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/resume";
StringBuilder sb = path(qPath, serviceName, instanceId);
exec(qPath, "POST", sb.toString(), null);
} | [
"public",
"void",
"project_serviceName_instance_instanceId_resume_POST",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}/resume\"",
";",
"StringBuilder",
... | Resume a suspended instance
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/resume
@param instanceId [required] Instance id
@param serviceName [required] Service name | [
"Resume",
"a",
"suspended",
"instance"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2001-L2005 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java | IndexChangeAdapters.forNodeName | public static IndexChangeAdapter forNodeName( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
ProvidedIndex<?> index ) {
return new NodeNameChangeAdapter(context, matcher, workspaceName, index);
} | java | public static IndexChangeAdapter forNodeName( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
ProvidedIndex<?> index ) {
return new NodeNameChangeAdapter(context, matcher, workspaceName, index);
} | [
"public",
"static",
"IndexChangeAdapter",
"forNodeName",
"(",
"ExecutionContext",
"context",
",",
"NodeTypePredicate",
"matcher",
",",
"String",
"workspaceName",
",",
"ProvidedIndex",
"<",
"?",
">",
"index",
")",
"{",
"return",
"new",
"NodeNameChangeAdapter",
"(",
"... | Create an {@link IndexChangeAdapter} implementation that handles the "jcr:name" property.
@param context the execution context; may not be null
@param matcher the node type matcher used to determine which nodes should be included in the index; may not be null
@param workspaceName the name of the workspace; may not be null
@param index the local index that should be used; may not be null
@return the new {@link IndexChangeAdapter}; never null | [
"Create",
"an",
"{",
"@link",
"IndexChangeAdapter",
"}",
"implementation",
"that",
"handles",
"the",
"jcr",
":",
"name",
"property",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L96-L101 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/extension/std/XCostExtension.java | XCostExtension.assignAmounts | public void assignAmounts(XEvent event, Map<String, Double> amounts) {
XCostAmount.instance().assignValues(event, amounts);
} | java | public void assignAmounts(XEvent event, Map<String, Double> amounts) {
XCostAmount.instance().assignValues(event, amounts);
} | [
"public",
"void",
"assignAmounts",
"(",
"XEvent",
"event",
",",
"Map",
"<",
"String",
",",
"Double",
">",
"amounts",
")",
"{",
"XCostAmount",
".",
"instance",
"(",
")",
".",
"assignValues",
"(",
"event",
",",
"amounts",
")",
";",
"}"
] | Assigns (to the given event) multiple amounts given their keys. Note that
as a side effect this method creates attributes when it does not find an
attribute with the proper key.
For example, the call:
<pre>
assignAmounts(event, [[a 10.00] [b 15.00] [c 25.00]])
</pre>
should result into the following XES fragment:
<pre>
{@code
<event>
<string key="a" value="">
<float key="cost:amount" value="10.00"/>
</string>
<string key="b" value="">
<float key="cost:amount" value="15.00"/>
</string>
<string key="c" value="">
<float key="cost:amount" value="25.00"/>
</string>
</event>
}
</pre>
@param event
Event to assign the amounts to.
@param amounts
Mapping from keys to amounts which are to be assigned. | [
"Assigns",
"(",
"to",
"the",
"given",
"event",
")",
"multiple",
"amounts",
"given",
"their",
"keys",
".",
"Note",
"that",
"as",
"a",
"side",
"effect",
"this",
"method",
"creates",
"attributes",
"when",
"it",
"does",
"not",
"find",
"an",
"attribute",
"with"... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L608-L610 |
jpmml/jpmml-sklearn | src/main/java/numpy/core/NDArrayUtil.java | NDArrayUtil.getContent | static
public List<?> getContent(NDArray array, String key){
Map<String, ?> content = (Map<String, ?>)array.getContent();
return asJavaList(array, (List<?>)content.get(key));
} | java | static
public List<?> getContent(NDArray array, String key){
Map<String, ?> content = (Map<String, ?>)array.getContent();
return asJavaList(array, (List<?>)content.get(key));
} | [
"static",
"public",
"List",
"<",
"?",
">",
"getContent",
"(",
"NDArray",
"array",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"?",
">",
"content",
"=",
"(",
"Map",
"<",
"String",
",",
"?",
">",
")",
"array",
".",
"getContent",
"(",
... | Gets the payload of the specified dimension of a multi-dimensional array.
@param key The dimension. | [
"Gets",
"the",
"payload",
"of",
"the",
"specified",
"dimension",
"of",
"a",
"multi",
"-",
"dimensional",
"array",
"."
] | train | https://github.com/jpmml/jpmml-sklearn/blob/6cd8bbd44faa4344857c085defa71d49cb663406/src/main/java/numpy/core/NDArrayUtil.java#L71-L76 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java | Packer.setInsetRight | public Packer setInsetRight(final int val) {
Insets i = gc.insets;
if (i == null) {
i = new Insets(0, 0, 0, 0);
}
gc.insets = new Insets(i.top, i.left, i.bottom, val);
setConstraints(comp, gc);
return this;
} | java | public Packer setInsetRight(final int val) {
Insets i = gc.insets;
if (i == null) {
i = new Insets(0, 0, 0, 0);
}
gc.insets = new Insets(i.top, i.left, i.bottom, val);
setConstraints(comp, gc);
return this;
} | [
"public",
"Packer",
"setInsetRight",
"(",
"final",
"int",
"val",
")",
"{",
"Insets",
"i",
"=",
"gc",
".",
"insets",
";",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"i",
"=",
"new",
"Insets",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}",... | sets right Insets on the constraints for the current component to the
value specified. | [
"sets",
"right",
"Insets",
"on",
"the",
"constraints",
"for",
"the",
"current",
"component",
"to",
"the",
"value",
"specified",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L869-L877 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java | KafkaUtils.getPartitionAvgRecordSize | public static long getPartitionAvgRecordSize(State state, KafkaPartition partition) {
return state.getPropAsLong(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_SIZE);
} | java | public static long getPartitionAvgRecordSize(State state, KafkaPartition partition) {
return state.getPropAsLong(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_SIZE);
} | [
"public",
"static",
"long",
"getPartitionAvgRecordSize",
"(",
"State",
"state",
",",
"KafkaPartition",
"partition",
")",
"{",
"return",
"state",
".",
"getPropAsLong",
"(",
"getPartitionPropName",
"(",
"partition",
".",
"getTopicName",
"(",
")",
",",
"partition",
"... | Get the average record size of a partition, which is stored in property "[topicname].[partitionid].avg.record.size".
If state doesn't contain this property, it returns defaultSize. | [
"Get",
"the",
"average",
"record",
"size",
"of",
"a",
"partition",
"which",
"is",
"stored",
"in",
"property",
"[",
"topicname",
"]",
".",
"[",
"partitionid",
"]",
".",
"avg",
".",
"record",
".",
"size",
".",
"If",
"state",
"doesn",
"t",
"contain",
"thi... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java#L120-L123 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addSizeGreaterThanOrEqualToCondition | protected void addSizeGreaterThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().ge(propertySizeExpression, size));
} | java | protected void addSizeGreaterThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().ge(propertySizeExpression, size));
} | [
"protected",
"void",
"addSizeGreaterThanOrEqualToCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Integer",
"size",
")",
"{",
"final",
"Expression",
"<",
"Integer",
">",
"propertySizeExpression",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"size",
"(... | Add a Field Search Condition that will check if the size of a collection in an entity is greater than or equal to the
specified size.
@param propertyName The name of the collection as defined in the Entity mapping class.
@param size The size that the collection should be greater than or equal to. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"size",
"of",
"a",
"collection",
"in",
"an",
"entity",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"specified",
"size",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L247-L250 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.setTypeMap | public final void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set TypeMap to " + typeMap);
try{
sqlConn.setTypeMap(typeMap);
} catch(SQLFeatureNotSupportedException nse){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "supportsGetTypeMap false due to ", nse);
mcf.supportsGetTypeMap = false;
throw nse;
} catch(UnsupportedOperationException uoe){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "supportsGetTypeMap false due to ", uoe);
mcf.supportsGetTypeMap = false;
throw uoe;
}
connectionPropertyChanged = true;
} | java | public final void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set TypeMap to " + typeMap);
try{
sqlConn.setTypeMap(typeMap);
} catch(SQLFeatureNotSupportedException nse){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "supportsGetTypeMap false due to ", nse);
mcf.supportsGetTypeMap = false;
throw nse;
} catch(UnsupportedOperationException uoe){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "supportsGetTypeMap false due to ", uoe);
mcf.supportsGetTypeMap = false;
throw uoe;
}
connectionPropertyChanged = true;
} | [
"public",
"final",
"void",
"setTypeMap",
"(",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"typeMap",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
... | Updates the value of the typeMap property.
@param typeMap the new type map. | [
"Updates",
"the",
"value",
"of",
"the",
"typeMap",
"property",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4174-L4192 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/settings/checkout/PaymentSettingsUrl.java | PaymentSettingsUrl.getThirdPartyPaymentWorkflowWithValuesUrl | public static MozuUrl getThirdPartyPaymentWorkflowWithValuesUrl(String fullyQualifiedName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflow/{fullyQualifiedName}?responseFields={responseFields}");
formatter.formatUrl("fullyQualifiedName", fullyQualifiedName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getThirdPartyPaymentWorkflowWithValuesUrl(String fullyQualifiedName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflow/{fullyQualifiedName}?responseFields={responseFields}");
formatter.formatUrl("fullyQualifiedName", fullyQualifiedName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getThirdPartyPaymentWorkflowWithValuesUrl",
"(",
"String",
"fullyQualifiedName",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/settings/checkout/paymentsettings/thirdpartyw... | Get Resource Url for GetThirdPartyPaymentWorkflowWithValues
@param fullyQualifiedName Fully qualified name of the attribute for the third-party payment workflow.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetThirdPartyPaymentWorkflowWithValues"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/settings/checkout/PaymentSettingsUrl.java#L22-L28 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextManager.java | ContextManager.initItem | private void initItem(IManagedContext<?> item, ISurveyCallback callback) {
try {
localChangeBegin(item);
if (hasSubject(item.getContextName())) {
item.setContextItems(contextItems);
} else {
item.init();
}
localChangeEnd(item, callback);
} catch (ContextException e) {
log.error("Error initializing context.", e);
execCallback(callback, new SurveyResponse(e.toString()));
}
} | java | private void initItem(IManagedContext<?> item, ISurveyCallback callback) {
try {
localChangeBegin(item);
if (hasSubject(item.getContextName())) {
item.setContextItems(contextItems);
} else {
item.init();
}
localChangeEnd(item, callback);
} catch (ContextException e) {
log.error("Error initializing context.", e);
execCallback(callback, new SurveyResponse(e.toString()));
}
} | [
"private",
"void",
"initItem",
"(",
"IManagedContext",
"<",
"?",
">",
"item",
",",
"ISurveyCallback",
"callback",
")",
"{",
"try",
"{",
"localChangeBegin",
"(",
"item",
")",
";",
"if",
"(",
"hasSubject",
"(",
"item",
".",
"getContextName",
"(",
")",
")",
... | Initializes the managed context.
@param item Managed context to initialize.
@param callback Callback to report subscriber responses. | [
"Initializes",
"the",
"managed",
"context",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextManager.java#L223-L238 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.createPlaceholder | public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name)
{
return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED,
cfg.willSupportNamespaces(), cfg.isXml11());
} | java | public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name)
{
return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED,
cfg.willSupportNamespaces(), cfg.isXml11());
} | [
"public",
"static",
"DTDElement",
"createPlaceholder",
"(",
"ReaderConfig",
"cfg",
",",
"Location",
"loc",
",",
"PrefixedName",
"name",
")",
"{",
"return",
"new",
"DTDElement",
"(",
"loc",
",",
"name",
",",
"null",
",",
"XMLValidator",
".",
"CONTENT_ALLOW_UNDEFI... | Method called to create a "placeholder" element definition, needed to
contain attribute definitions. | [
"Method",
"called",
"to",
"create",
"a",
"placeholder",
"element",
"definition",
"needed",
"to",
"contain",
"attribute",
"definitions",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L172-L176 |
apache/flink | flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java | MetricConfig.getLong | public long getLong(String key, long defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Long.parseLong(argument);
} | java | public long getLong(String key, long defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Long.parseLong(argument);
} | [
"public",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"String",
"argument",
"=",
"getProperty",
"(",
"key",
",",
"null",
")",
";",
"return",
"argument",
"==",
"null",
"?",
"defaultValue",
":",
"Long",
".",
"parseLong",
... | Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
@param key the hashtable key.
@param defaultValue a default value.
@return the value in this property list with the specified key value parsed as a long. | [
"Searches",
"for",
"the",
"property",
"with",
"the",
"specified",
"key",
"in",
"this",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"rec... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L59-L64 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/game/FloatWindowApi.java | FloatWindowApi.onConnect | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (isCurFloatShow && client != null) {
showFinal(true, null, client);
}
} | java | @Override
public void onConnect(int rst, HuaweiApiClient client) {
if (isCurFloatShow && client != null) {
showFinal(true, null, client);
}
} | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"int",
"rst",
",",
"HuaweiApiClient",
"client",
")",
"{",
"if",
"(",
"isCurFloatShow",
"&&",
"client",
"!=",
"null",
")",
"{",
"showFinal",
"(",
"true",
",",
"null",
",",
"client",
")",
";",
"}",
"}"... | 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/game/FloatWindowApi.java#L46-L51 |
grpc/grpc-java | alts/src/main/java/io/grpc/alts/internal/AltsHandshakerClient.java | AltsHandshakerClient.setStartServerFields | private void setStartServerFields(HandshakerReq.Builder req, ByteBuffer inBytes) {
ServerHandshakeParameters serverParameters =
ServerHandshakeParameters.newBuilder().addRecordProtocols(RECORD_PROTOCOL).build();
StartServerHandshakeReq.Builder startServerReq =
StartServerHandshakeReq.newBuilder()
.addApplicationProtocols(APPLICATION_PROTOCOL)
.putHandshakeParameters(HandshakeProtocol.ALTS.getNumber(), serverParameters)
.setInBytes(ByteString.copyFrom(inBytes.duplicate()));
if (handshakerOptions.getRpcProtocolVersions() != null) {
startServerReq.setRpcVersions(handshakerOptions.getRpcProtocolVersions());
}
req.setServerStart(startServerReq);
} | java | private void setStartServerFields(HandshakerReq.Builder req, ByteBuffer inBytes) {
ServerHandshakeParameters serverParameters =
ServerHandshakeParameters.newBuilder().addRecordProtocols(RECORD_PROTOCOL).build();
StartServerHandshakeReq.Builder startServerReq =
StartServerHandshakeReq.newBuilder()
.addApplicationProtocols(APPLICATION_PROTOCOL)
.putHandshakeParameters(HandshakeProtocol.ALTS.getNumber(), serverParameters)
.setInBytes(ByteString.copyFrom(inBytes.duplicate()));
if (handshakerOptions.getRpcProtocolVersions() != null) {
startServerReq.setRpcVersions(handshakerOptions.getRpcProtocolVersions());
}
req.setServerStart(startServerReq);
} | [
"private",
"void",
"setStartServerFields",
"(",
"HandshakerReq",
".",
"Builder",
"req",
",",
"ByteBuffer",
"inBytes",
")",
"{",
"ServerHandshakeParameters",
"serverParameters",
"=",
"ServerHandshakeParameters",
".",
"newBuilder",
"(",
")",
".",
"addRecordProtocols",
"("... | Sets the start server fields for the passed handshake request. | [
"Sets",
"the",
"start",
"server",
"fields",
"for",
"the",
"passed",
"handshake",
"request",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsHandshakerClient.java#L89-L101 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/adaptor/ESAAdaptor.java | ESAAdaptor.requiredByPlatformFeature | private static boolean requiredByPlatformFeature(File baseDir, File testFile) {
try {
Map<String, ProvisioningFeatureDefinition> features = new Product(baseDir).getFeatureDefinitions();
for (ProvisioningFeatureDefinition fd : features.values()) {
if (fd.isKernel()) {
if (requiredByFile(fd, baseDir, testFile))
return true;
}
}
} catch (Exception e) {
}
return false;
} | java | private static boolean requiredByPlatformFeature(File baseDir, File testFile) {
try {
Map<String, ProvisioningFeatureDefinition> features = new Product(baseDir).getFeatureDefinitions();
for (ProvisioningFeatureDefinition fd : features.values()) {
if (fd.isKernel()) {
if (requiredByFile(fd, baseDir, testFile))
return true;
}
}
} catch (Exception e) {
}
return false;
} | [
"private",
"static",
"boolean",
"requiredByPlatformFeature",
"(",
"File",
"baseDir",
",",
"File",
"testFile",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"features",
"=",
"new",
"Product",
"(",
"baseDir",
")",
".",
"g... | Determine there is another platform feature requires this resource | [
"Determine",
"there",
"is",
"another",
"platform",
"feature",
"requires",
"this",
"resource"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/adaptor/ESAAdaptor.java#L503-L515 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Attributes.java | Attributes.put | public Attributes put(String key, String value) {
int i = indexOfKey(key);
if (i != NotFound)
vals[i] = value;
else
add(key, value);
return this;
} | java | public Attributes put(String key, String value) {
int i = indexOfKey(key);
if (i != NotFound)
vals[i] = value;
else
add(key, value);
return this;
} | [
"public",
"Attributes",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"int",
"i",
"=",
"indexOfKey",
"(",
"key",
")",
";",
"if",
"(",
"i",
"!=",
"NotFound",
")",
"vals",
"[",
"i",
"]",
"=",
"value",
";",
"else",
"add",
"(",
"key"... | Set a new attribute, or replace an existing one by key.
@param key case sensitive attribute key
@param value attribute value
@return these attributes, for chaining | [
"Set",
"a",
"new",
"attribute",
"or",
"replace",
"an",
"existing",
"one",
"by",
"key",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L128-L135 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java | SecStrucState.setTurn | public void setTurn(char c, int t) {
if (turn[t - 3] == 'X')
return;
else if (turn[t - 3] == '<' && c == '>' || turn[t - 3] == '>'
&& c == '<') {
turn[t - 3] = 'X';
} else if (turn[t - 3] == '<' || turn[t - 3] == '>')
return;
else
turn[t - 3] = c;
} | java | public void setTurn(char c, int t) {
if (turn[t - 3] == 'X')
return;
else if (turn[t - 3] == '<' && c == '>' || turn[t - 3] == '>'
&& c == '<') {
turn[t - 3] = 'X';
} else if (turn[t - 3] == '<' || turn[t - 3] == '>')
return;
else
turn[t - 3] = c;
} | [
"public",
"void",
"setTurn",
"(",
"char",
"c",
",",
"int",
"t",
")",
"{",
"if",
"(",
"turn",
"[",
"t",
"-",
"3",
"]",
"==",
"'",
"'",
")",
"return",
";",
"else",
"if",
"(",
"turn",
"[",
"t",
"-",
"3",
"]",
"==",
"'",
"'",
"&&",
"c",
"==",... | Set the turn column corresponding to 3,4 or 5 helix patterns. If starting
> or ending < was set and the opposite is being set, the value will be
converted to X. If a number was set, it will be overwritten by the new
character.
@param c
character in the column
@param t
turn of the helix {3,4,5} | [
"Set",
"the",
"turn",
"column",
"corresponding",
"to",
"3",
"4",
"or",
"5",
"helix",
"patterns",
".",
"If",
"starting",
">",
"or",
"ending",
"<",
"was",
"set",
"and",
"the",
"opposite",
"is",
"being",
"set",
"the",
"value",
"will",
"be",
"converted",
"... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java#L117-L127 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java | ContextManager.setContextPool | public void setContextPool(boolean enableContextPool, Integer initPoolSize, Integer prefPoolSize, Integer maxPoolSize, Long poolTimeOut,
Long poolWaitTime) throws InvalidInitPropertyException {
final String METHODNAME = "setContextPool";
this.iContextPoolEnabled = enableContextPool;
if (iContextPoolEnabled) {
this.iInitPoolSize = initPoolSize == null ? DEFAULT_INIT_POOL_SIZE : initPoolSize;
this.iMaxPoolSize = maxPoolSize == null ? DEFAULT_MAX_POOL_SIZE : maxPoolSize;
this.iPrefPoolSize = prefPoolSize == null ? DEFAULT_PREF_POOL_SIZE : prefPoolSize;
this.iPoolTimeOut = poolTimeOut == null ? DEFAULT_POOL_TIME_OUT : poolTimeOut;
this.iPoolWaitTime = poolWaitTime == null ? DEFAULT_POOL_WAIT_TIME : poolWaitTime;
if (iMaxPoolSize != 0 && iMaxPoolSize < iInitPoolSize) {
String msg = Tr.formatMessage(tc, WIMMessageKey.INIT_POOL_SIZE_TOO_BIG,
WIMMessageHelper.generateMsgParms(Integer.valueOf(iInitPoolSize), Integer.valueOf(iMaxPoolSize)));
throw new InvalidInitPropertyException(WIMMessageKey.INIT_POOL_SIZE_TOO_BIG, msg);
}
if (iMaxPoolSize != 0 && iPrefPoolSize != 0 && iMaxPoolSize < iPrefPoolSize) {
String msg = Tr.formatMessage(tc, WIMMessageKey.PREF_POOL_SIZE_TOO_BIG,
WIMMessageHelper.generateMsgParms(Integer.valueOf(iInitPoolSize), Integer.valueOf(iMaxPoolSize)));
throw new InvalidInitPropertyException(WIMMessageKey.PREF_POOL_SIZE_TOO_BIG, msg);
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context Pool is disabled.");
}
}
} | java | public void setContextPool(boolean enableContextPool, Integer initPoolSize, Integer prefPoolSize, Integer maxPoolSize, Long poolTimeOut,
Long poolWaitTime) throws InvalidInitPropertyException {
final String METHODNAME = "setContextPool";
this.iContextPoolEnabled = enableContextPool;
if (iContextPoolEnabled) {
this.iInitPoolSize = initPoolSize == null ? DEFAULT_INIT_POOL_SIZE : initPoolSize;
this.iMaxPoolSize = maxPoolSize == null ? DEFAULT_MAX_POOL_SIZE : maxPoolSize;
this.iPrefPoolSize = prefPoolSize == null ? DEFAULT_PREF_POOL_SIZE : prefPoolSize;
this.iPoolTimeOut = poolTimeOut == null ? DEFAULT_POOL_TIME_OUT : poolTimeOut;
this.iPoolWaitTime = poolWaitTime == null ? DEFAULT_POOL_WAIT_TIME : poolWaitTime;
if (iMaxPoolSize != 0 && iMaxPoolSize < iInitPoolSize) {
String msg = Tr.formatMessage(tc, WIMMessageKey.INIT_POOL_SIZE_TOO_BIG,
WIMMessageHelper.generateMsgParms(Integer.valueOf(iInitPoolSize), Integer.valueOf(iMaxPoolSize)));
throw new InvalidInitPropertyException(WIMMessageKey.INIT_POOL_SIZE_TOO_BIG, msg);
}
if (iMaxPoolSize != 0 && iPrefPoolSize != 0 && iMaxPoolSize < iPrefPoolSize) {
String msg = Tr.formatMessage(tc, WIMMessageKey.PREF_POOL_SIZE_TOO_BIG,
WIMMessageHelper.generateMsgParms(Integer.valueOf(iInitPoolSize), Integer.valueOf(iMaxPoolSize)));
throw new InvalidInitPropertyException(WIMMessageKey.PREF_POOL_SIZE_TOO_BIG, msg);
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context Pool is disabled.");
}
}
} | [
"public",
"void",
"setContextPool",
"(",
"boolean",
"enableContextPool",
",",
"Integer",
"initPoolSize",
",",
"Integer",
"prefPoolSize",
",",
"Integer",
"maxPoolSize",
",",
"Long",
"poolTimeOut",
",",
"Long",
"poolWaitTime",
")",
"throws",
"InvalidInitPropertyException"... | Set the context pool configuration.<p/>
The context pool parameters are not required when <code>enableContextPool == false</code>. If <code>enableContextPool == true</code> and any of the context pool parameters
are null, that parameter will be set to the default value.
@param enableContextPool Whether the context pool is enabled.
@param initPoolSize The initial context pool size.
@param prefPoolSize The preferred context pool size. Not required when <code>enableContextPool == false</code>.
@param maxPoolSize The maximum context pool size. A size of '0' means the maximum size is unlimited. Not required when <code>enableContextPool == false</code>.
@param poolTimeOut The context pool timeout in milliseconds. This is the amount of time a context is valid for in
the context pool is valid for until it is discarded. Not required when <code>enableContextPool == false</code>.
@param poolWaitTime The context pool wait time in milliseconds. This is the amount of time to wait when getDirContext() is called
and no context is available from the pool before checking again. Not required when <code>enableContextPool == false</code>.
@throws InvalidInitPropertyException If <code>initPoolSize > maxPoolSize</code> or <code>prefPoolSize > maxPoolSize</code> when <code>maxPoolSize != 0</code>. | [
"Set",
"the",
"context",
"pool",
"configuration",
".",
"<p",
"/",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java#L1397-L1426 |
j256/simplejmx | src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java | ObjectNameUtil.makeObjectName | public static ObjectName makeObjectName(String objectNameString) {
try {
return new ObjectName(objectNameString);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid ObjectName generated: " + objectNameString, e);
}
} | java | public static ObjectName makeObjectName(String objectNameString) {
try {
return new ObjectName(objectNameString);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid ObjectName generated: " + objectNameString, e);
}
} | [
"public",
"static",
"ObjectName",
"makeObjectName",
"(",
"String",
"objectNameString",
")",
"{",
"try",
"{",
"return",
"new",
"ObjectName",
"(",
"objectNameString",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | Constructs an object-name from a string suitable to be passed to the {@link ObjectName} constructor.
@param objectNameString
The entire object-name string in the form of something like
<tt>your.domain:folder=1,name=beanBean</tt>
@throws IllegalArgumentException
If we had problems building the name | [
"Constructs",
"an",
"object",
"-",
"name",
"from",
"a",
"string",
"suitable",
"to",
"be",
"passed",
"to",
"the",
"{",
"@link",
"ObjectName",
"}",
"constructor",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java#L131-L137 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java | MappedDeleteCollection.deleteObjects | public static <T, ID> int deleteObjects(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<T> datas, ObjectCache objectCache) throws SQLException {
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, datas.size());
Object[] fieldObjects = new Object[datas.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (T data : datas) {
fieldObjects[objC] = idField.extractJavaFieldToSqlArgValue(data);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | java | public static <T, ID> int deleteObjects(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<T> datas, ObjectCache objectCache) throws SQLException {
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, datas.size());
Object[] fieldObjects = new Object[datas.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (T data : datas) {
fieldObjects[objC] = idField.extractJavaFieldToSqlArgValue(data);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | [
"public",
"static",
"<",
"T",
",",
"ID",
">",
"int",
"deleteObjects",
"(",
"Dao",
"<",
"T",
",",
"ID",
">",
"dao",
",",
"TableInfo",
"<",
"T",
",",
"ID",
">",
"tableInfo",
",",
"DatabaseConnection",
"databaseConnection",
",",
"Collection",
"<",
"T",
">... | Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
datas could be variable sized. | [
"Delete",
"all",
"of",
"the",
"objects",
"in",
"the",
"collection",
".",
"This",
"builds",
"a",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java#L30-L41 |
aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.publishTo | public void publishTo(final K key, final Publisher<V> publisher) {
registered.get(key).fromStream(Spouts.from(publisher));
} | java | public void publishTo(final K key, final Publisher<V> publisher) {
registered.get(key).fromStream(Spouts.from(publisher));
} | [
"public",
"void",
"publishTo",
"(",
"final",
"K",
"key",
",",
"final",
"Publisher",
"<",
"V",
">",
"publisher",
")",
"{",
"registered",
".",
"get",
"(",
"key",
")",
".",
"fromStream",
"(",
"Spouts",
".",
"from",
"(",
"publisher",
")",
")",
";",
"}"
] | Synchronously publish data to the Adapter specified by the provided Key, blocking the current thread
@param key for registered cylops-react async.Adapter
@param publisher Reactive Streams publisher to push data onto this pipe | [
"Synchronously",
"publish",
"data",
"to",
"the",
"Adapter",
"specified",
"by",
"the",
"provided",
"Key",
"blocking",
"the",
"current",
"thread"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L584-L586 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.userActionItem | public String userActionItem(String action, String uid, String iid,
Map<String, Object> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(userActionItemAsFuture(action, uid, iid, properties, eventTime));
} | java | public String userActionItem(String action, String uid, String iid,
Map<String, Object> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(userActionItemAsFuture(action, uid, iid, properties, eventTime));
} | [
"public",
"String",
"userActionItem",
"(",
"String",
"action",
",",
"String",
"uid",
",",
"String",
"iid",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"DateTime",
"eventTime",
")",
"throws",
"ExecutionException",
",",
"InterruptedException"... | Records a user-action-on-item event.
@param action name of the action performed
@param uid ID of the user
@param iid ID of the item
@param properties a map of properties associated with this action
@param eventTime timestamp of the event
@return ID of this event | [
"Records",
"a",
"user",
"-",
"action",
"-",
"on",
"-",
"item",
"event",
"."
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L646-L650 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java | LinearClassifierFactory.crossValidateSetSigma | public void crossValidateSetSigma(GeneralDataset<L, F> dataset,int kfold, final Scorer<L> scorer, LineSearcher minimizer) {
System.err.println("##in Cross Validate, folds = " + kfold);
System.err.println("##Scorer is " + scorer);
featureIndex = dataset.featureIndex;
labelIndex = dataset.labelIndex;
final CrossValidator<L, F> crossValidator = new CrossValidator<L, F>(dataset,kfold);
final Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> score =
new Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> ()
{
public Double apply (Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState> fold) {
GeneralDataset<L, F> trainSet = fold.first();
GeneralDataset<L, F> devSet = fold.second();
double[] weights = (double[])fold.third().state;
double[][] weights2D;
weights2D = trainWeights(trainSet, weights,true); // must of course bypass sigma tuning here.
fold.third().state = ArrayUtils.flatten(weights2D);
LinearClassifier<L, F> classifier = new LinearClassifier<L, F>(weights2D, trainSet.featureIndex, trainSet.labelIndex);
double score = scorer.score(classifier, devSet);
//System.out.println("score: "+score);
System.out.print(".");
return score;
}
};
Function<Double,Double> negativeScorer =
new Function<Double,Double> ()
{
public Double apply(Double sigmaToTry) {
//sigma = sigmaToTry;
setSigma(sigmaToTry);
Double averageScore = crossValidator.computeAverage(score);
System.err.print("##sigma = "+getSigma()+" ");
System.err.println("-> average Score: "+averageScore);
return -averageScore;
}
};
double bestSigma = minimizer.minimize(negativeScorer);
System.err.println("##best sigma: " + bestSigma);
setSigma(bestSigma);
} | java | public void crossValidateSetSigma(GeneralDataset<L, F> dataset,int kfold, final Scorer<L> scorer, LineSearcher minimizer) {
System.err.println("##in Cross Validate, folds = " + kfold);
System.err.println("##Scorer is " + scorer);
featureIndex = dataset.featureIndex;
labelIndex = dataset.labelIndex;
final CrossValidator<L, F> crossValidator = new CrossValidator<L, F>(dataset,kfold);
final Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> score =
new Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> ()
{
public Double apply (Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState> fold) {
GeneralDataset<L, F> trainSet = fold.first();
GeneralDataset<L, F> devSet = fold.second();
double[] weights = (double[])fold.third().state;
double[][] weights2D;
weights2D = trainWeights(trainSet, weights,true); // must of course bypass sigma tuning here.
fold.third().state = ArrayUtils.flatten(weights2D);
LinearClassifier<L, F> classifier = new LinearClassifier<L, F>(weights2D, trainSet.featureIndex, trainSet.labelIndex);
double score = scorer.score(classifier, devSet);
//System.out.println("score: "+score);
System.out.print(".");
return score;
}
};
Function<Double,Double> negativeScorer =
new Function<Double,Double> ()
{
public Double apply(Double sigmaToTry) {
//sigma = sigmaToTry;
setSigma(sigmaToTry);
Double averageScore = crossValidator.computeAverage(score);
System.err.print("##sigma = "+getSigma()+" ");
System.err.println("-> average Score: "+averageScore);
return -averageScore;
}
};
double bestSigma = minimizer.minimize(negativeScorer);
System.err.println("##best sigma: " + bestSigma);
setSigma(bestSigma);
} | [
"public",
"void",
"crossValidateSetSigma",
"(",
"GeneralDataset",
"<",
"L",
",",
"F",
">",
"dataset",
",",
"int",
"kfold",
",",
"final",
"Scorer",
"<",
"L",
">",
"scorer",
",",
"LineSearcher",
"minimizer",
")",
"{",
"System",
".",
"err",
".",
"println",
... | Sets the sigma parameter to a value that optimizes the cross-validation score given by <code>scorer</code>. Search for an optimal value
is carried out by <code>minimizer</code>
@param dataset the data set to optimize sigma on. | [
"Sets",
"the",
"sigma",
"parameter",
"to",
"a",
"value",
"that",
"optimizes",
"the",
"cross",
"-",
"validation",
"score",
"given",
"by",
"<code",
">",
"scorer<",
"/",
"code",
">",
".",
"Search",
"for",
"an",
"optimal",
"value",
"is",
"carried",
"out",
"b... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java#L562-L609 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java | AbstractExecutableMemberWriter.addExceptions | protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
List<? extends TypeMirror> exceptions = member.getThrownTypes();
if (!exceptions.isEmpty()) {
CharSequence indent = makeSpace(indentSize + 1 - 7);
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
htmltree.addContent("throws ");
indent = makeSpace(indentSize + 1);
Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
htmltree.addContent(link);
for(int i = 1; i < exceptions.size(); i++) {
htmltree.addContent(",");
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
exceptions.get(i)));
htmltree.addContent(exceptionLink);
}
}
} | java | protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
List<? extends TypeMirror> exceptions = member.getThrownTypes();
if (!exceptions.isEmpty()) {
CharSequence indent = makeSpace(indentSize + 1 - 7);
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
htmltree.addContent("throws ");
indent = makeSpace(indentSize + 1);
Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
htmltree.addContent(link);
for(int i = 1; i < exceptions.size(); i++) {
htmltree.addContent(",");
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
exceptions.get(i)));
htmltree.addContent(exceptionLink);
}
}
} | [
"protected",
"void",
"addExceptions",
"(",
"ExecutableElement",
"member",
",",
"Content",
"htmltree",
",",
"int",
"indentSize",
")",
"{",
"List",
"<",
"?",
"extends",
"TypeMirror",
">",
"exceptions",
"=",
"member",
".",
"getThrownTypes",
"(",
")",
";",
"if",
... | Add exceptions for the executable member.
@param member the member to write exceptions for.
@param htmltree the content tree to which the exceptions information will be added. | [
"Add",
"exceptions",
"for",
"the",
"executable",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L259-L278 |
borball/weixin-sdk | weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java | Materials.addThumb | public Material addThumb(InputStream inputStream, String fileName) {
return upload(MediaType.thumb, inputStream, fileName);
} | java | public Material addThumb(InputStream inputStream, String fileName) {
return upload(MediaType.thumb, inputStream, fileName);
} | [
"public",
"Material",
"addThumb",
"(",
"InputStream",
"inputStream",
",",
"String",
"fileName",
")",
"{",
"return",
"upload",
"(",
"MediaType",
".",
"thumb",
",",
"inputStream",
",",
"fileName",
")",
";",
"}"
] | 上传缩略图
@param inputStream 缩略图
@param fileName 文件名
@return 上传结果 | [
"上传缩略图"
] | train | https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java#L175-L177 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java | RepositoryResolver.byMaxDistance | static Comparator<RepositoryResource> byMaxDistance(final Map<String, Integer> maxDistanceMap) {
return new Comparator<RepositoryResource>() {
@Override
public int compare(RepositoryResource o1, RepositoryResource o2) {
return Integer.compare(getDistance(o2), getDistance(o1));
}
private int getDistance(RepositoryResource res) {
if (res.getType() == ResourceType.FEATURE) {
Integer distance = maxDistanceMap.get(((EsaResource) res).getProvideFeature());
return distance == null ? 0 : distance;
} else {
return 0;
}
}
};
} | java | static Comparator<RepositoryResource> byMaxDistance(final Map<String, Integer> maxDistanceMap) {
return new Comparator<RepositoryResource>() {
@Override
public int compare(RepositoryResource o1, RepositoryResource o2) {
return Integer.compare(getDistance(o2), getDistance(o1));
}
private int getDistance(RepositoryResource res) {
if (res.getType() == ResourceType.FEATURE) {
Integer distance = maxDistanceMap.get(((EsaResource) res).getProvideFeature());
return distance == null ? 0 : distance;
} else {
return 0;
}
}
};
} | [
"static",
"Comparator",
"<",
"RepositoryResource",
">",
"byMaxDistance",
"(",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"maxDistanceMap",
")",
"{",
"return",
"new",
"Comparator",
"<",
"RepositoryResource",
">",
"(",
")",
"{",
"@",
"Override",
"public... | Returns a comparator which sorts EsaResources by their values from {@code maxDistanceMap} from greatest to smallest
<p>
Resources whose symbolic names do not appear in the map or which are not EsaResources are assigned a value of zero meaning that they will appear last in a sorted list.
@param maxDistanceMap map from symbolic name to the length of the longest dependency chain from a specific point
@return compariator which sorts based on the maxDistance of resources | [
"Returns",
"a",
"comparator",
"which",
"sorts",
"EsaResources",
"by",
"their",
"values",
"from",
"{",
"@code",
"maxDistanceMap",
"}",
"from",
"greatest",
"to",
"smallest",
"<p",
">",
"Resources",
"whose",
"symbolic",
"names",
"do",
"not",
"appear",
"in",
"the"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L589-L607 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createPartialMock | public static synchronized <T> T createPartialMock(Class<T> type, String... methodNames) {
return createMock(type, Whitebox.getMethods(type, methodNames));
} | java | public static synchronized <T> T createPartialMock(Class<T> type, String... methodNames) {
return createMock(type, Whitebox.getMethods(type, methodNames));
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createPartialMock",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"{",
"return",
"createMock",
"(",
"type",
",",
"Whitebox",
".",
"getMethods",
"(",
"type",
",",
"m... | A utility method that may be used to mock several methods in an easy way
(by just passing in the method names of the method you wish to mock).
Note that you cannot uniquely specify a method to mock using this method
if there are several methods with the same name in {@code type}.
This method will mock ALL methods that match the supplied name regardless
of parameter types and signature. If this is the case you should
fall-back on using the {@link #createMock(Class, Method...)} method
instead.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return A mock object of type <T>. | [
"A",
"utility",
"method",
"that",
"may",
"be",
"used",
"to",
"mock",
"several",
"methods",
"in",
"an",
"easy",
"way",
"(",
"by",
"just",
"passing",
"in",
"the",
"method",
"names",
"of",
"the",
"method",
"you",
"wish",
"to",
"mock",
")",
".",
"Note",
... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L667-L669 |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java | AbstractResource.getURI | @Override
public URI getURI() throws IOException {
URL url = getURL();
try {
return ResourceUtils.toURI(url);
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid URI [" + url + "]", ex);
}
} | java | @Override
public URI getURI() throws IOException {
URL url = getURL();
try {
return ResourceUtils.toURI(url);
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid URI [" + url + "]", ex);
}
} | [
"@",
"Override",
"public",
"URI",
"getURI",
"(",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getURL",
"(",
")",
";",
"try",
"{",
"return",
"ResourceUtils",
".",
"toURI",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"ex",
")... | This implementation builds a URI based on the URL returned by
{@link #getURL()}. | [
"This",
"implementation",
"builds",
"a",
"URI",
"based",
"on",
"the",
"URL",
"returned",
"by",
"{"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java#L78-L86 |
jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getLongProperty | public Long getLongProperty(String pstrSection, String pstrProp)
{
Long lngRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) lngRet = new Long(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return lngRet;
} | java | public Long getLongProperty(String pstrSection, String pstrProp)
{
Long lngRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) lngRet = new Long(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return lngRet;
} | [
"public",
"Long",
"getLongProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"Long",
"lngRet",
"=",
"null",
";",
"String",
"strVal",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",... | Returns the specified long property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the long property value. | [
"Returns",
"the",
"specified",
"long",
"property",
"from",
"the",
"specified",
"section",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L217-L246 |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageWriter.java | MessageWriter.writeBody | public <T> void writeBody(T body, Charset charset) {
if (isPrimitive(body)) {
String bodyAsString = String.valueOf(body);
writeBodyFromString(bodyAsString, charset);
} else if (isString(body)) {
String bodyAsString = (String)body;
writeBodyFromString(bodyAsString, charset);
} else {
writeBodyFromObject(body, charset);
}
} | java | public <T> void writeBody(T body, Charset charset) {
if (isPrimitive(body)) {
String bodyAsString = String.valueOf(body);
writeBodyFromString(bodyAsString, charset);
} else if (isString(body)) {
String bodyAsString = (String)body;
writeBodyFromString(bodyAsString, charset);
} else {
writeBodyFromObject(body, charset);
}
} | [
"public",
"<",
"T",
">",
"void",
"writeBody",
"(",
"T",
"body",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"isPrimitive",
"(",
"body",
")",
")",
"{",
"String",
"bodyAsString",
"=",
"String",
".",
"valueOf",
"(",
"body",
")",
";",
"writeBodyFromStr... | <p>Writes the message body using the given object of type T
using the given charset for character encoding.</p>
<p>For primitive types and Strings, the message body is written as
plain text. In all other cases, the object is serialized to XML.</p>
@param body The message body
@param charset The charset to use for character encoding
@param <T> The object type | [
"<p",
">",
"Writes",
"the",
"message",
"body",
"using",
"the",
"given",
"object",
"of",
"type",
"T",
"using",
"the",
"given",
"charset",
"for",
"character",
"encoding",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageWriter.java#L48-L58 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java | SSLUtils.getBufferLimits | public static void getBufferLimits(WsByteBuffer[] buffers, int[] limits) {
// Double check that the parameters are non null.
if ((buffers != null) && (limits != null)) {
// Loop through the buffers.
// In case of errant parameters, protect from array out of bounds.
for (int i = 0; i < buffers.length && i < limits.length; i++) {
// Double check for null buffers.
if (buffers[i] != null) {
// Save the limit.
limits[i] = buffers[i].limit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getBufferLimits: buffer[" + i + "] limit of " + limits[i]);
}
} else {
// When buffer is null, save a limit of 0.
limits[i] = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getBufferLimits: null buffer[" + i + "] limit of " + limits[i]);
}
}
}
}
} | java | public static void getBufferLimits(WsByteBuffer[] buffers, int[] limits) {
// Double check that the parameters are non null.
if ((buffers != null) && (limits != null)) {
// Loop through the buffers.
// In case of errant parameters, protect from array out of bounds.
for (int i = 0; i < buffers.length && i < limits.length; i++) {
// Double check for null buffers.
if (buffers[i] != null) {
// Save the limit.
limits[i] = buffers[i].limit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getBufferLimits: buffer[" + i + "] limit of " + limits[i]);
}
} else {
// When buffer is null, save a limit of 0.
limits[i] = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getBufferLimits: null buffer[" + i + "] limit of " + limits[i]);
}
}
}
}
} | [
"public",
"static",
"void",
"getBufferLimits",
"(",
"WsByteBuffer",
"[",
"]",
"buffers",
",",
"int",
"[",
"]",
"limits",
")",
"{",
"// Double check that the parameters are non null.",
"if",
"(",
"(",
"buffers",
"!=",
"null",
")",
"&&",
"(",
"limits",
"!=",
"nu... | Assign an array of limits associated with the passed in buffer array.
@param buffers
@param limits | [
"Assign",
"an",
"array",
"of",
"limits",
"associated",
"with",
"the",
"passed",
"in",
"buffer",
"array",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L1370-L1392 |
getsentry/sentry-java | sentry-appengine/src/main/java/io/sentry/appengine/connection/AppEngineAsyncConnection.java | AppEngineAsyncConnection.send | @Override
public void send(Event event) {
if (!closed) {
queue.add(withPayload(new EventSubmitter(id, event)));
}
} | java | @Override
public void send(Event event) {
if (!closed) {
queue.add(withPayload(new EventSubmitter(id, event)));
}
} | [
"@",
"Override",
"public",
"void",
"send",
"(",
"Event",
"event",
")",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"queue",
".",
"add",
"(",
"withPayload",
"(",
"new",
"EventSubmitter",
"(",
"id",
",",
"event",
")",
")",
")",
";",
"}",
"}"
] | {@inheritDoc}
<p>
The event will be added to a queue and will be handled by a separate {@code Thread} later on. | [
"{"
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry-appengine/src/main/java/io/sentry/appengine/connection/AppEngineAsyncConnection.java#L73-L78 |
UrielCh/ovh-java-sdk | ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java | ApiOvhMsServices.serviceName_account_userPrincipalName_sync_GET | public OvhSyncInformation serviceName_account_userPrincipalName_sync_GET(String serviceName, String userPrincipalName) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sync";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSyncInformation.class);
} | java | public OvhSyncInformation serviceName_account_userPrincipalName_sync_GET(String serviceName, String userPrincipalName) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sync";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSyncInformation.class);
} | [
"public",
"OvhSyncInformation",
"serviceName_account_userPrincipalName_sync_GET",
"(",
"String",
"serviceName",
",",
"String",
"userPrincipalName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/msServices/{serviceName}/account/{userPrincipalName}/sync\"",
";",
"S... | Get this object properties
REST: GET /msServices/{serviceName}/account/{userPrincipalName}/sync
@param serviceName [required] The internal name of your Active Directory organization
@param userPrincipalName [required] User Principal Name
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L156-L161 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_reverse_POST | public OvhReverseIp ip_reverse_POST(String ip, String ipReverse, String reverse) throws IOException {
String qPath = "/ip/{ip}/reverse";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipReverse", ipReverse);
addBody(o, "reverse", reverse);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhReverseIp.class);
} | java | public OvhReverseIp ip_reverse_POST(String ip, String ipReverse, String reverse) throws IOException {
String qPath = "/ip/{ip}/reverse";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipReverse", ipReverse);
addBody(o, "reverse", reverse);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhReverseIp.class);
} | [
"public",
"OvhReverseIp",
"ip_reverse_POST",
"(",
"String",
"ip",
",",
"String",
"ipReverse",
",",
"String",
"reverse",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/reverse\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",... | Add reverse on an ip
REST: POST /ip/{ip}/reverse
@param reverse [required]
@param ipReverse [required]
@param ip [required] | [
"Add",
"reverse",
"on",
"an",
"ip"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L473-L481 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java | SubordinateControlHelper.applyRegisteredControls | public static void applyRegisteredControls(final Request request, final boolean useRequestValues) {
Set<String> controls = getRegisteredSubordinateControls();
if (controls == null) {
return;
}
// Process Controls
for (String controlId : controls) {
// Find the Component for this ID
ComponentWithContext controlWithContext = WebUtilities.getComponentById(controlId,
true);
if (controlWithContext == null) {
LOG.warn(
"Subordinate control for id " + controlId + " is no longer in the tree.");
continue;
}
if (!(controlWithContext.getComponent() instanceof WSubordinateControl)) {
LOG.warn("Component for id " + controlId + " is not a subordinate control.");
continue;
}
WSubordinateControl control = (WSubordinateControl) controlWithContext.getComponent();
UIContext uic = controlWithContext.getContext();
UIContextHolder.pushContext(uic);
try {
if (useRequestValues) {
control.applyTheControls(request);
} else {
control.applyTheControls();
}
} finally {
UIContextHolder.popContext();
}
}
} | java | public static void applyRegisteredControls(final Request request, final boolean useRequestValues) {
Set<String> controls = getRegisteredSubordinateControls();
if (controls == null) {
return;
}
// Process Controls
for (String controlId : controls) {
// Find the Component for this ID
ComponentWithContext controlWithContext = WebUtilities.getComponentById(controlId,
true);
if (controlWithContext == null) {
LOG.warn(
"Subordinate control for id " + controlId + " is no longer in the tree.");
continue;
}
if (!(controlWithContext.getComponent() instanceof WSubordinateControl)) {
LOG.warn("Component for id " + controlId + " is not a subordinate control.");
continue;
}
WSubordinateControl control = (WSubordinateControl) controlWithContext.getComponent();
UIContext uic = controlWithContext.getContext();
UIContextHolder.pushContext(uic);
try {
if (useRequestValues) {
control.applyTheControls(request);
} else {
control.applyTheControls();
}
} finally {
UIContextHolder.popContext();
}
}
} | [
"public",
"static",
"void",
"applyRegisteredControls",
"(",
"final",
"Request",
"request",
",",
"final",
"boolean",
"useRequestValues",
")",
"{",
"Set",
"<",
"String",
">",
"controls",
"=",
"getRegisteredSubordinateControls",
"(",
")",
";",
"if",
"(",
"controls",
... | Apply the registered Subordinate Controls.
@param request the request being processed.
@param useRequestValues the flag to indicate the controls should use values from the request. | [
"Apply",
"the",
"registered",
"Subordinate",
"Controls",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java#L73-L111 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getEventsBatch | public OneLoginResponse<Event> getEventsBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_EVENTS_URL);
List<Event> events = new ArrayList<Event>(batchSize);
afterCursor = getEventsBatch(events, context.url, context.bearerRequest, context.oAuthResponse);
return new OneLoginResponse<Event>(events, afterCursor);
} | java | public OneLoginResponse<Event> getEventsBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_EVENTS_URL);
List<Event> events = new ArrayList<Event>(batchSize);
afterCursor = getEventsBatch(events, context.url, context.bearerRequest, context.oAuthResponse);
return new OneLoginResponse<Event>(events, afterCursor);
} | [
"public",
"OneLoginResponse",
"<",
"Event",
">",
"getEventsBatch",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"queryParameters",
",",
"int",
"batchSize",
",",
"String",
"afterCursor",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
... | Get a batch of Events.
@param queryParameters Query parameters of the Resource
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of Event (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.Event
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-events">Get Events documentation</a> | [
"Get",
"a",
"batch",
"of",
"Events",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2025-L2031 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseToDate | public static Date parseToDate(final String datum, final String[] formats, final Locale locale)
{
for (final String format : formats)
{
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
try
{
return sdf.parse(datum);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | java | public static Date parseToDate(final String datum, final String[] formats, final Locale locale)
{
for (final String format : formats)
{
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
try
{
return sdf.parse(datum);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | [
"public",
"static",
"Date",
"parseToDate",
"(",
"final",
"String",
"datum",
",",
"final",
"String",
"[",
"]",
"formats",
",",
"final",
"Locale",
"locale",
")",
"{",
"for",
"(",
"final",
"String",
"format",
":",
"formats",
")",
"{",
"final",
"SimpleDateForm... | Returns a date-object if the array with the formats are valid otherwise null.
@param datum
The date as string which to parse to a date-object.
@param formats
The string-array with the date-patterns.
@param locale
THe Locale for the SimpleDateFormat.
@return A date-object if the array with the formats are valid otherwise null. | [
"Returns",
"a",
"date",
"-",
"object",
"if",
"the",
"array",
"with",
"the",
"formats",
"are",
"valid",
"otherwise",
"null",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L103-L118 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.tword_ptr | public static final Mem tword_ptr(Label label, Register index, int shift, long disp) {
return _ptr_build(label, index, shift, disp, SIZE_TWORD);
} | java | public static final Mem tword_ptr(Label label, Register index, int shift, long disp) {
return _ptr_build(label, index, shift, disp, SIZE_TWORD);
} | [
"public",
"static",
"final",
"Mem",
"tword_ptr",
"(",
"Label",
"label",
",",
"Register",
"index",
",",
"int",
"shift",
",",
"long",
"disp",
")",
"{",
"return",
"_ptr_build",
"(",
"label",
",",
"index",
",",
"shift",
",",
"disp",
",",
"SIZE_TWORD",
")",
... | Create tword (10 Bytes) pointer operand (used for 80 bit floating points). | [
"Create",
"tword",
"(",
"10",
"Bytes",
")",
"pointer",
"operand",
"(",
"used",
"for",
"80",
"bit",
"floating",
"points",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L372-L374 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.updateWithOnConflict | public int updateWithOnConflict(String table, ContentValues values,
String whereClause, String[] whereArgs, int conflictAlgorithm) {
if (values == null || values.size() == 0) {
throw new IllegalArgumentException("Empty values");
}
acquireReference();
try {
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
sql.append(CONFLICT_VALUES[conflictAlgorithm]);
sql.append(table);
sql.append(" SET ");
// move all bind args to one array
int setValuesSize = values.size();
int bindArgsSize = (whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
Object[] bindArgs = new Object[bindArgsSize];
int i = 0;
for (String colName : values.keySet()) {
sql.append((i > 0) ? "," : "");
sql.append(colName);
bindArgs[i++] = values.get(colName);
sql.append("=?");
}
if (whereArgs != null) {
for (i = setValuesSize; i < bindArgsSize; i++) {
bindArgs[i] = whereArgs[i - setValuesSize];
}
}
if (!TextUtils.isEmpty(whereClause)) {
sql.append(" WHERE ");
sql.append(whereClause);
}
SQLiteStatement statement = new SQLiteStatement(this, sql.toString(), bindArgs);
try {
return statement.executeUpdateDelete();
} finally {
statement.close();
}
} finally {
releaseReference();
}
} | java | public int updateWithOnConflict(String table, ContentValues values,
String whereClause, String[] whereArgs, int conflictAlgorithm) {
if (values == null || values.size() == 0) {
throw new IllegalArgumentException("Empty values");
}
acquireReference();
try {
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
sql.append(CONFLICT_VALUES[conflictAlgorithm]);
sql.append(table);
sql.append(" SET ");
// move all bind args to one array
int setValuesSize = values.size();
int bindArgsSize = (whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
Object[] bindArgs = new Object[bindArgsSize];
int i = 0;
for (String colName : values.keySet()) {
sql.append((i > 0) ? "," : "");
sql.append(colName);
bindArgs[i++] = values.get(colName);
sql.append("=?");
}
if (whereArgs != null) {
for (i = setValuesSize; i < bindArgsSize; i++) {
bindArgs[i] = whereArgs[i - setValuesSize];
}
}
if (!TextUtils.isEmpty(whereClause)) {
sql.append(" WHERE ");
sql.append(whereClause);
}
SQLiteStatement statement = new SQLiteStatement(this, sql.toString(), bindArgs);
try {
return statement.executeUpdateDelete();
} finally {
statement.close();
}
} finally {
releaseReference();
}
} | [
"public",
"int",
"updateWithOnConflict",
"(",
"String",
"table",
",",
"ContentValues",
"values",
",",
"String",
"whereClause",
",",
"String",
"[",
"]",
"whereArgs",
",",
"int",
"conflictAlgorithm",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
... | Convenience method for updating rows in the database.
@param table the table to update in
@param values a map from column names to new column values. null is a
valid value that will be translated to NULL.
@param whereClause the optional WHERE clause to apply when updating.
Passing null will update all rows.
@param whereArgs You may include ?s in the where clause, which
will be replaced by the values from whereArgs. The values
will be bound as Strings.
@param conflictAlgorithm for update conflict resolver
@return the number of rows affected | [
"Convenience",
"method",
"for",
"updating",
"rows",
"in",
"the",
"database",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1544-L1588 |
jMetal/jMetal | jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/espea/util/ScalarizationUtils.java | ScalarizationUtils.setScalarizationValue | private static <S extends Solution<?>> void setScalarizationValue(S solution, double scalarizationValue) {
solution.setAttribute(new ScalarizationValue<S>().getAttributeIdentifier(), scalarizationValue);
} | java | private static <S extends Solution<?>> void setScalarizationValue(S solution, double scalarizationValue) {
solution.setAttribute(new ScalarizationValue<S>().getAttributeIdentifier(), scalarizationValue);
} | [
"private",
"static",
"<",
"S",
"extends",
"Solution",
"<",
"?",
">",
">",
"void",
"setScalarizationValue",
"(",
"S",
"solution",
",",
"double",
"scalarizationValue",
")",
"{",
"solution",
".",
"setAttribute",
"(",
"new",
"ScalarizationValue",
"<",
"S",
">",
... | Sets the scalarization value of a solution. Used for for simplified
static access.
@param solution The solution whose scalarization value is set.
@param scalarizationValue The scalarization value of the solution. | [
"Sets",
"the",
"scalarization",
"value",
"of",
"a",
"solution",
".",
"Used",
"for",
"for",
"simplified",
"static",
"access",
"."
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/espea/util/ScalarizationUtils.java#L30-L32 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/impl/light/LightMetaBean.java | LightMetaBean.build | @Deprecated
private T build(Constructor<T> constructor, Object[] args) {
try {
return constructor.newInstance(args);
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException ex) {
throw new IllegalArgumentException(
"Bean cannot be created: " + beanName() + " from " + Arrays.toString(args), ex);
} catch (InvocationTargetException ex) {
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new RuntimeException(ex);
}
} | java | @Deprecated
private T build(Constructor<T> constructor, Object[] args) {
try {
return constructor.newInstance(args);
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException ex) {
throw new IllegalArgumentException(
"Bean cannot be created: " + beanName() + " from " + Arrays.toString(args), ex);
} catch (InvocationTargetException ex) {
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new RuntimeException(ex);
}
} | [
"@",
"Deprecated",
"private",
"T",
"build",
"(",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"return",
"constructor",
".",
"newInstance",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentEx... | Creates an instance of the bean.
@param constructor the constructor
@param args the arguments
@return the created instance
@deprecated Use method handles version of this method | [
"Creates",
"an",
"instance",
"of",
"the",
"bean",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/light/LightMetaBean.java#L197-L211 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/StoredBlock.java | StoredBlock.deserializeCompact | public static StoredBlock deserializeCompact(NetworkParameters params, ByteBuffer buffer) throws ProtocolException {
byte[] chainWorkBytes = new byte[StoredBlock.CHAIN_WORK_BYTES];
buffer.get(chainWorkBytes);
BigInteger chainWork = new BigInteger(1, chainWorkBytes);
int height = buffer.getInt(); // +4 bytes
byte[] header = new byte[Block.HEADER_SIZE + 1]; // Extra byte for the 00 transactions length.
buffer.get(header, 0, Block.HEADER_SIZE);
return new StoredBlock(params.getDefaultSerializer().makeBlock(header), chainWork, height);
} | java | public static StoredBlock deserializeCompact(NetworkParameters params, ByteBuffer buffer) throws ProtocolException {
byte[] chainWorkBytes = new byte[StoredBlock.CHAIN_WORK_BYTES];
buffer.get(chainWorkBytes);
BigInteger chainWork = new BigInteger(1, chainWorkBytes);
int height = buffer.getInt(); // +4 bytes
byte[] header = new byte[Block.HEADER_SIZE + 1]; // Extra byte for the 00 transactions length.
buffer.get(header, 0, Block.HEADER_SIZE);
return new StoredBlock(params.getDefaultSerializer().makeBlock(header), chainWork, height);
} | [
"public",
"static",
"StoredBlock",
"deserializeCompact",
"(",
"NetworkParameters",
"params",
",",
"ByteBuffer",
"buffer",
")",
"throws",
"ProtocolException",
"{",
"byte",
"[",
"]",
"chainWorkBytes",
"=",
"new",
"byte",
"[",
"StoredBlock",
".",
"CHAIN_WORK_BYTES",
"]... | De-serializes the stored block from a custom packed format. Used by {@link CheckpointManager}. | [
"De",
"-",
"serializes",
"the",
"stored",
"block",
"from",
"a",
"custom",
"packed",
"format",
".",
"Used",
"by",
"{"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/StoredBlock.java#L135-L143 |
bohnman/squiggly-java | src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java | SquigglyUtils.stringify | public static String stringify(ObjectMapper mapper, Object object) {
try {
return mapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e);
}
} | java | public static String stringify(ObjectMapper mapper, Object object) {
try {
return mapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"String",
"stringify",
"(",
"ObjectMapper",
"mapper",
",",
"Object",
"object",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"writeValueAsString",
"(",
"object",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{",
"thr... | Takes an object and converts it to a string.
@param mapper the object mapper
@param object the object to convert
@return json string | [
"Takes",
"an",
"object",
"and",
"converts",
"it",
"to",
"a",
"string",
"."
] | train | https://github.com/bohnman/squiggly-java/blob/ba0c0b924ab718225d1ad180273ee63ea6c4f55a/src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java#L241-L247 |
HeidelTime/heideltime | src/jmaxent/Dictionary.java | Dictionary.addDict | public void addDict(int cp, int label, int count) {
Element elem = (Element)dict.get(new Integer(cp));
if (elem == null) {
// if the context predicate is not found
elem = new Element();
elem.count = count;
CountFIdx cntFIdx = new CountFIdx(count, -1);
elem.lbCntFidxes.put(new Integer(label), cntFIdx);
// insert the new element to the dict
dict.put(new Integer(cp), elem);
} else {
// update the total count
elem.count += count;
CountFIdx cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(label));
if (cntFIdx == null) {
// the label not found
cntFIdx = new CountFIdx(count, -1);
elem.lbCntFidxes.put(new Integer(label), cntFIdx);
} else {
// if label found, update the count only
cntFIdx.count += count;
}
}
} | java | public void addDict(int cp, int label, int count) {
Element elem = (Element)dict.get(new Integer(cp));
if (elem == null) {
// if the context predicate is not found
elem = new Element();
elem.count = count;
CountFIdx cntFIdx = new CountFIdx(count, -1);
elem.lbCntFidxes.put(new Integer(label), cntFIdx);
// insert the new element to the dict
dict.put(new Integer(cp), elem);
} else {
// update the total count
elem.count += count;
CountFIdx cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(label));
if (cntFIdx == null) {
// the label not found
cntFIdx = new CountFIdx(count, -1);
elem.lbCntFidxes.put(new Integer(label), cntFIdx);
} else {
// if label found, update the count only
cntFIdx.count += count;
}
}
} | [
"public",
"void",
"addDict",
"(",
"int",
"cp",
",",
"int",
"label",
",",
"int",
"count",
")",
"{",
"Element",
"elem",
"=",
"(",
"Element",
")",
"dict",
".",
"get",
"(",
"new",
"Integer",
"(",
"cp",
")",
")",
";",
"if",
"(",
"elem",
"==",
"null",
... | Adds the dict.
@param cp the cp
@param label the label
@param count the count | [
"Adds",
"the",
"dict",
"."
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jmaxent/Dictionary.java#L202-L231 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.getFromComputeNodeAsync | public Observable<InputStream> getFromComputeNodeAsync(String poolId, String nodeId, String filePath) {
return getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<InputStream, FileGetFromComputeNodeHeaders>, InputStream>() {
@Override
public InputStream call(ServiceResponseWithHeaders<InputStream, FileGetFromComputeNodeHeaders> response) {
return response.body();
}
});
} | java | public Observable<InputStream> getFromComputeNodeAsync(String poolId, String nodeId, String filePath) {
return getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<InputStream, FileGetFromComputeNodeHeaders>, InputStream>() {
@Override
public InputStream call(ServiceResponseWithHeaders<InputStream, FileGetFromComputeNodeHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"InputStream",
">",
"getFromComputeNodeAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"filePath",
")",
"{",
"return",
"getFromComputeNodeWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
",",
"filePath",
... | Returns the content of the specified compute node file.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node that contains the file.
@param filePath The path to the compute node file that you want to get the content of.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the InputStream object | [
"Returns",
"the",
"content",
"of",
"the",
"specified",
"compute",
"node",
"file",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1135-L1142 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/datepicker/Datepicker.java | Datepicker.addLabel | protected void addLabel(ResponseWriter rw, String clientId, String fieldId) throws IOException {
String label = getLabel();
if (!isRenderLabel()) {
label = null;
}
if (label != null) {
rw.startElement("label", this);
rw.writeAttribute("for", clientId, "for");
new CoreRenderer().generateErrorAndRequiredClassForLabels(this, rw, fieldId,
getLabelStyleClass() + " control-label");
if (getLabelStyle() != null) {
rw.writeAttribute("style", getLabelStyle(), "style");
}
rw.writeText(label, null);
rw.endElement("label");
}
} | java | protected void addLabel(ResponseWriter rw, String clientId, String fieldId) throws IOException {
String label = getLabel();
if (!isRenderLabel()) {
label = null;
}
if (label != null) {
rw.startElement("label", this);
rw.writeAttribute("for", clientId, "for");
new CoreRenderer().generateErrorAndRequiredClassForLabels(this, rw, fieldId,
getLabelStyleClass() + " control-label");
if (getLabelStyle() != null) {
rw.writeAttribute("style", getLabelStyle(), "style");
}
rw.writeText(label, null);
rw.endElement("label");
}
} | [
"protected",
"void",
"addLabel",
"(",
"ResponseWriter",
"rw",
",",
"String",
"clientId",
",",
"String",
"fieldId",
")",
"throws",
"IOException",
"{",
"String",
"label",
"=",
"getLabel",
"(",
")",
";",
"if",
"(",
"!",
"isRenderLabel",
"(",
")",
")",
"{",
... | Renders the optional label. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param clientId
the id used by the label to refernce the input field
@throws IOException
may be thrown by the response writer | [
"Renders",
"the",
"optional",
"label",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/datepicker/Datepicker.java#L227-L244 |
io7m/jcanephora | com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLProjectionMatrices.java | JCGLProjectionMatrices.perspectiveProjectionRH | public static Matrix4x4D perspectiveProjectionRH(
final double z_near,
final double z_far,
final double aspect,
final double horizontal_fov)
{
final double x_max = z_near * StrictMath.tan(horizontal_fov / 2.0);
final double x_min = -x_max;
final double y_max = x_max / aspect;
final double y_min = -y_max;
return frustumProjectionRH(x_min, x_max, y_min, y_max, z_near, z_far);
} | java | public static Matrix4x4D perspectiveProjectionRH(
final double z_near,
final double z_far,
final double aspect,
final double horizontal_fov)
{
final double x_max = z_near * StrictMath.tan(horizontal_fov / 2.0);
final double x_min = -x_max;
final double y_max = x_max / aspect;
final double y_min = -y_max;
return frustumProjectionRH(x_min, x_max, y_min, y_max, z_near, z_far);
} | [
"public",
"static",
"Matrix4x4D",
"perspectiveProjectionRH",
"(",
"final",
"double",
"z_near",
",",
"final",
"double",
"z_far",
",",
"final",
"double",
"aspect",
",",
"final",
"double",
"horizontal_fov",
")",
"{",
"final",
"double",
"x_max",
"=",
"z_near",
"*",
... | <p>Calculate a matrix that will produce a perspective projection based on
the given view frustum parameters, the aspect ratio of the viewport and a
given horizontal field of view in radians. Note that {@code fov_radians}
represents the full horizontal field of view: the angle at the base of the
triangle formed by the frustum on the {@code x/z} plane.</p>
<p>Note that iff {@code z_far >= Double.POSITIVE_INFINITY}, the
function produces an "infinite projection matrix", suitable for use in code
that deals with shadow volumes.</p>
<p>The function assumes a right-handed coordinate system.</p>
<p>See
<a href="http://http.developer.nvidia.com/GPUGems/gpugems_ch09.html">GPU
Gems</a></p>
@param z_near The near clipping plane coordinate
@param z_far The far clipping plane coordinate
@param aspect The aspect ratio of the viewport; the width divided
by the height. For example, an aspect ratio of 2.0
indicates a viewport twice as wide as it is high
@param horizontal_fov The horizontal field of view in radians
@return A perspective projection matrix | [
"<p",
">",
"Calculate",
"a",
"matrix",
"that",
"will",
"produce",
"a",
"perspective",
"projection",
"based",
"on",
"the",
"given",
"view",
"frustum",
"parameters",
"the",
"aspect",
"ratio",
"of",
"the",
"viewport",
"and",
"a",
"given",
"horizontal",
"field",
... | train | https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLProjectionMatrices.java#L172-L183 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java | CommerceShipmentItemPersistenceImpl.findAll | @Override
public List<CommerceShipmentItem> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceShipmentItem> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceShipmentItem",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce shipment items.
<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 CommerceShipmentItemModelImpl}. 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 start the lower bound of the range of commerce shipment items
@param end the upper bound of the range of commerce shipment items (not inclusive)
@return the range of commerce shipment items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"shipment",
"items",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java#L1671-L1674 |
kopihao/peasy-recyclerview | peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyViewHolder.java | PeasyViewHolder.bindWith | <T> void bindWith(final PeasyRecyclerView<T> binder, final int viewType) {
this.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = getLayoutPosition();
position = (position <= binder.getLastItemIndex()) ? position : getAdapterPosition();
position = (position <= binder.getLastItemIndex()) ? position : RecyclerView.NO_POSITION;
if (position != RecyclerView.NO_POSITION) {
binder.onItemClick(v, viewType, position, binder.getItem(position), getInstance());
}
}
});
this.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int position = getLayoutPosition();
position = (position <= binder.getLastItemIndex()) ? position : getAdapterPosition();
position = (position <= binder.getLastItemIndex()) ? position : RecyclerView.NO_POSITION;
if (getLayoutPosition() != RecyclerView.NO_POSITION) {
return binder.onItemLongClick(v, viewType, position, binder.getItem(position), getInstance());
}
return false;
}
});
} | java | <T> void bindWith(final PeasyRecyclerView<T> binder, final int viewType) {
this.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = getLayoutPosition();
position = (position <= binder.getLastItemIndex()) ? position : getAdapterPosition();
position = (position <= binder.getLastItemIndex()) ? position : RecyclerView.NO_POSITION;
if (position != RecyclerView.NO_POSITION) {
binder.onItemClick(v, viewType, position, binder.getItem(position), getInstance());
}
}
});
this.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int position = getLayoutPosition();
position = (position <= binder.getLastItemIndex()) ? position : getAdapterPosition();
position = (position <= binder.getLastItemIndex()) ? position : RecyclerView.NO_POSITION;
if (getLayoutPosition() != RecyclerView.NO_POSITION) {
return binder.onItemLongClick(v, viewType, position, binder.getItem(position), getInstance());
}
return false;
}
});
} | [
"<",
"T",
">",
"void",
"bindWith",
"(",
"final",
"PeasyRecyclerView",
"<",
"T",
">",
"binder",
",",
"final",
"int",
"viewType",
")",
"{",
"this",
".",
"itemView",
".",
"setOnClickListener",
"(",
"new",
"View",
".",
"OnClickListener",
"(",
")",
"{",
"@",
... | Will bind onClick and setOnLongClickListener here
@param binder {@link PeasyViewHolder} itself
@param viewType viewType ID | [
"Will",
"bind",
"onClick",
"and",
"setOnLongClickListener",
"here"
] | train | https://github.com/kopihao/peasy-recyclerview/blob/a26071849e5d5b5b1febe685f205558b49908f87/peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyViewHolder.java#L55-L79 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/core/HeapCache.java | HeapCache.entryInRefreshProbationAccessed | private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) {
long nrt = e.getRefreshProbationNextRefreshTime();
if (nrt > now) {
reviveRefreshedEntry(e, nrt);
return true;
}
return false;
} | java | private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) {
long nrt = e.getRefreshProbationNextRefreshTime();
if (nrt > now) {
reviveRefreshedEntry(e, nrt);
return true;
}
return false;
} | [
"private",
"boolean",
"entryInRefreshProbationAccessed",
"(",
"final",
"Entry",
"<",
"K",
",",
"V",
">",
"e",
",",
"final",
"long",
"now",
")",
"{",
"long",
"nrt",
"=",
"e",
".",
"getRefreshProbationNextRefreshTime",
"(",
")",
";",
"if",
"(",
"nrt",
">",
... | Entry was refreshed before, reset timer and make entry visible again. | [
"Entry",
"was",
"refreshed",
"before",
"reset",
"timer",
"and",
"make",
"entry",
"visible",
"again",
"."
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1393-L1400 |
elki-project/elki | elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java | VALPNormDistance.getPartialMaxDist | public double getPartialMaxDist(int dimension, int vp) {
final int qp = queryApprox.getApproximation(dimension);
if(vp < qp) {
return lookup[dimension][vp];
}
else if(vp > qp) {
return lookup[dimension][vp + 1];
}
else {
return Math.max(lookup[dimension][vp], lookup[dimension][vp + 1]);
}
} | java | public double getPartialMaxDist(int dimension, int vp) {
final int qp = queryApprox.getApproximation(dimension);
if(vp < qp) {
return lookup[dimension][vp];
}
else if(vp > qp) {
return lookup[dimension][vp + 1];
}
else {
return Math.max(lookup[dimension][vp], lookup[dimension][vp + 1]);
}
} | [
"public",
"double",
"getPartialMaxDist",
"(",
"int",
"dimension",
",",
"int",
"vp",
")",
"{",
"final",
"int",
"qp",
"=",
"queryApprox",
".",
"getApproximation",
"(",
"dimension",
")",
";",
"if",
"(",
"vp",
"<",
"qp",
")",
"{",
"return",
"lookup",
"[",
... | Get the maximum distance contribution of a single dimension.
@param dimension Dimension
@param vp Vector position
@return Increment | [
"Get",
"the",
"maximum",
"distance",
"contribution",
"of",
"a",
"single",
"dimension",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java#L106-L117 |
yannrichet/rsession | src/main/java/org/math/R/StartRserve.java | StartRserve.checkLocalRserve | public static boolean checkLocalRserve() {
if (isRserveRunning()) {
return true;
}
if (RserveDaemon.isWindows()) {
Log.Out.println("Windows: query registry to find where R is installed ...");
String installPath = null;
try {
Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R");
RegistryHog regHog = new RegistryHog(rp.getInputStream(), true);
rp.waitFor();
regHog.join();
installPath = regHog.getInstallPath();
} catch (Exception rge) {
Log.Err.println("ERROR: unable to run REG to find the location of R: " + rge);
return false;
}
if (installPath == null) {
Log.Err.println("ERROR: cannot find path to R. Make sure reg is available and R was installed with registry settings.");
return false;
}
return launchRserve(installPath + "\\bin\\R.exe") != null;
} else if (RserveDaemon.isMacOSX()) {
FilenameFilter ff = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("3.");
}
};
return ((launchRserve("R") != null)
|| (new File("/usr/local/Cellar/r/").exists() && new File("/usr/local/Cellar/r/").list(ff).length > 0 && launchRserve(new File("/usr/local/Cellar/r/").list(ff)[0]) != null)
|| (new File("/Library/Frameworks/R.framework/Resources/bin/R").exists() && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R") != null)
|| (new File("/usr/lib/R/bin/R").exists() && launchRserve("/usr/lib/R/bin/R") != null)
|| (new File("/usr/local/lib/R/bin/R").exists() && launchRserve("/usr/local/lib/R/bin/R") != null));
} else {
return ((launchRserve("R") != null)
|| (new File("/usr/local/lib/R/bin/R").exists() && launchRserve("/usr/local/lib/R/bin/R") != null)
|| (new File("/usr/lib/R/bin/R").exists() && launchRserve("/usr/lib/R/bin/R") != null)
|| (new File("/usr/local/bin/R").exists() && launchRserve("/usr/local/bin/R") != null)
|| (new File("/sw/bin/R").exists() && launchRserve("/sw/bin/R") != null)
|| (new File("/usr/common/bin/R").exists() && launchRserve("/usr/common/bin/R") != null)
|| (new File("/opt/bin/R").exists() && launchRserve("/opt/bin/R") != null));
}
} | java | public static boolean checkLocalRserve() {
if (isRserveRunning()) {
return true;
}
if (RserveDaemon.isWindows()) {
Log.Out.println("Windows: query registry to find where R is installed ...");
String installPath = null;
try {
Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R");
RegistryHog regHog = new RegistryHog(rp.getInputStream(), true);
rp.waitFor();
regHog.join();
installPath = regHog.getInstallPath();
} catch (Exception rge) {
Log.Err.println("ERROR: unable to run REG to find the location of R: " + rge);
return false;
}
if (installPath == null) {
Log.Err.println("ERROR: cannot find path to R. Make sure reg is available and R was installed with registry settings.");
return false;
}
return launchRserve(installPath + "\\bin\\R.exe") != null;
} else if (RserveDaemon.isMacOSX()) {
FilenameFilter ff = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("3.");
}
};
return ((launchRserve("R") != null)
|| (new File("/usr/local/Cellar/r/").exists() && new File("/usr/local/Cellar/r/").list(ff).length > 0 && launchRserve(new File("/usr/local/Cellar/r/").list(ff)[0]) != null)
|| (new File("/Library/Frameworks/R.framework/Resources/bin/R").exists() && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R") != null)
|| (new File("/usr/lib/R/bin/R").exists() && launchRserve("/usr/lib/R/bin/R") != null)
|| (new File("/usr/local/lib/R/bin/R").exists() && launchRserve("/usr/local/lib/R/bin/R") != null));
} else {
return ((launchRserve("R") != null)
|| (new File("/usr/local/lib/R/bin/R").exists() && launchRserve("/usr/local/lib/R/bin/R") != null)
|| (new File("/usr/lib/R/bin/R").exists() && launchRserve("/usr/lib/R/bin/R") != null)
|| (new File("/usr/local/bin/R").exists() && launchRserve("/usr/local/bin/R") != null)
|| (new File("/sw/bin/R").exists() && launchRserve("/sw/bin/R") != null)
|| (new File("/usr/common/bin/R").exists() && launchRserve("/usr/common/bin/R") != null)
|| (new File("/opt/bin/R").exists() && launchRserve("/opt/bin/R") != null));
}
} | [
"public",
"static",
"boolean",
"checkLocalRserve",
"(",
")",
"{",
"if",
"(",
"isRserveRunning",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"RserveDaemon",
".",
"isWindows",
"(",
")",
")",
"{",
"Log",
".",
"Out",
".",
"println",
"(",
"... | checks whether Rserve is running and if that's not the case it attempts
to start it using the defaults for the platform where it is run on. This
method is meant to be set-and-forget and cover most default setups. For
special setups you may get more control over R with
<code>launchRserve</code> instead.
@return is ok ? | [
"checks",
"whether",
"Rserve",
"is",
"running",
"and",
"if",
"that",
"s",
"not",
"the",
"case",
"it",
"attempts",
"to",
"start",
"it",
"using",
"the",
"defaults",
"for",
"the",
"platform",
"where",
"it",
"is",
"run",
"on",
".",
"This",
"method",
"is",
... | train | https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/StartRserve.java#L461-L504 |
JM-Lab/utils-java9 | src/main/java/kr/jm/utils/helper/JMJson.java | JMJson.withJsonString | public static <T> T withJsonString(String jsonString, Class<T> c) {
return withBytes(jsonString.getBytes(), c);
} | java | public static <T> T withJsonString(String jsonString, Class<T> c) {
return withBytes(jsonString.getBytes(), c);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withJsonString",
"(",
"String",
"jsonString",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"return",
"withBytes",
"(",
"jsonString",
".",
"getBytes",
"(",
")",
",",
"c",
")",
";",
"}"
] | With json string t.
@param <T> the type parameter
@param jsonString the json string
@param c the c
@return the t | [
"With",
"json",
"string",
"t",
"."
] | train | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L203-L205 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/event/EventHandlers.java | EventHandlers.handleUIEvent | public void handleUIEvent(String callbackKey, JSObject result) {
if (handlers.containsKey(callbackKey) && handlers.get(callbackKey) instanceof UIEventHandler) {
((UIEventHandler) handlers.get(callbackKey)).handle(result);
} else if (handlers.containsKey(callbackKey) && handlers.get(callbackKey) instanceof MouseEventHandler) {
((MouseEventHandler) handlers.get(callbackKey)).handle(buildMouseEvent(result));
} else {
System.err.println("Error in handle: " + callbackKey + " for result: " + result);
}
} | java | public void handleUIEvent(String callbackKey, JSObject result) {
if (handlers.containsKey(callbackKey) && handlers.get(callbackKey) instanceof UIEventHandler) {
((UIEventHandler) handlers.get(callbackKey)).handle(result);
} else if (handlers.containsKey(callbackKey) && handlers.get(callbackKey) instanceof MouseEventHandler) {
((MouseEventHandler) handlers.get(callbackKey)).handle(buildMouseEvent(result));
} else {
System.err.println("Error in handle: " + callbackKey + " for result: " + result);
}
} | [
"public",
"void",
"handleUIEvent",
"(",
"String",
"callbackKey",
",",
"JSObject",
"result",
")",
"{",
"if",
"(",
"handlers",
".",
"containsKey",
"(",
"callbackKey",
")",
"&&",
"handlers",
".",
"get",
"(",
"callbackKey",
")",
"instanceof",
"UIEventHandler",
")"... | This method is called from Javascript, passing in the previously created
callback key, and the event object. The current implementation is
receiving the LatLng object that the Javascript MouseEvent contains.
<p>
It may be more useful to return the MouseEvent and let clients go from
there, but there is only the stop() method on the MouseEvent?
@param callbackKey Key generated by the call to registerHandler.
@param result Currently the event object from the Google Maps event. | [
"This",
"method",
"is",
"called",
"from",
"Javascript",
"passing",
"in",
"the",
"previously",
"created",
"callback",
"key",
"and",
"the",
"event",
"object",
".",
"The",
"current",
"implementation",
"is",
"receiving",
"the",
"LatLng",
"object",
"that",
"the",
"... | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/event/EventHandlers.java#L96-L104 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java | FieldScopes.fromSetFields | public static FieldScope fromSetFields(
Message firstMessage, Message secondMessage, Message... rest) {
return fromSetFields(asList(firstMessage, secondMessage, rest));
} | java | public static FieldScope fromSetFields(
Message firstMessage, Message secondMessage, Message... rest) {
return fromSetFields(asList(firstMessage, secondMessage, rest));
} | [
"public",
"static",
"FieldScope",
"fromSetFields",
"(",
"Message",
"firstMessage",
",",
"Message",
"secondMessage",
",",
"Message",
"...",
"rest",
")",
"{",
"return",
"fromSetFields",
"(",
"asList",
"(",
"firstMessage",
",",
"secondMessage",
",",
"rest",
")",
")... | Creates a {@link FieldScope} covering the fields set in every message in the provided list of
messages, with the same semantics as in {@link #fromSetFields(Message)}.
<p>This can be thought of as the union of the {@link FieldScope}s for each individual message,
or the {@link FieldScope} for the merge of all the messages. These are equivalent. | [
"Creates",
"a",
"{",
"@link",
"FieldScope",
"}",
"covering",
"the",
"fields",
"set",
"in",
"every",
"message",
"in",
"the",
"provided",
"list",
"of",
"messages",
"with",
"the",
"same",
"semantics",
"as",
"in",
"{",
"@link",
"#fromSetFields",
"(",
"Message",
... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java#L79-L82 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.uploadFileChunked | public <E extends Throwable> DbxEntry.File uploadFileChunked(String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)
throws DbxException, E
{
Uploader uploader = startUploadFileChunked(targetPath, writeMode, numBytes);
return finishUploadFile(uploader, writer);
} | java | public <E extends Throwable> DbxEntry.File uploadFileChunked(String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)
throws DbxException, E
{
Uploader uploader = startUploadFileChunked(targetPath, writeMode, numBytes);
return finishUploadFile(uploader, writer);
} | [
"public",
"<",
"E",
"extends",
"Throwable",
">",
"DbxEntry",
".",
"File",
"uploadFileChunked",
"(",
"String",
"targetPath",
",",
"DbxWriteMode",
"writeMode",
",",
"long",
"numBytes",
",",
"DbxStreamWriter",
"<",
"E",
">",
"writer",
")",
"throws",
"DbxException",... | Similar to {@link #uploadFile}, except always uses the chunked upload API. | [
"Similar",
"to",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1249-L1254 |
jayantk/jklol | src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java | FeatureStandardizer.normalizeVariance | public static DiscreteFactor normalizeVariance(DiscreteFactor featureFactor, int featureVariableNum) {
DiscreteFactor variance = getVariances(featureFactor, featureVariableNum);
DiscreteFactor stdDev = new TableFactor(variance.getVars(), variance.getWeights().elementwiseSqrt());
return featureFactor.product(stdDev.inverse());
} | java | public static DiscreteFactor normalizeVariance(DiscreteFactor featureFactor, int featureVariableNum) {
DiscreteFactor variance = getVariances(featureFactor, featureVariableNum);
DiscreteFactor stdDev = new TableFactor(variance.getVars(), variance.getWeights().elementwiseSqrt());
return featureFactor.product(stdDev.inverse());
} | [
"public",
"static",
"DiscreteFactor",
"normalizeVariance",
"(",
"DiscreteFactor",
"featureFactor",
",",
"int",
"featureVariableNum",
")",
"{",
"DiscreteFactor",
"variance",
"=",
"getVariances",
"(",
"featureFactor",
",",
"featureVariableNum",
")",
";",
"DiscreteFactor",
... | Computes the empirical variance of the features in {@code featureFactor}
and normalizes each feature such that its empirical variance is 1.
@param featureFactor
@param featureVariableNum
@return | [
"Computes",
"the",
"empirical",
"variance",
"of",
"the",
"features",
"in",
"{",
"@code",
"featureFactor",
"}",
"and",
"normalizes",
"each",
"feature",
"such",
"that",
"its",
"empirical",
"variance",
"is",
"1",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java#L226-L231 |
AgNO3/jcifs-ng | src/main/java/jcifs/Config.java | Config.getInetAddress | public static InetAddress getInetAddress ( Properties props, String key, InetAddress def ) {
String addr = props.getProperty(key);
if ( addr != null ) {
try {
def = InetAddress.getByName(addr);
}
catch ( UnknownHostException uhe ) {
log.error("Unknown host " + addr, uhe);
}
}
return def;
} | java | public static InetAddress getInetAddress ( Properties props, String key, InetAddress def ) {
String addr = props.getProperty(key);
if ( addr != null ) {
try {
def = InetAddress.getByName(addr);
}
catch ( UnknownHostException uhe ) {
log.error("Unknown host " + addr, uhe);
}
}
return def;
} | [
"public",
"static",
"InetAddress",
"getInetAddress",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"InetAddress",
"def",
")",
"{",
"String",
"addr",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"addr",
"!=",
"null",
")",
"{... | Retrieve an <code>InetAddress</code>. If the address is not
an IP address and cannot be resolved <code>null</code> will
be returned. | [
"Retrieve",
"an",
"<code",
">",
"InetAddress<",
"/",
"code",
">",
".",
"If",
"the",
"address",
"is",
"not",
"an",
"IP",
"address",
"and",
"cannot",
"be",
"resolved",
"<code",
">",
"null<",
"/",
"code",
">",
"will",
"be",
"returned",
"."
] | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/Config.java#L135-L146 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/utils/StorageUtils.java | StorageUtils.getOwnCacheDirectory | public static File getOwnCacheDirectory(Context context, String cacheDir) {
File appCacheDir = null;
if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && hasExternalStoragePermission(context)) {
appCacheDir = new File(Environment.getExternalStorageDirectory(), cacheDir);
}
if (appCacheDir == null || (!appCacheDir.exists() && !appCacheDir.mkdirs())) {
appCacheDir = context.getCacheDir();
}
return appCacheDir;
} | java | public static File getOwnCacheDirectory(Context context, String cacheDir) {
File appCacheDir = null;
if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && hasExternalStoragePermission(context)) {
appCacheDir = new File(Environment.getExternalStorageDirectory(), cacheDir);
}
if (appCacheDir == null || (!appCacheDir.exists() && !appCacheDir.mkdirs())) {
appCacheDir = context.getCacheDir();
}
return appCacheDir;
} | [
"public",
"static",
"File",
"getOwnCacheDirectory",
"(",
"Context",
"context",
",",
"String",
"cacheDir",
")",
"{",
"File",
"appCacheDir",
"=",
"null",
";",
"if",
"(",
"MEDIA_MOUNTED",
".",
"equals",
"(",
"Environment",
".",
"getExternalStorageState",
"(",
")",
... | Returns specified application cache directory. Cache directory will be created on SD card by defined path if card
is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system.
@param context Application context
@param cacheDir Cache directory path (e.g.: "AppCacheDir", "AppDir/cache/images")
@return Cache {@link File directory} | [
"Returns",
"specified",
"application",
"cache",
"directory",
".",
"Cache",
"directory",
"will",
"be",
"created",
"on",
"SD",
"card",
"by",
"defined",
"path",
"if",
"card",
"is",
"mounted",
"and",
"app",
"has",
"appropriate",
"permission",
".",
"Else",
"-",
"... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/StorageUtils.java#L130-L139 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.addPanels | public void addPanels(List<AbstractPanel> panels, PanelType panelType) {
validateNotNull(panels, "panels");
validateNotNull(panelType, "panelType");
boolean fullLayout = layout == Layout.FULL;
addPanels(getTabbedFull(), panels, fullLayout);
switch (panelType) {
case SELECT:
addPanels(getTabbedSelect(), panels, !fullLayout);
break;
case STATUS:
addPanels(getTabbedStatus(), panels, !fullLayout);
break;
case WORK:
addPanels(getTabbedWork(), panels, !fullLayout);
break;
default:
break;
}
} | java | public void addPanels(List<AbstractPanel> panels, PanelType panelType) {
validateNotNull(panels, "panels");
validateNotNull(panelType, "panelType");
boolean fullLayout = layout == Layout.FULL;
addPanels(getTabbedFull(), panels, fullLayout);
switch (panelType) {
case SELECT:
addPanels(getTabbedSelect(), panels, !fullLayout);
break;
case STATUS:
addPanels(getTabbedStatus(), panels, !fullLayout);
break;
case WORK:
addPanels(getTabbedWork(), panels, !fullLayout);
break;
default:
break;
}
} | [
"public",
"void",
"addPanels",
"(",
"List",
"<",
"AbstractPanel",
">",
"panels",
",",
"PanelType",
"panelType",
")",
"{",
"validateNotNull",
"(",
"panels",
",",
"\"panels\"",
")",
";",
"validateNotNull",
"(",
"panelType",
",",
"\"panelType\"",
")",
";",
"boole... | Adds the given panels to the workbench, hinting with the given panel type.
@param panels the panels to add to the workbench
@param panelType the type of the panels
@throws IllegalArgumentException if any of the parameters is {@code null}.
@since 2.5.0
@see #removePanels(List, PanelType)
@see #addPanel(AbstractPanel, PanelType) | [
"Adds",
"the",
"given",
"panels",
"to",
"the",
"workbench",
"hinting",
"with",
"the",
"given",
"panel",
"type",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L844-L865 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/component/AnimatedModelComponent.java | AnimatedModelComponent.forceStart | public Timer forceStart(BlockPos pos, String animation, Timer timer)
{
stop(pos, animation);
return addTimer(pos, animation, timer);
} | java | public Timer forceStart(BlockPos pos, String animation, Timer timer)
{
stop(pos, animation);
return addTimer(pos, animation, timer);
} | [
"public",
"Timer",
"forceStart",
"(",
"BlockPos",
"pos",
",",
"String",
"animation",
",",
"Timer",
"timer",
")",
"{",
"stop",
"(",
"pos",
",",
"animation",
")",
";",
"return",
"addTimer",
"(",
"pos",
",",
"animation",
",",
"timer",
")",
";",
"}"
] | Start the animation with the specified {@link Timer}.<br>
Restarts the animation if it is already running.
@param pos the pos
@param animation the animation
@param timer the timer
@return the timer | [
"Start",
"the",
"animation",
"with",
"the",
"specified",
"{",
"@link",
"Timer",
"}",
".",
"<br",
">",
"Restarts",
"the",
"animation",
"if",
"it",
"is",
"already",
"running",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/component/AnimatedModelComponent.java#L193-L197 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java | AbstractRenderer.createLabel | public Label createLabel(BaseComponent parent, Object value, String prefix) {
return createLabel(parent, value, prefix, null);
} | java | public Label createLabel(BaseComponent parent, Object value, String prefix) {
return createLabel(parent, value, prefix, null);
} | [
"public",
"Label",
"createLabel",
"(",
"BaseComponent",
"parent",
",",
"Object",
"value",
",",
"String",
"prefix",
")",
"{",
"return",
"createLabel",
"(",
"parent",
",",
"value",
",",
"prefix",
",",
"null",
")",
";",
"}"
] | Creates a label for a string value.
@param parent BaseComponent that will be the parent of the label.
@param value Value to be used as label text.
@param prefix Value to be used as a prefix for the label text.
@return The newly created label. | [
"Creates",
"a",
"label",
"for",
"a",
"string",
"value",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java#L87-L89 |
Metatavu/edelphi | rest/src/main/java/fi/metatavu/edelphi/comments/QueryQuestionCommentController.java | QueryQuestionCommentController.isPanelsComment | public boolean isPanelsComment(QueryQuestionComment comment, Panel panel) {
Panel queryPanel = resourceController.getResourcePanel(comment.getQueryPage().getQuerySection().getQuery());
if (queryPanel == null || panel == null) {
return false;
}
return queryPanel.getId().equals(panel.getId());
} | java | public boolean isPanelsComment(QueryQuestionComment comment, Panel panel) {
Panel queryPanel = resourceController.getResourcePanel(comment.getQueryPage().getQuerySection().getQuery());
if (queryPanel == null || panel == null) {
return false;
}
return queryPanel.getId().equals(panel.getId());
} | [
"public",
"boolean",
"isPanelsComment",
"(",
"QueryQuestionComment",
"comment",
",",
"Panel",
"panel",
")",
"{",
"Panel",
"queryPanel",
"=",
"resourceController",
".",
"getResourcePanel",
"(",
"comment",
".",
"getQueryPage",
"(",
")",
".",
"getQuerySection",
"(",
... | Returns whether comment belongs to given panel
@param comment comment
@param panel panel
@return whether comment belongs to given panel | [
"Returns",
"whether",
"comment",
"belongs",
"to",
"given",
"panel"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/comments/QueryQuestionCommentController.java#L145-L152 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java | ReflectionUtils.getRequiredInternalConstructor | @Internal
public static <T> Constructor<T> getRequiredInternalConstructor(Class<T> type, Class... argumentTypes) {
try {
return type.getDeclaredConstructor(argumentTypes);
} catch (NoSuchMethodException e) {
throw newNoSuchConstructorInternalError(type, argumentTypes);
}
} | java | @Internal
public static <T> Constructor<T> getRequiredInternalConstructor(Class<T> type, Class... argumentTypes) {
try {
return type.getDeclaredConstructor(argumentTypes);
} catch (NoSuchMethodException e) {
throw newNoSuchConstructorInternalError(type, argumentTypes);
}
} | [
"@",
"Internal",
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"getRequiredInternalConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Class",
"...",
"argumentTypes",
")",
"{",
"try",
"{",
"return",
"type",
".",
"getDeclaredConstructo... | Finds an internal constructor defined by the Micronaut API and throws a {@link NoSuchMethodError} if it doesn't exist.
@param type The type
@param argumentTypes The argument types
@param <T> The type
@return An {@link Optional} contains the method or empty
@throws NoSuchMethodError If the method doesn't exist | [
"Finds",
"an",
"internal",
"constructor",
"defined",
"by",
"the",
"Micronaut",
"API",
"and",
"throws",
"a",
"{",
"@link",
"NoSuchMethodError",
"}",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java#L273-L280 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/databases/information/TableInformation.java | TableInformation.addColInfo | public void addColInfo(final String _colName,
final Set<AbstractDatabase.ColumnType> _colTypes,
final int _size,
final int _scale,
final boolean _isNullable)
{
this.colMap.put(_colName.toUpperCase(),
new ColumnInformation(_colName, _colTypes, _size, _scale, _isNullable));
} | java | public void addColInfo(final String _colName,
final Set<AbstractDatabase.ColumnType> _colTypes,
final int _size,
final int _scale,
final boolean _isNullable)
{
this.colMap.put(_colName.toUpperCase(),
new ColumnInformation(_colName, _colTypes, _size, _scale, _isNullable));
} | [
"public",
"void",
"addColInfo",
"(",
"final",
"String",
"_colName",
",",
"final",
"Set",
"<",
"AbstractDatabase",
".",
"ColumnType",
">",
"_colTypes",
",",
"final",
"int",
"_size",
",",
"final",
"int",
"_scale",
",",
"final",
"boolean",
"_isNullable",
")",
"... | Appends the column information for given values for column
<code>_colName</code>.
@param _colName name of the column
@param _colTypes eFaps types of the column
@param _size size (for character)
@param _scale scale (for number)
@param _isNullable is the column nullable?
@see #colMap | [
"Appends",
"the",
"column",
"information",
"for",
"given",
"values",
"for",
"column",
"<code",
">",
"_colName<",
"/",
"code",
">",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/databases/information/TableInformation.java#L110-L118 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateTranslation | public Matrix4f rotateTranslation(Quaternionfc quat, Matrix4f dest) {
float w2 = quat.w() * quat.w(), x2 = quat.x() * quat.x();
float y2 = quat.y() * quat.y(), z2 = quat.z() * quat.z();
float zw = quat.z() * quat.w(), dzw = zw + zw, xy = quat.x() * quat.y(), dxy = xy + xy;
float xz = quat.x() * quat.z(), dxz = xz + xz, yw = quat.y() * quat.w(), dyw = yw + yw;
float yz = quat.y() * quat.z(), dyz = yz + yz, xw = quat.x() * quat.w(), dxw = xw + xw;
float rm00 = w2 + x2 - z2 - y2;
float rm01 = dxy + dzw;
float rm02 = dxz - dyw;
float rm10 = -dzw + dxy;
float rm11 = y2 - z2 + w2 - x2;
float rm12 = dyz + dxw;
float rm20 = dyw + dxz;
float rm21 = dyz - dxw;
float rm22 = z2 - y2 - x2 + w2;
dest._m20(rm20);
dest._m21(rm21);
dest._m22(rm22);
dest._m23(0.0f);
dest._m00(rm00);
dest._m01(rm01);
dest._m02(rm02);
dest._m03(0.0f);
dest._m10(rm10);
dest._m11(rm11);
dest._m12(rm12);
dest._m13(0.0f);
dest._m30(m30);
dest._m31(m31);
dest._m32(m32);
dest._m33(m33);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | java | public Matrix4f rotateTranslation(Quaternionfc quat, Matrix4f dest) {
float w2 = quat.w() * quat.w(), x2 = quat.x() * quat.x();
float y2 = quat.y() * quat.y(), z2 = quat.z() * quat.z();
float zw = quat.z() * quat.w(), dzw = zw + zw, xy = quat.x() * quat.y(), dxy = xy + xy;
float xz = quat.x() * quat.z(), dxz = xz + xz, yw = quat.y() * quat.w(), dyw = yw + yw;
float yz = quat.y() * quat.z(), dyz = yz + yz, xw = quat.x() * quat.w(), dxw = xw + xw;
float rm00 = w2 + x2 - z2 - y2;
float rm01 = dxy + dzw;
float rm02 = dxz - dyw;
float rm10 = -dzw + dxy;
float rm11 = y2 - z2 + w2 - x2;
float rm12 = dyz + dxw;
float rm20 = dyw + dxz;
float rm21 = dyz - dxw;
float rm22 = z2 - y2 - x2 + w2;
dest._m20(rm20);
dest._m21(rm21);
dest._m22(rm22);
dest._m23(0.0f);
dest._m00(rm00);
dest._m01(rm01);
dest._m02(rm02);
dest._m03(0.0f);
dest._m10(rm10);
dest._m11(rm11);
dest._m12(rm12);
dest._m13(0.0f);
dest._m30(m30);
dest._m31(m31);
dest._m32(m32);
dest._m33(m33);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | [
"public",
"Matrix4f",
"rotateTranslation",
"(",
"Quaternionfc",
"quat",
",",
"Matrix4f",
"dest",
")",
"{",
"float",
"w2",
"=",
"quat",
".",
"w",
"(",
")",
"*",
"quat",
".",
"w",
"(",
")",
",",
"x2",
"=",
"quat",
".",
"x",
"(",
")",
"*",
"quat",
"... | Apply the rotation transformation of the given {@link Quaternionfc} to this matrix, which is assumed to only contain a translation, and store
the result in <code>dest</code>.
<p>
This method assumes <code>this</code> to only contain a translation.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying,
use {@link #rotation(Quaternionfc)}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@see #rotation(Quaternionfc)
@param quat
the {@link Quaternionfc}
@param dest
will hold the result
@return dest | [
"Apply",
"the",
"rotation",
"transformation",
"of",
"the",
"given",
"{",
"@link",
"Quaternionfc",
"}",
"to",
"this",
"matrix",
"which",
"is",
"assumed",
"to",
"only",
"contain",
"a",
"translation",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L11161-L11195 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Chunk.java | Chunk.setRemoteGoto | public Chunk setRemoteGoto(String filename, String name) {
return setAttribute(REMOTEGOTO, new Object[] { filename, name });
} | java | public Chunk setRemoteGoto(String filename, String name) {
return setAttribute(REMOTEGOTO, new Object[] { filename, name });
} | [
"public",
"Chunk",
"setRemoteGoto",
"(",
"String",
"filename",
",",
"String",
"name",
")",
"{",
"return",
"setAttribute",
"(",
"REMOTEGOTO",
",",
"new",
"Object",
"[",
"]",
"{",
"filename",
",",
"name",
"}",
")",
";",
"}"
] | Sets a goto for a remote destination for this <CODE>Chunk</CODE>.
@param filename
the file name of the destination document
@param name
the name of the destination to go to
@return this <CODE>Chunk</CODE> | [
"Sets",
"a",
"goto",
"for",
"a",
"remote",
"destination",
"for",
"this",
"<CODE",
">",
"Chunk<",
"/",
"CODE",
">",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Chunk.java#L692-L694 |
Trilarion/java-vorbis-support | src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java | VorbisAudioFileReader.getAudioInputStream | public AudioInputStream getAudioInputStream(InputStream inputStream, int medialength, int totalms) throws UnsupportedAudioFileException, IOException {
LOG.log(Level.FINE, "getAudioInputStream(InputStream inputStreamint medialength, int totalms)");
try {
if (!inputStream.markSupported()) {
inputStream = new BufferedInputStream(inputStream);
}
inputStream.mark(MARK_LIMIT);
AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, medialength, totalms);
inputStream.reset();
return new AudioInputStream(inputStream, audioFileFormat.getFormat(), audioFileFormat.getFrameLength());
} catch (UnsupportedAudioFileException | IOException e) {
inputStream.reset();
throw e;
}
} | java | public AudioInputStream getAudioInputStream(InputStream inputStream, int medialength, int totalms) throws UnsupportedAudioFileException, IOException {
LOG.log(Level.FINE, "getAudioInputStream(InputStream inputStreamint medialength, int totalms)");
try {
if (!inputStream.markSupported()) {
inputStream = new BufferedInputStream(inputStream);
}
inputStream.mark(MARK_LIMIT);
AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, medialength, totalms);
inputStream.reset();
return new AudioInputStream(inputStream, audioFileFormat.getFormat(), audioFileFormat.getFrameLength());
} catch (UnsupportedAudioFileException | IOException e) {
inputStream.reset();
throw e;
}
} | [
"public",
"AudioInputStream",
"getAudioInputStream",
"(",
"InputStream",
"inputStream",
",",
"int",
"medialength",
",",
"int",
"totalms",
")",
"throws",
"UnsupportedAudioFileException",
",",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\... | Return the AudioInputStream from the given InputStream.
@param inputStream
@param totalms
@param medialength
@return
@throws javax.sound.sampled.UnsupportedAudioFileException
@throws java.io.IOException | [
"Return",
"the",
"AudioInputStream",
"from",
"the",
"given",
"InputStream",
"."
] | train | https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java#L290-L304 |
wanglinsong/thx-android | uia-client/src/main/java/com/android/uiautomator/stub/Rect.java | Rect.intersects | public static boolean intersects(Rect a, Rect b) {
return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
} | java | public static boolean intersects(Rect a, Rect b) {
return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
} | [
"public",
"static",
"boolean",
"intersects",
"(",
"Rect",
"a",
",",
"Rect",
"b",
")",
"{",
"return",
"a",
".",
"left",
"<",
"b",
".",
"right",
"&&",
"b",
".",
"left",
"<",
"a",
".",
"right",
"&&",
"a",
".",
"top",
"<",
"b",
".",
"bottom",
"&&",... | Returns true iff the two specified rectangles intersect. In no event are
either of the rectangles modified. To record the intersection,
use {@link #intersect(Rect)} or {@link #setIntersect(Rect, Rect)}.
@param a The first rectangle being tested for intersection
@param b The second rectangle being tested for intersection
@return true iff the two specified rectangles intersect. In no event are
either of the rectangles modified. | [
"Returns",
"true",
"iff",
"the",
"two",
"specified",
"rectangles",
"intersect",
".",
"In",
"no",
"event",
"are",
"either",
"of",
"the",
"rectangles",
"modified",
".",
"To",
"record",
"the",
"intersection",
"use",
"{",
"@link",
"#intersect",
"(",
"Rect",
")",... | train | https://github.com/wanglinsong/thx-android/blob/4a98c4181b3e8876e688591737da37627c07e72b/uia-client/src/main/java/com/android/uiautomator/stub/Rect.java#L493-L495 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/XmlContentBuilder.java | XmlContentBuilder.buildPage | public Document buildPage(Map<String, Object> content) {
Document doc = documentBuilder.newDocument();
Element jcrRoot = createJcrRoot(doc, NT_PAGE);
Element jcrContent = createJcrContent(doc, jcrRoot, NT_PAGE_CONTENT);
exportPayload(doc, jcrContent, content);
return doc;
} | java | public Document buildPage(Map<String, Object> content) {
Document doc = documentBuilder.newDocument();
Element jcrRoot = createJcrRoot(doc, NT_PAGE);
Element jcrContent = createJcrContent(doc, jcrRoot, NT_PAGE_CONTENT);
exportPayload(doc, jcrContent, content);
return doc;
} | [
"public",
"Document",
"buildPage",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
")",
"{",
"Document",
"doc",
"=",
"documentBuilder",
".",
"newDocument",
"(",
")",
";",
"Element",
"jcrRoot",
"=",
"createJcrRoot",
"(",
"doc",
",",
"NT_PAGE",
")"... | Build XML for cq:Page.
@param content Content with page properties and nested nodes
@return cq:Page JCR XML | [
"Build",
"XML",
"for",
"cq",
":",
"Page",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/XmlContentBuilder.java#L88-L96 |
threerings/nenya | core/src/main/java/com/threerings/openal/SoundManager.java | SoundManager.getClip | protected ClipBuffer getClip (ClipProvider provider, String path)
{
return getClip(provider, path, null);
} | java | protected ClipBuffer getClip (ClipProvider provider, String path)
{
return getClip(provider, path, null);
} | [
"protected",
"ClipBuffer",
"getClip",
"(",
"ClipProvider",
"provider",
",",
"String",
"path",
")",
"{",
"return",
"getClip",
"(",
"provider",
",",
"path",
",",
"null",
")",
";",
"}"
] | Creates a clip buffer for the sound clip loaded via the specified provider with the
specified path. The clip buffer may come from the cache, and it will immediately be queued
for loading if it is not already loaded. | [
"Creates",
"a",
"clip",
"buffer",
"for",
"the",
"sound",
"clip",
"loaded",
"via",
"the",
"specified",
"provider",
"with",
"the",
"specified",
"path",
".",
"The",
"clip",
"buffer",
"may",
"come",
"from",
"the",
"cache",
"and",
"it",
"will",
"immediately",
"... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/SoundManager.java#L249-L252 |
Trilarion/java-vorbis-support | src/main/java/com/github/trilarion/sound/vorbis/jcraft/jorbis/CodeBook.java | CodeBook.besterror | int besterror(float[] a, int step, int addmul) {
int best = best(a, step);
switch (addmul) {
case 0:
for (int i = 0, o = 0; i < dim; i++, o += step) {
a[o] -= valuelist[best * dim + i];
}
break;
case 1:
for (int i = 0, o = 0; i < dim; i++, o += step) {
float val = valuelist[best * dim + i];
if (val == 0) {
a[o] = 0;
} else {
a[o] /= val;
}
}
break;
}
return (best);
} | java | int besterror(float[] a, int step, int addmul) {
int best = best(a, step);
switch (addmul) {
case 0:
for (int i = 0, o = 0; i < dim; i++, o += step) {
a[o] -= valuelist[best * dim + i];
}
break;
case 1:
for (int i = 0, o = 0; i < dim; i++, o += step) {
float val = valuelist[best * dim + i];
if (val == 0) {
a[o] = 0;
} else {
a[o] /= val;
}
}
break;
}
return (best);
} | [
"int",
"besterror",
"(",
"float",
"[",
"]",
"a",
",",
"int",
"step",
",",
"int",
"addmul",
")",
"{",
"int",
"best",
"=",
"best",
"(",
"a",
",",
"step",
")",
";",
"switch",
"(",
"addmul",
")",
"{",
"case",
"0",
":",
"for",
"(",
"int",
"i",
"="... | returns the entry number and *modifies a* to the remainder value | [
"returns",
"the",
"entry",
"number",
"and",
"*",
"modifies",
"a",
"*",
"to",
"the",
"remainder",
"value"
] | train | https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/jcraft/jorbis/CodeBook.java#L284-L304 |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CellValidator.java | CellValidator.cellValidator | public static <T> CellValidator cellValidator(T obj) {
if (obj == null) {
return null;
}
Kind kind = Kind.objectToKind(obj);
AbstractType<?> tAbstractType = CassandraUtils.marshallerInstance(obj);
String validatorClassName = tAbstractType.getClass().getCanonicalName();
Collection<String> validatorTypes = null;
DataType.Name cqlTypeName = MAP_JAVA_TYPE_TO_DATA_TYPE_NAME.get(validatorClassName);// tAbstractType.get
return new CellValidator(validatorClassName, kind, validatorTypes, cqlTypeName);
} | java | public static <T> CellValidator cellValidator(T obj) {
if (obj == null) {
return null;
}
Kind kind = Kind.objectToKind(obj);
AbstractType<?> tAbstractType = CassandraUtils.marshallerInstance(obj);
String validatorClassName = tAbstractType.getClass().getCanonicalName();
Collection<String> validatorTypes = null;
DataType.Name cqlTypeName = MAP_JAVA_TYPE_TO_DATA_TYPE_NAME.get(validatorClassName);// tAbstractType.get
return new CellValidator(validatorClassName, kind, validatorTypes, cqlTypeName);
} | [
"public",
"static",
"<",
"T",
">",
"CellValidator",
"cellValidator",
"(",
"T",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Kind",
"kind",
"=",
"Kind",
".",
"objectToKind",
"(",
"obj",
")",
";",
"AbstractTyp... | Generates a CellValidator for a generic instance of an object.
We need the actual instance in order to differentiate between an UUID and a TimeUUID.
@param obj an instance to use to build the new CellValidator.
@param <T> the generic type of the provided object instance.
@return a new CellValidator associated to the provided object. | [
"Generates",
"a",
"CellValidator",
"for",
"a",
"generic",
"instance",
"of",
"an",
"object",
".",
"We",
"need",
"the",
"actual",
"instance",
"in",
"order",
"to",
"differentiate",
"between",
"an",
"UUID",
"and",
"a",
"TimeUUID",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CellValidator.java#L247-L259 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/WaveHandlerBase.java | WaveHandlerBase.performHandle | private void performHandle(final Wave wave, final Method method) throws WaveException {
// Build parameter list of the searched method
final List<Object> parameterValues = new ArrayList<>();
// Don't add WaveType parameters if we us the default processWave method
if (!AbstractComponent.PROCESS_WAVE_METHOD_NAME.equals(method.getName())) {
for (final WaveData<?> wd : wave.waveDatas()) {
// Add only wave items defined as parameter
if (wd.key().isParameter()) {
parameterValues.add(wd.value());
}
}
}
// Add the current wave to process
parameterValues.add(wave);
try {
ClassUtility.callMethod(method, getWaveReady(), parameterValues.toArray());
} catch (final CoreException e) {
LOGGER.error(WAVE_DISPATCH_ERROR, e);
// Propagate the wave exception
throw new WaveException(wave, e);
}
} | java | private void performHandle(final Wave wave, final Method method) throws WaveException {
// Build parameter list of the searched method
final List<Object> parameterValues = new ArrayList<>();
// Don't add WaveType parameters if we us the default processWave method
if (!AbstractComponent.PROCESS_WAVE_METHOD_NAME.equals(method.getName())) {
for (final WaveData<?> wd : wave.waveDatas()) {
// Add only wave items defined as parameter
if (wd.key().isParameter()) {
parameterValues.add(wd.value());
}
}
}
// Add the current wave to process
parameterValues.add(wave);
try {
ClassUtility.callMethod(method, getWaveReady(), parameterValues.toArray());
} catch (final CoreException e) {
LOGGER.error(WAVE_DISPATCH_ERROR, e);
// Propagate the wave exception
throw new WaveException(wave, e);
}
} | [
"private",
"void",
"performHandle",
"(",
"final",
"Wave",
"wave",
",",
"final",
"Method",
"method",
")",
"throws",
"WaveException",
"{",
"// Build parameter list of the searched method",
"final",
"List",
"<",
"Object",
">",
"parameterValues",
"=",
"new",
"ArrayList",
... | Perform the handle independently of thread used.
@param wave the wave to manage
@param method the handler method to call, could be null
@throws WaveException if an error occurred while processing the wave | [
"Perform",
"the",
"handle",
"independently",
"of",
"thread",
"used",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/WaveHandlerBase.java#L192-L220 |
rundeck/rundeck | examples/example-java-step-plugin/src/main/java/com/dtolabs/rundeck/plugin/example/ExampleStepPlugin.java | ExampleStepPlugin.executeStep | public void executeStep(final PluginStepContext context, final Map<String, Object> configuration) throws
StepException{
System.out.println("Example step executing on nodes: " + context.getNodes().getNodeNames());
System.out.println("Example step configuration: " + configuration);
System.out.println("Example step num: " + context.getStepNumber());
System.out.println("Example step context: " + context.getStepContext());
if ("true".equals(configuration.get("lampkin"))) {
throw new StepException("lampkin was true", Reason.ExampleReason);
}
} | java | public void executeStep(final PluginStepContext context, final Map<String, Object> configuration) throws
StepException{
System.out.println("Example step executing on nodes: " + context.getNodes().getNodeNames());
System.out.println("Example step configuration: " + configuration);
System.out.println("Example step num: " + context.getStepNumber());
System.out.println("Example step context: " + context.getStepContext());
if ("true".equals(configuration.get("lampkin"))) {
throw new StepException("lampkin was true", Reason.ExampleReason);
}
} | [
"public",
"void",
"executeStep",
"(",
"final",
"PluginStepContext",
"context",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"configuration",
")",
"throws",
"StepException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Example step executing on nod... | Here is the meat of the plugin implementation, which should perform the appropriate logic for your plugin.
<p/>
The {@link PluginStepContext} provides access to the appropriate Nodes, the configuration of the plugin, and
details about the step number and context. | [
"Here",
"is",
"the",
"meat",
"of",
"the",
"plugin",
"implementation",
"which",
"should",
"perform",
"the",
"appropriate",
"logic",
"for",
"your",
"plugin",
".",
"<p",
"/",
">",
"The",
"{"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/examples/example-java-step-plugin/src/main/java/com/dtolabs/rundeck/plugin/example/ExampleStepPlugin.java#L139-L148 |
qiujuer/Genius-Android | caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java | Run.onUiSync | public static <T> T onUiSync(Func<T> func, long waitMillis, boolean cancelOnTimeOut) {
return onUiSync(func, waitMillis, 0, cancelOnTimeOut);
} | java | public static <T> T onUiSync(Func<T> func, long waitMillis, boolean cancelOnTimeOut) {
return onUiSync(func, waitMillis, 0, cancelOnTimeOut);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"onUiSync",
"(",
"Func",
"<",
"T",
">",
"func",
",",
"long",
"waitMillis",
",",
"boolean",
"cancelOnTimeOut",
")",
"{",
"return",
"onUiSync",
"(",
"func",
",",
"waitMillis",
",",
"0",
",",
"cancelOnTimeOut",
")",
... | Synchronously
<p/>
In this you can receiver {@link Func#call()} return
<p/>
The current thread relative thread synchronization operation,
blocking the current thread,
thread for the main thread to complete
But the current thread just wait for the waitTime long.
@param func Func Interface
@param waitMillis wait for the main thread run milliseconds Time
@param cancelOnTimeOut on timeout the current thread cancel the runnable task
@param <T> you can set any type to return
@return {@link T} | [
"Synchronously",
"<p",
"/",
">",
"In",
"this",
"you",
"can",
"receiver",
"{",
"@link",
"Func#call",
"()",
"}",
"return",
"<p",
"/",
">",
"The",
"current",
"thread",
"relative",
"thread",
"synchronization",
"operation",
"blocking",
"the",
"current",
"thread",
... | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java#L239-L241 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java | PersonGroupsImpl.updateWithServiceResponseAsync | public Observable<ServiceResponse<Void>> updateWithServiceResponseAsync(String personGroupId, UpdatePersonGroupsOptionalParameter updateOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (personGroupId == null) {
throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null.");
}
final String name = updateOptionalParameter != null ? updateOptionalParameter.name() : null;
final String userData = updateOptionalParameter != null ? updateOptionalParameter.userData() : null;
return updateWithServiceResponseAsync(personGroupId, name, userData);
} | java | public Observable<ServiceResponse<Void>> updateWithServiceResponseAsync(String personGroupId, UpdatePersonGroupsOptionalParameter updateOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (personGroupId == null) {
throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null.");
}
final String name = updateOptionalParameter != null ? updateOptionalParameter.name() : null;
final String userData = updateOptionalParameter != null ? updateOptionalParameter.userData() : null;
return updateWithServiceResponseAsync(personGroupId, name, userData);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Void",
">",
">",
"updateWithServiceResponseAsync",
"(",
"String",
"personGroupId",
",",
"UpdatePersonGroupsOptionalParameter",
"updateOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"azureRegion"... | Update an existing person group's display name and userData. The properties which does not appear in request body will not be updated.
@param personGroupId Id referencing a particular person group.
@param updateOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Update",
"an",
"existing",
"person",
"group",
"s",
"display",
"name",
"and",
"userData",
".",
"The",
"properties",
"which",
"does",
"not",
"appear",
"in",
"request",
"body",
"will",
"not",
"be",
"updated",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java#L465-L476 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/Sysprop.java | Sysprop.addProperty | @JsonAnySetter
public Sysprop addProperty(String name, Object value) {
if (!StringUtils.isBlank(name) && value != null) {
getProperties().put(name, value);
}
return this;
} | java | @JsonAnySetter
public Sysprop addProperty(String name, Object value) {
if (!StringUtils.isBlank(name) && value != null) {
getProperties().put(name, value);
}
return this;
} | [
"@",
"JsonAnySetter",
"public",
"Sysprop",
"addProperty",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
"&&",
"value",
"!=",
"null",
")",
"{",
"getProperties",
"(",
")",
".",
"... | Adds a new key/value pair to the map.
@param name a key
@param value a value
@return this | [
"Adds",
"a",
"new",
"key",
"/",
"value",
"pair",
"to",
"the",
"map",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/Sysprop.java#L83-L89 |
Azure/azure-sdk-for-java | signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java | SignalRsInner.beginCreateOrUpdateAsync | public Observable<SignalRResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() {
@Override
public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) {
return response.body();
}
});
} | java | public Observable<SignalRResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() {
@Override
public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SignalRResourceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"SignalRCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"reso... | Create a new SignalR service and update an exiting SignalR service.
@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 resourceName The name of the SignalR resource.
@param parameters Parameters for the create or update operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SignalRResourceInner object | [
"Create",
"a",
"new",
"SignalR",
"service",
"and",
"update",
"an",
"exiting",
"SignalR",
"service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1235-L1242 |
sagiegurari/fax4j | src/main/java/org/fax4j/bridge/email/DefaultMailMessageParser.java | DefaultMailMessageParser.updateFaxJobFromInputDataImpl | @Override
protected void updateFaxJobFromInputDataImpl(Message inputData,FaxJob faxJob)
{
String targetAddress=null;
String senderEmail=null;
try
{
//get target address
targetAddress=this.getTargetAddress(inputData);
//get sender email
senderEmail=this.getSenderEmail(inputData);
}
catch(MessagingException exception)
{
throw new FaxException("Unable to extract fax job data from mail message.",exception);
}
//update fax job
faxJob.setTargetAddress(targetAddress);
faxJob.setSenderEmail(senderEmail);
} | java | @Override
protected void updateFaxJobFromInputDataImpl(Message inputData,FaxJob faxJob)
{
String targetAddress=null;
String senderEmail=null;
try
{
//get target address
targetAddress=this.getTargetAddress(inputData);
//get sender email
senderEmail=this.getSenderEmail(inputData);
}
catch(MessagingException exception)
{
throw new FaxException("Unable to extract fax job data from mail message.",exception);
}
//update fax job
faxJob.setTargetAddress(targetAddress);
faxJob.setSenderEmail(senderEmail);
} | [
"@",
"Override",
"protected",
"void",
"updateFaxJobFromInputDataImpl",
"(",
"Message",
"inputData",
",",
"FaxJob",
"faxJob",
")",
"{",
"String",
"targetAddress",
"=",
"null",
";",
"String",
"senderEmail",
"=",
"null",
";",
"try",
"{",
"//get target address",
"targ... | This function update the fax job from the request data.<br>
This fax job will not have any file data.
@param inputData
The input data
@param faxJob
The fax job to update | [
"This",
"function",
"update",
"the",
"fax",
"job",
"from",
"the",
"request",
"data",
".",
"<br",
">",
"This",
"fax",
"job",
"will",
"not",
"have",
"any",
"file",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/email/DefaultMailMessageParser.java#L91-L112 |
apiman/apiman | tools/i18n/src/main/java/io/apiman/tools/i18n/TemplateScanner.java | TemplateScanner.outputMessages | private static void outputMessages(TreeMap<String, String> strings, File outputFile) throws FileNotFoundException {
PrintWriter writer = new PrintWriter(new FileOutputStream(outputFile));
for (Entry<String, String> entry : strings.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
writer.append(key);
writer.append('=');
writer.append(val);
writer.append("\n");
}
writer.flush();
writer.close();
} | java | private static void outputMessages(TreeMap<String, String> strings, File outputFile) throws FileNotFoundException {
PrintWriter writer = new PrintWriter(new FileOutputStream(outputFile));
for (Entry<String, String> entry : strings.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
writer.append(key);
writer.append('=');
writer.append(val);
writer.append("\n");
}
writer.flush();
writer.close();
} | [
"private",
"static",
"void",
"outputMessages",
"(",
"TreeMap",
"<",
"String",
",",
"String",
">",
"strings",
",",
"File",
"outputFile",
")",
"throws",
"FileNotFoundException",
"{",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"new",
"FileOutputStream",... | Output the sorted map of strings to the specified output file.
@param strings
@param outputFile
@throws FileNotFoundException | [
"Output",
"the",
"sorted",
"map",
"of",
"strings",
"to",
"the",
"specified",
"output",
"file",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/tools/i18n/src/main/java/io/apiman/tools/i18n/TemplateScanner.java#L220-L232 |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.printResult | public static String printResult(final JoinPoint joinPoint, final Object object) {
return printResult(joinPoint, object, LoggingAspectConfig.DEFAULT_RESULT_DETAILS);
} | java | public static String printResult(final JoinPoint joinPoint, final Object object) {
return printResult(joinPoint, object, LoggingAspectConfig.DEFAULT_RESULT_DETAILS);
} | [
"public",
"static",
"String",
"printResult",
"(",
"final",
"JoinPoint",
"joinPoint",
",",
"final",
"Object",
"object",
")",
"{",
"return",
"printResult",
"(",
"joinPoint",
",",
"object",
",",
"LoggingAspectConfig",
".",
"DEFAULT_RESULT_DETAILS",
")",
";",
"}"
] | Print Result object according to input parameters and {@link LoggingAspectConfig}.
@param joinPoint - intercepting join point
@param object - result value to be printed | [
"Print",
"Result",
"object",
"according",
"to",
"input",
"parameters",
"and",
"{"
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L244-L246 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java | UIComponentClassicTagBase._indexOfStartingFrom | private static int _indexOfStartingFrom(List<?> list, int startIndex, Object searchValue)
{
int itemCount = list.size();
boolean found = false;
// start searching from location remembered from last time
for (int currIndex = startIndex; currIndex < itemCount; currIndex++)
{
Object currId = list.get(currIndex);
if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId)))
{
return currIndex;
}
}
// handle case where we started past the first item and didn't find the
// searchValue. Now search from the beginning to where we started
if (startIndex > 0)
{
for (int currIndex = 0; currIndex < startIndex; currIndex++)
{
Object currId = list.get(currIndex);
if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId)))
{
return currIndex;
}
}
}
// didn't find it
return -1;
} | java | private static int _indexOfStartingFrom(List<?> list, int startIndex, Object searchValue)
{
int itemCount = list.size();
boolean found = false;
// start searching from location remembered from last time
for (int currIndex = startIndex; currIndex < itemCount; currIndex++)
{
Object currId = list.get(currIndex);
if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId)))
{
return currIndex;
}
}
// handle case where we started past the first item and didn't find the
// searchValue. Now search from the beginning to where we started
if (startIndex > 0)
{
for (int currIndex = 0; currIndex < startIndex; currIndex++)
{
Object currId = list.get(currIndex);
if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId)))
{
return currIndex;
}
}
}
// didn't find it
return -1;
} | [
"private",
"static",
"int",
"_indexOfStartingFrom",
"(",
"List",
"<",
"?",
">",
"list",
",",
"int",
"startIndex",
",",
"Object",
"searchValue",
")",
"{",
"int",
"itemCount",
"=",
"list",
".",
"size",
"(",
")",
";",
"boolean",
"found",
"=",
"false",
";",
... | Similar to List.indexOf, except that we start searching from a specific index
and then wrap aroud. For this to be performant, the List should implement
RandomAccess.
@param <T>
@param list List to seatch
@param startIndex index to start searching for value from
@param searchValue Value to search for (null not supported)
@return The index at which the value was first found, or -1 if not found | [
"Similar",
"to",
"List",
".",
"indexOf",
"except",
"that",
"we",
"start",
"searching",
"from",
"a",
"specific",
"index",
"and",
"then",
"wrap",
"aroud",
".",
"For",
"this",
"to",
"be",
"performant",
"the",
"List",
"should",
"implement",
"RandomAccess",
"."
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java#L884-L918 |
ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java | HttpClient.newClient | public static HttpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
return newClient(new InetSocketAddress(host, port));
} | java | public static HttpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
return newClient(new InetSocketAddress(host, port));
} | [
"public",
"static",
"HttpClient",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"newClient",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"newClient",
"(",
"new",
"InetSocketAddress",
"(",
"host",
",",
"port",
")",
")",
";",
"}"
] | Creates a new HTTP client instance with the passed host and port for the target server.
@param host Hostname for the target server.
@param port Port for the target server.
@return A new {@code HttpClient} instance. | [
"Creates",
"a",
"new",
"HTTP",
"client",
"instance",
"with",
"the",
"passed",
"host",
"and",
"port",
"for",
"the",
"target",
"server",
"."
] | train | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java#L316-L318 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java | Attachment.fromBinaryBytes | public static Attachment fromBinaryBytes( byte[] bytes, MediaType mediaType ) {
if( !mediaType.isBinary() ) {
throw new IllegalArgumentException( "MediaType must be binary" );
}
return new Attachment(BaseEncoding.base64().encode( bytes ), mediaType, null );
} | java | public static Attachment fromBinaryBytes( byte[] bytes, MediaType mediaType ) {
if( !mediaType.isBinary() ) {
throw new IllegalArgumentException( "MediaType must be binary" );
}
return new Attachment(BaseEncoding.base64().encode( bytes ), mediaType, null );
} | [
"public",
"static",
"Attachment",
"fromBinaryBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"MediaType",
"mediaType",
")",
"{",
"if",
"(",
"!",
"mediaType",
".",
"isBinary",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"MediaType must b... | Creates an attachment from a given array of bytes.
The bytes will be Base64 encoded.
@throws java.lang.IllegalArgumentException if mediaType is not binary | [
"Creates",
"an",
"attachment",
"from",
"a",
"given",
"array",
"of",
"bytes",
".",
"The",
"bytes",
"will",
"be",
"Base64",
"encoded",
"."
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java#L163-L168 |
grpc/grpc-java | okhttp/src/main/java/io/grpc/okhttp/OkHttpChannelBuilder.java | OkHttpChannelBuilder.enableKeepAlive | @Deprecated
public final OkHttpChannelBuilder enableKeepAlive(boolean enable) {
if (enable) {
return keepAliveTime(DEFAULT_KEEPALIVE_TIME_NANOS, TimeUnit.NANOSECONDS);
} else {
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
} | java | @Deprecated
public final OkHttpChannelBuilder enableKeepAlive(boolean enable) {
if (enable) {
return keepAliveTime(DEFAULT_KEEPALIVE_TIME_NANOS, TimeUnit.NANOSECONDS);
} else {
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
} | [
"@",
"Deprecated",
"public",
"final",
"OkHttpChannelBuilder",
"enableKeepAlive",
"(",
"boolean",
"enable",
")",
"{",
"if",
"(",
"enable",
")",
"{",
"return",
"keepAliveTime",
"(",
"DEFAULT_KEEPALIVE_TIME_NANOS",
",",
"TimeUnit",
".",
"NANOSECONDS",
")",
";",
"}",
... | Enable keepalive with default delay and timeout.
@deprecated Use {@link #keepAliveTime} instead | [
"Enable",
"keepalive",
"with",
"default",
"delay",
"and",
"timeout",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpChannelBuilder.java#L206-L213 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ReceiveMessageActionParser.java | ReceiveMessageActionParser.getXPathMessageValidationContext | private XpathMessageValidationContext getXPathMessageValidationContext(Element messageElement, XmlMessageValidationContext parentContext) {
XpathMessageValidationContext context = new XpathMessageValidationContext();
parseXPathValidationElements(messageElement, context);
context.setControlNamespaces(parentContext.getControlNamespaces());
context.setNamespaces(parentContext.getNamespaces());
context.setIgnoreExpressions(parentContext.getIgnoreExpressions());
context.setSchema(parentContext.getSchema());
context.setSchemaRepository(parentContext.getSchemaRepository());
context.setSchemaValidation(parentContext.isSchemaValidationEnabled());
context.setDTDResource(parentContext.getDTDResource());
return context;
} | java | private XpathMessageValidationContext getXPathMessageValidationContext(Element messageElement, XmlMessageValidationContext parentContext) {
XpathMessageValidationContext context = new XpathMessageValidationContext();
parseXPathValidationElements(messageElement, context);
context.setControlNamespaces(parentContext.getControlNamespaces());
context.setNamespaces(parentContext.getNamespaces());
context.setIgnoreExpressions(parentContext.getIgnoreExpressions());
context.setSchema(parentContext.getSchema());
context.setSchemaRepository(parentContext.getSchemaRepository());
context.setSchemaValidation(parentContext.isSchemaValidationEnabled());
context.setDTDResource(parentContext.getDTDResource());
return context;
} | [
"private",
"XpathMessageValidationContext",
"getXPathMessageValidationContext",
"(",
"Element",
"messageElement",
",",
"XmlMessageValidationContext",
"parentContext",
")",
"{",
"XpathMessageValidationContext",
"context",
"=",
"new",
"XpathMessageValidationContext",
"(",
")",
";",... | Construct the XPath message validation context.
@param messageElement
@param parentContext
@return | [
"Construct",
"the",
"XPath",
"message",
"validation",
"context",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ReceiveMessageActionParser.java#L286-L300 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static String eachMatch(String self, Pattern pattern, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
Matcher m = pattern.matcher(self);
each(m, closure);
return self;
} | java | public static String eachMatch(String self, Pattern pattern, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
Matcher m = pattern.matcher(self);
each(m, closure);
return self;
} | [
"public",
"static",
"String",
"eachMatch",
"(",
"String",
"self",
",",
"Pattern",
"pattern",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"String[]\"",
"}",
")",
"Closure",
"cl... | Process each regex group matched substring of the given pattern. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source string
@param pattern a regex Pattern
@param closure a closure with one parameter or as much parameters as groups
@return the source string
@since 1.6.1 | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"pattern",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
"the... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L727-L731 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/AmBaseBolt.java | AmBaseBolt.createKeyRecorededHistory | protected KeyHistory createKeyRecorededHistory(KeyHistory history, Object messageKey)
{
KeyHistory result = null;
if (history == null)
{
result = new KeyHistory();
}
else
{
// For adjust message splited, use keyhistory's deepcopy.
result = history.createDeepCopy();
}
result.addKey(messageKey.toString());
return result;
} | java | protected KeyHistory createKeyRecorededHistory(KeyHistory history, Object messageKey)
{
KeyHistory result = null;
if (history == null)
{
result = new KeyHistory();
}
else
{
// For adjust message splited, use keyhistory's deepcopy.
result = history.createDeepCopy();
}
result.addKey(messageKey.toString());
return result;
} | [
"protected",
"KeyHistory",
"createKeyRecorededHistory",
"(",
"KeyHistory",
"history",
",",
"Object",
"messageKey",
")",
"{",
"KeyHistory",
"result",
"=",
"null",
";",
"if",
"(",
"history",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"KeyHistory",
"(",
")",
... | Create keyhistory from original key history and current message key.
@param history original key history
@param messageKey current message key
@return created key history | [
"Create",
"keyhistory",
"from",
"original",
"key",
"history",
"and",
"current",
"message",
"key",
"."
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L295-L312 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java | AtomContainerManipulator.findSingleBond | private static IAtom findSingleBond(IAtomContainer container, IAtom atom, IAtom exclude) {
for (IBond bond : container.getConnectedBondsList(atom)) {
if (bond.getOrder() != Order.SINGLE)
continue;
IAtom neighbor = bond.getOther(atom);
if (!neighbor.equals(exclude))
return neighbor;
}
return null;
} | java | private static IAtom findSingleBond(IAtomContainer container, IAtom atom, IAtom exclude) {
for (IBond bond : container.getConnectedBondsList(atom)) {
if (bond.getOrder() != Order.SINGLE)
continue;
IAtom neighbor = bond.getOther(atom);
if (!neighbor.equals(exclude))
return neighbor;
}
return null;
} | [
"private",
"static",
"IAtom",
"findSingleBond",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"atom",
",",
"IAtom",
"exclude",
")",
"{",
"for",
"(",
"IBond",
"bond",
":",
"container",
".",
"getConnectedBondsList",
"(",
"atom",
")",
")",
"{",
"if",
"(",
... | Finds an neighbor connected to 'atom' which is connected by a
single bond and is not 'exclude'.
@param container structure
@param atom atom to find a neighbor of
@param exclude the neighbor should not be this atom
@return a neighbor of 'atom', null if not found | [
"Finds",
"an",
"neighbor",
"connected",
"to",
"atom",
"which",
"is",
"connected",
"by",
"a",
"single",
"bond",
"and",
"is",
"not",
"exclude",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L1253-L1262 |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TextComponentUtil.java | TextComponentUtil.getWhiteSpaceOrCommentLineStartAfter | public static int getWhiteSpaceOrCommentLineStartAfter( String script, int end )
{
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
String line = script.substring( nextLineStart, nextLineEnd );
boolean whitespace = GosuStringUtil.isWhitespace( line ) || line.trim().startsWith( "//" );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
} | java | public static int getWhiteSpaceOrCommentLineStartAfter( String script, int end )
{
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
String line = script.substring( nextLineStart, nextLineEnd );
boolean whitespace = GosuStringUtil.isWhitespace( line ) || line.trim().startsWith( "//" );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
} | [
"public",
"static",
"int",
"getWhiteSpaceOrCommentLineStartAfter",
"(",
"String",
"script",
",",
"int",
"end",
")",
"{",
"int",
"endLine",
"=",
"getLineEnd",
"(",
"script",
",",
"end",
")",
";",
"if",
"(",
"endLine",
"<",
"script",
".",
"length",
"(",
")",... | Returns the start of the next line if that line is only whitespace. Returns -1 otherwise. | [
"Returns",
"the",
"start",
"of",
"the",
"next",
"line",
"if",
"that",
"line",
"is",
"only",
"whitespace",
".",
"Returns",
"-",
"1",
"otherwise",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L837-L852 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/App.java | App.getEnvironment | public java.util.List<EnvironmentVariable> getEnvironment() {
if (environment == null) {
environment = new com.amazonaws.internal.SdkInternalList<EnvironmentVariable>();
}
return environment;
} | java | public java.util.List<EnvironmentVariable> getEnvironment() {
if (environment == null) {
environment = new com.amazonaws.internal.SdkInternalList<EnvironmentVariable>();
}
return environment;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"EnvironmentVariable",
">",
"getEnvironment",
"(",
")",
"{",
"if",
"(",
"environment",
"==",
"null",
")",
"{",
"environment",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<"... | <p>
An array of <code>EnvironmentVariable</code> objects that specify environment variables to be associated with the
app. After you deploy the app, these variables are defined on the associated app server instances. For more
information, see <a href=
"http://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment"
> Environment Variables</a>.
</p>
<note>
<p>
There is no specific limit on the number of environment variables. However, the size of the associated data
structure - which includes the variable names, values, and protected flag values - cannot exceed 10 KB (10240
Bytes). This limit should accommodate most if not all use cases, but if you do exceed it, you will cause an
exception (API) with an "Environment: is too large (maximum is 10KB)" message.
</p>
</note>
@return An array of <code>EnvironmentVariable</code> objects that specify environment variables to be associated
with the app. After you deploy the app, these variables are defined on the associated app server
instances. For more information, see <a href=
"http://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment"
> Environment Variables</a>. </p> <note>
<p>
There is no specific limit on the number of environment variables. However, the size of the associated
data structure - which includes the variable names, values, and protected flag values - cannot exceed 10
KB (10240 Bytes). This limit should accommodate most if not all use cases, but if you do exceed it, you
will cause an exception (API) with an "Environment: is too large (maximum is 10KB)" message.
</p> | [
"<p",
">",
"An",
"array",
"of",
"<code",
">",
"EnvironmentVariable<",
"/",
"code",
">",
"objects",
"that",
"specify",
"environment",
"variables",
"to",
"be",
"associated",
"with",
"the",
"app",
".",
"After",
"you",
"deploy",
"the",
"app",
"these",
"variables... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/App.java#L821-L826 |
xwiki/xwiki-rendering | xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocTreeBuilder.java | TocTreeBuilder.createTocEntry | private ListItemBlock createTocEntry(HeaderBlock headerBlock, String documentReference)
{
// Create the link to target the header anchor
DocumentResourceReference reference = new DocumentResourceReference(documentReference);
reference.setAnchor(headerBlock.getId());
LinkBlock linkBlock = new LinkBlock(this.tocBlockFilter.generateLabel(headerBlock), reference, false);
return new ListItemBlock(Collections.singletonList(linkBlock));
} | java | private ListItemBlock createTocEntry(HeaderBlock headerBlock, String documentReference)
{
// Create the link to target the header anchor
DocumentResourceReference reference = new DocumentResourceReference(documentReference);
reference.setAnchor(headerBlock.getId());
LinkBlock linkBlock = new LinkBlock(this.tocBlockFilter.generateLabel(headerBlock), reference, false);
return new ListItemBlock(Collections.singletonList(linkBlock));
} | [
"private",
"ListItemBlock",
"createTocEntry",
"(",
"HeaderBlock",
"headerBlock",
",",
"String",
"documentReference",
")",
"{",
"// Create the link to target the header anchor",
"DocumentResourceReference",
"reference",
"=",
"new",
"DocumentResourceReference",
"(",
"documentRefere... | Create a new toc list item based on section title.
@param headerBlock the {@link HeaderBlock}.
@return the new list item block. | [
"Create",
"a",
"new",
"toc",
"list",
"item",
"based",
"on",
"section",
"title",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocTreeBuilder.java#L188-L196 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java | SubWriterHolderWriter.getMemberTree | public Content getMemberTree(HtmlStyle style, Content contentTree) {
Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
return div;
} | java | public Content getMemberTree(HtmlStyle style, Content contentTree) {
Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
return div;
} | [
"public",
"Content",
"getMemberTree",
"(",
"HtmlStyle",
"style",
",",
"Content",
"contentTree",
")",
"{",
"Content",
"div",
"=",
"HtmlTree",
".",
"DIV",
"(",
"style",
",",
"getMemberTree",
"(",
"contentTree",
")",
")",
";",
"return",
"div",
";",
"}"
] | Get the member tree
@param style the style class to be added to the content tree
@param contentTree the tree used to generate the complete member tree | [
"Get",
"the",
"member",
"tree"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L358-L361 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.listNextAsync | public ServiceFuture<List<ComputeNode>> listNextAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions, final ServiceFuture<List<ComputeNode>> serviceFuture, final ListOperationCallback<ComputeNode> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<ComputeNode>> listNextAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions, final ServiceFuture<List<ComputeNode>> serviceFuture, final ListOperationCallback<ComputeNode> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"ComputeNode",
">",
">",
"listNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"ComputeNodeListNextOptions",
"computeNodeListNextOptions",
",",
"final",
"ServiceFuture",
"<",
"List",
"<",
"ComputeNode",
">"... | Lists the compute nodes in the specified pool.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param computeNodeListNextOptions Additional parameters for the operation
@param serviceFuture the ServiceFuture object tracking the Retrofit calls
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"the",
"compute",
"nodes",
"in",
"the",
"specified",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L3033-L3043 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.