repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
romannurik/muzei | muzei-api/src/main/java/com/google/android/apps/muzei/api/provider/ProviderContract.java | ProviderContract.getProviderClient | @RequiresApi(Build.VERSION_CODES.KITKAT)
@NonNull
public static ProviderClient getProviderClient(
@NonNull Context context,
@NonNull Class<? extends MuzeiArtProvider> provider) {
ComponentName componentName = new ComponentName(context, provider);
PackageManager pm = context.getPackageManager();
String authority;
try {
@SuppressLint("InlinedApi")
ProviderInfo info = pm.getProviderInfo(componentName, 0);
authority = info.authority;
} catch (PackageManager.NameNotFoundException e) {
throw new IllegalArgumentException("Invalid MuzeiArtProvider: " + componentName
+ ", is your provider disabled?", e);
}
return getProviderClient(context, authority);
} | java | @RequiresApi(Build.VERSION_CODES.KITKAT)
@NonNull
public static ProviderClient getProviderClient(
@NonNull Context context,
@NonNull Class<? extends MuzeiArtProvider> provider) {
ComponentName componentName = new ComponentName(context, provider);
PackageManager pm = context.getPackageManager();
String authority;
try {
@SuppressLint("InlinedApi")
ProviderInfo info = pm.getProviderInfo(componentName, 0);
authority = info.authority;
} catch (PackageManager.NameNotFoundException e) {
throw new IllegalArgumentException("Invalid MuzeiArtProvider: " + componentName
+ ", is your provider disabled?", e);
}
return getProviderClient(context, authority);
} | [
"@",
"RequiresApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"KITKAT",
")",
"@",
"NonNull",
"public",
"static",
"ProviderClient",
"getProviderClient",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"NonNull",
"Class",
"<",
"?",
"extends",
"MuzeiArtProvider... | Creates a new {@link ProviderClient} for accessing the given {@link MuzeiArtProvider}
from anywhere in your application.
@param context Context used to construct the ProviderClient.
@param provider The {@link MuzeiArtProvider} you need a ProviderClient for.
@return a {@link ProviderClient} suitable for accessing the {@link MuzeiArtProvider}. | [
"Creates",
"a",
"new",
"{",
"@link",
"ProviderClient",
"}",
"for",
"accessing",
"the",
"given",
"{",
"@link",
"MuzeiArtProvider",
"}",
"from",
"anywhere",
"in",
"your",
"application",
"."
] | train | https://github.com/romannurik/muzei/blob/d00777a5fc59f34471be338c814ea85ddcbde304/muzei-api/src/main/java/com/google/android/apps/muzei/api/provider/ProviderContract.java#L74-L91 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/parser/Parser.java | Parser.maybeReportNoInitializer | private void maybeReportNoInitializer(TokenType token, ParseTree lvalue) {
if (token == TokenType.CONST) {
reportError("const variables must have an initializer");
} else if (lvalue.isPattern()) {
reportError("destructuring must have an initializer");
}
} | java | private void maybeReportNoInitializer(TokenType token, ParseTree lvalue) {
if (token == TokenType.CONST) {
reportError("const variables must have an initializer");
} else if (lvalue.isPattern()) {
reportError("destructuring must have an initializer");
}
} | [
"private",
"void",
"maybeReportNoInitializer",
"(",
"TokenType",
"token",
",",
"ParseTree",
"lvalue",
")",
"{",
"if",
"(",
"token",
"==",
"TokenType",
".",
"CONST",
")",
"{",
"reportError",
"(",
"\"const variables must have an initializer\"",
")",
";",
"}",
"else"... | Reports if declaration requires an initializer, assuming initializer is absent. | [
"Reports",
"if",
"declaration",
"requires",
"an",
"initializer",
"assuming",
"initializer",
"is",
"absent",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/Parser.java#L2038-L2044 |
kite-sdk/kite | kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/Loader.java | Loader.setMetaStoreURI | private static void setMetaStoreURI(
Configuration conf, Map<String, String> match) {
try {
// If the host is set, construct a new MetaStore URI and set the property
// in the Configuration. Otherwise, do not change the MetaStore URI.
String host = match.get(URIPattern.HOST);
if (host != null && !NOT_SET.equals(host)) {
int port;
try {
port = Integer.parseInt(match.get(URIPattern.PORT));
} catch (NumberFormatException e) {
port = UNSPECIFIED_PORT;
}
conf.set(HIVE_METASTORE_URI_PROP,
new URI("thrift", null, host, port, null, null, null).toString());
}
} catch (URISyntaxException ex) {
throw new DatasetOperationException(
"Could not build metastore URI", ex);
}
} | java | private static void setMetaStoreURI(
Configuration conf, Map<String, String> match) {
try {
// If the host is set, construct a new MetaStore URI and set the property
// in the Configuration. Otherwise, do not change the MetaStore URI.
String host = match.get(URIPattern.HOST);
if (host != null && !NOT_SET.equals(host)) {
int port;
try {
port = Integer.parseInt(match.get(URIPattern.PORT));
} catch (NumberFormatException e) {
port = UNSPECIFIED_PORT;
}
conf.set(HIVE_METASTORE_URI_PROP,
new URI("thrift", null, host, port, null, null, null).toString());
}
} catch (URISyntaxException ex) {
throw new DatasetOperationException(
"Could not build metastore URI", ex);
}
} | [
"private",
"static",
"void",
"setMetaStoreURI",
"(",
"Configuration",
"conf",
",",
"Map",
"<",
"String",
",",
"String",
">",
"match",
")",
"{",
"try",
"{",
"// If the host is set, construct a new MetaStore URI and set the property",
"// in the Configuration. Otherwise, do not... | Sets the MetaStore URI in the given Configuration, if there is a host in
the match arguments. If there is no host, then the conf is not changed.
@param conf a Configuration that will be used to connect to the MetaStore
@param match URIPattern match results | [
"Sets",
"the",
"MetaStore",
"URI",
"in",
"the",
"given",
"Configuration",
"if",
"there",
"is",
"a",
"host",
"in",
"the",
"match",
"arguments",
".",
"If",
"there",
"is",
"no",
"host",
"then",
"the",
"conf",
"is",
"not",
"changed",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/Loader.java#L221-L241 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WAbbrTextRenderer.java | WAbbrTextRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WAbbrText abbrText = (WAbbrText) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("abbr");
xml.appendOptionalAttribute("title", abbrText.getToolTip());
xml.appendOptionalAttribute("class", abbrText.getHtmlClass());
xml.appendClose();
xml.append(abbrText.getText(), abbrText.isEncodeText());
xml.appendEndTag("abbr");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WAbbrText abbrText = (WAbbrText) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("abbr");
xml.appendOptionalAttribute("title", abbrText.getToolTip());
xml.appendOptionalAttribute("class", abbrText.getHtmlClass());
xml.appendClose();
xml.append(abbrText.getText(), abbrText.isEncodeText());
xml.appendEndTag("abbr");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WAbbrText",
"abbrText",
"=",
"(",
"WAbbrText",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderCo... | Paints the given WAbbrText.
@param component the WAbbrText to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WAbbrText",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WAbbrTextRenderer.java#L23-L34 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getUsersAssignedToPrivilegesBatch | private String getUsersAssignedToPrivilegesBatch(List<Long> userIds, URIBuilder url, OAuthClientRequest bearerRequest,
OneloginOAuth2JSONResourceResponse oAuth2Response) {
if (oAuth2Response.getResponseCode() == 200) {
JSONArray dataArray = (JSONArray)oAuth2Response.getFromContent("users");
for (int i = 0; i < dataArray.length(); i++) {
userIds.add(dataArray.optLong(i));
}
return collectAfterCursor(url, bearerRequest, oAuth2Response);
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return null;
} | java | private String getUsersAssignedToPrivilegesBatch(List<Long> userIds, URIBuilder url, OAuthClientRequest bearerRequest,
OneloginOAuth2JSONResourceResponse oAuth2Response) {
if (oAuth2Response.getResponseCode() == 200) {
JSONArray dataArray = (JSONArray)oAuth2Response.getFromContent("users");
for (int i = 0; i < dataArray.length(); i++) {
userIds.add(dataArray.optLong(i));
}
return collectAfterCursor(url, bearerRequest, oAuth2Response);
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return null;
} | [
"private",
"String",
"getUsersAssignedToPrivilegesBatch",
"(",
"List",
"<",
"Long",
">",
"userIds",
",",
"URIBuilder",
"url",
",",
"OAuthClientRequest",
"bearerRequest",
",",
"OneloginOAuth2JSONResourceResponse",
"oAuth2Response",
")",
"{",
"if",
"(",
"oAuth2Response",
... | Get a batch of users assigned to privilege.
@param userIds
@param url
@param bearerRequest
@param oAuth2Response
@return The Batch reference
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-users">Get Users documentation</a> | [
"Get",
"a",
"batch",
"of",
"users",
"assigned",
"to",
"privilege",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L3761-L3774 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java | NodeReportsInner.listByNodeWithServiceResponseAsync | public Observable<ServiceResponse<Page<DscNodeReportInner>>> listByNodeWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String nodeId, final String filter) {
return listByNodeSinglePageAsync(resourceGroupName, automationAccountName, nodeId, filter)
.concatMap(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Observable<ServiceResponse<Page<DscNodeReportInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DscNodeReportInner>>> call(ServiceResponse<Page<DscNodeReportInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByNodeNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<DscNodeReportInner>>> listByNodeWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String nodeId, final String filter) {
return listByNodeSinglePageAsync(resourceGroupName, automationAccountName, nodeId, filter)
.concatMap(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Observable<ServiceResponse<Page<DscNodeReportInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DscNodeReportInner>>> call(ServiceResponse<Page<DscNodeReportInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByNodeNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DscNodeReportInner",
">",
">",
">",
"listByNodeWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
",",
"final",
"String",
"nodeId",
... | Retrieve the Dsc node report list by node id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeId The parameters supplied to the list operation.
@param filter The filter to apply on the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DscNodeReportInner> object | [
"Retrieve",
"the",
"Dsc",
"node",
"report",
"list",
"by",
"node",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java#L276-L288 |
mockito/mockito | src/main/java/org/mockito/internal/invocation/InvocationsFinder.java | InvocationsFinder.findFirstUnverifiedInOrder | public static Invocation findFirstUnverifiedInOrder(InOrderContext context, List<Invocation> orderedInvocations) {
Invocation candidate = null;
for(Invocation i : orderedInvocations) {
if (!context.isVerified(i)) {
candidate = candidate != null ? candidate : i;
} else {
candidate = null;
}
}
return candidate;
} | java | public static Invocation findFirstUnverifiedInOrder(InOrderContext context, List<Invocation> orderedInvocations) {
Invocation candidate = null;
for(Invocation i : orderedInvocations) {
if (!context.isVerified(i)) {
candidate = candidate != null ? candidate : i;
} else {
candidate = null;
}
}
return candidate;
} | [
"public",
"static",
"Invocation",
"findFirstUnverifiedInOrder",
"(",
"InOrderContext",
"context",
",",
"List",
"<",
"Invocation",
">",
"orderedInvocations",
")",
"{",
"Invocation",
"candidate",
"=",
"null",
";",
"for",
"(",
"Invocation",
"i",
":",
"orderedInvocation... | i3 is unverified here:
i1, i2, i3
v
all good here:
i1, i2, i3
v v
@param context
@param orderedInvocations | [
"i3",
"is",
"unverified",
"here",
":"
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/invocation/InvocationsFinder.java#L187-L197 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.percentRank | public static <T> Collector<T, ?, Optional<Double>> percentRank(T value, Comparator<? super T> comparator) {
return percentRankBy(value, t -> t, comparator);
} | java | public static <T> Collector<T, ?, Optional<Double>> percentRank(T value, Comparator<? super T> comparator) {
return percentRankBy(value, t -> t, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"Double",
">",
">",
"percentRank",
"(",
"T",
"value",
",",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"percentRankBy",
"(",
"v... | Get a {@link Collector} that calculates the <code>PERCENT_RANK()</code> function given a specific ordering. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L754-L756 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java | InventoryItem.withContext | public InventoryItem withContext(java.util.Map<String, String> context) {
setContext(context);
return this;
} | java | public InventoryItem withContext(java.util.Map<String, String> context) {
setContext(context);
return this;
} | [
"public",
"InventoryItem",
"withContext",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"context",
")",
"{",
"setContext",
"(",
"context",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of associated properties for a specified inventory type. For example, with this attribute, you can specify
the <code>ExecutionId</code>, <code>ExecutionType</code>, <code>ComplianceType</code> properties of the
<code>AWS:ComplianceItem</code> type.
</p>
@param context
A map of associated properties for a specified inventory type. For example, with this attribute, you can
specify the <code>ExecutionId</code>, <code>ExecutionType</code>, <code>ComplianceType</code> properties
of the <code>AWS:ComplianceItem</code> type.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"associated",
"properties",
"for",
"a",
"specified",
"inventory",
"type",
".",
"For",
"example",
"with",
"this",
"attribute",
"you",
"can",
"specify",
"the",
"<code",
">",
"ExecutionId<",
"/",
"code",
">",
"<code",
">",
"Execut... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java#L378-L381 |
buschmais/extended-objects | neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java | AbstractNeo4jDatastore.ensureIndex | private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
String statement;
if (unique) {
LOGGER.debug("Creating constraint for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE", label.getName(), propertyMetadata.getName());
} else {
LOGGER.debug("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE INDEX ON :%s(%s)", label.getName(), propertyMetadata.getName());
}
try (ResultIterator iterator = session.createQuery(Cypher.class).execute(statement, Collections.emptyMap())) {
}
} | java | private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
String statement;
if (unique) {
LOGGER.debug("Creating constraint for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE", label.getName(), propertyMetadata.getName());
} else {
LOGGER.debug("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE INDEX ON :%s(%s)", label.getName(), propertyMetadata.getName());
}
try (ResultIterator iterator = session.createQuery(Cypher.class).execute(statement, Collections.emptyMap())) {
}
} | [
"private",
"void",
"ensureIndex",
"(",
"DS",
"session",
",",
"L",
"label",
",",
"PrimitivePropertyMethodMetadata",
"<",
"PropertyMetadata",
">",
"propertyMethodMetadata",
",",
"boolean",
"unique",
")",
"{",
"PropertyMetadata",
"propertyMetadata",
"=",
"propertyMethodMet... | Ensures that an index exists for the given label and property.
@param session
The datastore session
@param label
The label.
@param propertyMethodMetadata
The property metadata.
@param unique
if <code>true</code> create a unique constraint | [
"Ensures",
"that",
"an",
"index",
"exists",
"for",
"the",
"given",
"label",
"and",
"property",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java#L82-L94 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java | SystemInputJson.asValidCondition | private static ICondition asValidCondition( JsonObject json)
{
try
{
return asCondition( json);
}
catch( SystemInputException e)
{
throw new SystemInputException( "Invalid condition", e);
}
} | java | private static ICondition asValidCondition( JsonObject json)
{
try
{
return asCondition( json);
}
catch( SystemInputException e)
{
throw new SystemInputException( "Invalid condition", e);
}
} | [
"private",
"static",
"ICondition",
"asValidCondition",
"(",
"JsonObject",
"json",
")",
"{",
"try",
"{",
"return",
"asCondition",
"(",
"json",
")",
";",
"}",
"catch",
"(",
"SystemInputException",
"e",
")",
"{",
"throw",
"new",
"SystemInputException",
"(",
"\"In... | Returns the condition definition represented by the given JSON object. | [
"Returns",
"the",
"condition",
"definition",
"represented",
"by",
"the",
"given",
"JSON",
"object",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java#L385-L395 |
azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java | FlowRunner.propagateStatusAndAlert | private void propagateStatusAndAlert(final ExecutableFlowBase base, final Status status) {
if (!Status.isStatusFinished(base.getStatus()) && base.getStatus() != Status.KILLING) {
this.logger.info("Setting " + base.getNestedId() + " to " + status);
boolean shouldAlert = false;
if (base.getStatus() != status) {
base.setStatus(status);
shouldAlert = true;
}
if (base.getParentFlow() != null) {
propagateStatusAndAlert(base.getParentFlow(), status);
} else if (this.azkabanProps.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false)) {
// Alert on the root flow if the first error is encountered.
// Todo jamiesjc: Add a new FLOW_STATUS_CHANGED event type and alert on that event.
if (shouldAlert && base.getStatus() == Status.FAILED_FINISHING) {
ExecutionControllerUtils.alertUserOnFirstError((ExecutableFlow) base, this.alerterHolder);
}
}
}
} | java | private void propagateStatusAndAlert(final ExecutableFlowBase base, final Status status) {
if (!Status.isStatusFinished(base.getStatus()) && base.getStatus() != Status.KILLING) {
this.logger.info("Setting " + base.getNestedId() + " to " + status);
boolean shouldAlert = false;
if (base.getStatus() != status) {
base.setStatus(status);
shouldAlert = true;
}
if (base.getParentFlow() != null) {
propagateStatusAndAlert(base.getParentFlow(), status);
} else if (this.azkabanProps.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false)) {
// Alert on the root flow if the first error is encountered.
// Todo jamiesjc: Add a new FLOW_STATUS_CHANGED event type and alert on that event.
if (shouldAlert && base.getStatus() == Status.FAILED_FINISHING) {
ExecutionControllerUtils.alertUserOnFirstError((ExecutableFlow) base, this.alerterHolder);
}
}
}
} | [
"private",
"void",
"propagateStatusAndAlert",
"(",
"final",
"ExecutableFlowBase",
"base",
",",
"final",
"Status",
"status",
")",
"{",
"if",
"(",
"!",
"Status",
".",
"isStatusFinished",
"(",
"base",
".",
"getStatus",
"(",
")",
")",
"&&",
"base",
".",
"getStat... | Recursively propagate status to parent flow. Alert on first error of the flow in new AZ
dispatching design.
@param base the base flow
@param status the status to be propagated | [
"Recursively",
"propagate",
"status",
"to",
"parent",
"flow",
".",
"Alert",
"on",
"first",
"error",
"of",
"the",
"flow",
"in",
"new",
"AZ",
"dispatching",
"design",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java#L646-L664 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.newPair | public static DBIDPair newPair(DBIDRef id1, DBIDRef id2) {
return DBIDFactory.FACTORY.newPair(id1, id2);
} | java | public static DBIDPair newPair(DBIDRef id1, DBIDRef id2) {
return DBIDFactory.FACTORY.newPair(id1, id2);
} | [
"public",
"static",
"DBIDPair",
"newPair",
"(",
"DBIDRef",
"id1",
",",
"DBIDRef",
"id2",
")",
"{",
"return",
"DBIDFactory",
".",
"FACTORY",
".",
"newPair",
"(",
"id1",
",",
"id2",
")",
";",
"}"
] | Make a DBID pair.
@param id1 first ID
@param id2 second ID
@return DBID pair | [
"Make",
"a",
"DBID",
"pair",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L467-L469 |
treasure-data/td-client-java | src/main/java/com/treasuredata/client/TDClientConfig.java | TDClientConfig.readTDConf | public static Properties readTDConf()
{
Properties p = new Properties();
File file = new File(System.getProperty("user.home", "./"), String.format(".td/td.conf"));
if (!file.exists()) {
logger.warn(String.format("config file %s is not found", file));
return p;
}
return readTDConf(file);
} | java | public static Properties readTDConf()
{
Properties p = new Properties();
File file = new File(System.getProperty("user.home", "./"), String.format(".td/td.conf"));
if (!file.exists()) {
logger.warn(String.format("config file %s is not found", file));
return p;
}
return readTDConf(file);
} | [
"public",
"static",
"Properties",
"readTDConf",
"(",
")",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
",",
"\"./\"",
")",
",",
"String",
"."... | Read apikey, user (e-mail address) and password from $HOME/.td/td.conf
@return
@throws IOException | [
"Read",
"apikey",
"user",
"(",
"e",
"-",
"mail",
"address",
")",
"and",
"password",
"from",
"$HOME",
"/",
".",
"td",
"/",
"td",
".",
"conf"
] | train | https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDClientConfig.java#L241-L250 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addConstraintsDecimalMaxMessage | public FessMessages addConstraintsDecimalMaxMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_DecimalMax_MESSAGE, value));
return this;
} | java | public FessMessages addConstraintsDecimalMaxMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_DecimalMax_MESSAGE, value));
return this;
} | [
"public",
"FessMessages",
"addConstraintsDecimalMaxMessage",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"CONSTRAINTS_DecimalMax_MESSAGE",
",",... | Add the created action message for the key 'constraints.DecimalMax.message' with parameters.
<pre>
message: {item} must be less than ${inclusive == true ? 'or equal to ' : ''}{value}.
</pre>
@param property The property name for the message. (NotNull)
@param value The parameter value for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"constraints",
".",
"DecimalMax",
".",
"message",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"{",
"item",
"}",
"must",
"be",
"less",
"than",
"$",
"{",
"inclusive",
"==",
"tru... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L636-L640 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/remap/AddVersionFieldClassAdapter.java | AddVersionFieldClassAdapter.visitField | @Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
fieldAlreadyExists |= name.equals(versionFieldName);
return super.visitField(access, name, desc, signature, value);
} | java | @Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
fieldAlreadyExists |= name.equals(versionFieldName);
return super.visitField(access, name, desc, signature, value);
} | [
"@",
"Override",
"public",
"FieldVisitor",
"visitField",
"(",
"int",
"access",
",",
"String",
"name",
",",
"String",
"desc",
",",
"String",
"signature",
",",
"Object",
"value",
")",
"{",
"fieldAlreadyExists",
"|=",
"name",
".",
"equals",
"(",
"versionFieldName... | Field visitor that observes existing fields before chaining to the
delegate {@ClassVisitor}.
<p> {@inheritDoc} | [
"Field",
"visitor",
"that",
"observes",
"existing",
"fields",
"before",
"chaining",
"to",
"the",
"delegate",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/remap/AddVersionFieldClassAdapter.java#L61-L66 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.getReview | public Review getReview(String teamName, String reviewId) {
return getReviewWithServiceResponseAsync(teamName, reviewId).toBlocking().single().body();
} | java | public Review getReview(String teamName, String reviewId) {
return getReviewWithServiceResponseAsync(teamName, reviewId).toBlocking().single().body();
} | [
"public",
"Review",
"getReview",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
")",
"{",
"return",
"getReviewWithServiceResponseAsync",
"(",
"teamName",
",",
"reviewId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")"... | Returns review details for the review Id passed.
@param teamName Your Team Name.
@param reviewId Id of the review.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Review object if successful. | [
"Returns",
"review",
"details",
"for",
"the",
"review",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L141-L143 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java | DataSetLineageService.getSchema | @Override
@GraphTransaction
public String getSchema(String datasetName) throws AtlasException {
datasetName = ParamChecker.notEmpty(datasetName, "table name");
LOG.info("Fetching schema for tableName={}", datasetName);
TypeUtils.Pair<String, String> typeIdPair = validateDatasetNameExists(datasetName);
return getSchemaForId(typeIdPair.left, typeIdPair.right);
} | java | @Override
@GraphTransaction
public String getSchema(String datasetName) throws AtlasException {
datasetName = ParamChecker.notEmpty(datasetName, "table name");
LOG.info("Fetching schema for tableName={}", datasetName);
TypeUtils.Pair<String, String> typeIdPair = validateDatasetNameExists(datasetName);
return getSchemaForId(typeIdPair.left, typeIdPair.right);
} | [
"@",
"Override",
"@",
"GraphTransaction",
"public",
"String",
"getSchema",
"(",
"String",
"datasetName",
")",
"throws",
"AtlasException",
"{",
"datasetName",
"=",
"ParamChecker",
".",
"notEmpty",
"(",
"datasetName",
",",
"\"table name\"",
")",
";",
"LOG",
".",
"... | Return the schema for the given tableName.
@param datasetName tableName
@return Schema as JSON | [
"Return",
"the",
"schema",
"for",
"the",
"given",
"tableName",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java#L173-L181 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java | MSwingUtilities.showMessage | public static void showMessage(Component component, String message) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(component), message,
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.INFORMATION_MESSAGE);
} | java | public static void showMessage(Component component, String message) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(component), message,
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.INFORMATION_MESSAGE);
} | [
"public",
"static",
"void",
"showMessage",
"(",
"Component",
"component",
",",
"String",
"message",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"SwingUtilities",
".",
"getWindowAncestor",
"(",
"component",
")",
",",
"message",
",",
"UIManager",
".",
... | Affiche une boîte de dialogue d'information.
@param component Component
@param message String | [
"Affiche",
"une",
"boîte",
"de",
"dialogue",
"d",
"information",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java#L79-L83 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java | ConstraintFactory.getObject | private Constraint getObject(final MathRandom random, final Element element, final Constructor<? extends Constraint> constructor)
throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
LOG.debug("Creating constraint: " + element.getAttributes());
Constraint instance = constructor.newInstance(new Object[] { random, element, generator });
injector.injectMembers(instance);
return instance;
} | java | private Constraint getObject(final MathRandom random, final Element element, final Constructor<? extends Constraint> constructor)
throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
LOG.debug("Creating constraint: " + element.getAttributes());
Constraint instance = constructor.newInstance(new Object[] { random, element, generator });
injector.injectMembers(instance);
return instance;
} | [
"private",
"Constraint",
"getObject",
"(",
"final",
"MathRandom",
"random",
",",
"final",
"Element",
"element",
",",
"final",
"Constructor",
"<",
"?",
"extends",
"Constraint",
">",
"constructor",
")",
"throws",
"IllegalArgumentException",
",",
"InstantiationException"... | Generates a new constraint instance using the given constructor, the element and the
generateor callback as parameters. | [
"Generates",
"a",
"new",
"constraint",
"instance",
"using",
"the",
"given",
"constructor",
"the",
"element",
"and",
"the",
"generateor",
"callback",
"as",
"parameters",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java#L151-L157 |
sdl/Testy | src/main/java/com/sdl/selenium/web/XPathBuilder.java | XPathBuilder.getBasePathSelector | protected String getBasePathSelector() {
// TODO use disabled
// TODO verify what need to be equal OR contains
List<String> selector = new ArrayList<>();
CollectionUtils.addIgnoreNull(selector, getBasePath());
if (!WebDriverConfig.isIE()) {
if (hasStyle()) {
selector.add(applyTemplate("style", getStyle()));
}
// TODO make specific for WebLocator
if (isVisibility()) {
// TODO selector.append(" and count(ancestor-or-self::*[contains(replace(@style, '\s*:\s*', ':'), 'display:none')]) = 0");
CollectionUtils.addIgnoreNull(selector, applyTemplate("visibility", isVisibility()));
}
}
return selector.isEmpty() ? "" : String.join(" and ", selector);
} | java | protected String getBasePathSelector() {
// TODO use disabled
// TODO verify what need to be equal OR contains
List<String> selector = new ArrayList<>();
CollectionUtils.addIgnoreNull(selector, getBasePath());
if (!WebDriverConfig.isIE()) {
if (hasStyle()) {
selector.add(applyTemplate("style", getStyle()));
}
// TODO make specific for WebLocator
if (isVisibility()) {
// TODO selector.append(" and count(ancestor-or-self::*[contains(replace(@style, '\s*:\s*', ':'), 'display:none')]) = 0");
CollectionUtils.addIgnoreNull(selector, applyTemplate("visibility", isVisibility()));
}
}
return selector.isEmpty() ? "" : String.join(" and ", selector);
} | [
"protected",
"String",
"getBasePathSelector",
"(",
")",
"{",
"// TODO use disabled",
"// TODO verify what need to be equal OR contains",
"List",
"<",
"String",
">",
"selector",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"CollectionUtils",
".",
"addIgnoreNull",
"(",
... | Containing baseCls, class, name and style
@return baseSelector | [
"Containing",
"baseCls",
"class",
"name",
"and",
"style"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/XPathBuilder.java#L766-L784 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/query/HBaseQuery.java | HBaseQuery.onQuery | private List onQuery(EntityMetadata m, Client client)
{
boolean useLuceneOrES = !MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata());
QueryTranslator translator = new QueryTranslator();
List<Map<String, Object>> columnsToOutput = translator.getColumnsToOutput(m, getKunderaQuery(), useLuceneOrES);
translator.translate(getKunderaQuery(), m, useLuceneOrES);
Filter filters = translator.getFilters();
if (!translator.isWhereOrAggregationQuery() || !useLuceneOrES)
{
return ((HBaseClient) client).findData(m, null, translator.getStartRow(), translator.getEndRow(),
columnsToOutput, filters);
}
else
{
return populateUsingLucene(m, client, null, null);
}
} | java | private List onQuery(EntityMetadata m, Client client)
{
boolean useLuceneOrES = !MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata());
QueryTranslator translator = new QueryTranslator();
List<Map<String, Object>> columnsToOutput = translator.getColumnsToOutput(m, getKunderaQuery(), useLuceneOrES);
translator.translate(getKunderaQuery(), m, useLuceneOrES);
Filter filters = translator.getFilters();
if (!translator.isWhereOrAggregationQuery() || !useLuceneOrES)
{
return ((HBaseClient) client).findData(m, null, translator.getStartRow(), translator.getEndRow(),
columnsToOutput, filters);
}
else
{
return populateUsingLucene(m, client, null, null);
}
} | [
"private",
"List",
"onQuery",
"(",
"EntityMetadata",
"m",
",",
"Client",
"client",
")",
"{",
"boolean",
"useLuceneOrES",
"=",
"!",
"MetadataUtils",
".",
"useSecondryIndex",
"(",
"(",
"(",
"ClientBase",
")",
"client",
")",
".",
"getClientMetadata",
"(",
")",
... | On query.
@param m
the m
@param client
the client
@return the list | [
"On",
"query",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/query/HBaseQuery.java#L163-L179 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java | CmsXmlContentPropertyHelper.convertPathsToIds | protected static String convertPathsToIds(CmsObject cms, String value) {
if (value == null) {
return null;
}
// represent vfslists as lists of path in JSON
List<String> paths = CmsStringUtil.splitAsList(value, CmsXmlContentProperty.PROP_SEPARATOR);
List<String> ids = new ArrayList<String>();
for (String path : paths) {
try {
CmsUUID id = getIdForUri(cms, path);
ids.add(id.toString());
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
continue;
}
}
return CmsStringUtil.listAsString(ids, CmsXmlContentProperty.PROP_SEPARATOR);
} | java | protected static String convertPathsToIds(CmsObject cms, String value) {
if (value == null) {
return null;
}
// represent vfslists as lists of path in JSON
List<String> paths = CmsStringUtil.splitAsList(value, CmsXmlContentProperty.PROP_SEPARATOR);
List<String> ids = new ArrayList<String>();
for (String path : paths) {
try {
CmsUUID id = getIdForUri(cms, path);
ids.add(id.toString());
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
continue;
}
}
return CmsStringUtil.listAsString(ids, CmsXmlContentProperty.PROP_SEPARATOR);
} | [
"protected",
"static",
"String",
"convertPathsToIds",
"(",
"CmsObject",
"cms",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// represent vfslists as lists of path in JSON",
"List",
"<",
"String",
">",... | Converts a string containing zero or more VFS paths into a string containing the corresponding structure ids.<p>
@param cms the CmsObject to use for the VFS operations
@param value a string representation of a list of paths
@return a string representation of a list of ids | [
"Converts",
"a",
"string",
"containing",
"zero",
"or",
"more",
"VFS",
"paths",
"into",
"a",
"string",
"containing",
"the",
"corresponding",
"structure",
"ids",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L828-L847 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getFormattedFilter | private String getFormattedFilter(String searchFilter, String caller, String attribute) {
//Allow %v in addition to %s for string replacement
String filter = searchFilter.replaceAll("%v", "%s");
if (!(filter.startsWith("(") && filter.endsWith(")")) && !filter.isEmpty()) {
filter = "(" + filter + ")";
}
if (filter.contains("%s")) {
filter = String.format(filter, caller);
} else {
filter = "(&" + filter + "(" + attribute + "=" + caller + "))";
}
return filter;
} | java | private String getFormattedFilter(String searchFilter, String caller, String attribute) {
//Allow %v in addition to %s for string replacement
String filter = searchFilter.replaceAll("%v", "%s");
if (!(filter.startsWith("(") && filter.endsWith(")")) && !filter.isEmpty()) {
filter = "(" + filter + ")";
}
if (filter.contains("%s")) {
filter = String.format(filter, caller);
} else {
filter = "(&" + filter + "(" + attribute + "=" + caller + "))";
}
return filter;
} | [
"private",
"String",
"getFormattedFilter",
"(",
"String",
"searchFilter",
",",
"String",
"caller",
",",
"String",
"attribute",
")",
"{",
"//Allow %v in addition to %s for string replacement",
"String",
"filter",
"=",
"searchFilter",
".",
"replaceAll",
"(",
"\"%v\"",
","... | Format the callerSearchFilter or groupSearchFilter. We need to check for String substitution.
If a substitution is needed, use the result as is. Otherwise, construct the remainder of the
filter using the name attribute of the group or caller.
@param searchFilter The filter set in LdapIdentityStore
@param caller The name of the caller whose groups or DN we are searching for
@param attribute The attribute to use when forming the filter
@return The new filter after string replacements or constructing the filter | [
"Format",
"the",
"callerSearchFilter",
"or",
"groupSearchFilter",
".",
"We",
"need",
"to",
"check",
"for",
"String",
"substitution",
".",
"If",
"a",
"substitution",
"is",
"needed",
"use",
"the",
"result",
"as",
"is",
".",
"Otherwise",
"construct",
"the",
"rema... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L416-L428 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/contrib/NotifyingBlockingThreadPoolExecutor.java | NotifyingBlockingThreadPoolExecutor.afterExecute | @Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
// synchronizing on the pool (and actually all its threads)
// the synchronization is needed to avoid more than one signal if two or more
// threads decrement almost together and come to the if with 0 tasks together
synchronized (this) {
tasksInProcess.decrementAndGet();
if (tasksInProcess.intValue() == 0) {
synchronizer.signalAll();
}
}
} | java | @Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
// synchronizing on the pool (and actually all its threads)
// the synchronization is needed to avoid more than one signal if two or more
// threads decrement almost together and come to the if with 0 tasks together
synchronized (this) {
tasksInProcess.decrementAndGet();
if (tasksInProcess.intValue() == 0) {
synchronizer.signalAll();
}
}
} | [
"@",
"Override",
"protected",
"void",
"afterExecute",
"(",
"Runnable",
"r",
",",
"Throwable",
"t",
")",
"{",
"super",
".",
"afterExecute",
"(",
"r",
",",
"t",
")",
";",
"// synchronizing on the pool (and actually all its threads)",
"// the synchronization is needed to a... | After calling super's implementation of this method, the amount of tasks which are currently in process is
decremented. Finally, if the amount of tasks currently running is zero the synchronizer's signallAll() method is
invoked, thus anyone awaiting on this instance of ThreadPoolExecutor is released.
@see java.util.concurrent.ThreadPoolExecutor#afterExecute(Runnable, Throwable) | [
"After",
"calling",
"super",
"s",
"implementation",
"of",
"this",
"method",
"the",
"amount",
"of",
"tasks",
"which",
"are",
"currently",
"in",
"process",
"is",
"decremented",
".",
"Finally",
"if",
"the",
"amount",
"of",
"tasks",
"currently",
"running",
"is",
... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/NotifyingBlockingThreadPoolExecutor.java#L145-L159 |
javamonkey/beetl2.0 | beetl-core/src/main/java/org/beetl/core/io/FloatingIOWriter.java | FDBigInt.multaddMe | public void multaddMe(int iv, int addend)
{
long v = iv;
long p;
// unroll 0th iteration, doing addition.
p = v * ((long) data[0] & 0xffffffffL) + ((long) addend & 0xffffffffL);
data[0] = (int) p;
p >>>= 32;
for (int i = 1; i < nWords; i++)
{
p += v * ((long) data[i] & 0xffffffffL);
data[i] = (int) p;
p >>>= 32;
}
if (p != 0L)
{
data[nWords] = (int) p; // will fail noisily if illegal!
nWords++;
}
} | java | public void multaddMe(int iv, int addend)
{
long v = iv;
long p;
// unroll 0th iteration, doing addition.
p = v * ((long) data[0] & 0xffffffffL) + ((long) addend & 0xffffffffL);
data[0] = (int) p;
p >>>= 32;
for (int i = 1; i < nWords; i++)
{
p += v * ((long) data[i] & 0xffffffffL);
data[i] = (int) p;
p >>>= 32;
}
if (p != 0L)
{
data[nWords] = (int) p; // will fail noisily if illegal!
nWords++;
}
} | [
"public",
"void",
"multaddMe",
"(",
"int",
"iv",
",",
"int",
"addend",
")",
"{",
"long",
"v",
"=",
"iv",
";",
"long",
"p",
";",
"// unroll 0th iteration, doing addition.\r",
"p",
"=",
"v",
"*",
"(",
"(",
"long",
")",
"data",
"[",
"0",
"]",
"&",
"0xff... | /*
Multiply a FDBigInt by an int and add another int.
Result is computed in place.
Hope it fits! | [
"/",
"*",
"Multiply",
"a",
"FDBigInt",
"by",
"an",
"int",
"and",
"add",
"another",
"int",
".",
"Result",
"is",
"computed",
"in",
"place",
".",
"Hope",
"it",
"fits!"
] | train | https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/io/FloatingIOWriter.java#L2021-L2041 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java | Tuple.getTupleClass | @SuppressWarnings("unchecked")
public static Class<? extends Tuple> getTupleClass(int arity) {
if (arity < 0 || arity > MAX_ARITY) {
throw new IllegalArgumentException("The tuple arity must be in [0, " + MAX_ARITY + "].");
}
return (Class<? extends Tuple>) CLASSES[arity];
} | java | @SuppressWarnings("unchecked")
public static Class<? extends Tuple> getTupleClass(int arity) {
if (arity < 0 || arity > MAX_ARITY) {
throw new IllegalArgumentException("The tuple arity must be in [0, " + MAX_ARITY + "].");
}
return (Class<? extends Tuple>) CLASSES[arity];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Class",
"<",
"?",
"extends",
"Tuple",
">",
"getTupleClass",
"(",
"int",
"arity",
")",
"{",
"if",
"(",
"arity",
"<",
"0",
"||",
"arity",
">",
"MAX_ARITY",
")",
"{",
"throw",
"new",
... | Gets the class corresponding to the tuple of the given arity (dimensions). For
example, {@code getTupleClass(3)} will return the {@code Tuple3.class}.
@param arity The arity of the tuple class to get.
@return The tuple class with the given arity. | [
"Gets",
"the",
"class",
"corresponding",
"to",
"the",
"tuple",
"of",
"the",
"given",
"arity",
"(",
"dimensions",
")",
".",
"For",
"example",
"{",
"@code",
"getTupleClass",
"(",
"3",
")",
"}",
"will",
"return",
"the",
"{",
"@code",
"Tuple3",
".",
"class",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java#L102-L108 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java | P2sVpnServerConfigurationsInner.listByVirtualWanAsync | public Observable<Page<P2SVpnServerConfigurationInner>> listByVirtualWanAsync(final String resourceGroupName, final String virtualWanName) {
return listByVirtualWanWithServiceResponseAsync(resourceGroupName, virtualWanName)
.map(new Func1<ServiceResponse<Page<P2SVpnServerConfigurationInner>>, Page<P2SVpnServerConfigurationInner>>() {
@Override
public Page<P2SVpnServerConfigurationInner> call(ServiceResponse<Page<P2SVpnServerConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<P2SVpnServerConfigurationInner>> listByVirtualWanAsync(final String resourceGroupName, final String virtualWanName) {
return listByVirtualWanWithServiceResponseAsync(resourceGroupName, virtualWanName)
.map(new Func1<ServiceResponse<Page<P2SVpnServerConfigurationInner>>, Page<P2SVpnServerConfigurationInner>>() {
@Override
public Page<P2SVpnServerConfigurationInner> call(ServiceResponse<Page<P2SVpnServerConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"P2SVpnServerConfigurationInner",
">",
">",
"listByVirtualWanAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualWanName",
")",
"{",
"return",
"listByVirtualWanWithServiceResponseAsync",
"(",
"reso... | Retrieves all P2SVpnServerConfigurations for a particular VirtualWan.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWanName The name of the VirtualWan.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<P2SVpnServerConfigurationInner> object | [
"Retrieves",
"all",
"P2SVpnServerConfigurations",
"for",
"a",
"particular",
"VirtualWan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L581-L589 |
apache/incubator-heron | heron/uploaders/src/java/org/apache/heron/uploader/gcs/GcsUploader.java | GcsUploader.generateStorageObjectName | private static String generateStorageObjectName(String topologyName, String filename) {
return String.format("%s/%s", topologyName, filename);
} | java | private static String generateStorageObjectName(String topologyName, String filename) {
return String.format("%s/%s", topologyName, filename);
} | [
"private",
"static",
"String",
"generateStorageObjectName",
"(",
"String",
"topologyName",
",",
"String",
"filename",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s/%s\"",
",",
"topologyName",
",",
"filename",
")",
";",
"}"
] | Generate the storage object name in gcs given the topologyName and filename.
@param topologyName the name of the topology
@param filename the name of the file to upload to gcs
@return the name of the object. | [
"Generate",
"the",
"storage",
"object",
"name",
"in",
"gcs",
"given",
"the",
"topologyName",
"and",
"filename",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/uploaders/src/java/org/apache/heron/uploader/gcs/GcsUploader.java#L214-L216 |
jtrfp/jfdt | src/main/java/org/jtrfp/jfdt/Parser.java | Parser.readToExistingBean | public void readToExistingBean(EndianAwareDataInputStream is, ThirdPartyParseable target)
throws IllegalAccessException, UnrecognizedFormatException{
//target = (CLASS)Beans.instantiate(null, clazz.getName());
ensureContextInstantiatedForReading(is,target);
target.describeFormat(this);
popBean();
} | java | public void readToExistingBean(EndianAwareDataInputStream is, ThirdPartyParseable target)
throws IllegalAccessException, UnrecognizedFormatException{
//target = (CLASS)Beans.instantiate(null, clazz.getName());
ensureContextInstantiatedForReading(is,target);
target.describeFormat(this);
popBean();
} | [
"public",
"void",
"readToExistingBean",
"(",
"EndianAwareDataInputStream",
"is",
",",
"ThirdPartyParseable",
"target",
")",
"throws",
"IllegalAccessException",
",",
"UnrecognizedFormatException",
"{",
"//target = (CLASS)Beans.instantiate(null, clazz.getName());",
"ensureContextInstan... | Read the specified EndianAwareDataInputStream, parsing it and writing the property values to the given instantiated bean.<br>
When finished, the current position of the stream will be immediately after the data extracted.
@param is An endian-aware InputStream supplying the raw data to be parsed.
@param target The bean to which the properties are to be updated. Parser is implicitly specified when passing this bean.
@throws IllegalAccessException
@throws UnrecognizedFormatException
@since Sep 17, 2012 | [
"Read",
"the",
"specified",
"EndianAwareDataInputStream",
"parsing",
"it",
"and",
"writing",
"the",
"property",
"values",
"to",
"the",
"given",
"instantiated",
"bean",
".",
"<br",
">",
"When",
"finished",
"the",
"current",
"position",
"of",
"the",
"stream",
"wil... | train | https://github.com/jtrfp/jfdt/blob/64e665669b5fcbfe96736346b4e7893e466dd8a0/src/main/java/org/jtrfp/jfdt/Parser.java#L99-L105 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/asm/FieldVisitor.java | FieldVisitor.visitAnnotation | public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (fv != null) {
return fv.visitAnnotation(desc, visible);
}
return null;
} | java | public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (fv != null) {
return fv.visitAnnotation(desc, visible);
}
return null;
} | [
"public",
"AnnotationVisitor",
"visitAnnotation",
"(",
"String",
"desc",
",",
"boolean",
"visible",
")",
"{",
"if",
"(",
"fv",
"!=",
"null",
")",
"{",
"return",
"fv",
".",
"visitAnnotation",
"(",
"desc",
",",
"visible",
")",
";",
"}",
"return",
"null",
"... | Visits an annotation of the field.
@param desc
the class descriptor of the annotation class.
@param visible
<tt>true</tt> if the annotation is visible at runtime.
@return a visitor to visit the annotation values, or <tt>null</tt> if
this visitor is not interested in visiting this annotation. | [
"Visits",
"an",
"annotation",
"of",
"the",
"field",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/asm/FieldVisitor.java#L92-L97 |
skuzzle/TinyPlugz | tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Require.java | Require.nonNullResult | @NonNull
public static <T> T nonNullResult(@Nullable T result, String call) {
if (result == null) {
// XXX: IllegalStateException might not be the best choice
throw new IllegalStateException(String.format(
"call of '%s' yielded unexpected null value", call));
}
return result;
} | java | @NonNull
public static <T> T nonNullResult(@Nullable T result, String call) {
if (result == null) {
// XXX: IllegalStateException might not be the best choice
throw new IllegalStateException(String.format(
"call of '%s' yielded unexpected null value", call));
}
return result;
} | [
"@",
"NonNull",
"public",
"static",
"<",
"T",
">",
"T",
"nonNullResult",
"(",
"@",
"Nullable",
"T",
"result",
",",
"String",
"call",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// XXX: IllegalStateException might not be the best choice",
"throw",
"... | Asserts that a method call yielded a non-null result.
@param <T> Type of the object to test.
@param result The result object.
@param call A String description of the call, like "Object.calledMethod".
@return The object which was passed in.
@throws IllegalStateException If {@code result} is <code>null</code>. | [
"Asserts",
"that",
"a",
"method",
"call",
"yielded",
"a",
"non",
"-",
"null",
"result",
"."
] | train | https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Require.java#L108-L116 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java | ServerDnsAliasesInner.createOrUpdateAsync | public Observable<ServerDnsAliasInner> createOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() {
@Override
public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) {
return response.body();
}
});
} | java | public Observable<ServerDnsAliasInner> createOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() {
@Override
public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerDnsAliasInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"dnsAliasName",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Creates a server dns alias.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server that the alias is pointing to.
@param dnsAliasName The name of the server DNS alias.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"server",
"dns",
"alias",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L234-L241 |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.checkNull | public static Character checkNull(Character value, Character elseValue) {
return isNull(value) ? elseValue : value;
} | java | public static Character checkNull(Character value, Character elseValue) {
return isNull(value) ? elseValue : value;
} | [
"public",
"static",
"Character",
"checkNull",
"(",
"Character",
"value",
",",
"Character",
"elseValue",
")",
"{",
"return",
"isNull",
"(",
"value",
")",
"?",
"elseValue",
":",
"value",
";",
"}"
] | 检查Character是否为null
@param value 值
@param elseValue 为null返回的值
@return {@link Character}
@since 1.0.8 | [
"检查Character是否为null"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1377-L1379 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/mappings/Mappings.java | Mappings.safeGet | public static <D, R> R safeGet(Mapping<? super D, R> mapping, D key, R fallback) {
if (mapping == null) {
return fallback;
}
R val = mapping.get(key);
if (val == null) {
return fallback;
}
return val;
} | java | public static <D, R> R safeGet(Mapping<? super D, R> mapping, D key, R fallback) {
if (mapping == null) {
return fallback;
}
R val = mapping.get(key);
if (val == null) {
return fallback;
}
return val;
} | [
"public",
"static",
"<",
"D",
",",
"R",
">",
"R",
"safeGet",
"(",
"Mapping",
"<",
"?",
"super",
"D",
",",
"R",
">",
"mapping",
",",
"D",
"key",
",",
"R",
"fallback",
")",
"{",
"if",
"(",
"mapping",
"==",
"null",
")",
"{",
"return",
"fallback",
... | Safely retrieves a value from a mapping. If the mapping is <code>null</code> or returns a <code>null</code>
value, the given fallback value is returned.
@param mapping
the mapping.
@param key
the key.
@param fallback
the fallback value to return if either the mapping or the originally returned value are
<code>null</code>.
@return the value returned by the specified mapping, or the fallback value. | [
"Safely",
"retrieves",
"a",
"value",
"from",
"a",
"mapping",
".",
"If",
"the",
"mapping",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"or",
"returns",
"a",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
"the",
"given",
"fallback",
"value",
"is",
... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/mappings/Mappings.java#L230-L239 |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.isCollection | public boolean isCollection(Object obj, Field field) {
try {
Object val = field.get(obj);
boolean isCollResource = false;
if (val != null) {
isCollResource = CollectionResource.class.equals(val.getClass());
}
return (!isCollResource && !field.getType().equals(CollectionResource.class))
&& (Collection.class.equals(field.getType()) || ArrayUtils.contains(field.getType().getInterfaces(),
Collection.class));
} catch (Exception e) {
throw new Siren4JRuntimeException(e);
}
} | java | public boolean isCollection(Object obj, Field field) {
try {
Object val = field.get(obj);
boolean isCollResource = false;
if (val != null) {
isCollResource = CollectionResource.class.equals(val.getClass());
}
return (!isCollResource && !field.getType().equals(CollectionResource.class))
&& (Collection.class.equals(field.getType()) || ArrayUtils.contains(field.getType().getInterfaces(),
Collection.class));
} catch (Exception e) {
throw new Siren4JRuntimeException(e);
}
} | [
"public",
"boolean",
"isCollection",
"(",
"Object",
"obj",
",",
"Field",
"field",
")",
"{",
"try",
"{",
"Object",
"val",
"=",
"field",
".",
"get",
"(",
"obj",
")",
";",
"boolean",
"isCollResource",
"=",
"false",
";",
"if",
"(",
"val",
"!=",
"null",
"... | Determine if the field is a Collection class and not a CollectionResource class which needs special treatment.
@param field
@return | [
"Determine",
"if",
"the",
"field",
"is",
"a",
"Collection",
"class",
"and",
"not",
"a",
"CollectionResource",
"class",
"which",
"needs",
"special",
"treatment",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L971-L984 |
threerings/nenya | core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java | BundledTileSetRepository.addBundle | protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
TileSetBundle bundle)
{
IMImageProvider improv = (_imgr == null) ?
null : new IMImageProvider(_imgr, bundle);
// map all of the tilesets in this bundle
for (IntMap.IntEntry<TileSet> entry : bundle.intEntrySet()) {
Integer tsid = entry.getKey();
TileSet tset = entry.getValue();
tset.setImageProvider(improv);
idmap.put(tsid.intValue(), tset);
namemap.put(tset.getName(), tsid);
}
} | java | protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
TileSetBundle bundle)
{
IMImageProvider improv = (_imgr == null) ?
null : new IMImageProvider(_imgr, bundle);
// map all of the tilesets in this bundle
for (IntMap.IntEntry<TileSet> entry : bundle.intEntrySet()) {
Integer tsid = entry.getKey();
TileSet tset = entry.getValue();
tset.setImageProvider(improv);
idmap.put(tsid.intValue(), tset);
namemap.put(tset.getName(), tsid);
}
} | [
"protected",
"void",
"addBundle",
"(",
"HashIntMap",
"<",
"TileSet",
">",
"idmap",
",",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"namemap",
",",
"TileSetBundle",
"bundle",
")",
"{",
"IMImageProvider",
"improv",
"=",
"(",
"_imgr",
"==",
"null",
")",
"... | Adds the tilesets in the supplied bundle to our tileset mapping
tables. Any tilesets with the same name or id will be overwritten. | [
"Adds",
"the",
"tilesets",
"in",
"the",
"supplied",
"bundle",
"to",
"our",
"tileset",
"mapping",
"tables",
".",
"Any",
"tilesets",
"with",
"the",
"same",
"name",
"or",
"id",
"will",
"be",
"overwritten",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java#L142-L156 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policypatset_binding.java | policypatset_binding.get | public static policypatset_binding get(nitro_service service, String name) throws Exception{
policypatset_binding obj = new policypatset_binding();
obj.set_name(name);
policypatset_binding response = (policypatset_binding) obj.get_resource(service);
return response;
} | java | public static policypatset_binding get(nitro_service service, String name) throws Exception{
policypatset_binding obj = new policypatset_binding();
obj.set_name(name);
policypatset_binding response = (policypatset_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"policypatset_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"policypatset_binding",
"obj",
"=",
"new",
"policypatset_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")"... | Use this API to fetch policypatset_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"policypatset_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policypatset_binding.java#L103-L108 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/traverson/Traverson.java | Traverson.followLink | public Traverson followLink(final String rel,
final Map<String, Object> vars) {
return followLink(rel, always(), vars);
} | java | public Traverson followLink(final String rel,
final Map<String, Object> vars) {
return followLink(rel, always(), vars);
} | [
"public",
"Traverson",
"followLink",
"(",
"final",
"String",
"rel",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"vars",
")",
"{",
"return",
"followLink",
"(",
"rel",
",",
"always",
"(",
")",
",",
"vars",
")",
";",
"}"
] | Follow the first {@link Link} of the current resource, selected by its link-relation type.
<p>
Templated links are expanded to URIs using the specified template variables.
</p>
<p>
Other than {@link #follow(String, Map)}, this method will ignore possibly embedded resources
with the same link-relation type. Only if the link is missing, the embedded resource is
used.
</p>
@param rel the link-relation type of the followed link
@param vars uri-template variables used to build links.
@return this
@since 2.0.0 | [
"Follow",
"the",
"first",
"{",
"@link",
"Link",
"}",
"of",
"the",
"current",
"resource",
"selected",
"by",
"its",
"link",
"-",
"relation",
"type",
".",
"<p",
">",
"Templated",
"links",
"are",
"expanded",
"to",
"URIs",
"using",
"the",
"specified",
"template... | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L531-L534 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsPublishScheduledDialog.java | CmsPublishScheduledDialog.addToTempProject | private void addToTempProject(CmsObject adminCms, CmsObject userCms, CmsResource resource, CmsProject tmpProject)
throws CmsException {
// copy the resource to the project
adminCms.copyResourceToProject(resource);
// lock the resource in the current project
CmsLock lock = userCms.getLock(resource);
// prove is current lock from current but not in current project
if ((lock != null)
&& lock.isOwnedBy(userCms.getRequestContext().getCurrentUser())
&& !lock.isOwnedInProjectBy(
userCms.getRequestContext().getCurrentUser(),
userCms.getRequestContext().getCurrentProject())) {
// file is locked by current user but not in current project
// change the lock from this file
userCms.changeLock(resource);
}
// lock resource from current user in current project
userCms.lockResource(resource);
// get current lock
lock = userCms.getLock(resource);
} | java | private void addToTempProject(CmsObject adminCms, CmsObject userCms, CmsResource resource, CmsProject tmpProject)
throws CmsException {
// copy the resource to the project
adminCms.copyResourceToProject(resource);
// lock the resource in the current project
CmsLock lock = userCms.getLock(resource);
// prove is current lock from current but not in current project
if ((lock != null)
&& lock.isOwnedBy(userCms.getRequestContext().getCurrentUser())
&& !lock.isOwnedInProjectBy(
userCms.getRequestContext().getCurrentUser(),
userCms.getRequestContext().getCurrentProject())) {
// file is locked by current user but not in current project
// change the lock from this file
userCms.changeLock(resource);
}
// lock resource from current user in current project
userCms.lockResource(resource);
// get current lock
lock = userCms.getLock(resource);
} | [
"private",
"void",
"addToTempProject",
"(",
"CmsObject",
"adminCms",
",",
"CmsObject",
"userCms",
",",
"CmsResource",
"resource",
",",
"CmsProject",
"tmpProject",
")",
"throws",
"CmsException",
"{",
"// copy the resource to the project",
"adminCms",
".",
"copyResourceToPr... | Adds the given resource to the temporary project.<p>
@param adminCms the admin cms context
@param userCms the user cms context
@param resource the resource
@param tmpProject the temporary project
@throws CmsException in case something goes wrong | [
"Adds",
"the",
"given",
"resource",
"to",
"the",
"temporary",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsPublishScheduledDialog.java#L284-L306 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java | ChecksumExtensions.getChecksum | public static String getChecksum(final Algorithm algorithm, final byte[]... byteArrays)
throws NoSuchAlgorithmException
{
StringBuilder sb = new StringBuilder();
for (byte[] byteArray : byteArrays)
{
sb.append(getChecksum(byteArray, algorithm.getAlgorithm()));
}
return sb.toString();
} | java | public static String getChecksum(final Algorithm algorithm, final byte[]... byteArrays)
throws NoSuchAlgorithmException
{
StringBuilder sb = new StringBuilder();
for (byte[] byteArray : byteArrays)
{
sb.append(getChecksum(byteArray, algorithm.getAlgorithm()));
}
return sb.toString();
} | [
"public",
"static",
"String",
"getChecksum",
"(",
"final",
"Algorithm",
"algorithm",
",",
"final",
"byte",
"[",
"]",
"...",
"byteArrays",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
... | Gets the checksum from the given byte arrays with the given algorithm
@param algorithm
the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".
@param byteArrays
the array of byte arrays
@return The checksum from the given byte arrays as a String object.
@throws NoSuchAlgorithmException
Is thrown if the algorithm is not supported or does not exists.
{@link java.security.MessageDigest} object. | [
"Gets",
"the",
"checksum",
"from",
"the",
"given",
"byte",
"arrays",
"with",
"the",
"given",
"algorithm"
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java#L80-L89 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.openDirectory | public SftpFile openDirectory(String path) throws SftpStatusException,
SshException {
String absolutePath = getAbsolutePath(path);
SftpFileAttributes attrs = getAttributes(absolutePath);
if (!attrs.isDirectory()) {
throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
path + " is not a directory");
}
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_OPENDIR);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
byte[] handle = getHandleResponse(requestId);
SftpFile file = new SftpFile(absolutePath, attrs);
file.setHandle(handle);
file.setSFTPSubsystem(this);
return file;
} catch (SshIOException ex) {
throw ex.getRealException();
} catch (IOException ex) {
throw new SshException(ex);
}
} | java | public SftpFile openDirectory(String path) throws SftpStatusException,
SshException {
String absolutePath = getAbsolutePath(path);
SftpFileAttributes attrs = getAttributes(absolutePath);
if (!attrs.isDirectory()) {
throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
path + " is not a directory");
}
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_OPENDIR);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
byte[] handle = getHandleResponse(requestId);
SftpFile file = new SftpFile(absolutePath, attrs);
file.setHandle(handle);
file.setSFTPSubsystem(this);
return file;
} catch (SshIOException ex) {
throw ex.getRealException();
} catch (IOException ex) {
throw new SshException(ex);
}
} | [
"public",
"SftpFile",
"openDirectory",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"String",
"absolutePath",
"=",
"getAbsolutePath",
"(",
"path",
")",
";",
"SftpFileAttributes",
"attrs",
"=",
"getAttributes",
"(",
"absolute... | Open a directory.
@param path
@return sftpfile
@throws SftpStatusException
, SshException | [
"Open",
"a",
"directory",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1597-L1630 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | Comparator.thenComparing | public <U extends Comparable<? super U>> Comparator<T> thenComparing(
Function<? super T, ? extends U> keyExtractor,
java.util.Comparator<? super U> keyComparator
) {
return thenComparing(F.comparing(keyExtractor, keyComparator));
} | java | public <U extends Comparable<? super U>> Comparator<T> thenComparing(
Function<? super T, ? extends U> keyExtractor,
java.util.Comparator<? super U> keyComparator
) {
return thenComparing(F.comparing(keyExtractor, keyComparator));
} | [
"public",
"<",
"U",
"extends",
"Comparable",
"<",
"?",
"super",
"U",
">",
">",
"Comparator",
"<",
"T",
">",
"thenComparing",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"U",
">",
"keyExtractor",
",",
"java",
".",
"util",
".",
"Compa... | See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#thenComparing-java.util.function.Function-java.util.Comparator-">Java 8 doc</a>
@param keyExtractor
The function to extract the key for comparison
@param keyComparator
The function to compare the extracted key
@param <U>
the generic type of the key
@return a function that extract key of type {@code U} from element of type {@code T}
and run {@code keyComparator} to compare the two keys
@since 0.2 | [
"See",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"8",
"/",
"docs",
"/",
"api",
"/",
"java",
"/",
"util",
"/",
"Comparator",
".",
"html#thenComparing",
"-",
"java",
".",
"util",
".",
"function",
".... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L2093-L2098 |
lightblue-platform/lightblue-migrator | migrator/src/main/java/com/redhat/lightblue/migrator/Utils.java | Utils.fastCompareDocs | public static boolean fastCompareDocs(JsonNode sourceDocument, JsonNode destinationDocument, List<String> exclusionPaths, boolean ignoreTimestampMSDiffs) {
try {
JsonDiff diff = new JsonDiff();
diff.setOption(JsonDiff.Option.ARRAY_ORDER_INSIGNIFICANT);
diff.setOption(JsonDiff.Option.RETURN_LEAVES_ONLY);
diff.setFilter(new AbstractFieldFilter() {
public boolean includeField(List<String> fieldName) {
return !fieldName.get(fieldName.size() - 1).endsWith("#");
}
});
List<JsonDelta> list = diff.computeDiff(sourceDocument, destinationDocument);
for (JsonDelta x : list) {
String field = x.getField();
if (!isExcluded(exclusionPaths, field)) {
if (reallyDifferent(x.getNode1(), x.getNode2(), ignoreTimestampMSDiffs)) {
return true;
}
}
}
} catch (Exception e) {
LOGGER.error("Cannot compare docs:{}", e, e);
}
return false;
} | java | public static boolean fastCompareDocs(JsonNode sourceDocument, JsonNode destinationDocument, List<String> exclusionPaths, boolean ignoreTimestampMSDiffs) {
try {
JsonDiff diff = new JsonDiff();
diff.setOption(JsonDiff.Option.ARRAY_ORDER_INSIGNIFICANT);
diff.setOption(JsonDiff.Option.RETURN_LEAVES_ONLY);
diff.setFilter(new AbstractFieldFilter() {
public boolean includeField(List<String> fieldName) {
return !fieldName.get(fieldName.size() - 1).endsWith("#");
}
});
List<JsonDelta> list = diff.computeDiff(sourceDocument, destinationDocument);
for (JsonDelta x : list) {
String field = x.getField();
if (!isExcluded(exclusionPaths, field)) {
if (reallyDifferent(x.getNode1(), x.getNode2(), ignoreTimestampMSDiffs)) {
return true;
}
}
}
} catch (Exception e) {
LOGGER.error("Cannot compare docs:{}", e, e);
}
return false;
} | [
"public",
"static",
"boolean",
"fastCompareDocs",
"(",
"JsonNode",
"sourceDocument",
",",
"JsonNode",
"destinationDocument",
",",
"List",
"<",
"String",
">",
"exclusionPaths",
",",
"boolean",
"ignoreTimestampMSDiffs",
")",
"{",
"try",
"{",
"JsonDiff",
"diff",
"=",
... | Compare two docs fast if they are the same, excluding exclusions
@return true if documents are different | [
"Compare",
"two",
"docs",
"fast",
"if",
"they",
"are",
"the",
"same",
"excluding",
"exclusions"
] | train | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/Utils.java#L132-L155 |
samskivert/pythagoras | src/main/java/pythagoras/d/Vectors.java | Vectors.isEpsilonZero | public static boolean isEpsilonZero (double x, double y, double epsilon) {
return Math.abs(x) <= epsilon && Math.abs(y) <= epsilon;
} | java | public static boolean isEpsilonZero (double x, double y, double epsilon) {
return Math.abs(x) <= epsilon && Math.abs(y) <= epsilon;
} | [
"public",
"static",
"boolean",
"isEpsilonZero",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"epsilon",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"x",
")",
"<=",
"epsilon",
"&&",
"Math",
".",
"abs",
"(",
"y",
")",
"<=",
"epsilon",
";",
... | Returns true if the supplied vector's x and y components are {@code epsilon} close to zero
magnitude. | [
"Returns",
"true",
"if",
"the",
"supplied",
"vector",
"s",
"x",
"and",
"y",
"components",
"are",
"{"
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Vectors.java#L75-L77 |
vincentk/joptimizer | src/main/java/com/joptimizer/util/ColtUtils.java | ColtUtils.replaceValues | public static final DoubleMatrix1D replaceValues(DoubleMatrix1D v, double oldValue, double newValue) {
if(v == null){
return null;
}
DoubleFactory1D F1 = (v instanceof SparseDoubleMatrix1D)? DoubleFactory1D.sparse : DoubleFactory1D.dense;
DoubleMatrix1D ret = F1.make(v.size());
for (int i = 0; i < v.size(); i++) {
double vi = v.getQuick(i);
if (Double.compare(oldValue, vi) != 0) {
// no substitution
ret.setQuick(i, vi);
} else {
ret.setQuick(i, newValue);
}
}
return ret;
} | java | public static final DoubleMatrix1D replaceValues(DoubleMatrix1D v, double oldValue, double newValue) {
if(v == null){
return null;
}
DoubleFactory1D F1 = (v instanceof SparseDoubleMatrix1D)? DoubleFactory1D.sparse : DoubleFactory1D.dense;
DoubleMatrix1D ret = F1.make(v.size());
for (int i = 0; i < v.size(); i++) {
double vi = v.getQuick(i);
if (Double.compare(oldValue, vi) != 0) {
// no substitution
ret.setQuick(i, vi);
} else {
ret.setQuick(i, newValue);
}
}
return ret;
} | [
"public",
"static",
"final",
"DoubleMatrix1D",
"replaceValues",
"(",
"DoubleMatrix1D",
"v",
",",
"double",
"oldValue",
",",
"double",
"newValue",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"DoubleFactory1D",
"F1",
"=",
"(... | Return a new array with all the occurences of oldValue replaced by newValue. | [
"Return",
"a",
"new",
"array",
"with",
"all",
"the",
"occurences",
"of",
"oldValue",
"replaced",
"by",
"newValue",
"."
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/ColtUtils.java#L477-L493 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.setController | public void setController(Object object, GraphicsController controller) {
if (isAttached()) {
helper.setController(object, controller);
}
} | java | public void setController(Object object, GraphicsController controller) {
if (isAttached()) {
helper.setController(object, controller);
}
} | [
"public",
"void",
"setController",
"(",
"Object",
"object",
",",
"GraphicsController",
"controller",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"helper",
".",
"setController",
"(",
"object",
",",
"controller",
")",
";",
"}",
"}"
] | Set the controller on an element of this <code>GraphicsContext</code> so it can react to events.
@param object
the element on which the controller should be set.
@param controller
The new <code>GraphicsController</code> | [
"Set",
"the",
"controller",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"so",
"it",
"can",
"react",
"to",
"events",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L615-L619 |
reactor/reactor-netty | src/main/java/reactor/netty/udp/UdpServer.java | UdpServer.doOnBind | public final UdpServer doOnBind(Consumer<? super Bootstrap> doOnBind) {
Objects.requireNonNull(doOnBind, "doOnBind");
return new UdpServerDoOn(this, doOnBind, null, null);
} | java | public final UdpServer doOnBind(Consumer<? super Bootstrap> doOnBind) {
Objects.requireNonNull(doOnBind, "doOnBind");
return new UdpServerDoOn(this, doOnBind, null, null);
} | [
"public",
"final",
"UdpServer",
"doOnBind",
"(",
"Consumer",
"<",
"?",
"super",
"Bootstrap",
">",
"doOnBind",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnBind",
",",
"\"doOnBind\"",
")",
";",
"return",
"new",
"UdpServerDoOn",
"(",
"this",
",",
"doO... | Setup a callback called when {@link io.netty.channel.Channel} is about to
bind.
@param doOnBind a consumer observing server start event
@return a new {@link UdpServer} | [
"Setup",
"a",
"callback",
"called",
"when",
"{",
"@link",
"io",
".",
"netty",
".",
"channel",
".",
"Channel",
"}",
"is",
"about",
"to",
"bind",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpServer.java#L180-L184 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java | FacebookSignatureUtil.verifySignature | public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret) {
if (null == params || params.isEmpty() )
return false;
CharSequence sigParam = params.remove(FacebookParam.SIGNATURE);
return (null == sigParam) ? false : verifySignature(params, secret, sigParam.toString());
} | java | public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret) {
if (null == params || params.isEmpty() )
return false;
CharSequence sigParam = params.remove(FacebookParam.SIGNATURE);
return (null == sigParam) ? false : verifySignature(params, secret, sigParam.toString());
} | [
"public",
"static",
"boolean",
"verifySignature",
"(",
"EnumMap",
"<",
"FacebookParam",
",",
"CharSequence",
">",
"params",
",",
"String",
"secret",
")",
"{",
"if",
"(",
"null",
"==",
"params",
"||",
"params",
".",
"isEmpty",
"(",
")",
")",
"return",
"fals... | Verifies that a signature received matches the expected value.
Removes FacebookParam.SIGNATURE from params if present.
@param params a map of parameters and their values, such as one
obtained from extractFacebookParams; expected to the expected signature
as the FacebookParam.SIGNATURE parameter
@param secret
@return a boolean indicating whether the calculated signature matched the
expected signature | [
"Verifies",
"that",
"a",
"signature",
"received",
"matches",
"the",
"expected",
"value",
".",
"Removes",
"FacebookParam",
".",
"SIGNATURE",
"from",
"params",
"if",
"present",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java#L146-L151 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java | IoUtil.transformDocumentToXml | public static void transformDocumentToXml(DomDocument document, StreamResult result) {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
try {
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
synchronized(document) {
transformer.transform(document.getDomSource(), result);
}
} catch (TransformerConfigurationException e) {
throw new ModelIoException("Unable to create a transformer for the model", e);
} catch (TransformerException e) {
throw new ModelIoException("Unable to transform model to xml", e);
}
} | java | public static void transformDocumentToXml(DomDocument document, StreamResult result) {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
try {
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
synchronized(document) {
transformer.transform(document.getDomSource(), result);
}
} catch (TransformerConfigurationException e) {
throw new ModelIoException("Unable to create a transformer for the model", e);
} catch (TransformerException e) {
throw new ModelIoException("Unable to transform model to xml", e);
}
} | [
"public",
"static",
"void",
"transformDocumentToXml",
"(",
"DomDocument",
"document",
",",
"StreamResult",
"result",
")",
"{",
"TransformerFactory",
"transformerFactory",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"try",
"{",
"Transformer",
"transfo... | Transforms a {@link DomDocument} to XML output.
@param document the DOM document to transform
@param result the {@link StreamResult} to write to | [
"Transforms",
"a",
"{",
"@link",
"DomDocument",
"}",
"to",
"XML",
"output",
"."
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java#L124-L140 |
mguymon/naether | src/main/java/com/tobedevoured/naether/PathClassLoader.java | PathClassLoader.execStaticMethod | public Object execStaticMethod( String className, String methodName ) throws ClassLoaderException {
return execStaticMethod( className, methodName, null );
} | java | public Object execStaticMethod( String className, String methodName ) throws ClassLoaderException {
return execStaticMethod( className, methodName, null );
} | [
"public",
"Object",
"execStaticMethod",
"(",
"String",
"className",
",",
"String",
"methodName",
")",
"throws",
"ClassLoaderException",
"{",
"return",
"execStaticMethod",
"(",
"className",
",",
"methodName",
",",
"null",
")",
";",
"}"
] | Helper for executing static methods on a Class
@param className String fully qualified class
@param methodName String method name
@return Object result
@throws ClassLoaderException exception | [
"Helper",
"for",
"executing",
"static",
"methods",
"on",
"a",
"Class"
] | train | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/PathClassLoader.java#L207-L209 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java | MergePolicyValidator.checkMergePolicySupportsInMemoryFormat | public static boolean checkMergePolicySupportsInMemoryFormat(String name, Object mergePolicy, InMemoryFormat inMemoryFormat,
boolean failFast, ILogger logger) {
if (inMemoryFormat != NATIVE) {
return true;
}
if (mergePolicy instanceof SplitBrainMergePolicy) {
return true;
}
if (failFast) {
throw new InvalidConfigurationException(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
}
logger.warning(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
return false;
} | java | public static boolean checkMergePolicySupportsInMemoryFormat(String name, Object mergePolicy, InMemoryFormat inMemoryFormat,
boolean failFast, ILogger logger) {
if (inMemoryFormat != NATIVE) {
return true;
}
if (mergePolicy instanceof SplitBrainMergePolicy) {
return true;
}
if (failFast) {
throw new InvalidConfigurationException(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
}
logger.warning(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
return false;
} | [
"public",
"static",
"boolean",
"checkMergePolicySupportsInMemoryFormat",
"(",
"String",
"name",
",",
"Object",
"mergePolicy",
",",
"InMemoryFormat",
"inMemoryFormat",
",",
"boolean",
"failFast",
",",
"ILogger",
"logger",
")",
"{",
"if",
"(",
"inMemoryFormat",
"!=",
... | Checks if the given {@link InMemoryFormat} can be merged by the given
{@code mergePolicy} instance.
<p>
When a wrong policy is detected, it does one of two things:
if {@code failFast} is {@code true} and the cluster version is 3.10 or later,
it throws an {@link InvalidConfigurationException}, otherwise it logs a warning.
@return {@code true} if the given {@code inMemoryFormat} can be merged by
the supplied {@code mergePolicy}, {@code false} otherwise | [
"Checks",
"if",
"the",
"given",
"{",
"@link",
"InMemoryFormat",
"}",
"can",
"be",
"merged",
"by",
"the",
"given",
"{",
"@code",
"mergePolicy",
"}",
"instance",
".",
"<p",
">",
"When",
"a",
"wrong",
"policy",
"is",
"detected",
"it",
"does",
"one",
"of",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java#L63-L76 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_ip.java | ns_ns_ip.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_ns_ip_responses result = (ns_ns_ip_responses) service.get_payload_formatter().string_to_resource(ns_ns_ip_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_ip_response_array);
}
ns_ns_ip[] result_ns_ns_ip = new ns_ns_ip[result.ns_ns_ip_response_array.length];
for(int i = 0; i < result.ns_ns_ip_response_array.length; i++)
{
result_ns_ns_ip[i] = result.ns_ns_ip_response_array[i].ns_ns_ip[0];
}
return result_ns_ns_ip;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_ns_ip_responses result = (ns_ns_ip_responses) service.get_payload_formatter().string_to_resource(ns_ns_ip_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_ip_response_array);
}
ns_ns_ip[] result_ns_ns_ip = new ns_ns_ip[result.ns_ns_ip_response_array.length];
for(int i = 0; i < result.ns_ns_ip_response_array.length; i++)
{
result_ns_ns_ip[i] = result.ns_ns_ip_response_array[i].ns_ns_ip[0];
}
return result_ns_ns_ip;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_ns_ip_responses",
"result",
"=",
"(",
"ns_ns_ip_responses",
")",
"service",
".",
"get_payload_formatter",
... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_ip.java#L298-L315 |
JadiraOrg/jadira | jms/src/main/java/org/jadira/jms/container/BatchedMessageListenerContainer.java | BatchedMessageListenerContainer.commitIfNecessary | protected void commitIfNecessary(Session session, List<Message> messages) throws JMSException {
// Commit session or acknowledge message.
if (session.getTransacted()) {
// Commit necessary - but avoid commit call within a JTA transaction.
if (isSessionLocallyTransacted(session)) {
// Transacted session created by this container -> commit.
JmsUtils.commitIfNecessary(session);
}
} else if (messages != null && isClientAcknowledge(session)) {
for (Message message : messages) {
message.acknowledge();
}
}
} | java | protected void commitIfNecessary(Session session, List<Message> messages) throws JMSException {
// Commit session or acknowledge message.
if (session.getTransacted()) {
// Commit necessary - but avoid commit call within a JTA transaction.
if (isSessionLocallyTransacted(session)) {
// Transacted session created by this container -> commit.
JmsUtils.commitIfNecessary(session);
}
} else if (messages != null && isClientAcknowledge(session)) {
for (Message message : messages) {
message.acknowledge();
}
}
} | [
"protected",
"void",
"commitIfNecessary",
"(",
"Session",
"session",
",",
"List",
"<",
"Message",
">",
"messages",
")",
"throws",
"JMSException",
"{",
"// Commit session or acknowledge message.",
"if",
"(",
"session",
".",
"getTransacted",
"(",
")",
")",
"{",
"// ... | Variant of {@link AbstractMessageListenerContainer#commitIfNecessary(Session, Message)} that performs the activity for a batch of messages.
@param session the JMS Session to commit
@param messages the messages to acknowledge
@throws javax.jms.JMSException in case of commit failure | [
"Variant",
"of",
"{"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/jms/src/main/java/org/jadira/jms/container/BatchedMessageListenerContainer.java#L346-L359 |
baratine/baratine | framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java | DatabaseServiceRamp.findOne | @Override
public void findOne(String sql, Result<Cursor> result, Object ...args)
{
_kraken.query(sql).findOne(result, args);
} | java | @Override
public void findOne(String sql, Result<Cursor> result, Object ...args)
{
_kraken.query(sql).findOne(result, args);
} | [
"@",
"Override",
"public",
"void",
"findOne",
"(",
"String",
"sql",
",",
"Result",
"<",
"Cursor",
">",
"result",
",",
"Object",
"...",
"args",
")",
"{",
"_kraken",
".",
"query",
"(",
"sql",
")",
".",
"findOne",
"(",
"result",
",",
"args",
")",
";",
... | Queries for a single result in the database.
@param sql the select query
@param result holder for the result
@param args arguments to the select | [
"Queries",
"for",
"a",
"single",
"result",
"in",
"the",
"database",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java#L118-L122 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.loadClass | public static Class loadClass(ClassLoader cl, String className) throws ClassException {
Set<Throwable> exceptions = new HashSet<Throwable>();
Class clazz = loadClass(cl, className, null, exceptions);
if (clazz != null) return clazz;
String msg = "cannot load class through its string name, because no definition for the class with the specified name [" + className + "] could be found";
if (!exceptions.isEmpty()) {
StringBuilder detail = new StringBuilder();
Iterator<Throwable> it = exceptions.iterator();
Throwable t;
while (it.hasNext()) {
t = it.next();
detail.append(t.getClass().getName()).append(':').append(t.getMessage()).append(';');
}
throw new ClassException(msg + " caused by (" + detail.toString() + ")");
}
throw new ClassException(msg);
} | java | public static Class loadClass(ClassLoader cl, String className) throws ClassException {
Set<Throwable> exceptions = new HashSet<Throwable>();
Class clazz = loadClass(cl, className, null, exceptions);
if (clazz != null) return clazz;
String msg = "cannot load class through its string name, because no definition for the class with the specified name [" + className + "] could be found";
if (!exceptions.isEmpty()) {
StringBuilder detail = new StringBuilder();
Iterator<Throwable> it = exceptions.iterator();
Throwable t;
while (it.hasNext()) {
t = it.next();
detail.append(t.getClass().getName()).append(':').append(t.getMessage()).append(';');
}
throw new ClassException(msg + " caused by (" + detail.toString() + ")");
}
throw new ClassException(msg);
} | [
"public",
"static",
"Class",
"loadClass",
"(",
"ClassLoader",
"cl",
",",
"String",
"className",
")",
"throws",
"ClassException",
"{",
"Set",
"<",
"Throwable",
">",
"exceptions",
"=",
"new",
"HashSet",
"<",
"Throwable",
">",
"(",
")",
";",
"Class",
"clazz",
... | loads a class from a specified Classloader with given classname
@param className
@param cl
@return matching Class
@throws ClassException | [
"loads",
"a",
"class",
"from",
"a",
"specified",
"Classloader",
"with",
"given",
"classname"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L267-L288 |
deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/chunk/NDArrayMessageChunk.java | NDArrayMessageChunk.fromBuffer | public static NDArrayMessageChunk fromBuffer(ByteBuffer byteBuffer, NDArrayMessage.MessageType type) {
int numChunks = byteBuffer.getInt();
int chunkSize = byteBuffer.getInt();
int idLength = byteBuffer.getInt();
byte[] id = new byte[idLength];
byteBuffer.get(id);
String idString = new String(id);
int index = byteBuffer.getInt();
ByteBuffer firstData = byteBuffer.slice();
NDArrayMessageChunk chunk = NDArrayMessageChunk.builder().chunkSize(chunkSize).numChunks(numChunks)
.data(firstData).messageType(type).id(idString).chunkIndex(index).build();
return chunk;
} | java | public static NDArrayMessageChunk fromBuffer(ByteBuffer byteBuffer, NDArrayMessage.MessageType type) {
int numChunks = byteBuffer.getInt();
int chunkSize = byteBuffer.getInt();
int idLength = byteBuffer.getInt();
byte[] id = new byte[idLength];
byteBuffer.get(id);
String idString = new String(id);
int index = byteBuffer.getInt();
ByteBuffer firstData = byteBuffer.slice();
NDArrayMessageChunk chunk = NDArrayMessageChunk.builder().chunkSize(chunkSize).numChunks(numChunks)
.data(firstData).messageType(type).id(idString).chunkIndex(index).build();
return chunk;
} | [
"public",
"static",
"NDArrayMessageChunk",
"fromBuffer",
"(",
"ByteBuffer",
"byteBuffer",
",",
"NDArrayMessage",
".",
"MessageType",
"type",
")",
"{",
"int",
"numChunks",
"=",
"byteBuffer",
".",
"getInt",
"(",
")",
";",
"int",
"chunkSize",
"=",
"byteBuffer",
"."... | Returns a chunk given the passed in {@link ByteBuffer}
NOTE THAT THIS WILL MODIFY THE PASSED IN BYTEBUFFER's POSITION.
@param byteBuffer the byte buffer to extract the chunk from
@return the ndarray message chunk based on the passed in {@link ByteBuffer} | [
"Returns",
"a",
"chunk",
"given",
"the",
"passed",
"in",
"{",
"@link",
"ByteBuffer",
"}",
"NOTE",
"THAT",
"THIS",
"WILL",
"MODIFY",
"THE",
"PASSED",
"IN",
"BYTEBUFFER",
"s",
"POSITION",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/chunk/NDArrayMessageChunk.java#L120-L133 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/crypto/EncryptionConfigParser.java | EncryptionConfigParser.getCipher | public static String getCipher(Map<String, Object> parameters) {
return (String)parameters.get(ENCRYPTION_CIPHER_KEY);
} | java | public static String getCipher(Map<String, Object> parameters) {
return (String)parameters.get(ENCRYPTION_CIPHER_KEY);
} | [
"public",
"static",
"String",
"getCipher",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"return",
"(",
"String",
")",
"parameters",
".",
"get",
"(",
"ENCRYPTION_CIPHER_KEY",
")",
";",
"}"
] | Get the underlying cipher name
@param parameters parameters map
@return the cipher name | [
"Get",
"the",
"underlying",
"cipher",
"name"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/crypto/EncryptionConfigParser.java#L211-L213 |
podio/podio-java | src/main/java/com/podio/stream/StreamAPI.java | StreamAPI.getGlobalStreamV2 | public List<StreamObjectV2> getGlobalStreamV2(Integer limit,
Integer offset, DateTime dateFrom, DateTime dateTo) {
return getStreamV2("/stream/v2/", limit, offset, dateFrom, dateTo);
} | java | public List<StreamObjectV2> getGlobalStreamV2(Integer limit,
Integer offset, DateTime dateFrom, DateTime dateTo) {
return getStreamV2("/stream/v2/", limit, offset, dateFrom, dateTo);
} | [
"public",
"List",
"<",
"StreamObjectV2",
">",
"getGlobalStreamV2",
"(",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"DateTime",
"dateFrom",
",",
"DateTime",
"dateTo",
")",
"{",
"return",
"getStreamV2",
"(",
"\"/stream/v2/\"",
",",
"limit",
",",
"offset",
... | Returns the global stream. The types of objects in the stream can be
either "item", "status" or "task".
@param limit
How many objects should be returned, defaults to 10
@param offset
How far should the objects be offset, defaults to 0
@param dateFrom
The date and time that all events should be after, defaults to
no limit
@param dateTo
The date and time that all events should be before, defaults
to no limit
@return The list of stream objects | [
"Returns",
"the",
"global",
"stream",
".",
"The",
"types",
"of",
"objects",
"in",
"the",
"stream",
"can",
"be",
"either",
"item",
"status",
"or",
"task",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/stream/StreamAPI.java#L91-L94 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java | Util.getZxidFromName | public static long getZxidFromName(String name, String prefix) {
long zxid = -1;
String nameParts[] = name.split("\\.");
if (nameParts.length == 2 && nameParts[0].equals(prefix)) {
try {
zxid = Long.parseLong(nameParts[1], 16);
} catch (NumberFormatException e) {
}
}
return zxid;
} | java | public static long getZxidFromName(String name, String prefix) {
long zxid = -1;
String nameParts[] = name.split("\\.");
if (nameParts.length == 2 && nameParts[0].equals(prefix)) {
try {
zxid = Long.parseLong(nameParts[1], 16);
} catch (NumberFormatException e) {
}
}
return zxid;
} | [
"public",
"static",
"long",
"getZxidFromName",
"(",
"String",
"name",
",",
"String",
"prefix",
")",
"{",
"long",
"zxid",
"=",
"-",
"1",
";",
"String",
"nameParts",
"[",
"]",
"=",
"name",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"nameParts",... | Extracts zxid from the file name. The file name should have been created
using one of the {@link makeLogName} or {@link makeSnapshotName}.
@param name the file name to parse
@param prefix the file name prefix (snapshot or log)
@return zxid | [
"Extracts",
"zxid",
"from",
"the",
"file",
"name",
".",
"The",
"file",
"name",
"should",
"have",
"been",
"created",
"using",
"one",
"of",
"the",
"{",
"@link",
"makeLogName",
"}",
"or",
"{",
"@link",
"makeSnapshotName",
"}",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L139-L149 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java | VectorUtil.randomVector | public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim) {
return randomVector(factory, dim, new Random());
} | java | public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim) {
return randomVector(factory, dim, new Random());
} | [
"public",
"static",
"<",
"V",
"extends",
"NumberVector",
">",
"V",
"randomVector",
"(",
"NumberVector",
".",
"Factory",
"<",
"V",
">",
"factory",
",",
"int",
"dim",
")",
"{",
"return",
"randomVector",
"(",
"factory",
",",
"dim",
",",
"new",
"Random",
"("... | Produce a new vector based on random numbers in [0:1].
@param factory Vector factory
@param dim desired dimensionality
@param <V> vector type
@return new instance | [
"Produce",
"a",
"new",
"vector",
"based",
"on",
"random",
"numbers",
"in",
"[",
"0",
":",
"1",
"]",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L82-L84 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java | AsciiArtUtils.printAsciiArt | @SneakyThrows
public static void printAsciiArt(final PrintStream out, final String asciiArt, final String additional) {
out.println(ANSI_CYAN);
if (StringUtils.isNotBlank(additional)) {
out.println(FigletFont.convertOneLine(asciiArt));
out.println(additional);
} else {
out.print(FigletFont.convertOneLine(asciiArt));
}
out.println(ANSI_RESET);
} | java | @SneakyThrows
public static void printAsciiArt(final PrintStream out, final String asciiArt, final String additional) {
out.println(ANSI_CYAN);
if (StringUtils.isNotBlank(additional)) {
out.println(FigletFont.convertOneLine(asciiArt));
out.println(additional);
} else {
out.print(FigletFont.convertOneLine(asciiArt));
}
out.println(ANSI_RESET);
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"printAsciiArt",
"(",
"final",
"PrintStream",
"out",
",",
"final",
"String",
"asciiArt",
",",
"final",
"String",
"additional",
")",
"{",
"out",
".",
"println",
"(",
"ANSI_CYAN",
")",
";",
"if",
"(",
"StringUti... | Print ascii art.
@param out the out
@param asciiArt the ascii art
@param additional the additional | [
"Print",
"ascii",
"art",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java#L39-L49 |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/ThreadMethods.java | ThreadMethods.forkJoinExecution | public static <T> T forkJoinExecution(Callable<T> callable, ConcurrencyConfiguration concurrencyConfiguration, boolean parallelStream) {
if(parallelStream && concurrencyConfiguration.isParallelized()) {
try {
ForkJoinPool pool = new ForkJoinPool(concurrencyConfiguration.getMaxNumberOfThreadsPerTask());
T results = pool.submit(callable).get();
pool.shutdown();
return results;
}
catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
else {
try {
return callable.call();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
} | java | public static <T> T forkJoinExecution(Callable<T> callable, ConcurrencyConfiguration concurrencyConfiguration, boolean parallelStream) {
if(parallelStream && concurrencyConfiguration.isParallelized()) {
try {
ForkJoinPool pool = new ForkJoinPool(concurrencyConfiguration.getMaxNumberOfThreadsPerTask());
T results = pool.submit(callable).get();
pool.shutdown();
return results;
}
catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
else {
try {
return callable.call();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"forkJoinExecution",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"ConcurrencyConfiguration",
"concurrencyConfiguration",
",",
"boolean",
"parallelStream",
")",
"{",
"if",
"(",
"parallelStream",
"&&",
"concurrencyConfigura... | Alternative to parallelStreams() which executes a callable in a separate
pool.
@param <T>
@param callable
@param concurrencyConfiguration
@param parallelStream
@return | [
"Alternative",
"to",
"parallelStreams",
"()",
"which",
"executes",
"a",
"callable",
"in",
"a",
"separate",
"pool",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/ThreadMethods.java#L77-L98 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_member_account_memberAccountId_GET | public OvhExchangeDistributionGroupMember organizationName_service_exchangeService_mailingList_mailingListAddress_member_account_memberAccountId_GET(String organizationName, String exchangeService, String mailingListAddress, Long memberAccountId) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/member/account/{memberAccountId}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, memberAccountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeDistributionGroupMember.class);
} | java | public OvhExchangeDistributionGroupMember organizationName_service_exchangeService_mailingList_mailingListAddress_member_account_memberAccountId_GET(String organizationName, String exchangeService, String mailingListAddress, Long memberAccountId) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/member/account/{memberAccountId}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, memberAccountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeDistributionGroupMember.class);
} | [
"public",
"OvhExchangeDistributionGroupMember",
"organizationName_service_exchangeService_mailingList_mailingListAddress_member_account_memberAccountId_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"mailingListAddress",
",",
"Long",
"memberAcco... | Get this object properties
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/member/account/{memberAccountId}
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param mailingListAddress [required] The mailing list address
@param memberAccountId [required] Member account id | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1096-L1101 |
podio/podio-java | src/main/java/com/podio/space/SpaceAPI.java | SpaceAPI.getSpaceMembership | public SpaceMember getSpaceMembership(int spaceId, int userId) {
return getResourceFactory().getApiResource(
"/space/" + spaceId + "/member/" + userId).get(
SpaceMember.class);
} | java | public SpaceMember getSpaceMembership(int spaceId, int userId) {
return getResourceFactory().getApiResource(
"/space/" + spaceId + "/member/" + userId).get(
SpaceMember.class);
} | [
"public",
"SpaceMember",
"getSpaceMembership",
"(",
"int",
"spaceId",
",",
"int",
"userId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/space/\"",
"+",
"spaceId",
"+",
"\"/member/\"",
"+",
"userId",
")",
".",
"get",
"(",... | Used to get the details of an active users membership of a space.
@param spaceId
The id of the space
@param userId
The ud of the user
@return The details about the space membership | [
"Used",
"to",
"get",
"the",
"details",
"of",
"an",
"active",
"users",
"membership",
"of",
"a",
"space",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/space/SpaceAPI.java#L94-L98 |
apache/groovy | src/main/java/org/codehaus/groovy/syntax/Token.java | Token.newKeyword | public static Token newKeyword(String text, int startLine, int startColumn) {
int type = Types.lookupKeyword(text);
if (type != Types.UNKNOWN) {
return new Token(type, text, startLine, startColumn);
}
return null;
} | java | public static Token newKeyword(String text, int startLine, int startColumn) {
int type = Types.lookupKeyword(text);
if (type != Types.UNKNOWN) {
return new Token(type, text, startLine, startColumn);
}
return null;
} | [
"public",
"static",
"Token",
"newKeyword",
"(",
"String",
"text",
",",
"int",
"startLine",
",",
"int",
"startColumn",
")",
"{",
"int",
"type",
"=",
"Types",
".",
"lookupKeyword",
"(",
"text",
")",
";",
"if",
"(",
"type",
"!=",
"Types",
".",
"UNKNOWN",
... | Creates a token that represents a keyword. Returns null if the
specified text isn't a keyword. | [
"Creates",
"a",
"token",
"that",
"represents",
"a",
"keyword",
".",
"Returns",
"null",
"if",
"the",
"specified",
"text",
"isn",
"t",
"a",
"keyword",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/syntax/Token.java#L220-L228 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/password/forgotten/AbstractPasswordForgottenPanel.java | AbstractPasswordForgottenPanel.newEmailTextField | protected Component newEmailTextField(final String id,
final IModel<PasswordForgottenModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(
"password.forgotten.content.label", this, "Give email in the Textfield");
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.email.label", this, "Enter your email here");
final LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean> emailTextField = new LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean>(
id, model, labelModel)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected EmailTextField newEmailTextField(final String id,
final IModel<PasswordForgottenModelBean> model)
{
final EmailTextField emailTextField = new EmailTextField(id,
new PropertyModel<>(model, "email"));
emailTextField.setOutputMarkupId(true);
emailTextField.setRequired(true);
if (placeholderModel != null)
{
emailTextField.add(new AttributeAppender("placeholder", placeholderModel));
}
return emailTextField;
}
};
return emailTextField;
} | java | protected Component newEmailTextField(final String id,
final IModel<PasswordForgottenModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(
"password.forgotten.content.label", this, "Give email in the Textfield");
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.email.label", this, "Enter your email here");
final LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean> emailTextField = new LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean>(
id, model, labelModel)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected EmailTextField newEmailTextField(final String id,
final IModel<PasswordForgottenModelBean> model)
{
final EmailTextField emailTextField = new EmailTextField(id,
new PropertyModel<>(model, "email"));
emailTextField.setOutputMarkupId(true);
emailTextField.setRequired(true);
if (placeholderModel != null)
{
emailTextField.add(new AttributeAppender("placeholder", placeholderModel));
}
return emailTextField;
}
};
return emailTextField;
} | [
"protected",
"Component",
"newEmailTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"PasswordForgottenModelBean",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"labelModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",... | Factory method for creating the EmailTextField for the email. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a EmailTextField for the email.
@param id
the id
@param model
the model
@return the text field | [
"Factory",
"method",
"for",
"creating",
"the",
"EmailTextField",
"for",
"the",
"email",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/password/forgotten/AbstractPasswordForgottenPanel.java#L193-L228 |
resilience4j/resilience4j | resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/collectors/CircuitBreakerMetricsCollector.java | CircuitBreakerMetricsCollector.ofSupplier | public static CircuitBreakerMetricsCollector ofSupplier(MetricNames names, Supplier<? extends Iterable<? extends CircuitBreaker>> supplier) {
return new CircuitBreakerMetricsCollector(names, supplier);
} | java | public static CircuitBreakerMetricsCollector ofSupplier(MetricNames names, Supplier<? extends Iterable<? extends CircuitBreaker>> supplier) {
return new CircuitBreakerMetricsCollector(names, supplier);
} | [
"public",
"static",
"CircuitBreakerMetricsCollector",
"ofSupplier",
"(",
"MetricNames",
"names",
",",
"Supplier",
"<",
"?",
"extends",
"Iterable",
"<",
"?",
"extends",
"CircuitBreaker",
">",
">",
"supplier",
")",
"{",
"return",
"new",
"CircuitBreakerMetricsCollector",... | Creates a new collector with custom metric names and
using given {@code supplier} as source of circuit breakers.
@param names the custom metric names
@param supplier the supplier of circuit breakers, note that supplier will be called one every {@link #collect()} | [
"Creates",
"a",
"new",
"collector",
"with",
"custom",
"metric",
"names",
"and",
"using",
"given",
"{",
"@code",
"supplier",
"}",
"as",
"source",
"of",
"circuit",
"breakers",
"."
] | train | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/collectors/CircuitBreakerMetricsCollector.java#L42-L44 |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/CallControlHelper.java | CallControlHelper.checkAuthentication | public static boolean checkAuthentication(SipServletRequest request, DaoManager storage, Sid organizationSid) throws IOException {
// Make sure we force clients to authenticate.
final String authorization = request.getHeader("Proxy-Authorization");
final String method = request.getMethod();
if (authorization == null || !CallControlHelper.permitted(authorization, method, storage, organizationSid)) {
if (logger.isDebugEnabled()) {
String msg = String.format("Either authorization header is null [if(authorization==null) evaluates %s], or CallControlHelper.permitted() method failed, will send \"407 Proxy Authentication required\"", authorization==null);
logger.debug(msg);
}
authenticate(request, storage.getOrganizationsDao().getOrganization(organizationSid).getDomainName());
return false;
} else {
return true;
}
} | java | public static boolean checkAuthentication(SipServletRequest request, DaoManager storage, Sid organizationSid) throws IOException {
// Make sure we force clients to authenticate.
final String authorization = request.getHeader("Proxy-Authorization");
final String method = request.getMethod();
if (authorization == null || !CallControlHelper.permitted(authorization, method, storage, organizationSid)) {
if (logger.isDebugEnabled()) {
String msg = String.format("Either authorization header is null [if(authorization==null) evaluates %s], or CallControlHelper.permitted() method failed, will send \"407 Proxy Authentication required\"", authorization==null);
logger.debug(msg);
}
authenticate(request, storage.getOrganizationsDao().getOrganization(organizationSid).getDomainName());
return false;
} else {
return true;
}
} | [
"public",
"static",
"boolean",
"checkAuthentication",
"(",
"SipServletRequest",
"request",
",",
"DaoManager",
"storage",
",",
"Sid",
"organizationSid",
")",
"throws",
"IOException",
"{",
"// Make sure we force clients to authenticate.",
"final",
"String",
"authorization",
"... | Check if a client is authenticated. If so, return true. Otherwise request authentication and return false;
@param request
@param storage
@param organizationSid
@return
@throws IOException | [
"Check",
"if",
"a",
"client",
"is",
"authenticated",
".",
"If",
"so",
"return",
"true",
".",
"Otherwise",
"request",
"authentication",
"and",
"return",
"false",
";"
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/CallControlHelper.java#L102-L116 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java | ProbeManagerImpl.addInterestedByClass | synchronized void addInterestedByClass(Class<?> clazz, Collection<ProbeListener> newListeners) {
Set<ProbeListener> currentListeners = listenersByClass.get(clazz);
if (currentListeners == null) {
currentListeners = new HashSet<ProbeListener>();
listenersByClass.put(clazz, currentListeners);
}
currentListeners.addAll(newListeners);
} | java | synchronized void addInterestedByClass(Class<?> clazz, Collection<ProbeListener> newListeners) {
Set<ProbeListener> currentListeners = listenersByClass.get(clazz);
if (currentListeners == null) {
currentListeners = new HashSet<ProbeListener>();
listenersByClass.put(clazz, currentListeners);
}
currentListeners.addAll(newListeners);
} | [
"synchronized",
"void",
"addInterestedByClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Collection",
"<",
"ProbeListener",
">",
"newListeners",
")",
"{",
"Set",
"<",
"ProbeListener",
">",
"currentListeners",
"=",
"listenersByClass",
".",
"get",
"(",
"clazz",... | Associate the collection of listeners with {@link ProbeFilter}s that
match the specified class with the specified class.
@param clazz the probe source candidate
@param newListeners listeners with filters that match {@code clazz} | [
"Associate",
"the",
"collection",
"of",
"listeners",
"with",
"{",
"@link",
"ProbeFilter",
"}",
"s",
"that",
"match",
"the",
"specified",
"class",
"with",
"the",
"specified",
"class",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L564-L571 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/compiler/TypeConvertingCompiler.java | TypeConvertingCompiler.isToBeCastedAnyType | private boolean isToBeCastedAnyType(LightweightTypeReference actualType, XExpression obj, ITreeAppendable appendable) {
if (actualType instanceof AnyTypeReference) {
if (getReferenceName(obj, appendable) != null)
return true;
else if (obj instanceof XBlockExpression) {
XBlockExpression blockExpression = (XBlockExpression) obj;
EList<XExpression> expressions = blockExpression.getExpressions();
if (expressions.isEmpty())
return false;
if (expressions.size() > 1)
return true;
XExpression last = expressions.get(0);
return isToBeCastedAnyType(actualType, last, appendable);
}
}
return false;
} | java | private boolean isToBeCastedAnyType(LightweightTypeReference actualType, XExpression obj, ITreeAppendable appendable) {
if (actualType instanceof AnyTypeReference) {
if (getReferenceName(obj, appendable) != null)
return true;
else if (obj instanceof XBlockExpression) {
XBlockExpression blockExpression = (XBlockExpression) obj;
EList<XExpression> expressions = blockExpression.getExpressions();
if (expressions.isEmpty())
return false;
if (expressions.size() > 1)
return true;
XExpression last = expressions.get(0);
return isToBeCastedAnyType(actualType, last, appendable);
}
}
return false;
} | [
"private",
"boolean",
"isToBeCastedAnyType",
"(",
"LightweightTypeReference",
"actualType",
",",
"XExpression",
"obj",
",",
"ITreeAppendable",
"appendable",
")",
"{",
"if",
"(",
"actualType",
"instanceof",
"AnyTypeReference",
")",
"{",
"if",
"(",
"getReferenceName",
"... | On Java-level the any-type is represented as java.lang.Object as there is no subtype of everything (i.e. type for null).
So, when the values are used we need to manually cast them to whatever is expected.
This method tells us whether such a cast is needed. | [
"On",
"Java",
"-",
"level",
"the",
"any",
"-",
"type",
"is",
"represented",
"as",
"java",
".",
"lang",
".",
"Object",
"as",
"there",
"is",
"no",
"subtype",
"of",
"everything",
"(",
"i",
".",
"e",
".",
"type",
"for",
"null",
")",
".",
"So",
"when",
... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/compiler/TypeConvertingCompiler.java#L115-L131 |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/BoostingPredictionCombinerProcessor.java | BoostingPredictionCombinerProcessor.process | @Override
public boolean process(ContentEvent event) {
ResultContentEvent inEvent = (ResultContentEvent) event;
double[] prediction = inEvent.getClassVotes();
int instanceIndex = (int) inEvent.getInstanceIndex();
addStatisticsForInstanceReceived(instanceIndex, inEvent.getClassifierIndex(), prediction, 1);
//Boosting
addPredictions(instanceIndex, inEvent, prediction);
if (inEvent.isLastEvent() || hasAllVotesArrivedInstance(instanceIndex)) {
DoubleVector combinedVote = this.mapVotesforInstanceReceived.get(instanceIndex);
if (combinedVote == null){
combinedVote = new DoubleVector();
}
ResultContentEvent outContentEvent = new ResultContentEvent(inEvent.getInstanceIndex(),
inEvent.getInstance(), inEvent.getClassId(),
combinedVote.getArrayCopy(), inEvent.isLastEvent());
outContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());
outputStream.put(outContentEvent);
clearStatisticsInstance(instanceIndex);
//Boosting
computeBoosting(inEvent, instanceIndex);
return true;
}
return false;
} | java | @Override
public boolean process(ContentEvent event) {
ResultContentEvent inEvent = (ResultContentEvent) event;
double[] prediction = inEvent.getClassVotes();
int instanceIndex = (int) inEvent.getInstanceIndex();
addStatisticsForInstanceReceived(instanceIndex, inEvent.getClassifierIndex(), prediction, 1);
//Boosting
addPredictions(instanceIndex, inEvent, prediction);
if (inEvent.isLastEvent() || hasAllVotesArrivedInstance(instanceIndex)) {
DoubleVector combinedVote = this.mapVotesforInstanceReceived.get(instanceIndex);
if (combinedVote == null){
combinedVote = new DoubleVector();
}
ResultContentEvent outContentEvent = new ResultContentEvent(inEvent.getInstanceIndex(),
inEvent.getInstance(), inEvent.getClassId(),
combinedVote.getArrayCopy(), inEvent.isLastEvent());
outContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());
outputStream.put(outContentEvent);
clearStatisticsInstance(instanceIndex);
//Boosting
computeBoosting(inEvent, instanceIndex);
return true;
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"ContentEvent",
"event",
")",
"{",
"ResultContentEvent",
"inEvent",
"=",
"(",
"ResultContentEvent",
")",
"event",
";",
"double",
"[",
"]",
"prediction",
"=",
"inEvent",
".",
"getClassVotes",
"(",
")",
";",
... | On event.
@param event the event
@return true, if successful | [
"On",
"event",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/BoostingPredictionCombinerProcessor.java#L57-L85 |
apache/incubator-atlas | addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java | HiveMetaStoreBridge.getTableQualifiedName | public static String getTableQualifiedName(String clusterName, Table table) {
return getTableQualifiedName(clusterName, table.getDbName(), table.getTableName(), table.isTemporary());
} | java | public static String getTableQualifiedName(String clusterName, Table table) {
return getTableQualifiedName(clusterName, table.getDbName(), table.getTableName(), table.isTemporary());
} | [
"public",
"static",
"String",
"getTableQualifiedName",
"(",
"String",
"clusterName",
",",
"Table",
"table",
")",
"{",
"return",
"getTableQualifiedName",
"(",
"clusterName",
",",
"table",
".",
"getDbName",
"(",
")",
",",
"table",
".",
"getTableName",
"(",
")",
... | Construct the qualified name used to uniquely identify a Table instance in Atlas.
@param clusterName Name of the cluster to which the Hive component belongs
@param table hive table for which the qualified name is needed
@return Unique qualified name to identify the Table instance in Atlas. | [
"Construct",
"the",
"qualified",
"name",
"used",
"to",
"uniquely",
"identify",
"a",
"Table",
"instance",
"in",
"Atlas",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java#L394-L396 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.contains | public static boolean contains(Bbox bbox, Coordinate coordinate) {
if (bbox.getX() >= coordinate.getX()) {
return false;
}
if (bbox.getY() >= coordinate.getY()) {
return false;
}
if (bbox.getMaxX() <= coordinate.getX()) {
return false;
}
if (bbox.getMaxY() <= coordinate.getY()) {
return false;
}
return true;
} | java | public static boolean contains(Bbox bbox, Coordinate coordinate) {
if (bbox.getX() >= coordinate.getX()) {
return false;
}
if (bbox.getY() >= coordinate.getY()) {
return false;
}
if (bbox.getMaxX() <= coordinate.getX()) {
return false;
}
if (bbox.getMaxY() <= coordinate.getY()) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Bbox",
"bbox",
",",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"bbox",
".",
"getX",
"(",
")",
">=",
"coordinate",
".",
"getX",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"bbox",
... | Is the given coordinate contained within the bounding box or not? If the coordinate is on the bounding box
border, it is considered outside.
@param bbox
The bounding box.
@param coordinate
The coordinate to check.
@return True if the coordinate is within the bounding box, false otherwise.
@since 1.1.0 | [
"Is",
"the",
"given",
"coordinate",
"contained",
"within",
"the",
"bounding",
"box",
"or",
"not?",
"If",
"the",
"coordinate",
"is",
"on",
"the",
"bounding",
"box",
"border",
"it",
"is",
"considered",
"outside",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L133-L147 |
duracloud/duracloud | storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java | StorageProviderUtil.compareChecksum | public static String compareChecksum(StorageProvider provider,
String spaceId,
String contentId,
String checksum)
throws StorageException {
String providerChecksum =
provider.getContentProperties(spaceId, contentId).
get(StorageProvider.PROPERTIES_CONTENT_CHECKSUM);
return compareChecksum(providerChecksum, spaceId, contentId, checksum);
} | java | public static String compareChecksum(StorageProvider provider,
String spaceId,
String contentId,
String checksum)
throws StorageException {
String providerChecksum =
provider.getContentProperties(spaceId, contentId).
get(StorageProvider.PROPERTIES_CONTENT_CHECKSUM);
return compareChecksum(providerChecksum, spaceId, contentId, checksum);
} | [
"public",
"static",
"String",
"compareChecksum",
"(",
"StorageProvider",
"provider",
",",
"String",
"spaceId",
",",
"String",
"contentId",
",",
"String",
"checksum",
")",
"throws",
"StorageException",
"{",
"String",
"providerChecksum",
"=",
"provider",
".",
"getCont... | Determines if the checksum for a particular piece of content
stored in a StorageProvider matches the expected checksum value.
@param provider The StorageProvider where the content was stored
@param spaceId The Space in which the content was stored
@param contentId The Id of the content
@param checksum The content checksum, either provided or computed
@throws StorageException if the included checksum does not match
the storage provider generated checksum
@returns the validated checksum value from the provider | [
"Determines",
"if",
"the",
"checksum",
"for",
"a",
"particular",
"piece",
"of",
"content",
"stored",
"in",
"a",
"StorageProvider",
"matches",
"the",
"expected",
"checksum",
"value",
"."
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java#L117-L126 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.loadPropertyRecord | protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
{
// NOTE: cpid never should be null or root parent (' ')
try
{
QPath qpath =
QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
String identifier = getIdentifier(cid);
List<ValueDataWrapper> data = readValues(cid, cptype, identifier, cversion);
long size = 0;
List<ValueData> values = new ArrayList<ValueData>();
for (ValueDataWrapper vdDataWrapper : data)
{
values.add(vdDataWrapper.value);
size += vdDataWrapper.size;
}
PersistedPropertyData pdata =
new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values,
new SimplePersistedSize(size));
return pdata;
}
catch (IllegalNameException e)
{
throw new RepositoryException(e);
}
} | java | protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
{
// NOTE: cpid never should be null or root parent (' ')
try
{
QPath qpath =
QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
String identifier = getIdentifier(cid);
List<ValueDataWrapper> data = readValues(cid, cptype, identifier, cversion);
long size = 0;
List<ValueData> values = new ArrayList<ValueData>();
for (ValueDataWrapper vdDataWrapper : data)
{
values.add(vdDataWrapper.value);
size += vdDataWrapper.size;
}
PersistedPropertyData pdata =
new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values,
new SimplePersistedSize(size));
return pdata;
}
catch (IllegalNameException e)
{
throw new RepositoryException(e);
}
} | [
"protected",
"PersistedPropertyData",
"loadPropertyRecord",
"(",
"QPath",
"parentPath",
",",
"String",
"cname",
",",
"String",
"cid",
",",
"String",
"cpid",
",",
"int",
"cversion",
",",
"int",
"cptype",
",",
"boolean",
"cpmultivalued",
")",
"throws",
"RepositoryEx... | Load PropertyData record.
@param parentPath
parent path
@param cname
Property name
@param cid
Property id
@param cpid
Property parent id
@param cversion
Property persistent verison
@param cptype
Property type
@param cpmultivalued
Property multivalued status
@return PersistedPropertyData
@throws RepositoryException
Repository error
@throws SQLException
database error
@throws IOException
I/O error | [
"Load",
"PropertyData",
"record",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2496-L2529 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/formatting/impl/NodeModelStreamer.java | NodeModelStreamer.getFormattedDatatypeValue | protected String getFormattedDatatypeValue(ICompositeNode node, AbstractRule rule, String text) throws ValueConverterException {
Object value = valueConverter.toValue(text, rule.getName(), node);
text = valueConverter.toString(value, rule.getName());
return text;
} | java | protected String getFormattedDatatypeValue(ICompositeNode node, AbstractRule rule, String text) throws ValueConverterException {
Object value = valueConverter.toValue(text, rule.getName(), node);
text = valueConverter.toString(value, rule.getName());
return text;
} | [
"protected",
"String",
"getFormattedDatatypeValue",
"(",
"ICompositeNode",
"node",
",",
"AbstractRule",
"rule",
",",
"String",
"text",
")",
"throws",
"ValueConverterException",
"{",
"Object",
"value",
"=",
"valueConverter",
".",
"toValue",
"(",
"text",
",",
"rule",
... | Create a canonical represenation of the data type value. Defaults to the value converter.
@since 2.9 | [
"Create",
"a",
"canonical",
"represenation",
"of",
"the",
"data",
"type",
"value",
".",
"Defaults",
"to",
"the",
"value",
"converter",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/formatting/impl/NodeModelStreamer.java#L163-L167 |
elki-project/elki | elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/NNDescent.java | NNDescent.clearAll | private void clearAll(DBIDs ids, WritableDataStore<HashSetModifiableDBIDs> sets) {
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
sets.get(it).clear();
}
} | java | private void clearAll(DBIDs ids, WritableDataStore<HashSetModifiableDBIDs> sets) {
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
sets.get(it).clear();
}
} | [
"private",
"void",
"clearAll",
"(",
"DBIDs",
"ids",
",",
"WritableDataStore",
"<",
"HashSetModifiableDBIDs",
">",
"sets",
")",
"{",
"for",
"(",
"DBIDIter",
"it",
"=",
"ids",
".",
"iter",
"(",
")",
";",
"it",
".",
"valid",
"(",
")",
";",
"it",
".",
"a... | Clear (but reuse) all sets in the given storage.
@param ids Ids to process
@param sets Sets to clear | [
"Clear",
"(",
"but",
"reuse",
")",
"all",
"sets",
"in",
"the",
"given",
"storage",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/NNDescent.java#L269-L273 |
JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.max | static MonetaryAmount max(MonetaryAmount a, MonetaryAmount b) {
MoneyUtils.checkAmountParameter(Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency()));
return a.isGreaterThan(b) ? a : b;
} | java | static MonetaryAmount max(MonetaryAmount a, MonetaryAmount b) {
MoneyUtils.checkAmountParameter(Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency()));
return a.isGreaterThan(b) ? a : b;
} | [
"static",
"MonetaryAmount",
"max",
"(",
"MonetaryAmount",
"a",
",",
"MonetaryAmount",
"b",
")",
"{",
"MoneyUtils",
".",
"checkAmountParameter",
"(",
"Objects",
".",
"requireNonNull",
"(",
"a",
")",
",",
"Objects",
".",
"requireNonNull",
"(",
"b",
".",
"getCurr... | Returns the greater of two {@code MonetaryAmount} values. If the
arguments have the same value, the result is that same value.
@param a an argument.
@param b another argument.
@return the larger of {@code a} and {@code b}. | [
"Returns",
"the",
"greater",
"of",
"two",
"{"
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L297-L300 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.getQualifiedBundleName | public static String getQualifiedBundleName( String bundleName, ServletRequest request )
{
if ( bundleName != null )
{
if ( bundleName.indexOf( '/' ) == -1 )
{
ModuleConfig mc = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
// Note that we don't append the module path for the root module.
if ( mc != null && mc.getPrefix() != null && mc.getPrefix().length() > 1 )
{
bundleName += mc.getPrefix();
}
}
else if ( bundleName.endsWith( "/" ) )
{
// Special handling for bundles referring to the root module -- they should not have
// the module path ("/") at the end.
bundleName = bundleName.substring( 0, bundleName.length() - 1 );
}
}
return bundleName;
} | java | public static String getQualifiedBundleName( String bundleName, ServletRequest request )
{
if ( bundleName != null )
{
if ( bundleName.indexOf( '/' ) == -1 )
{
ModuleConfig mc = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
// Note that we don't append the module path for the root module.
if ( mc != null && mc.getPrefix() != null && mc.getPrefix().length() > 1 )
{
bundleName += mc.getPrefix();
}
}
else if ( bundleName.endsWith( "/" ) )
{
// Special handling for bundles referring to the root module -- they should not have
// the module path ("/") at the end.
bundleName = bundleName.substring( 0, bundleName.length() - 1 );
}
}
return bundleName;
} | [
"public",
"static",
"String",
"getQualifiedBundleName",
"(",
"String",
"bundleName",
",",
"ServletRequest",
"request",
")",
"{",
"if",
"(",
"bundleName",
"!=",
"null",
")",
"{",
"if",
"(",
"bundleName",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
... | Qualify the given bundle name with the current module path to return a full bundle name.
@return the qualified Bundle name | [
"Qualify",
"the",
"given",
"bundle",
"name",
"with",
"the",
"current",
"module",
"path",
"to",
"return",
"a",
"full",
"bundle",
"name",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L1220-L1243 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.convertLineSeparator | public static File convertLineSeparator(File file, Charset charset, LineSeparator lineSeparator) {
final List<String> lines = readLines(file, charset);
return FileWriter.create(file, charset).writeLines(lines, lineSeparator, false);
} | java | public static File convertLineSeparator(File file, Charset charset, LineSeparator lineSeparator) {
final List<String> lines = readLines(file, charset);
return FileWriter.create(file, charset).writeLines(lines, lineSeparator, false);
} | [
"public",
"static",
"File",
"convertLineSeparator",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineSeparator",
"lineSeparator",
")",
"{",
"final",
"List",
"<",
"String",
">",
"lines",
"=",
"readLines",
"(",
"file",
",",
"charset",
")",
";",
"retur... | 转换换行符<br>
将给定文件的换行符转换为指定换行符
@param file 文件
@param charset 编码
@param lineSeparator 换行符枚举{@link LineSeparator}
@return 被修改的文件
@since 3.1.0 | [
"转换换行符<br",
">",
"将给定文件的换行符转换为指定换行符"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3243-L3246 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.getBeanProvider | protected @Nonnull <T> Provider<T> getBeanProvider(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
return getBeanProvider(resolutionContext, beanType, null);
} | java | protected @Nonnull <T> Provider<T> getBeanProvider(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
return getBeanProvider(resolutionContext, beanType, null);
} | [
"protected",
"@",
"Nonnull",
"<",
"T",
">",
"Provider",
"<",
"T",
">",
"getBeanProvider",
"(",
"@",
"Nullable",
"BeanResolutionContext",
"resolutionContext",
",",
"@",
"Nonnull",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"return",
"getBeanProvider",
"(",
... | Get provided beans of the given type.
@param resolutionContext The bean resolution context
@param beanType The bean type
@param <T> The bean type parameter
@return The found beans | [
"Get",
"provided",
"beans",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L881-L883 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPong | public static <T> void sendPong(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
sendInternal(pooledData, WebSocketFrameType.PONG, wsChannel, callback, context, -1);
} | java | public static <T> void sendPong(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
sendInternal(pooledData, WebSocketFrameType.PONG, wsChannel, callback, context, -1);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sendPong",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"T",
">",
"callback",
",",
"T",
"context",
")",
"{",
"sendInternal",
"... | Sends a complete pong message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
@param context The context object that will be passed to the callback on completion | [
"Sends",
"a",
"complete",
"pong",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L520-L522 |
wb14123/bard | bard-core/src/main/java/com/bardframework/bard/core/Context.java | Context.putCustom | public <T> void putCustom(String key, T value) {
custom.put(key, value);
} | java | public <T> void putCustom(String key, T value) {
custom.put(key, value);
} | [
"public",
"<",
"T",
">",
"void",
"putCustom",
"(",
"String",
"key",
",",
"T",
"value",
")",
"{",
"custom",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Put a custom value into context.
@param key The key to get value.
@param value The value.
@param <T> The type of value. | [
"Put",
"a",
"custom",
"value",
"into",
"context",
"."
] | train | https://github.com/wb14123/bard/blob/98618ae31fd80000c794661b4c130af1b1298d9b/bard-core/src/main/java/com/bardframework/bard/core/Context.java#L61-L63 |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.setContext | public static void setContext(String taskId, String parentOptId, String componentName) {
if (null == taskId) {
taskId = TracyThreadContext.generateRandomTaskId();
}
if (null == parentOptId) {
parentOptId = TRACY_DEFAULT_PARENT_OPT_ID;
}
if (null == componentName) {
componentName = TRACY_DEFAULT_COMPONENT_NAME;
}
threadContext.set(new TracyThreadContext(taskId, parentOptId, componentName));
} | java | public static void setContext(String taskId, String parentOptId, String componentName) {
if (null == taskId) {
taskId = TracyThreadContext.generateRandomTaskId();
}
if (null == parentOptId) {
parentOptId = TRACY_DEFAULT_PARENT_OPT_ID;
}
if (null == componentName) {
componentName = TRACY_DEFAULT_COMPONENT_NAME;
}
threadContext.set(new TracyThreadContext(taskId, parentOptId, componentName));
} | [
"public",
"static",
"void",
"setContext",
"(",
"String",
"taskId",
",",
"String",
"parentOptId",
",",
"String",
"componentName",
")",
"{",
"if",
"(",
"null",
"==",
"taskId",
")",
"{",
"taskId",
"=",
"TracyThreadContext",
".",
"generateRandomTaskId",
"(",
")",
... | Tracy allows to trace execution flow and later represent it as a Directed Acyclic Graph (DAG)
A Tracy identifier (taskId) starts at the most outbound endpoint exposed by a system<br>
The taskId is to be propagated across components, JVMs and hosts
If the endpoint is outside this JVM/component you should have received a taskId and optId from a client.<br>
@param taskId is a string which allows correlating Tracy events resulting of a endpoint being hit
@param parentOptId is a string identifying the parent operation which invoked some logic on a local component
@param componentName is a string identifying the name of the component the tracy belongs to | [
"Tracy",
"allows",
"to",
"trace",
"execution",
"flow",
"and",
"later",
"represent",
"it",
"as",
"a",
"Directed",
"Acyclic",
"Graph",
"(",
"DAG",
")",
"A",
"Tracy",
"identifier",
"(",
"taskId",
")",
"starts",
"at",
"the",
"most",
"outbound",
"endpoint",
"ex... | train | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L48-L59 |
openxc/openxc-android | library/src/main/java/com/openxc/interfaces/VehicleInterfaceFactory.java | VehicleInterfaceFactory.build | public static VehicleInterface build(
Class<? extends VehicleInterface> interfaceType,
Context context, String resource) throws VehicleInterfaceException {
Log.d(TAG, "Constructing new instance of " + interfaceType
+ " with resource " + resource);
Constructor<? extends VehicleInterface> constructor;
try {
constructor = interfaceType.getConstructor(
Context.class, String.class);
} catch(NoSuchMethodException e) {
throw new VehicleInterfaceException(interfaceType +
" doesn't have a proper constructor", e);
}
String message;
Exception error;
try {
return constructor.newInstance(context, resource);
} catch(InstantiationException e) {
message = "Couldn't instantiate vehicle interface " +
interfaceType;
error = e;
} catch(IllegalAccessException e) {
message = "Default constructor is not accessible on " +
interfaceType;
error = e;
} catch(InvocationTargetException e) {
message = interfaceType + "'s constructor threw an exception";
error = e;
}
throw new VehicleInterfaceException(message, error);
} | java | public static VehicleInterface build(
Class<? extends VehicleInterface> interfaceType,
Context context, String resource) throws VehicleInterfaceException {
Log.d(TAG, "Constructing new instance of " + interfaceType
+ " with resource " + resource);
Constructor<? extends VehicleInterface> constructor;
try {
constructor = interfaceType.getConstructor(
Context.class, String.class);
} catch(NoSuchMethodException e) {
throw new VehicleInterfaceException(interfaceType +
" doesn't have a proper constructor", e);
}
String message;
Exception error;
try {
return constructor.newInstance(context, resource);
} catch(InstantiationException e) {
message = "Couldn't instantiate vehicle interface " +
interfaceType;
error = e;
} catch(IllegalAccessException e) {
message = "Default constructor is not accessible on " +
interfaceType;
error = e;
} catch(InvocationTargetException e) {
message = interfaceType + "'s constructor threw an exception";
error = e;
}
throw new VehicleInterfaceException(message, error);
} | [
"public",
"static",
"VehicleInterface",
"build",
"(",
"Class",
"<",
"?",
"extends",
"VehicleInterface",
">",
"interfaceType",
",",
"Context",
"context",
",",
"String",
"resource",
")",
"throws",
"VehicleInterfaceException",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",... | Retrieve the Class for a given name and construct an instance of it.
@param interfaceType the desired class to load and instantiate.
@param context The Android application or service context to be passed to
the new instance of the VehicleInterface.
@param resource A reference to a resource the new instance should use -
see the specific implementation of {@link VehicleInterface} for its
requirements.
@return A new instance of the class given in interfaceType.
@throws VehicleInterfaceException If the class' constructor threw an
exception. | [
"Retrieve",
"the",
"Class",
"for",
"a",
"given",
"name",
"and",
"construct",
"an",
"instance",
"of",
"it",
"."
] | train | https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/interfaces/VehicleInterfaceFactory.java#L67-L98 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.readSingleValue | public Result<SingleValue> readSingleValue(Series series, DateTime timestamp) {
return readSingleValue(series, timestamp, DateTimeZone.getDefault(), Direction.EXACT);
} | java | public Result<SingleValue> readSingleValue(Series series, DateTime timestamp) {
return readSingleValue(series, timestamp, DateTimeZone.getDefault(), Direction.EXACT);
} | [
"public",
"Result",
"<",
"SingleValue",
">",
"readSingleValue",
"(",
"Series",
"series",
",",
"DateTime",
"timestamp",
")",
"{",
"return",
"readSingleValue",
"(",
"series",
",",
"timestamp",
",",
"DateTimeZone",
".",
"getDefault",
"(",
")",
",",
"Direction",
"... | Reads a single value for a series at a specific timestamp (exact match).
<p>The returned value (datapoint) can be null if there are no
datapoints in the series or in the specified direction. The system default
timezone is used.
@param series The series to read from
@param timestamp The timestamp to read a value at
@return The value at the specified timestamp
@see SingleValue
@since 1.1.0 | [
"Reads",
"a",
"single",
"value",
"for",
"a",
"series",
"at",
"a",
"specific",
"timestamp",
"(",
"exact",
"match",
")",
".",
"<p",
">",
"The",
"returned",
"value",
"(",
"datapoint",
")",
"can",
"be",
"null",
"if",
"there",
"are",
"no",
"datapoints",
"in... | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L400-L402 |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.allParametersAndArgumentsMatch | public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args) {
if (params==null) {
params = Parameter.EMPTY_ARRAY;
}
int dist = 0;
if (args.length<params.length) return -1;
// we already know the lengths are equal
for (int i = 0; i < params.length; i++) {
ClassNode paramType = params[i].getType();
ClassNode argType = args[i];
if (!isAssignableTo(argType, paramType)) return -1;
else {
if (!paramType.equals(argType)) dist+=getDistance(argType, paramType);
}
}
return dist;
} | java | public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args) {
if (params==null) {
params = Parameter.EMPTY_ARRAY;
}
int dist = 0;
if (args.length<params.length) return -1;
// we already know the lengths are equal
for (int i = 0; i < params.length; i++) {
ClassNode paramType = params[i].getType();
ClassNode argType = args[i];
if (!isAssignableTo(argType, paramType)) return -1;
else {
if (!paramType.equals(argType)) dist+=getDistance(argType, paramType);
}
}
return dist;
} | [
"public",
"static",
"int",
"allParametersAndArgumentsMatch",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"params",
"=",
"Parameter",
".",
"EMPTY_ARRAY",
";",
"}",
"int",
... | Checks that arguments and parameter types match.
@param params method parameters
@param args type arguments
@return -1 if arguments do not match, 0 if arguments are of the exact type and >0 when one or more argument is
not of the exact type but still match | [
"Checks",
"that",
"arguments",
"and",
"parameter",
"types",
"match",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L216-L232 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.traverseQPathSQ | protected QPath traverseQPathSQ(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
{
// get item by Identifier usecase
List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
String caid = cpid; // container ancestor id
do
{
ResultSet parent = findItemByIdentifier(caid);
try
{
if (!parent.next())
{
throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
}
QPathEntry qpe =
new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX), getIdentifier(caid));
qrpath.add(qpe);
caid = parent.getString(COLUMN_PARENTID);
if (caid.equals(parent.getString(COLUMN_ID)))
{
throw new InvalidItemStateException("An item with id='" + getIdentifier(caid) + "' is its own parent");
}
}
finally
{
try
{
parent.close();
}
catch (SQLException e)
{
LOG.error("Can't close the ResultSet: " + e.getMessage());
}
}
}
while (!caid.equals(Constants.ROOT_PARENT_UUID));
QPathEntry[] qentries = new QPathEntry[qrpath.size()];
int qi = 0;
for (int i = qrpath.size() - 1; i >= 0; i--)
{
qentries[qi++] = qrpath.get(i);
}
return new QPath(qentries);
} | java | protected QPath traverseQPathSQ(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
{
// get item by Identifier usecase
List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
String caid = cpid; // container ancestor id
do
{
ResultSet parent = findItemByIdentifier(caid);
try
{
if (!parent.next())
{
throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
}
QPathEntry qpe =
new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX), getIdentifier(caid));
qrpath.add(qpe);
caid = parent.getString(COLUMN_PARENTID);
if (caid.equals(parent.getString(COLUMN_ID)))
{
throw new InvalidItemStateException("An item with id='" + getIdentifier(caid) + "' is its own parent");
}
}
finally
{
try
{
parent.close();
}
catch (SQLException e)
{
LOG.error("Can't close the ResultSet: " + e.getMessage());
}
}
}
while (!caid.equals(Constants.ROOT_PARENT_UUID));
QPathEntry[] qentries = new QPathEntry[qrpath.size()];
int qi = 0;
for (int i = qrpath.size() - 1; i >= 0; i--)
{
qentries[qi++] = qrpath.get(i);
}
return new QPath(qentries);
} | [
"protected",
"QPath",
"traverseQPathSQ",
"(",
"String",
"cpid",
")",
"throws",
"SQLException",
",",
"InvalidItemStateException",
",",
"IllegalNameException",
"{",
"// get item by Identifier usecase ",
"List",
"<",
"QPathEntry",
">",
"qrpath",
"=",
"new",
"ArrayList",
"<... | The method <code>traverseQPath</code> implemented thanks to simple queries. It allows
to use Simple Queries instead of Complex Queries when complex queries are much slower such
as with HSQLDB for example. | [
"The",
"method",
"<code",
">",
"traverseQPath<",
"/",
"code",
">",
"implemented",
"thanks",
"to",
"simple",
"queries",
".",
"It",
"allows",
"to",
"use",
"Simple",
"Queries",
"instead",
"of",
"Complex",
"Queries",
"when",
"complex",
"queries",
"are",
"much",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1851-L1897 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java | AbstractMatrix.getInstance | public static AbstractMatrix getInstance(int rows, int cols, Class<?> cls)
{
return new AbstractMatrix(rows, Array.newInstance(cls, rows*cols));
} | java | public static AbstractMatrix getInstance(int rows, int cols, Class<?> cls)
{
return new AbstractMatrix(rows, Array.newInstance(cls, rows*cols));
} | [
"public",
"static",
"AbstractMatrix",
"getInstance",
"(",
"int",
"rows",
",",
"int",
"cols",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"return",
"new",
"AbstractMatrix",
"(",
"rows",
",",
"Array",
".",
"newInstance",
"(",
"cls",
",",
"rows",
"*",
"... | Returns new DoubleMatrix initialized to zeroes.
@param rows
@param cols
@return | [
"Returns",
"new",
"DoubleMatrix",
"initialized",
"to",
"zeroes",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java#L65-L68 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/io/MatrixVectorWriter.java | MatrixVectorWriter.printPattern | public void printPattern(int[] row, int[] column, int offset) {
int size = row.length;
if (size != column.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i)
format(Locale.ENGLISH, "%10d %10d%n", row[i] + offset, column[i]
+ offset);
} | java | public void printPattern(int[] row, int[] column, int offset) {
int size = row.length;
if (size != column.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i)
format(Locale.ENGLISH, "%10d %10d%n", row[i] + offset, column[i]
+ offset);
} | [
"public",
"void",
"printPattern",
"(",
"int",
"[",
"]",
"row",
",",
"int",
"[",
"]",
"column",
",",
"int",
"offset",
")",
"{",
"int",
"size",
"=",
"row",
".",
"length",
";",
"if",
"(",
"size",
"!=",
"column",
".",
"length",
")",
"throw",
"new",
"... | Prints the coordinates to the underlying stream. One index pair on each
line. The offset is added to each index, typically, this can transform
from a 0-based indicing to a 1-based. | [
"Prints",
"the",
"coordinates",
"to",
"the",
"underlying",
"stream",
".",
"One",
"index",
"pair",
"on",
"each",
"line",
".",
"The",
"offset",
"is",
"added",
"to",
"each",
"index",
"typically",
"this",
"can",
"transform",
"from",
"a",
"0",
"-",
"based",
"... | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/io/MatrixVectorWriter.java#L385-L393 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/inventory/message/InventoryActionMessage.java | InventoryActionMessage.process | @Override
public void process(Packet message, MessageContext ctx)
{
Container c = ctx.getServerHandler().player.openContainer;
if (message.windowId != c.windowId || !(c instanceof MalisisInventoryContainer))
return;
MalisisInventoryContainer container = (MalisisInventoryContainer) c;
container.handleAction(message.action, message.inventoryId, message.slotNumber, message.code);
container.detectAndSendChanges();
} | java | @Override
public void process(Packet message, MessageContext ctx)
{
Container c = ctx.getServerHandler().player.openContainer;
if (message.windowId != c.windowId || !(c instanceof MalisisInventoryContainer))
return;
MalisisInventoryContainer container = (MalisisInventoryContainer) c;
container.handleAction(message.action, message.inventoryId, message.slotNumber, message.code);
container.detectAndSendChanges();
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"Packet",
"message",
",",
"MessageContext",
"ctx",
")",
"{",
"Container",
"c",
"=",
"ctx",
".",
"getServerHandler",
"(",
")",
".",
"player",
".",
"openContainer",
";",
"if",
"(",
"message",
".",
"windowId"... | Handles the {@link Packet} received from the client.<br>
Passes the action to the {@link MalisisInventoryContainer}, and send the changes back to the client.
@param message the message
@param ctx the ctx | [
"Handles",
"the",
"{",
"@link",
"Packet",
"}",
"received",
"from",
"the",
"client",
".",
"<br",
">",
"Passes",
"the",
"action",
"to",
"the",
"{",
"@link",
"MalisisInventoryContainer",
"}",
"and",
"send",
"the",
"changes",
"back",
"to",
"the",
"client",
"."... | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/InventoryActionMessage.java#L61-L71 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java | XStringForFSB.startsWith | public boolean startsWith(XMLString prefix, int toffset)
{
FastStringBuffer fsb = fsb();
int to = m_start + toffset;
int tlim = m_start + m_length;
int po = 0;
int pc = prefix.length();
// Note: toffset might be near -1>>>1.
if ((toffset < 0) || (toffset > m_length - pc))
{
return false;
}
while (--pc >= 0)
{
if (fsb.charAt(to) != prefix.charAt(po))
{
return false;
}
to++;
po++;
}
return true;
} | java | public boolean startsWith(XMLString prefix, int toffset)
{
FastStringBuffer fsb = fsb();
int to = m_start + toffset;
int tlim = m_start + m_length;
int po = 0;
int pc = prefix.length();
// Note: toffset might be near -1>>>1.
if ((toffset < 0) || (toffset > m_length - pc))
{
return false;
}
while (--pc >= 0)
{
if (fsb.charAt(to) != prefix.charAt(po))
{
return false;
}
to++;
po++;
}
return true;
} | [
"public",
"boolean",
"startsWith",
"(",
"XMLString",
"prefix",
",",
"int",
"toffset",
")",
"{",
"FastStringBuffer",
"fsb",
"=",
"fsb",
"(",
")",
";",
"int",
"to",
"=",
"m_start",
"+",
"toffset",
";",
"int",
"tlim",
"=",
"m_start",
"+",
"m_length",
";",
... | Tests if this string starts with the specified prefix beginning
a specified index.
@param prefix the prefix.
@param toffset where to begin looking in the string.
@return <code>true</code> if the character sequence represented by the
argument is a prefix of the substring of this object starting
at index <code>toffset</code>; <code>false</code> otherwise.
The result is <code>false</code> if <code>toffset</code> is
negative or greater than the length of this
<code>String</code> object; otherwise the result is the same
as the result of the expression
<pre>
this.subString(toffset).startsWith(prefix)
</pre>
@exception java.lang.NullPointerException if <code>prefix</code> is
<code>null</code>. | [
"Tests",
"if",
"this",
"string",
"starts",
"with",
"the",
"specified",
"prefix",
"beginning",
"a",
"specified",
"index",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java#L608-L635 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java | JsonStringToJsonIntermediateConverter.parseJsonArrayType | private JsonElement parseJsonArrayType(JsonSchema schema, JsonElement value)
throws DataConversionException {
Type arrayType = schema.getTypeOfArrayItems();
JsonArray tempArray = new JsonArray();
if (Type.isPrimitive(arrayType)) {
return value;
}
JsonSchema nestedSchema = schema.getItemsWithinDataType();
for (JsonElement v : value.getAsJsonArray()) {
tempArray.add(parse(v, nestedSchema));
}
return tempArray;
} | java | private JsonElement parseJsonArrayType(JsonSchema schema, JsonElement value)
throws DataConversionException {
Type arrayType = schema.getTypeOfArrayItems();
JsonArray tempArray = new JsonArray();
if (Type.isPrimitive(arrayType)) {
return value;
}
JsonSchema nestedSchema = schema.getItemsWithinDataType();
for (JsonElement v : value.getAsJsonArray()) {
tempArray.add(parse(v, nestedSchema));
}
return tempArray;
} | [
"private",
"JsonElement",
"parseJsonArrayType",
"(",
"JsonSchema",
"schema",
",",
"JsonElement",
"value",
")",
"throws",
"DataConversionException",
"{",
"Type",
"arrayType",
"=",
"schema",
".",
"getTypeOfArrayItems",
"(",
")",
";",
"JsonArray",
"tempArray",
"=",
"ne... | Parses JsonArray type values
@param schema
@param value
@return
@throws DataConversionException | [
"Parses",
"JsonArray",
"type",
"values"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java#L183-L195 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/task/TaskUtils.java | TaskUtils.getTaskFactory | public static Optional<TaskFactory> getTaskFactory(State state) {
try {
if (state.contains(TASK_FACTORY_CLASS)) {
return Optional.of((TaskFactory) Class.forName(state.getProp(TASK_FACTORY_CLASS)).newInstance());
} else {
return Optional.absent();
}
} catch (ReflectiveOperationException roe) {
throw new RuntimeException("Could not create task factory.", roe);
}
} | java | public static Optional<TaskFactory> getTaskFactory(State state) {
try {
if (state.contains(TASK_FACTORY_CLASS)) {
return Optional.of((TaskFactory) Class.forName(state.getProp(TASK_FACTORY_CLASS)).newInstance());
} else {
return Optional.absent();
}
} catch (ReflectiveOperationException roe) {
throw new RuntimeException("Could not create task factory.", roe);
}
} | [
"public",
"static",
"Optional",
"<",
"TaskFactory",
">",
"getTaskFactory",
"(",
"State",
"state",
")",
"{",
"try",
"{",
"if",
"(",
"state",
".",
"contains",
"(",
"TASK_FACTORY_CLASS",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"(",
"TaskFactory",... | Parse the {@link TaskFactory} in the state if one is defined. | [
"Parse",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/task/TaskUtils.java#L35-L45 |
mgormley/prim | src/main/java/edu/jhu/prim/map/IntObjectHashMap.java | IntObjectHashMap.containsKey | private boolean containsKey(final int key, final int index) {
return (key != 0 || states[index] == FULL) && keys[index] == key;
} | java | private boolean containsKey(final int key, final int index) {
return (key != 0 || states[index] == FULL) && keys[index] == key;
} | [
"private",
"boolean",
"containsKey",
"(",
"final",
"int",
"key",
",",
"final",
"int",
"index",
")",
"{",
"return",
"(",
"key",
"!=",
"0",
"||",
"states",
"[",
"index",
"]",
"==",
"FULL",
")",
"&&",
"keys",
"[",
"index",
"]",
"==",
"key",
";",
"}"
] | Check if the tables contain an element associated with specified key
at specified index.
@param key key to check
@param index index to check
@return true if an element is associated with key at index | [
"Check",
"if",
"the",
"tables",
"contain",
"an",
"element",
"associated",
"with",
"specified",
"key",
"at",
"specified",
"index",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/map/IntObjectHashMap.java#L402-L404 |
google/flogger | api/src/main/java/com/google/common/flogger/parser/ParseException.java | ParseException.withBounds | public static ParseException withBounds(
String errorMessage, String logMessage, int start, int end) {
return new ParseException(msg(errorMessage, logMessage, start, end), logMessage);
} | java | public static ParseException withBounds(
String errorMessage, String logMessage, int start, int end) {
return new ParseException(msg(errorMessage, logMessage, start, end), logMessage);
} | [
"public",
"static",
"ParseException",
"withBounds",
"(",
"String",
"errorMessage",
",",
"String",
"logMessage",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"new",
"ParseException",
"(",
"msg",
"(",
"errorMessage",
",",
"logMessage",
",",
"start... | Creates a new parse exception for situations in which both the start and end positions of the
error are known.
@param errorMessage the user error message.
@param logMessage the original log message.
@param start the index of the first character in the invalid section of the log message.
@param end the index after the last character in the invalid section of the log message.
@return the parser exception. | [
"Creates",
"a",
"new",
"parse",
"exception",
"for",
"situations",
"in",
"which",
"both",
"the",
"start",
"and",
"end",
"positions",
"of",
"the",
"error",
"are",
"known",
"."
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/parser/ParseException.java#L43-L46 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.replaceAll | public static String replaceAll(String haystack, String[] needle, String newNeedle[]) {
if (needle.length != newNeedle.length) {
throw new IllegalArgumentException("length of original and replace values do not match (" + needle.length + " != " + newNeedle.length + " )");
}
StringBuffer buf = new StringBuffer(haystack);
for (int i = 0; i < needle.length; i++) {
//TODO not very elegant
replaceAll(buf, needle[i], newNeedle[i]);
}
return buf.toString();
} | java | public static String replaceAll(String haystack, String[] needle, String newNeedle[]) {
if (needle.length != newNeedle.length) {
throw new IllegalArgumentException("length of original and replace values do not match (" + needle.length + " != " + newNeedle.length + " )");
}
StringBuffer buf = new StringBuffer(haystack);
for (int i = 0; i < needle.length; i++) {
//TODO not very elegant
replaceAll(buf, needle[i], newNeedle[i]);
}
return buf.toString();
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"String",
"haystack",
",",
"String",
"[",
"]",
"needle",
",",
"String",
"newNeedle",
"[",
"]",
")",
"{",
"if",
"(",
"needle",
".",
"length",
"!=",
"newNeedle",
".",
"length",
")",
"{",
"throw",
"new",
"I... | Replaces a series of possible occurrences by a series of substitutes.
@param haystack
@param needle
@param newNeedle
@return | [
"Replaces",
"a",
"series",
"of",
"possible",
"occurrences",
"by",
"a",
"series",
"of",
"substitutes",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L120-L131 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/calibration/CalibratedCurves.java | CalibratedCurves.getCloneShiftedForRegExp | public CalibratedCurves getCloneShiftedForRegExp(String symbolRegExp, double shift) throws SolverException, CloneNotSupportedException {
return getCloneShifted(Pattern.compile(symbolRegExp), shift);
} | java | public CalibratedCurves getCloneShiftedForRegExp(String symbolRegExp, double shift) throws SolverException, CloneNotSupportedException {
return getCloneShifted(Pattern.compile(symbolRegExp), shift);
} | [
"public",
"CalibratedCurves",
"getCloneShiftedForRegExp",
"(",
"String",
"symbolRegExp",
",",
"double",
"shift",
")",
"throws",
"SolverException",
",",
"CloneNotSupportedException",
"{",
"return",
"getCloneShifted",
"(",
"Pattern",
".",
"compile",
"(",
"symbolRegExp",
"... | Returns the set curves calibrated to "shifted" market data, that is,
the market date of <code>this</code> object, modified by the shifts
provided to this methods.
This method will shift all symbols matching a given regular expression.
@see java.util.regex.Pattern
@param symbolRegExp A string representing a regular expression, identifying the symbols to shift.
@param shift The shift to apply to the symbol(s).
@return A new set of calibrated curves, calibrated to shifted market data.
@throws SolverException The likely cause of this exception is a failure of the solver used in the calibration.
@throws CloneNotSupportedException The likely cause of this exception is the inability to clone or modify a curve. | [
"Returns",
"the",
"set",
"curves",
"calibrated",
"to",
"shifted",
"market",
"data",
"that",
"is",
"the",
"market",
"date",
"of",
"<code",
">",
"this<",
"/",
"code",
">",
"object",
"modified",
"by",
"the",
"shifts",
"provided",
"to",
"this",
"methods",
"."
... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/calibration/CalibratedCurves.java#L655-L657 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java | MACAddressSection.isEUI64 | public boolean isEUI64(boolean asMAC, boolean partial) {
if(isExtended()) {
int segmentCount = getSegmentCount();
int endIndex = addressSegmentIndex + segmentCount;
if(addressSegmentIndex <= 3) {
if(endIndex > 4) {
int index3 = 3 - addressSegmentIndex;
MACAddressSegment seg3 = getSegment(index3);
MACAddressSegment seg4 = getSegment(index3 + 1);
return seg4.matches(asMAC ? 0xff : 0xfe) && seg3.matches(0xff);
} else if(partial && endIndex == 4) {
MACAddressSegment seg3 = getSegment(3 - addressSegmentIndex);
return seg3.matches(0xff);
}
} else if(partial && addressSegmentIndex == 4 && endIndex > 4) {
MACAddressSegment seg4 = getSegment(4 - addressSegmentIndex);
return seg4.matches(asMAC ? 0xff : 0xfe);
}
return partial;
}
return false;
} | java | public boolean isEUI64(boolean asMAC, boolean partial) {
if(isExtended()) {
int segmentCount = getSegmentCount();
int endIndex = addressSegmentIndex + segmentCount;
if(addressSegmentIndex <= 3) {
if(endIndex > 4) {
int index3 = 3 - addressSegmentIndex;
MACAddressSegment seg3 = getSegment(index3);
MACAddressSegment seg4 = getSegment(index3 + 1);
return seg4.matches(asMAC ? 0xff : 0xfe) && seg3.matches(0xff);
} else if(partial && endIndex == 4) {
MACAddressSegment seg3 = getSegment(3 - addressSegmentIndex);
return seg3.matches(0xff);
}
} else if(partial && addressSegmentIndex == 4 && endIndex > 4) {
MACAddressSegment seg4 = getSegment(4 - addressSegmentIndex);
return seg4.matches(asMAC ? 0xff : 0xfe);
}
return partial;
}
return false;
} | [
"public",
"boolean",
"isEUI64",
"(",
"boolean",
"asMAC",
",",
"boolean",
"partial",
")",
"{",
"if",
"(",
"isExtended",
"(",
")",
")",
"{",
"int",
"segmentCount",
"=",
"getSegmentCount",
"(",
")",
";",
"int",
"endIndex",
"=",
"addressSegmentIndex",
"+",
"se... | Whether this section is consistent with an EUI64 section,
which means it came from an extended 8 byte address,
and the corresponding segments in the middle match 0xff and 0xff/fe for MAC/not-MAC
@param partial whether missing segments are considered a match (this only has an effect if this section came from an extended 8 byte address),
or in other words, we don't consider 6 byte addresses to be "missing" the bytes that would make it 8 byte.
@param asMAC whether to search for the ffff or fffe pattern
@return | [
"Whether",
"this",
"section",
"is",
"consistent",
"with",
"an",
"EUI64",
"section",
"which",
"means",
"it",
"came",
"from",
"an",
"extended",
"8",
"byte",
"address",
"and",
"the",
"corresponding",
"segments",
"in",
"the",
"middle",
"match",
"0xff",
"and",
"0... | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java#L663-L684 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.