repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
aalmiray/Json-lib | src/main/java/net/sf/json/regexp/RegexpUtils.java | RegexpUtils.getMatcher | public static RegexpMatcher getMatcher( String pattern, boolean multiline ) {
if( isJDK13() ){
return new Perl5RegexpMatcher( pattern, true );
}else{
return new JdkRegexpMatcher( pattern, true );
}
} | java | public static RegexpMatcher getMatcher( String pattern, boolean multiline ) {
if( isJDK13() ){
return new Perl5RegexpMatcher( pattern, true );
}else{
return new JdkRegexpMatcher( pattern, true );
}
} | [
"public",
"static",
"RegexpMatcher",
"getMatcher",
"(",
"String",
"pattern",
",",
"boolean",
"multiline",
")",
"{",
"if",
"(",
"isJDK13",
"(",
")",
")",
"{",
"return",
"new",
"Perl5RegexpMatcher",
"(",
"pattern",
",",
"true",
")",
";",
"}",
"else",
"{",
... | Returns a RegexpMatcher that works in a specific environment.<br>
When in a JVM 1.3.1 it will return a Perl5RegexpMatcher, if the JVM is
younger (1.4+) it will return a JdkRegexpMatcher. | [
"Returns",
"a",
"RegexpMatcher",
"that",
"works",
"in",
"a",
"specific",
"environment",
".",
"<br",
">",
"When",
"in",
"a",
"JVM",
"1",
".",
"3",
".",
"1",
"it",
"will",
"return",
"a",
"Perl5RegexpMatcher",
"if",
"the",
"JVM",
"is",
"younger",
"(",
"1"... | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/regexp/RegexpUtils.java#L48-L54 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/ServiceUtils.java | ServiceUtils.getPartCount | public static Integer getPartCount(GetObjectRequest getObjectRequest, AmazonS3 s3) {
ValidationUtils.assertNotNull(s3, "S3 client");
ValidationUtils.assertNotNull(getObjectRequest, "GetObjectRequest");
GetObjectMetadataRequest getObjectMetadataRequest = RequestCopyUtils.createGetObjectMetadataRequestFrom(getObjectRequest)
.withPartNumber(1);
return s3.getObjectMetadata(getObjectMetadataRequest).getPartCount();
} | java | public static Integer getPartCount(GetObjectRequest getObjectRequest, AmazonS3 s3) {
ValidationUtils.assertNotNull(s3, "S3 client");
ValidationUtils.assertNotNull(getObjectRequest, "GetObjectRequest");
GetObjectMetadataRequest getObjectMetadataRequest = RequestCopyUtils.createGetObjectMetadataRequestFrom(getObjectRequest)
.withPartNumber(1);
return s3.getObjectMetadata(getObjectMetadataRequest).getPartCount();
} | [
"public",
"static",
"Integer",
"getPartCount",
"(",
"GetObjectRequest",
"getObjectRequest",
",",
"AmazonS3",
"s3",
")",
"{",
"ValidationUtils",
".",
"assertNotNull",
"(",
"s3",
",",
"\"S3 client\"",
")",
";",
"ValidationUtils",
".",
"assertNotNull",
"(",
"getObjectR... | Returns the part count of the object represented by the getObjectRequest.
@param getObjectRequest
The request to check.
@param s3
The Amazon s3 client.
@return The number of parts in the object if it is multipart object, otherwise returns null. | [
"Returns",
"the",
"part",
"count",
"of",
"the",
"object",
"represented",
"by",
"the",
"getObjectRequest",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/ServiceUtils.java#L514-L522 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setLinearLowerLimits | public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setLinearLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the lower limits for the "moving" body translation relative to joint point.
@param limitX the X axis lower translation limit
@param limitY the Y axis lower translation limit
@param limitZ the Z axis lower translation limit | [
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L65-L67 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java | Assertions.assertTrue | public static void assertTrue(@Nullable final String message, final boolean condition) {
if (!condition) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "Condition must be TRUE"));
MetaErrorListeners.fireError(error.getMessage(), error);
throw error;
}
} | java | public static void assertTrue(@Nullable final String message, final boolean condition) {
if (!condition) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "Condition must be TRUE"));
MetaErrorListeners.fireError(error.getMessage(), error);
throw error;
}
} | [
"public",
"static",
"void",
"assertTrue",
"(",
"@",
"Nullable",
"final",
"String",
"message",
",",
"final",
"boolean",
"condition",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"final",
"AssertionError",
"error",
"=",
"new",
"AssertionError",
"(",
"GetUt... | Assert condition flag is TRUE. GEL will be notified about error.
@param message message describing situation
@param condition condition which must be true
@throws AssertionError if the condition is not true
@since 1.0 | [
"Assert",
"condition",
"flag",
"is",
"TRUE",
".",
"GEL",
"will",
"be",
"notified",
"about",
"error",
"."
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L165-L171 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getDateTime | static public long getDateTime(String s, String format, TimeZone tz)
{
long ret = 0L;
SimpleDateFormat df = null;
try
{
if(s != null && s.length() > 0)
{
df = formatPool.getFormat(format);
df.setTimeZone(tz);
Date dt = df.parse(s);
ret = dt.getTime();
}
}
catch(Exception e)
{
}
if(df != null)
formatPool.release(df);
return ret;
} | java | static public long getDateTime(String s, String format, TimeZone tz)
{
long ret = 0L;
SimpleDateFormat df = null;
try
{
if(s != null && s.length() > 0)
{
df = formatPool.getFormat(format);
df.setTimeZone(tz);
Date dt = df.parse(s);
ret = dt.getTime();
}
}
catch(Exception e)
{
}
if(df != null)
formatPool.release(df);
return ret;
} | [
"static",
"public",
"long",
"getDateTime",
"(",
"String",
"s",
",",
"String",
"format",
",",
"TimeZone",
"tz",
")",
"{",
"long",
"ret",
"=",
"0L",
";",
"SimpleDateFormat",
"df",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"s",
"!=",
"null",
"&&",
"s",
... | Returns the given date time parsed using the given format.
@param s The formatted date to be parsed
@param format The format to use when parsing the date
@param tz The timezone associated with the date
@return The given date parsed using the given format | [
"Returns",
"the",
"given",
"date",
"time",
"parsed",
"using",
"the",
"given",
"format",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L310-L333 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.blockColourMatches | public static boolean blockColourMatches(IBlockState bs, List<Colour> allowedColours)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
// The block in question has a colour, so check it is a specified one:
net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)bs.getValue(prop);
for (Colour col : allowedColours)
{
if (current.getName().equalsIgnoreCase(col.name()))
return true;
}
}
}
return false;
} | java | public static boolean blockColourMatches(IBlockState bs, List<Colour> allowedColours)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
// The block in question has a colour, so check it is a specified one:
net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)bs.getValue(prop);
for (Colour col : allowedColours)
{
if (current.getName().equalsIgnoreCase(col.name()))
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"blockColourMatches",
"(",
"IBlockState",
"bs",
",",
"List",
"<",
"Colour",
">",
"allowedColours",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"bs",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if... | Test whether this block has a colour attribute which matches the list of allowed colours
@param bs blockstate to test
@param allowedColours list of allowed Colour enum values
@return true if the block matches. | [
"Test",
"whether",
"this",
"block",
"has",
"a",
"colour",
"attribute",
"which",
"matches",
"the",
"list",
"of",
"allowed",
"colours"
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L103-L119 |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.addBodyToAction | private void addBodyToAction(ControllerRouteModel<Raml> elem, Action action) {
action.setBody(new LinkedHashMap<String, MimeType>(elem.getBodyMimes().size()));
//the samples must be define in the same order as the accept!
Iterator<String> bodySamples = elem.getBodySamples().iterator();
for (String mime : elem.getBodyMimes()) {
MimeType mimeType = new MimeType(mime);
if (bodySamples.hasNext()) {
mimeType.setExample(bodySamples.next());
}
action.getBody().put(mime, mimeType);
}
} | java | private void addBodyToAction(ControllerRouteModel<Raml> elem, Action action) {
action.setBody(new LinkedHashMap<String, MimeType>(elem.getBodyMimes().size()));
//the samples must be define in the same order as the accept!
Iterator<String> bodySamples = elem.getBodySamples().iterator();
for (String mime : elem.getBodyMimes()) {
MimeType mimeType = new MimeType(mime);
if (bodySamples.hasNext()) {
mimeType.setExample(bodySamples.next());
}
action.getBody().put(mime, mimeType);
}
} | [
"private",
"void",
"addBodyToAction",
"(",
"ControllerRouteModel",
"<",
"Raml",
">",
"elem",
",",
"Action",
"action",
")",
"{",
"action",
".",
"setBody",
"(",
"new",
"LinkedHashMap",
"<",
"String",
",",
"MimeType",
">",
"(",
"elem",
".",
"getBodyMimes",
"(",... | Add the body specification to the given action.
<p>
<p>
Body can contain one example for each content-type supported. The example must be define in the same order as
the content-type.
<p>
</p>
@param elem The ControllerRouteModel that contains the body specification.
@param action The Action on which to add the body specification. | [
"Add",
"the",
"body",
"specification",
"to",
"the",
"given",
"action",
".",
"<p",
">",
"<p",
">",
"Body",
"can",
"contain",
"one",
"example",
"for",
"each",
"content",
"-",
"type",
"supported",
".",
"The",
"example",
"must",
"be",
"define",
"in",
"the",
... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L273-L286 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.resumeAppStream | public ResumeAppStreamResponse resumeAppStream(String app, String stream) {
ResumeAppStreamRequest request = new ResumeAppStreamRequest();
request.setApp(app);
request.setStream(stream);
return resumeAppStream(request);
} | java | public ResumeAppStreamResponse resumeAppStream(String app, String stream) {
ResumeAppStreamRequest request = new ResumeAppStreamRequest();
request.setApp(app);
request.setStream(stream);
return resumeAppStream(request);
} | [
"public",
"ResumeAppStreamResponse",
"resumeAppStream",
"(",
"String",
"app",
",",
"String",
"stream",
")",
"{",
"ResumeAppStreamRequest",
"request",
"=",
"new",
"ResumeAppStreamRequest",
"(",
")",
";",
"request",
".",
"setApp",
"(",
"app",
")",
";",
"request",
... | Resume your app stream by app name and stream name
@param app app name
@param stream stream name
@return the response | [
"Resume",
"your",
"app",
"stream",
"by",
"app",
"name",
"and",
"stream",
"name"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L964-L969 |
ebean-orm/ebean-querybean | src/main/java/io/ebean/typequery/TQRootBean.java | TQRootBean.fetchQuery | public R fetchQuery(String path, String properties) {
query.fetchQuery(path, properties);
return root;
} | java | public R fetchQuery(String path, String properties) {
query.fetchQuery(path, properties);
return root;
} | [
"public",
"R",
"fetchQuery",
"(",
"String",
"path",
",",
"String",
"properties",
")",
"{",
"query",
".",
"fetchQuery",
"(",
"path",
",",
"properties",
")",
";",
"return",
"root",
";",
"}"
] | Specify a path and properties to load using a "query join".
<pre>{@code
List<Customer> customers =
new QCustomer()
// eager fetch contacts using a "query join"
.fetchQuery("contacts", "email, firstName, lastName")
.findList();
}</pre>
@param path the property path of an associated (OneToOne, OneToMany, ManyToOne or ManyToMany) bean. | [
"Specify",
"a",
"path",
"and",
"properties",
"to",
"load",
"using",
"a",
"query",
"join",
"."
] | train | https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/TQRootBean.java#L322-L325 |
eclipse/xtext-core | org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java | JavaStringConverter.convertFromJavaString | public String convertFromJavaString(String string, boolean useUnicode) {
int firstEscapeSequence = string.indexOf('\\');
if (firstEscapeSequence == -1) {
return string;
}
int length = string.length();
StringBuilder result = new StringBuilder(length);
appendRegion(string, 0, firstEscapeSequence, result);
return convertFromJavaString(string, useUnicode, firstEscapeSequence, result);
} | java | public String convertFromJavaString(String string, boolean useUnicode) {
int firstEscapeSequence = string.indexOf('\\');
if (firstEscapeSequence == -1) {
return string;
}
int length = string.length();
StringBuilder result = new StringBuilder(length);
appendRegion(string, 0, firstEscapeSequence, result);
return convertFromJavaString(string, useUnicode, firstEscapeSequence, result);
} | [
"public",
"String",
"convertFromJavaString",
"(",
"String",
"string",
",",
"boolean",
"useUnicode",
")",
"{",
"int",
"firstEscapeSequence",
"=",
"string",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"firstEscapeSequence",
"==",
"-",
"1",
")",
"{",
... | Resolve Java control character sequences to the actual character value.
Optionally handle unicode escape sequences, too. | [
"Resolve",
"Java",
"control",
"character",
"sequences",
"to",
"the",
"actual",
"character",
"value",
".",
"Optionally",
"handle",
"unicode",
"escape",
"sequences",
"too",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java#L23-L32 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptActionsInner.java | ScriptActionsInner.getExecutionDetail | public RuntimeScriptActionDetailInner getExecutionDetail(String resourceGroupName, String clusterName, String scriptExecutionId) {
return getExecutionDetailWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).toBlocking().single().body();
} | java | public RuntimeScriptActionDetailInner getExecutionDetail(String resourceGroupName, String clusterName, String scriptExecutionId) {
return getExecutionDetailWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).toBlocking().single().body();
} | [
"public",
"RuntimeScriptActionDetailInner",
"getExecutionDetail",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"scriptExecutionId",
")",
"{",
"return",
"getExecutionDetailWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName"... | Gets the script execution detail for the given script execution ID.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param scriptExecutionId The script execution Id
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RuntimeScriptActionDetailInner object if successful. | [
"Gets",
"the",
"script",
"execution",
"detail",
"for",
"the",
"given",
"script",
"execution",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptActionsInner.java#L305-L307 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java | MetadataFinder.requestMetadataInternal | private TrackMetadata requestMetadataInternal(final DataReference track, final CdjStatus.TrackType trackType,
final boolean failIfPassive) {
// First check if we are using cached data for this request.
MetadataCache cache = getMetadataCache(SlotReference.getSlotReference(track));
if (cache != null && trackType == CdjStatus.TrackType.REKORDBOX) {
return cache.getTrackMetadata(null, track);
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = getMediaDetailsFor(track.getSlotReference());
if (sourceDetails != null) {
final TrackMetadata provided = allMetadataProviders.getTrackMetadata(sourceDetails, track);
if (provided != null) {
return provided;
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (passive.get() && failIfPassive && track.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null;
}
// Use the dbserver protocol implementation to request the metadata.
ConnectionManager.ClientTask<TrackMetadata> task = new ConnectionManager.ClientTask<TrackMetadata>() {
@Override
public TrackMetadata useClient(Client client) throws Exception {
return queryMetadata(track, trackType, client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(track.player, task, "requesting metadata");
} catch (Exception e) {
logger.error("Problem requesting metadata, returning null", e);
}
return null;
} | java | private TrackMetadata requestMetadataInternal(final DataReference track, final CdjStatus.TrackType trackType,
final boolean failIfPassive) {
// First check if we are using cached data for this request.
MetadataCache cache = getMetadataCache(SlotReference.getSlotReference(track));
if (cache != null && trackType == CdjStatus.TrackType.REKORDBOX) {
return cache.getTrackMetadata(null, track);
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = getMediaDetailsFor(track.getSlotReference());
if (sourceDetails != null) {
final TrackMetadata provided = allMetadataProviders.getTrackMetadata(sourceDetails, track);
if (provided != null) {
return provided;
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (passive.get() && failIfPassive && track.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null;
}
// Use the dbserver protocol implementation to request the metadata.
ConnectionManager.ClientTask<TrackMetadata> task = new ConnectionManager.ClientTask<TrackMetadata>() {
@Override
public TrackMetadata useClient(Client client) throws Exception {
return queryMetadata(track, trackType, client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(track.player, task, "requesting metadata");
} catch (Exception e) {
logger.error("Problem requesting metadata, returning null", e);
}
return null;
} | [
"private",
"TrackMetadata",
"requestMetadataInternal",
"(",
"final",
"DataReference",
"track",
",",
"final",
"CdjStatus",
".",
"TrackType",
"trackType",
",",
"final",
"boolean",
"failIfPassive",
")",
"{",
"// First check if we are using cached data for this request.",
"Metada... | Ask the specified player for metadata about the track in the specified slot with the specified rekordbox ID,
using cached media instead if it is available, and possibly giving up if we are in passive mode.
@param track uniquely identifies the track whose metadata is desired
@param trackType identifies the type of track being requested, which affects the type of metadata request
message that must be used
@param failIfPassive will prevent the request from taking place if we are in passive mode, so that automatic
metadata updates will use available caches only
@return the metadata found, if any | [
"Ask",
"the",
"specified",
"player",
"for",
"metadata",
"about",
"the",
"track",
"in",
"the",
"specified",
"slot",
"with",
"the",
"specified",
"rekordbox",
"ID",
"using",
"cached",
"media",
"instead",
"if",
"it",
"is",
"available",
"and",
"possibly",
"giving",... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L90-L127 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.postAccountInvoice | public InvoiceCollection postAccountInvoice(final String accountCode, final Invoice invoice) {
return doPOST(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Invoices.INVOICES_RESOURCE, invoice, InvoiceCollection.class);
} | java | public InvoiceCollection postAccountInvoice(final String accountCode, final Invoice invoice) {
return doPOST(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Invoices.INVOICES_RESOURCE, invoice, InvoiceCollection.class);
} | [
"public",
"InvoiceCollection",
"postAccountInvoice",
"(",
"final",
"String",
"accountCode",
",",
"final",
"Invoice",
"invoice",
")",
"{",
"return",
"doPOST",
"(",
"Accounts",
".",
"ACCOUNTS_RESOURCE",
"+",
"\"/\"",
"+",
"accountCode",
"+",
"Invoices",
".",
"INVOIC... | Post an invoice: invoice pending charges on an account
<p>
Returns an invoice collection
@param accountCode
@return the invoice collection that was generated on success, null otherwise | [
"Post",
"an",
"invoice",
":",
"invoice",
"pending",
"charges",
"on",
"an",
"account",
"<p",
">",
"Returns",
"an",
"invoice",
"collection"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1259-L1261 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/LightWeightGSet.java | LightWeightGSet.computeCapacity | public static int computeCapacity(double percentage, String mapName) {
return computeCapacity(Runtime.getRuntime().maxMemory(), percentage, mapName);
} | java | public static int computeCapacity(double percentage, String mapName) {
return computeCapacity(Runtime.getRuntime().maxMemory(), percentage, mapName);
} | [
"public",
"static",
"int",
"computeCapacity",
"(",
"double",
"percentage",
",",
"String",
"mapName",
")",
"{",
"return",
"computeCapacity",
"(",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"maxMemory",
"(",
")",
",",
"percentage",
",",
"mapName",
")",
";",
... | Let t = percentage of max memory.
Let e = round(log_2 t).
Then, we choose capacity = 2^e/(size of reference),
unless it is outside the close interval [1, 2^30]. | [
"Let",
"t",
"=",
"percentage",
"of",
"max",
"memory",
".",
"Let",
"e",
"=",
"round",
"(",
"log_2",
"t",
")",
".",
"Then",
"we",
"choose",
"capacity",
"=",
"2^e",
"/",
"(",
"size",
"of",
"reference",
")",
"unless",
"it",
"is",
"outside",
"the",
"clo... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/LightWeightGSet.java#L323-L325 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java | DaoTemplate.update | public int update(Entity record, Entity where) throws SQLException{
if (CollectionUtil.isEmpty(record)) {
return 0;
}
return db.update(fixEntity(record), where);
} | java | public int update(Entity record, Entity where) throws SQLException{
if (CollectionUtil.isEmpty(record)) {
return 0;
}
return db.update(fixEntity(record), where);
} | [
"public",
"int",
"update",
"(",
"Entity",
"record",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"record",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"db",
".",
"update",
"(",
"fix... | 按照条件更新
@param record 更新的内容
@param where 条件
@return 更新条目数
@throws SQLException SQL执行异常 | [
"按照条件更新"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L168-L173 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java | Util.getLength | public static long getLength(ValueData value, int propType)
{
if (propType == PropertyType.BINARY)
{
return value.getLength();
}
else if (propType == PropertyType.NAME || propType == PropertyType.PATH)
{
return -1;
}
else
{
return value.toString().length();
}
} | java | public static long getLength(ValueData value, int propType)
{
if (propType == PropertyType.BINARY)
{
return value.getLength();
}
else if (propType == PropertyType.NAME || propType == PropertyType.PATH)
{
return -1;
}
else
{
return value.toString().length();
}
} | [
"public",
"static",
"long",
"getLength",
"(",
"ValueData",
"value",
",",
"int",
"propType",
")",
"{",
"if",
"(",
"propType",
"==",
"PropertyType",
".",
"BINARY",
")",
"{",
"return",
"value",
".",
"getLength",
"(",
")",
";",
"}",
"else",
"if",
"(",
"pro... | Returns length of the internal value.
@param value a value.
@param propType
@return the length of the internal value or <code>-1</code> if the length
cannot be determined. | [
"Returns",
"length",
"of",
"the",
"internal",
"value",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java#L286-L300 |
tacitknowledge/discovery | src/main/java/com/tacitknowledge/util/discovery/ClasspathFileReader.java | ClasspathFileReader.findFile | private File findFile(String fileName, List path)
{
final String methodName = "findFile(): ";
String fileSeparator = System.getProperty("file.separator");
for (Iterator i = path.iterator(); i.hasNext();)
{
String directory = (String) i.next();
if (!directory.endsWith(fileSeparator) && !fileName.startsWith(fileSeparator))
{
directory = directory + fileSeparator;
}
File file = new File(directory + fileName);
if (log.isDebugEnabled())
{
log.debug(methodName + " checking '" + file.getAbsolutePath() + "'");
}
if (file.exists() && file.canRead())
{
log.debug(methodName + " found it - file is '" + file.getAbsolutePath() + "'");
cache.put(fileName, new CacheEntry(file));
return file;
}
}
return null;
} | java | private File findFile(String fileName, List path)
{
final String methodName = "findFile(): ";
String fileSeparator = System.getProperty("file.separator");
for (Iterator i = path.iterator(); i.hasNext();)
{
String directory = (String) i.next();
if (!directory.endsWith(fileSeparator) && !fileName.startsWith(fileSeparator))
{
directory = directory + fileSeparator;
}
File file = new File(directory + fileName);
if (log.isDebugEnabled())
{
log.debug(methodName + " checking '" + file.getAbsolutePath() + "'");
}
if (file.exists() && file.canRead())
{
log.debug(methodName + " found it - file is '" + file.getAbsolutePath() + "'");
cache.put(fileName, new CacheEntry(file));
return file;
}
}
return null;
} | [
"private",
"File",
"findFile",
"(",
"String",
"fileName",
",",
"List",
"path",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"findFile(): \"",
";",
"String",
"fileSeparator",
"=",
"System",
".",
"getProperty",
"(",
"\"file.separator\"",
")",
";",
"for",
"(... | Finds a file if it exists in a list of provided paths
@param fileName the name of the file
@param path a list of file paths
@return a file or null if none is found | [
"Finds",
"a",
"file",
"if",
"it",
"exists",
"in",
"a",
"list",
"of",
"provided",
"paths"
] | train | https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClasspathFileReader.java#L184-L208 |
pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Futures.java | Futures.exceptionListener | @SuppressWarnings("unchecked")
public static <T, E extends Throwable> void exceptionListener(CompletableFuture<T> completableFuture, Class<E> exceptionClass, Consumer<E> exceptionListener) {
completableFuture.whenComplete((r, ex) -> {
if (ex != null && exceptionClass.isAssignableFrom(ex.getClass())) {
Callbacks.invokeSafely(exceptionListener, (E) ex, null);
}
});
} | java | @SuppressWarnings("unchecked")
public static <T, E extends Throwable> void exceptionListener(CompletableFuture<T> completableFuture, Class<E> exceptionClass, Consumer<E> exceptionListener) {
completableFuture.whenComplete((r, ex) -> {
if (ex != null && exceptionClass.isAssignableFrom(ex.getClass())) {
Callbacks.invokeSafely(exceptionListener, (E) ex, null);
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Throwable",
">",
"void",
"exceptionListener",
"(",
"CompletableFuture",
"<",
"T",
">",
"completableFuture",
",",
"Class",
"<",
"E",
">",
"exceptionClass",
"... | Registers an exception listener to the given CompletableFuture for a particular type of exception.
@param completableFuture The Future to register to.
@param exceptionClass The type of exception to listen to.
@param exceptionListener The Listener to register.
@param <T> The Type of the future's result.
@param <E> The Type of the exception. | [
"Registers",
"an",
"exception",
"listener",
"to",
"the",
"given",
"CompletableFuture",
"for",
"a",
"particular",
"type",
"of",
"exception",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Futures.java#L254-L261 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageDrawing.java | ImageDrawing.drawInRound | public static void drawInRound(Bitmap src, Bitmap dest, int clearColor) {
if (dest.getWidth() != dest.getHeight()) {
throw new RuntimeException("dest Bitmap must have square size");
}
clearBitmap(dest, clearColor);
Canvas canvas = new Canvas(dest);
int r = dest.getWidth() / 2;
Rect sourceRect = WorkCache.RECT1.get();
Rect destRect = WorkCache.RECT2.get();
sourceRect.set(0, 0, src.getWidth(), src.getHeight());
destRect.set(0, 0, dest.getWidth(), dest.getHeight());
Paint paint = WorkCache.PAINT.get();
paint.reset();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.RED);
paint.setAntiAlias(true);
canvas.drawCircle(r, r, r, paint);
paint.reset();
paint.setFilterBitmap(true);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(src, sourceRect, destRect, paint);
canvas.setBitmap(null);
} | java | public static void drawInRound(Bitmap src, Bitmap dest, int clearColor) {
if (dest.getWidth() != dest.getHeight()) {
throw new RuntimeException("dest Bitmap must have square size");
}
clearBitmap(dest, clearColor);
Canvas canvas = new Canvas(dest);
int r = dest.getWidth() / 2;
Rect sourceRect = WorkCache.RECT1.get();
Rect destRect = WorkCache.RECT2.get();
sourceRect.set(0, 0, src.getWidth(), src.getHeight());
destRect.set(0, 0, dest.getWidth(), dest.getHeight());
Paint paint = WorkCache.PAINT.get();
paint.reset();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.RED);
paint.setAntiAlias(true);
canvas.drawCircle(r, r, r, paint);
paint.reset();
paint.setFilterBitmap(true);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(src, sourceRect, destRect, paint);
canvas.setBitmap(null);
} | [
"public",
"static",
"void",
"drawInRound",
"(",
"Bitmap",
"src",
",",
"Bitmap",
"dest",
",",
"int",
"clearColor",
")",
"{",
"if",
"(",
"dest",
".",
"getWidth",
"(",
")",
"!=",
"dest",
".",
"getHeight",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeExcept... | Drawing src bitmap to dest bitmap with round mask. Dest might be squared, src is recommended to be square
@param src source bitmap
@param dest destination bitmap
@param clearColor clear color | [
"Drawing",
"src",
"bitmap",
"to",
"dest",
"bitmap",
"with",
"round",
"mask",
".",
"Dest",
"might",
"be",
"squared",
"src",
"is",
"recommended",
"to",
"be",
"square"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageDrawing.java#L165-L191 |
ontop/ontop | client/protege/src/main/java/it/unibz/inf/ontop/utils/VirtualABoxStatistics.java | VirtualABoxStatistics.getStatistics | public int getStatistics(String datasourceId, String mappingId) {
final HashMap<String, Integer> mappingStat = getStatistics(datasourceId);
int triplesCount = mappingStat.get(mappingId).intValue();
return triplesCount;
} | java | public int getStatistics(String datasourceId, String mappingId) {
final HashMap<String, Integer> mappingStat = getStatistics(datasourceId);
int triplesCount = mappingStat.get(mappingId).intValue();
return triplesCount;
} | [
"public",
"int",
"getStatistics",
"(",
"String",
"datasourceId",
",",
"String",
"mappingId",
")",
"{",
"final",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"mappingStat",
"=",
"getStatistics",
"(",
"datasourceId",
")",
";",
"int",
"triplesCount",
"=",
"mapp... | Returns one triple count from a particular mapping.
@param datasourceId
The data source identifier.
@param mappingId
The mapping identifier.
@return The number of triples. | [
"Returns",
"one",
"triple",
"count",
"from",
"a",
"particular",
"mapping",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/utils/VirtualABoxStatistics.java#L86-L91 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getField | private static Field getField(String fieldName, Class<?> where) {
if (where == null) {
throw new IllegalArgumentException("where cannot be null");
}
Field field = null;
try {
field = where.getDeclaredField(fieldName);
field.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
+ ".");
}
return field;
} | java | private static Field getField(String fieldName, Class<?> where) {
if (where == null) {
throw new IllegalArgumentException("where cannot be null");
}
Field field = null;
try {
field = where.getDeclaredField(fieldName);
field.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
+ ".");
}
return field;
} | [
"private",
"static",
"Field",
"getField",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"if",
"(",
"where",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"where cannot be null\"",
")",
";",
"}",
"F... | Gets the field.
@param fieldName the field name
@param where the where
@return the field | [
"Gets",
"the",
"field",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2254-L2268 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java | CmsSearchWidgetDialog.initUserObject | @SuppressWarnings("rawtypes")
@Override
protected void initUserObject() {
super.initUserObject();
Object o = getDialogObject();
if (o == null) {
m_searchParams = new CmsSearchParameters();
// implant a hook upon modifications of the list
// this will set the search page to 1 if a restriction to the set of categories is performed
m_searchParams.setCategories(new CmsHookListSearchCategory(m_searchParams, m_searchParams.getCategories()));
m_search = new CmsSearch();
} else {
Map dialogObject = (Map)o;
m_searchParams = (CmsSearchParameters)dialogObject.get(PARAM_SEARCH_PARAMS);
if (m_searchParams == null) {
m_searchParams = new CmsSearchParameters();
}
m_search = (CmsSearch)dialogObject.get(PARAM_SEARCH_OBJECT);
if (m_search == null) {
m_search = new CmsSearch();
}
}
m_searchParams.setSearchIndex((CmsSearchIndex)getSearchIndexIndex());
} | java | @SuppressWarnings("rawtypes")
@Override
protected void initUserObject() {
super.initUserObject();
Object o = getDialogObject();
if (o == null) {
m_searchParams = new CmsSearchParameters();
// implant a hook upon modifications of the list
// this will set the search page to 1 if a restriction to the set of categories is performed
m_searchParams.setCategories(new CmsHookListSearchCategory(m_searchParams, m_searchParams.getCategories()));
m_search = new CmsSearch();
} else {
Map dialogObject = (Map)o;
m_searchParams = (CmsSearchParameters)dialogObject.get(PARAM_SEARCH_PARAMS);
if (m_searchParams == null) {
m_searchParams = new CmsSearchParameters();
}
m_search = (CmsSearch)dialogObject.get(PARAM_SEARCH_OBJECT);
if (m_search == null) {
m_search = new CmsSearch();
}
}
m_searchParams.setSearchIndex((CmsSearchIndex)getSearchIndexIndex());
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"protected",
"void",
"initUserObject",
"(",
")",
"{",
"super",
".",
"initUserObject",
"(",
")",
";",
"Object",
"o",
"=",
"getDialogObject",
"(",
")",
";",
"if",
"(",
"o",
"==",
"null",
"... | Overridden to additionally get a hold on the widget object of type
<code>{@link CmsSearchParameters}</code>.<p>
@see org.opencms.workplace.tools.searchindex.A_CmsEditSearchIndexDialog#initUserObject() | [
"Overridden",
"to",
"additionally",
"get",
"a",
"hold",
"on",
"the",
"widget",
"object",
"of",
"type",
"<code",
">",
"{",
"@link",
"CmsSearchParameters",
"}",
"<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java#L484-L508 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetBaseGenerator.java | RRBudgetBaseGenerator.hasPersonnelBudget | protected Boolean hasPersonnelBudget(KeyPersonDto keyPerson,int period){
List<? extends BudgetLineItemContract> budgetLineItemList = new ArrayList<>();
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
budgetLineItemList = budget.getBudgetPeriods().get(period-1).getBudgetLineItems();
for(BudgetLineItemContract budgetLineItem : budgetLineItemList) {
for(BudgetPersonnelDetailsContract budgetPersonnelDetails : budgetLineItem.getBudgetPersonnelDetailsList()){
if( budgetPersonnelDetails.getPersonId().equals(keyPerson.getPersonId())){
return true;
} else if (keyPerson.getRolodexId() != null && budgetPersonnelDetails.getPersonId().equals(keyPerson.getRolodexId().toString())) {
return true;
}
}
}
return false;
} | java | protected Boolean hasPersonnelBudget(KeyPersonDto keyPerson,int period){
List<? extends BudgetLineItemContract> budgetLineItemList = new ArrayList<>();
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
budgetLineItemList = budget.getBudgetPeriods().get(period-1).getBudgetLineItems();
for(BudgetLineItemContract budgetLineItem : budgetLineItemList) {
for(BudgetPersonnelDetailsContract budgetPersonnelDetails : budgetLineItem.getBudgetPersonnelDetailsList()){
if( budgetPersonnelDetails.getPersonId().equals(keyPerson.getPersonId())){
return true;
} else if (keyPerson.getRolodexId() != null && budgetPersonnelDetails.getPersonId().equals(keyPerson.getRolodexId().toString())) {
return true;
}
}
}
return false;
} | [
"protected",
"Boolean",
"hasPersonnelBudget",
"(",
"KeyPersonDto",
"keyPerson",
",",
"int",
"period",
")",
"{",
"List",
"<",
"?",
"extends",
"BudgetLineItemContract",
">",
"budgetLineItemList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ProposalDevelopmentBudget... | This method check whether the key person has a personnel budget
@param keyPerson
(KeyPersonInfo) key person entry.
@param period
budget period
@return true if key person has personnel budget else false. | [
"This",
"method",
"check",
"whether",
"the",
"key",
"person",
"has",
"a",
"personnel",
"budget"
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetBaseGenerator.java#L278-L295 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.convertTo | public <S, T> T convertTo(Class<S> input, Class<T> output, Object object) {
return convertTo(new ConverterKey<S,T>(input, output, DefaultBinding.class), object);
} | java | public <S, T> T convertTo(Class<S> input, Class<T> output, Object object) {
return convertTo(new ConverterKey<S,T>(input, output, DefaultBinding.class), object);
} | [
"public",
"<",
"S",
",",
"T",
">",
"T",
"convertTo",
"(",
"Class",
"<",
"S",
">",
"input",
",",
"Class",
"<",
"T",
">",
"output",
",",
"Object",
"object",
")",
"{",
"return",
"convertTo",
"(",
"new",
"ConverterKey",
"<",
"S",
",",
"T",
">",
"(",
... | Convert an object which is an instance of source class to the given target class
@param input The class of the object to be converted
@param output The target class to convert the object to
@param object The object to be converted | [
"Convert",
"an",
"object",
"which",
"is",
"an",
"instance",
"of",
"source",
"class",
"to",
"the",
"given",
"target",
"class"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L794-L796 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/logging/LogTemplates.java | LogTemplates.everyNSeconds | public static <C> LogTemplate<C> everyNSeconds(LogTemplate<C> delegateLogger, long period) {
return everyNMilliseconds(delegateLogger, period * SimonClock.MILLIS_IN_SECOND);
} | java | public static <C> LogTemplate<C> everyNSeconds(LogTemplate<C> delegateLogger, long period) {
return everyNMilliseconds(delegateLogger, period * SimonClock.MILLIS_IN_SECOND);
} | [
"public",
"static",
"<",
"C",
">",
"LogTemplate",
"<",
"C",
">",
"everyNSeconds",
"(",
"LogTemplate",
"<",
"C",
">",
"delegateLogger",
",",
"long",
"period",
")",
"{",
"return",
"everyNMilliseconds",
"(",
"delegateLogger",
",",
"period",
"*",
"SimonClock",
"... | Produces a log template which logs something at most every N secoonds.
@param delegateLogger Concrete log template
@param period N value in seconds, maximum period
@return Logger | [
"Produces",
"a",
"log",
"template",
"which",
"logs",
"something",
"at",
"most",
"every",
"N",
"secoonds",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/logging/LogTemplates.java#L61-L63 |
threerings/nenya | core/src/main/java/com/threerings/media/animation/ScaleAnimation.java | ScaleAnimation.getCorner | public static Point getCorner (Point center, Point size)
{
return new Point(center.x - size.x/2, center.y - size.y/2);
} | java | public static Point getCorner (Point center, Point size)
{
return new Point(center.x - size.x/2, center.y - size.y/2);
} | [
"public",
"static",
"Point",
"getCorner",
"(",
"Point",
"center",
",",
"Point",
"size",
")",
"{",
"return",
"new",
"Point",
"(",
"center",
".",
"x",
"-",
"size",
".",
"x",
"/",
"2",
",",
"center",
".",
"y",
"-",
"size",
".",
"y",
"/",
"2",
")",
... | Computes the upper left corner where the image should be drawn, given the center and
dimensions to which the image should be scaled. | [
"Computes",
"the",
"upper",
"left",
"corner",
"where",
"the",
"image",
"should",
"be",
"drawn",
"given",
"the",
"center",
"and",
"dimensions",
"to",
"which",
"the",
"image",
"should",
"be",
"scaled",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/ScaleAnimation.java#L105-L108 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getTroubleshootingResult | public TroubleshootingResultInner getTroubleshootingResult(String resourceGroupName, String networkWatcherName, String targetResourceId) {
return getTroubleshootingResultWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().last().body();
} | java | public TroubleshootingResultInner getTroubleshootingResult(String resourceGroupName, String networkWatcherName, String targetResourceId) {
return getTroubleshootingResultWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().last().body();
} | [
"public",
"TroubleshootingResultInner",
"getTroubleshootingResult",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"targetResourceId",
")",
"{",
"return",
"getTroubleshootingResultWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Get the last completed troubleshooting result on a specified resource.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher resource.
@param targetResourceId The target resource ID to query the troubleshooting result.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the TroubleshootingResultInner object if successful. | [
"Get",
"the",
"last",
"completed",
"troubleshooting",
"result",
"on",
"a",
"specified",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1632-L1634 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/BloomFilterSerializer.java | BloomFilterSerializer.serializedSize | public long serializedSize(BloomFilter bf, TypeSizes typeSizes)
{
int size = typeSizes.sizeof(bf.hashCount); // hash count
size += bf.bitset.serializedSize(typeSizes);
return size;
} | java | public long serializedSize(BloomFilter bf, TypeSizes typeSizes)
{
int size = typeSizes.sizeof(bf.hashCount); // hash count
size += bf.bitset.serializedSize(typeSizes);
return size;
} | [
"public",
"long",
"serializedSize",
"(",
"BloomFilter",
"bf",
",",
"TypeSizes",
"typeSizes",
")",
"{",
"int",
"size",
"=",
"typeSizes",
".",
"sizeof",
"(",
"bf",
".",
"hashCount",
")",
";",
"// hash count",
"size",
"+=",
"bf",
".",
"bitset",
".",
"serializ... | Calculates a serialized size of the given Bloom Filter
@see org.apache.cassandra.io.ISerializer#serialize(Object, org.apache.cassandra.io.util.DataOutputPlus)
@param bf Bloom filter to calculate serialized size
@return serialized size of the given bloom filter | [
"Calculates",
"a",
"serialized",
"size",
"of",
"the",
"given",
"Bloom",
"Filter",
"@see",
"org",
".",
"apache",
".",
"cassandra",
".",
"io",
".",
"ISerializer#serialize",
"(",
"Object",
"org",
".",
"apache",
".",
"cassandra",
".",
"io",
".",
"util",
".",
... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/BloomFilterSerializer.java#L60-L65 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.deleteWithRegEx | public RouteMatcher deleteWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, deleteBindings);
return this;
} | java | public RouteMatcher deleteWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, deleteBindings);
return this;
} | [
"public",
"RouteMatcher",
"deleteWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"deleteBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP DELETE
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"DELETE"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L239-L242 |
landawn/AbacusUtil | src/com/landawn/abacus/util/URLEncodedUtil.java | URLEncodedUtil.decodeFormFields | private static String decodeFormFields(final String content, final Charset charset) {
if (content == null) {
return null;
}
return urlDecode(content, (charset != null) ? charset : Charsets.UTF_8, true);
} | java | private static String decodeFormFields(final String content, final Charset charset) {
if (content == null) {
return null;
}
return urlDecode(content, (charset != null) ? charset : Charsets.UTF_8, true);
} | [
"private",
"static",
"String",
"decodeFormFields",
"(",
"final",
"String",
"content",
",",
"final",
"Charset",
"charset",
")",
"{",
"if",
"(",
"content",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"urlDecode",
"(",
"content",
",",
"(",
... | Decode/unescape www-url-form-encoded content.
@param content
the content to decode, will decode '+' as space
@param charset
the charset to use
@return encoded string | [
"Decode",
"/",
"unescape",
"www",
"-",
"url",
"-",
"form",
"-",
"encoded",
"content",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/URLEncodedUtil.java#L404-L410 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java | ComboButton.addButton | public AbstractButton addButton(final String text, final Icon icon, final boolean toggleButton) {
final AbstractButton button;
if (toggleButton) {
button = new JToggleButton(text, icon);
button.addActionListener(_commonToggleButtonActionListener);
} else {
button = new JButton(text, icon);
}
addButton(button);
return button;
} | java | public AbstractButton addButton(final String text, final Icon icon, final boolean toggleButton) {
final AbstractButton button;
if (toggleButton) {
button = new JToggleButton(text, icon);
button.addActionListener(_commonToggleButtonActionListener);
} else {
button = new JButton(text, icon);
}
addButton(button);
return button;
} | [
"public",
"AbstractButton",
"addButton",
"(",
"final",
"String",
"text",
",",
"final",
"Icon",
"icon",
",",
"final",
"boolean",
"toggleButton",
")",
"{",
"final",
"AbstractButton",
"button",
";",
"if",
"(",
"toggleButton",
")",
"{",
"button",
"=",
"new",
"JT... | Adds a button to this {@link ComboButton}
@param text
the text of the button
@param icon
the icon of the button
@param toggleButton
whether or not this button should be a toggle button (true) or
a regular button (false)
@return | [
"Adds",
"a",
"button",
"to",
"this",
"{",
"@link",
"ComboButton",
"}"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L105-L116 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/Html5UpdateTool.java | Html5UpdateTool.removePointsFromAttr | public final void removePointsFromAttr(final Element root,
final String selector, final String attr) {
final Iterable<Element> elements; // Elements to fix
checkNotNull(root, "Received a null pointer as root element");
checkNotNull(selector, "Received a null pointer as selector");
checkNotNull(attr, "Received a null pointer as attribute");
// Selects and iterates over the elements
elements = root.select(selector);
for (final Element selected : elements) {
removePointsFromAttr(selected, attr);
}
} | java | public final void removePointsFromAttr(final Element root,
final String selector, final String attr) {
final Iterable<Element> elements; // Elements to fix
checkNotNull(root, "Received a null pointer as root element");
checkNotNull(selector, "Received a null pointer as selector");
checkNotNull(attr, "Received a null pointer as attribute");
// Selects and iterates over the elements
elements = root.select(selector);
for (final Element selected : elements) {
removePointsFromAttr(selected, attr);
}
} | [
"public",
"final",
"void",
"removePointsFromAttr",
"(",
"final",
"Element",
"root",
",",
"final",
"String",
"selector",
",",
"final",
"String",
"attr",
")",
"{",
"final",
"Iterable",
"<",
"Element",
">",
"elements",
";",
"// Elements to fix",
"checkNotNull",
"("... | Removes the points from the contents of the specified attribute.
@param root
root element for the selection
@param selector
CSS selector for the elements
@param attr
attribute to clean | [
"Removes",
"the",
"points",
"from",
"the",
"contents",
"of",
"the",
"specified",
"attribute",
"."
] | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/Html5UpdateTool.java#L100-L113 |
jamesagnew/hapi-fhir | hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Filter.java | Filter.get | protected Object get(int index, Object... params) {
if (index >= params.length) {
throw new RuntimeException("error in filter '" + name +
"': cannot get param index: " + index +
" from: " + Arrays.toString(params));
}
return params[index];
} | java | protected Object get(int index, Object... params) {
if (index >= params.length) {
throw new RuntimeException("error in filter '" + name +
"': cannot get param index: " + index +
" from: " + Arrays.toString(params));
}
return params[index];
} | [
"protected",
"Object",
"get",
"(",
"int",
"index",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"index",
">=",
"params",
".",
"length",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"error in filter '\"",
"+",
"name",
"+",
"\"': cannot get par... | Returns a value at a specific index from an array of parameters.
If no such index exists, a RuntimeException is thrown.
@param index
the index of the value to be retrieved.
@param params
the values.
@return a value at a specific index from an array of
parameters. | [
"Returns",
"a",
"value",
"at",
"a",
"specific",
"index",
"from",
"an",
"array",
"of",
"parameters",
".",
"If",
"no",
"such",
"index",
"exists",
"a",
"RuntimeException",
"is",
"thrown",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Filter.java#L121-L130 |
haifengl/smile | core/src/main/java/smile/clustering/BBDTree.java | BBDTree.getNodeCost | private double getNodeCost(Node node, double[] center) {
int d = center.length;
double scatter = 0.0;
for (int i = 0; i < d; i++) {
double x = (node.sum[i] / node.count) - center[i];
scatter += x * x;
}
return node.cost + node.count * scatter;
} | java | private double getNodeCost(Node node, double[] center) {
int d = center.length;
double scatter = 0.0;
for (int i = 0; i < d; i++) {
double x = (node.sum[i] / node.count) - center[i];
scatter += x * x;
}
return node.cost + node.count * scatter;
} | [
"private",
"double",
"getNodeCost",
"(",
"Node",
"node",
",",
"double",
"[",
"]",
"center",
")",
"{",
"int",
"d",
"=",
"center",
".",
"length",
";",
"double",
"scatter",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"d",
";",
... | Returns the total contribution of all data in the given kd-tree node,
assuming they are all assigned to a mean at the given location.
sum_{x \in node} ||x - mean||^2.
If c denotes the mean of mass of the data in this node and n denotes
the number of data in it, then this quantity is given by
n * ||c - mean||^2 + sum_{x \in node} ||x - c||^2
The sum is precomputed for each node as cost. This formula follows
from expanding both sides as dot products. | [
"Returns",
"the",
"total",
"contribution",
"of",
"all",
"data",
"in",
"the",
"given",
"kd",
"-",
"tree",
"node",
"assuming",
"they",
"are",
"all",
"assigned",
"to",
"a",
"mean",
"at",
"the",
"given",
"location",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BBDTree.java#L241-L249 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_ZUpdateLineExtremities.java | ST_ZUpdateLineExtremities.force3DStartEnd | private static Geometry force3DStartEnd(LineString lineString, final double startZ,
final double endZ, final boolean interpolate) {
final double bigD = lineString.getLength();
final double z = endZ - startZ;
final Coordinate coordEnd = lineString.getCoordinates()[lineString.getCoordinates().length - 1];
lineString.apply(new CoordinateSequenceFilter() {
boolean done = false;
@Override
public boolean isGeometryChanged() {
return true;
}
@Override
public boolean isDone() {
return done;
}
@Override
public void filter(CoordinateSequence seq, int i) {
double x = seq.getX(i);
double y = seq.getY(i);
if (i == 0) {
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, startZ);
} else if (i == seq.size() - 1) {
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, endZ);
} else {
if (interpolate) {
double smallD = seq.getCoordinate(i).distance(coordEnd);
double factor = smallD / bigD;
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, startZ + (factor * z));
}
}
if (i == seq.size()) {
done = true;
}
}
});
return lineString;
} | java | private static Geometry force3DStartEnd(LineString lineString, final double startZ,
final double endZ, final boolean interpolate) {
final double bigD = lineString.getLength();
final double z = endZ - startZ;
final Coordinate coordEnd = lineString.getCoordinates()[lineString.getCoordinates().length - 1];
lineString.apply(new CoordinateSequenceFilter() {
boolean done = false;
@Override
public boolean isGeometryChanged() {
return true;
}
@Override
public boolean isDone() {
return done;
}
@Override
public void filter(CoordinateSequence seq, int i) {
double x = seq.getX(i);
double y = seq.getY(i);
if (i == 0) {
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, startZ);
} else if (i == seq.size() - 1) {
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, endZ);
} else {
if (interpolate) {
double smallD = seq.getCoordinate(i).distance(coordEnd);
double factor = smallD / bigD;
seq.setOrdinate(i, 0, x);
seq.setOrdinate(i, 1, y);
seq.setOrdinate(i, 2, startZ + (factor * z));
}
}
if (i == seq.size()) {
done = true;
}
}
});
return lineString;
} | [
"private",
"static",
"Geometry",
"force3DStartEnd",
"(",
"LineString",
"lineString",
",",
"final",
"double",
"startZ",
",",
"final",
"double",
"endZ",
",",
"final",
"boolean",
"interpolate",
")",
"{",
"final",
"double",
"bigD",
"=",
"lineString",
".",
"getLength... | Updates all z values by a new value using the specified first and the
last coordinates.
@param geom
@param startZ
@param endZ
@param interpolate is true the z value of the vertices are interpolate
according the length of the line.
@return | [
"Updates",
"all",
"z",
"values",
"by",
"a",
"new",
"value",
"using",
"the",
"specified",
"first",
"and",
"the",
"last",
"coordinates",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_ZUpdateLineExtremities.java#L90-L135 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java | AtomPositionMap.getLengthDirectional | public int getLengthDirectional(int positionStart, int positionEnd, String startingChain) {
int count = getLength(positionStart,positionEnd,startingChain);
if(positionStart <= positionEnd) {
return count;
} else {
return -count;
}
} | java | public int getLengthDirectional(int positionStart, int positionEnd, String startingChain) {
int count = getLength(positionStart,positionEnd,startingChain);
if(positionStart <= positionEnd) {
return count;
} else {
return -count;
}
} | [
"public",
"int",
"getLengthDirectional",
"(",
"int",
"positionStart",
",",
"int",
"positionEnd",
",",
"String",
"startingChain",
")",
"{",
"int",
"count",
"=",
"getLength",
"(",
"positionStart",
",",
"positionEnd",
",",
"startingChain",
")",
";",
"if",
"(",
"p... | Calculates the number of residues of the specified chain in a given range.
Will return a negative value if the start is past the end.
@param positionStart index of the first atom to count
@param positionEnd index of the last atom to count
@param startingChain Case-sensitive chain
@return The number of atoms from A to B inclusive belonging to the given chain | [
"Calculates",
"the",
"number",
"of",
"residues",
"of",
"the",
"specified",
"chain",
"in",
"a",
"given",
"range",
".",
"Will",
"return",
"a",
"negative",
"value",
"if",
"the",
"start",
"is",
"past",
"the",
"end",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L220-L227 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlUtils.java | CmsXmlUtils.createXpathElementCheck | public static String createXpathElementCheck(String path, int index) {
if (path.charAt(path.length() - 1) == ']') {
// path is already in the form "title[1]"
// ignore provided index and return the path "as is"
return path;
}
// append index in square brackets
return createXpathElement(path, index);
} | java | public static String createXpathElementCheck(String path, int index) {
if (path.charAt(path.length() - 1) == ']') {
// path is already in the form "title[1]"
// ignore provided index and return the path "as is"
return path;
}
// append index in square brackets
return createXpathElement(path, index);
} | [
"public",
"static",
"String",
"createXpathElementCheck",
"(",
"String",
"path",
",",
"int",
"index",
")",
"{",
"if",
"(",
"path",
".",
"charAt",
"(",
"path",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'",
"'",
")",
"{",
"// path is already in the for... | Ensures that a provided simplified Xpath has the format <code>title[1]</code>.<p>
This method is used if it's uncertain if some path does have
a square bracket already appended or not.<p>
Note: If the name already has the format <code>title[1]</code>, then provided index parameter
is ignored.<p>
@param path the path to get the simplified Xpath for
@param index the index to append (if required)
@return the simplified Xpath for the given name | [
"Ensures",
"that",
"a",
"provided",
"simplified",
"Xpath",
"has",
"the",
"format",
"<code",
">",
"title",
"[",
"1",
"]",
"<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L237-L247 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/TimeField.java | TimeField.setCalendar | public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode)
{ // Set this field's value
if (value != null)
{
value.set(Calendar.YEAR, DBConstants.FIRST_YEAR);
value.set(Calendar.MONTH, Calendar.JANUARY);
value.set(Calendar.DATE, 1);
}
return super.setCalendar(value, bDisplayOption, moveMode);
} | java | public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode)
{ // Set this field's value
if (value != null)
{
value.set(Calendar.YEAR, DBConstants.FIRST_YEAR);
value.set(Calendar.MONTH, Calendar.JANUARY);
value.set(Calendar.DATE, 1);
}
return super.setCalendar(value, bDisplayOption, moveMode);
} | [
"public",
"int",
"setCalendar",
"(",
"Calendar",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"{",
"// Set this field's value",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
".",
"set",
"(",
"Calendar",
".",
"YEAR",
",",
"... | SetValue in current calendar.
@param value The date (as a calendar value) to set (only time portion is used).
@param bDisplayOption Display changed fields if true.
@param iMoveMode The move mode.
@return The error code (or NORMAL_RETURN). | [
"SetValue",
"in",
"current",
"calendar",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/TimeField.java#L153-L162 |
redkale/redkale | src/org/redkale/net/http/HttpRequest.java | HttpRequest.getJsonHeader | public <T> T getJsonHeader(java.lang.reflect.Type type, String name) {
String v = getHeader(name);
return v == null || v.isEmpty() ? null : jsonConvert.convertFrom(type, v);
} | java | public <T> T getJsonHeader(java.lang.reflect.Type type, String name) {
String v = getHeader(name);
return v == null || v.isEmpty() ? null : jsonConvert.convertFrom(type, v);
} | [
"public",
"<",
"T",
">",
"T",
"getJsonHeader",
"(",
"java",
".",
"lang",
".",
"reflect",
".",
"Type",
"type",
",",
"String",
"name",
")",
"{",
"String",
"v",
"=",
"getHeader",
"(",
"name",
")",
";",
"return",
"v",
"==",
"null",
"||",
"v",
".",
"i... | 获取指定的header的json值
@param <T> 泛型
@param type 反序列化的类名
@param name header名
@return header值 | [
"获取指定的header的json值"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1029-L1032 |
GCRC/nunaliit | nunaliit2-geom/src/main/java/ca/carleton/gcrc/geom/wkt/WktWriter.java | WktWriter.writeNumber | private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
if( num.doubleValue() == Math.round(num.doubleValue()) ){
// Integer
if( null != numFormat ){
pw.print( numFormat.format(num.intValue()) );
} else {
pw.print( num.intValue() );
}
} else {
if( null != numFormat ){
pw.print( numFormat.format(num) );
} else {
pw.print( num );
}
}
} | java | private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
if( num.doubleValue() == Math.round(num.doubleValue()) ){
// Integer
if( null != numFormat ){
pw.print( numFormat.format(num.intValue()) );
} else {
pw.print( num.intValue() );
}
} else {
if( null != numFormat ){
pw.print( numFormat.format(num) );
} else {
pw.print( num );
}
}
} | [
"private",
"void",
"writeNumber",
"(",
"PrintWriter",
"pw",
",",
"NumberFormat",
"numFormat",
",",
"Number",
"num",
")",
"{",
"if",
"(",
"num",
".",
"doubleValue",
"(",
")",
"==",
"Math",
".",
"round",
"(",
"num",
".",
"doubleValue",
"(",
")",
")",
")"... | Writes a number to the print writer. If the number is an integer, do not
write the decimal points.
@param pw
@param num | [
"Writes",
"a",
"number",
"to",
"the",
"print",
"writer",
".",
"If",
"the",
"number",
"is",
"an",
"integer",
"do",
"not",
"write",
"the",
"decimal",
"points",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-geom/src/main/java/ca/carleton/gcrc/geom/wkt/WktWriter.java#L284-L300 |
JOML-CI/JOML | src/org/joml/AABBf.java | AABBf.intersectRay | public boolean intersectRay(float originX, float originY, float originZ, float dirX, float dirY, float dirZ, Vector2f result) {
return Intersectionf.intersectRayAab(originX, originY, originZ, dirX, dirY, dirZ, minX, minY, minZ, maxX, maxY, maxZ, result);
} | java | public boolean intersectRay(float originX, float originY, float originZ, float dirX, float dirY, float dirZ, Vector2f result) {
return Intersectionf.intersectRayAab(originX, originY, originZ, dirX, dirY, dirZ, minX, minY, minZ, maxX, maxY, maxZ, result);
} | [
"public",
"boolean",
"intersectRay",
"(",
"float",
"originX",
",",
"float",
"originY",
",",
"float",
"originZ",
",",
"float",
"dirX",
",",
"float",
"dirY",
",",
"float",
"dirZ",
",",
"Vector2f",
"result",
")",
"{",
"return",
"Intersectionf",
".",
"intersectR... | Determine whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code>
intersects this AABB, and return the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> of the near and far point of intersection.
<p>
This method returns <code>true</code> for a ray whose origin lies inside this AABB.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@param originX
the x coordinate of the ray's origin
@param originY
the y coordinate of the ray's origin
@param originZ
the z coordinate of the ray's origin
@param dirX
the x coordinate of the ray's direction
@param dirY
the y coordinate of the ray's direction
@param dirZ
the z coordinate of the ray's direction
@param result
a vector which will hold the resulting values of the parameter
<i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection
iff the ray intersects this AABB
@return <code>true</code> if the given ray intersects this AABB; <code>false</code> otherwise | [
"Determine",
"whether",
"the",
"given",
"ray",
"with",
"the",
"origin",
"<code",
">",
"(",
"originX",
"originY",
"originZ",
")",
"<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"(",
"dirX",
"dirY",
"dirZ",
")",
"<",
"/",
"code",
">",
"intersec... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/AABBf.java#L453-L455 |
waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/LittleEndian.java | LittleEndian.setInt16 | public static void setInt16(byte[] dst, int offset, int value) {
assert (value & 0xffff) == value : "value out of range";
dst[offset + 0] = (byte) (value & 0xFF);
dst[offset + 1] = (byte) ((value >>> 8) & 0xFF);
} | java | public static void setInt16(byte[] dst, int offset, int value) {
assert (value & 0xffff) == value : "value out of range";
dst[offset + 0] = (byte) (value & 0xFF);
dst[offset + 1] = (byte) ((value >>> 8) & 0xFF);
} | [
"public",
"static",
"void",
"setInt16",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"offset",
",",
"int",
"value",
")",
"{",
"assert",
"(",
"value",
"&",
"0xffff",
")",
"==",
"value",
":",
"\"value out of range\"",
";",
"dst",
"[",
"offset",
"+",
"0",
... | Sets a 16-bit integer in the given byte array at the given offset. | [
"Sets",
"a",
"16",
"-",
"bit",
"integer",
"in",
"the",
"given",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/LittleEndian.java#L82-L87 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.deleteRecursive | private void deleteRecursive(final File file) {
if (file.isDirectory()) {
final String[] files = file.list();
if (files != null) {
for (String name : files) {
deleteRecursive(new File(file, name));
}
}
}
if (!file.delete()) {
ControllerLogger.ROOT_LOGGER.cannotDeleteFileOrDirectory(file);
}
} | java | private void deleteRecursive(final File file) {
if (file.isDirectory()) {
final String[] files = file.list();
if (files != null) {
for (String name : files) {
deleteRecursive(new File(file, name));
}
}
}
if (!file.delete()) {
ControllerLogger.ROOT_LOGGER.cannotDeleteFileOrDirectory(file);
}
} | [
"private",
"void",
"deleteRecursive",
"(",
"final",
"File",
"file",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"final",
"String",
"[",
"]",
"files",
"=",
"file",
".",
"list",
"(",
")",
";",
"if",
"(",
"files",
"!=",
"null"... | note, this just logs an error and doesn't throw as its only used to remove old configuration files, and shouldn't stop boot | [
"note",
"this",
"just",
"logs",
"an",
"error",
"and",
"doesn",
"t",
"throw",
"as",
"its",
"only",
"used",
"to",
"remove",
"old",
"configuration",
"files",
"and",
"shouldn",
"t",
"stop",
"boot"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L714-L727 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/DateTimeFormatterCache.java | DateTimeFormatterCache.getDateTimeFormatterSmart | @Nonnull
public static DateTimeFormatter getDateTimeFormatterSmart (@Nonnull @Nonempty final String sPattern)
{
return getDateTimeFormatter (sPattern, ResolverStyle.SMART);
} | java | @Nonnull
public static DateTimeFormatter getDateTimeFormatterSmart (@Nonnull @Nonempty final String sPattern)
{
return getDateTimeFormatter (sPattern, ResolverStyle.SMART);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getDateTimeFormatterSmart",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sPattern",
")",
"{",
"return",
"getDateTimeFormatter",
"(",
"sPattern",
",",
"ResolverStyle",
".",
"SMART",
")",
";",
"}... | Get the cached DateTimeFormatter using SMART resolving.
@param sPattern
The pattern to retrieve. May neither be <code>null</code> nor empty.
@return The compiled DateTimeFormatter and never <code>null</code> .
@throws IllegalArgumentException
If the pattern is invalid | [
"Get",
"the",
"cached",
"DateTimeFormatter",
"using",
"SMART",
"resolving",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/DateTimeFormatterCache.java#L91-L95 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Range range) {
return primitiveArrayGet(array, range);
} | java | @SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Range range) {
return primitiveArrayGet(array, range);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Integer",
">",
"getAt",
"(",
"int",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] | Support the subscript operator with a range for an int array
@param array an int array
@param range a range indicating the indices for the items to retrieve
@return list of the ints at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"an",
"int",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13649-L13652 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java | MethodFinder.getClass | private static Class<?> getClass(Type type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return getClass(((ParameterizedType) type).getRawType());
}
throw new RuntimeException("Could not convert " + type + " to a class, it is a " + type.getClass());
} | java | private static Class<?> getClass(Type type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return getClass(((ParameterizedType) type).getRawType());
}
throw new RuntimeException("Could not convert " + type + " to a class, it is a " + type.getClass());
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"Para... | Convert a {@link Type} to a {@link Class}
<p>
Class instances are cast, ParameterizedType instances return the result of {@link ParameterizedType#getRawType()}
@param type the type to convert
@return the class
@throws RuntimeException if Type does not represent something that can be converted to a {@link Class} | [
"Convert",
"a",
"{",
"@link",
"Type",
"}",
"to",
"a",
"{",
"@link",
"Class",
"}",
"<p",
">",
"Class",
"instances",
"are",
"cast",
"ParameterizedType",
"instances",
"return",
"the",
"result",
"of",
"{",
"@link",
"ParameterizedType#getRawType",
"()",
"}"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L296-L303 |
enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.sendMessage | @SuppressWarnings({ "unchecked", "rawtypes" })
static void sendMessage(String to, String subject, String body, String mailSessionJndiAlias)
{
jqmlogger.debug("sending mail to " + to + " - subject is " + subject);
ClassLoader extLoader = getExtClassLoader();
extLoader = extLoader == null ? Helpers.class.getClassLoader() : extLoader;
ClassLoader old = Thread.currentThread().getContextClassLoader();
Object mailSession = null;
try
{
mailSession = InitialContext.doLookup(mailSessionJndiAlias);
}
catch (NamingException e)
{
throw new JqmRuntimeException("could not find mail session description", e);
}
try
{
Thread.currentThread().setContextClassLoader(extLoader);
Class transportZ = extLoader.loadClass("javax.mail.Transport");
Class sessionZ = extLoader.loadClass("javax.mail.Session");
Class mimeMessageZ = extLoader.loadClass("javax.mail.internet.MimeMessage");
Class messageZ = extLoader.loadClass("javax.mail.Message");
Class recipientTypeZ = extLoader.loadClass("javax.mail.Message$RecipientType");
Object msg = mimeMessageZ.getConstructor(sessionZ).newInstance(mailSession);
mimeMessageZ.getMethod("setRecipients", recipientTypeZ, String.class).invoke(msg, recipientTypeZ.getField("TO").get(null), to);
mimeMessageZ.getMethod("setSubject", String.class).invoke(msg, subject);
mimeMessageZ.getMethod("setText", String.class).invoke(msg, body);
transportZ.getMethod("send", messageZ).invoke(null, msg);
jqmlogger.trace("Mail was sent");
}
catch (Exception e)
{
throw new JqmRuntimeException("an exception occurred during mail sending", e);
}
finally
{
Thread.currentThread().setContextClassLoader(old);
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
static void sendMessage(String to, String subject, String body, String mailSessionJndiAlias)
{
jqmlogger.debug("sending mail to " + to + " - subject is " + subject);
ClassLoader extLoader = getExtClassLoader();
extLoader = extLoader == null ? Helpers.class.getClassLoader() : extLoader;
ClassLoader old = Thread.currentThread().getContextClassLoader();
Object mailSession = null;
try
{
mailSession = InitialContext.doLookup(mailSessionJndiAlias);
}
catch (NamingException e)
{
throw new JqmRuntimeException("could not find mail session description", e);
}
try
{
Thread.currentThread().setContextClassLoader(extLoader);
Class transportZ = extLoader.loadClass("javax.mail.Transport");
Class sessionZ = extLoader.loadClass("javax.mail.Session");
Class mimeMessageZ = extLoader.loadClass("javax.mail.internet.MimeMessage");
Class messageZ = extLoader.loadClass("javax.mail.Message");
Class recipientTypeZ = extLoader.loadClass("javax.mail.Message$RecipientType");
Object msg = mimeMessageZ.getConstructor(sessionZ).newInstance(mailSession);
mimeMessageZ.getMethod("setRecipients", recipientTypeZ, String.class).invoke(msg, recipientTypeZ.getField("TO").get(null), to);
mimeMessageZ.getMethod("setSubject", String.class).invoke(msg, subject);
mimeMessageZ.getMethod("setText", String.class).invoke(msg, body);
transportZ.getMethod("send", messageZ).invoke(null, msg);
jqmlogger.trace("Mail was sent");
}
catch (Exception e)
{
throw new JqmRuntimeException("an exception occurred during mail sending", e);
}
finally
{
Thread.currentThread().setContextClassLoader(old);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"static",
"void",
"sendMessage",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"body",
",",
"String",
"mailSessionJndiAlias",
")",
"{",
"jqmlogger",
".",
"debug"... | Send a mail message using a JNDI resource.<br>
As JNDI resource providers are inside the EXT class loader, this uses reflection. This method is basically a bonus on top of the
MailSessionFactory offered to payloads, making it accessible also to the engine.
@param to
@param subject
@param body
@param mailSessionJndiAlias
@throws MessagingException | [
"Send",
"a",
"mail",
"message",
"using",
"a",
"JNDI",
"resource",
".",
"<br",
">",
"As",
"JNDI",
"resource",
"providers",
"are",
"inside",
"the",
"EXT",
"class",
"loader",
"this",
"uses",
"reflection",
".",
"This",
"method",
"is",
"basically",
"a",
"bonus"... | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L551-L594 |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java | MutablePropertySources.addBefore | public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'");
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} | java | public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'");
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} | [
"public",
"void",
"addBefore",
"(",
"String",
"relativePropertySourceName",
",",
"PropertySource",
"<",
"?",
">",
"propertySource",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Adding PropertySource '\... | Add the given property source object with precedence immediately higher than
the named relative property source. | [
"Add",
"the",
"given",
"property",
"source",
"object",
"with",
"precedence",
"immediately",
"higher",
"than",
"the",
"named",
"relative",
"property",
"source",
"."
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L104-L113 |
rometools/rome | rome-modules/src/main/java/com/rometools/modules/mediarss/io/RSS20YahooParser.java | RSS20YahooParser.parseChannel | @Override
protected WireFeed parseChannel(final Element rssRoot, final Locale locale) {
final WireFeed wFeed = super.parseChannel(rssRoot, locale);
wFeed.setFeedType("rss_2.0");
return wFeed;
} | java | @Override
protected WireFeed parseChannel(final Element rssRoot, final Locale locale) {
final WireFeed wFeed = super.parseChannel(rssRoot, locale);
wFeed.setFeedType("rss_2.0");
return wFeed;
} | [
"@",
"Override",
"protected",
"WireFeed",
"parseChannel",
"(",
"final",
"Element",
"rssRoot",
",",
"final",
"Locale",
"locale",
")",
"{",
"final",
"WireFeed",
"wFeed",
"=",
"super",
".",
"parseChannel",
"(",
"rssRoot",
",",
"locale",
")",
";",
"wFeed",
".",
... | After we parse the feed we put "rss_2.0" in it (so converters and generators work) this
parser is a phantom. | [
"After",
"we",
"parse",
"the",
"feed",
"we",
"put",
"rss_2",
".",
"0",
"in",
"it",
"(",
"so",
"converters",
"and",
"generators",
"work",
")",
"this",
"parser",
"is",
"a",
"phantom",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/RSS20YahooParser.java#L83-L89 |
caelum/timemachine | src/main/java/br/com/caelum/timemachine/TimeMachine.java | TimeMachine.getCurrentTimeMillisProvider | private MillisProvider getCurrentTimeMillisProvider() {
try {
Field providerField = DateTimeUtils.class.getDeclaredField("cMillisProvider");
providerField.setAccessible(true);
return (MillisProvider) providerField.get(null);
} catch (NoSuchFieldException e) {
throw new UnsupportedClassVersionError("The JodaTime version in use is not supported by TimeMachine. Try to use version 2.2");
} catch (IllegalArgumentException e) {
throw new RuntimeException("This should not happen", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("This should not happen", e);
}
} | java | private MillisProvider getCurrentTimeMillisProvider() {
try {
Field providerField = DateTimeUtils.class.getDeclaredField("cMillisProvider");
providerField.setAccessible(true);
return (MillisProvider) providerField.get(null);
} catch (NoSuchFieldException e) {
throw new UnsupportedClassVersionError("The JodaTime version in use is not supported by TimeMachine. Try to use version 2.2");
} catch (IllegalArgumentException e) {
throw new RuntimeException("This should not happen", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("This should not happen", e);
}
} | [
"private",
"MillisProvider",
"getCurrentTimeMillisProvider",
"(",
")",
"{",
"try",
"{",
"Field",
"providerField",
"=",
"DateTimeUtils",
".",
"class",
".",
"getDeclaredField",
"(",
"\"cMillisProvider\"",
")",
";",
"providerField",
".",
"setAccessible",
"(",
"true",
"... | Retrieves the {@link MillisProvider} in use for {@link DateTimeUtils} | [
"Retrieves",
"the",
"{"
] | train | https://github.com/caelum/timemachine/blob/67327e67d93b7c64ac2cdcecf77c8919832cc8b9/src/main/java/br/com/caelum/timemachine/TimeMachine.java#L133-L145 |
grpc/grpc-java | grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java | GrpclbState.flattenEquivalentAddressGroup | private static EquivalentAddressGroup flattenEquivalentAddressGroup(
List<EquivalentAddressGroup> groupList, Attributes attrs) {
List<SocketAddress> addrs = new ArrayList<>();
for (EquivalentAddressGroup group : groupList) {
addrs.addAll(group.getAddresses());
}
return new EquivalentAddressGroup(addrs, attrs);
} | java | private static EquivalentAddressGroup flattenEquivalentAddressGroup(
List<EquivalentAddressGroup> groupList, Attributes attrs) {
List<SocketAddress> addrs = new ArrayList<>();
for (EquivalentAddressGroup group : groupList) {
addrs.addAll(group.getAddresses());
}
return new EquivalentAddressGroup(addrs, attrs);
} | [
"private",
"static",
"EquivalentAddressGroup",
"flattenEquivalentAddressGroup",
"(",
"List",
"<",
"EquivalentAddressGroup",
">",
"groupList",
",",
"Attributes",
"attrs",
")",
"{",
"List",
"<",
"SocketAddress",
">",
"addrs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | Flattens list of EquivalentAddressGroup objects into one EquivalentAddressGroup object. | [
"Flattens",
"list",
"of",
"EquivalentAddressGroup",
"objects",
"into",
"one",
"EquivalentAddressGroup",
"object",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java#L791-L798 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/ensemble/StackedEnsembleModel.java | StackedEnsembleModel.predictScoreImpl | @Override
protected Frame predictScoreImpl(Frame fr, Frame adaptFrm, String destination_key, Job j, boolean computeMetrics, CFuncRef customMetricFunc) {
Frame levelOneFrame = new Frame(Key.<Frame>make("preds_levelone_" + this._key.toString() + fr._key));
// TODO: don't score models that have 0 coefficients / aren't used by the metalearner.
// also we should be able to parallelize scoring of base models
for (Key<Model> baseKey : this._parms._base_models) {
Model base = baseKey.get();
Frame basePreds = base.score(
fr,
"preds_base_" + this._key.toString() + fr._key,
j,
false
);
StackedEnsemble.addModelPredictionsToLevelOneFrame(base, basePreds, levelOneFrame);
DKV.remove(basePreds._key); //Cleanup
Frame.deleteTempFrameAndItsNonSharedVecs(basePreds, levelOneFrame);
}
// Add response column to level one frame
levelOneFrame.add(this.responseColumn, adaptFrm.vec(this.responseColumn));
// TODO: what if we're running multiple in parallel and have a name collision?
Log.info("Finished creating \"level one\" frame for scoring: " + levelOneFrame.toString());
// Score the dataset, building the class distribution & predictions
Model metalearner = this._output._metalearner;
Frame predictFr = metalearner.score(
levelOneFrame,
destination_key,
j,
computeMetrics,
CFuncRef.from(_parms._custom_metric_func)
);
if (computeMetrics) {
// #score has just stored a ModelMetrics object for the (metalearner, preds_levelone) Model/Frame pair.
// We need to be able to look it up by the (this, fr) pair.
// The ModelMetrics object for the metalearner will be removed when the metalearner is removed.
Key<ModelMetrics>[] mms = metalearner._output.getModelMetrics();
ModelMetrics lastComputedMetric = mms[mms.length - 1].get();
ModelMetrics mmStackedEnsemble = lastComputedMetric.deepCloneWithDifferentModelAndFrame(this, fr);
this.addModelMetrics(mmStackedEnsemble);
}
Frame.deleteTempFrameAndItsNonSharedVecs(levelOneFrame, adaptFrm);
return predictFr;
} | java | @Override
protected Frame predictScoreImpl(Frame fr, Frame adaptFrm, String destination_key, Job j, boolean computeMetrics, CFuncRef customMetricFunc) {
Frame levelOneFrame = new Frame(Key.<Frame>make("preds_levelone_" + this._key.toString() + fr._key));
// TODO: don't score models that have 0 coefficients / aren't used by the metalearner.
// also we should be able to parallelize scoring of base models
for (Key<Model> baseKey : this._parms._base_models) {
Model base = baseKey.get();
Frame basePreds = base.score(
fr,
"preds_base_" + this._key.toString() + fr._key,
j,
false
);
StackedEnsemble.addModelPredictionsToLevelOneFrame(base, basePreds, levelOneFrame);
DKV.remove(basePreds._key); //Cleanup
Frame.deleteTempFrameAndItsNonSharedVecs(basePreds, levelOneFrame);
}
// Add response column to level one frame
levelOneFrame.add(this.responseColumn, adaptFrm.vec(this.responseColumn));
// TODO: what if we're running multiple in parallel and have a name collision?
Log.info("Finished creating \"level one\" frame for scoring: " + levelOneFrame.toString());
// Score the dataset, building the class distribution & predictions
Model metalearner = this._output._metalearner;
Frame predictFr = metalearner.score(
levelOneFrame,
destination_key,
j,
computeMetrics,
CFuncRef.from(_parms._custom_metric_func)
);
if (computeMetrics) {
// #score has just stored a ModelMetrics object for the (metalearner, preds_levelone) Model/Frame pair.
// We need to be able to look it up by the (this, fr) pair.
// The ModelMetrics object for the metalearner will be removed when the metalearner is removed.
Key<ModelMetrics>[] mms = metalearner._output.getModelMetrics();
ModelMetrics lastComputedMetric = mms[mms.length - 1].get();
ModelMetrics mmStackedEnsemble = lastComputedMetric.deepCloneWithDifferentModelAndFrame(this, fr);
this.addModelMetrics(mmStackedEnsemble);
}
Frame.deleteTempFrameAndItsNonSharedVecs(levelOneFrame, adaptFrm);
return predictFr;
} | [
"@",
"Override",
"protected",
"Frame",
"predictScoreImpl",
"(",
"Frame",
"fr",
",",
"Frame",
"adaptFrm",
",",
"String",
"destination_key",
",",
"Job",
"j",
",",
"boolean",
"computeMetrics",
",",
"CFuncRef",
"customMetricFunc",
")",
"{",
"Frame",
"levelOneFrame",
... | For StackedEnsemble we call score on all the base_models and then combine the results
with the metalearner to create the final predictions frame.
@see Model#predictScoreImpl(Frame, Frame, String, Job, boolean, CFuncRef)
@param adaptFrm Already adapted frame
@param computeMetrics
@return A Frame containing the prediction column, and class distribution | [
"For",
"StackedEnsemble",
"we",
"call",
"score",
"on",
"all",
"the",
"base_models",
"and",
"then",
"combine",
"the",
"results",
"with",
"the",
"metalearner",
"to",
"create",
"the",
"final",
"predictions",
"frame",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/ensemble/StackedEnsembleModel.java#L120-L168 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/external/msnumpress/MSNumpress.java | MSNumpress.decodePic | public static int decodePic(
byte[] data,
int dataSize,
double[] result
) {
int ri = 0;
long count;
IntDecoder dec = new IntDecoder(data, 0);
while (dec.pos < dataSize) {
if (dec.pos == (dataSize - 1) && dec.half) {
if ((data[dec.pos] & 0xf) != 0x8) {
break;
}
}
count = dec.next();
result[ri++] = count;
}
return ri;
} | java | public static int decodePic(
byte[] data,
int dataSize,
double[] result
) {
int ri = 0;
long count;
IntDecoder dec = new IntDecoder(data, 0);
while (dec.pos < dataSize) {
if (dec.pos == (dataSize - 1) && dec.half) {
if ((data[dec.pos] & 0xf) != 0x8) {
break;
}
}
count = dec.next();
result[ri++] = count;
}
return ri;
} | [
"public",
"static",
"int",
"decodePic",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"dataSize",
",",
"double",
"[",
"]",
"result",
")",
"{",
"int",
"ri",
"=",
"0",
";",
"long",
"count",
";",
"IntDecoder",
"dec",
"=",
"new",
"IntDecoder",
"(",
"data",
... | Decodes data encoded by encodePic
<p>
result vector guaranteed to be shorter of equal to |data| * 2
<p>
Note that this method may throw a ArrayIndexOutOfBoundsException if it deems the input data to
be corrupt, i.e. that the last encoded int does not use the last byte in the data. In addition
the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0
halfbyte.
@param data array of bytes to be decoded (need memorycont. repr.)
@param dataSize number of bytes from data to decode
@param result array were resulting doubles should be stored
@return the number of decoded doubles | [
"Decodes",
"data",
"encoded",
"by",
"encodePic",
"<p",
">",
"result",
"vector",
"guaranteed",
"to",
"be",
"shorter",
"of",
"equal",
"to",
"|data|",
"*",
"2",
"<p",
">",
"Note",
"that",
"this",
"method",
"may",
"throw",
"a",
"ArrayIndexOutOfBoundsException",
... | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/external/msnumpress/MSNumpress.java#L413-L433 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/server/WatchManager.java | WatchManager.dumpWatches | public synchronized void dumpWatches(PrintWriter pwriter, boolean byPath) {
if (byPath) {
for (Entry<String, HashSet<Watcher>> e : watchTable.entrySet()) {
pwriter.println(e.getKey());
for (Watcher w : e.getValue()) {
pwriter.print("\t0x");
pwriter.print(Long.toHexString(((ServerCnxn)w).getSessionId()));
pwriter.print("\n");
}
}
} else {
for (Entry<Watcher, HashSet<String>> e : watch2Paths.entrySet()) {
pwriter.print("0x");
pwriter.println(Long.toHexString(((ServerCnxn)e.getKey()).getSessionId()));
for (String path : e.getValue()) {
pwriter.print("\t");
pwriter.println(path);
}
}
}
} | java | public synchronized void dumpWatches(PrintWriter pwriter, boolean byPath) {
if (byPath) {
for (Entry<String, HashSet<Watcher>> e : watchTable.entrySet()) {
pwriter.println(e.getKey());
for (Watcher w : e.getValue()) {
pwriter.print("\t0x");
pwriter.print(Long.toHexString(((ServerCnxn)w).getSessionId()));
pwriter.print("\n");
}
}
} else {
for (Entry<Watcher, HashSet<String>> e : watch2Paths.entrySet()) {
pwriter.print("0x");
pwriter.println(Long.toHexString(((ServerCnxn)e.getKey()).getSessionId()));
for (String path : e.getValue()) {
pwriter.print("\t");
pwriter.println(path);
}
}
}
} | [
"public",
"synchronized",
"void",
"dumpWatches",
"(",
"PrintWriter",
"pwriter",
",",
"boolean",
"byPath",
")",
"{",
"if",
"(",
"byPath",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"HashSet",
"<",
"Watcher",
">",
">",
"e",
":",
"watchTable",
".",
... | String representation of watches. Warning, may be large!
@param byPath iff true output watches by paths, otw output
watches by connection
@return string representation of watches | [
"String",
"representation",
"of",
"watches",
".",
"Warning",
"may",
"be",
"large!"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/WatchManager.java#L148-L168 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java | LazyTreeReader.seek | protected void seek(int rowIndexEntry, boolean backwards) throws IOException {
if (backwards || rowIndexEntry != computeRowIndexEntry(previousRow)) {
// initialize the previousPositionProvider
previousRowIndexEntry = rowIndexEntry;
// if the present stream exists and we are seeking backwards or to a new row Index entry
// the present stream needs to seek
if (present != null && (backwards || rowIndexEntry != computeRowIndexEntry(previousPresentRow))) {
present.seek(rowIndexEntry);
// Update previousPresentRow because the state is now as if that were the case
previousPresentRow = rowBaseInStripe + rowIndexEntry * rowIndexStride - 1;
}
seek(rowIndexEntry);
// Update previousRow because the state is now as if that were the case
previousRow = rowBaseInStripe + rowIndexEntry * rowIndexStride - 1;
}
} | java | protected void seek(int rowIndexEntry, boolean backwards) throws IOException {
if (backwards || rowIndexEntry != computeRowIndexEntry(previousRow)) {
// initialize the previousPositionProvider
previousRowIndexEntry = rowIndexEntry;
// if the present stream exists and we are seeking backwards or to a new row Index entry
// the present stream needs to seek
if (present != null && (backwards || rowIndexEntry != computeRowIndexEntry(previousPresentRow))) {
present.seek(rowIndexEntry);
// Update previousPresentRow because the state is now as if that were the case
previousPresentRow = rowBaseInStripe + rowIndexEntry * rowIndexStride - 1;
}
seek(rowIndexEntry);
// Update previousRow because the state is now as if that were the case
previousRow = rowBaseInStripe + rowIndexEntry * rowIndexStride - 1;
}
} | [
"protected",
"void",
"seek",
"(",
"int",
"rowIndexEntry",
",",
"boolean",
"backwards",
")",
"throws",
"IOException",
"{",
"if",
"(",
"backwards",
"||",
"rowIndexEntry",
"!=",
"computeRowIndexEntry",
"(",
"previousRow",
")",
")",
"{",
"// initialize the previousPosit... | Adjust all streams to the beginning of the row index entry specified, backwards means that
a previous value is being read and forces the index entry to be restarted, otherwise, has
no effect if we're already in the current index entry
@param rowIndexEntry
@param backwards
@throws IOException | [
"Adjust",
"all",
"streams",
"to",
"the",
"beginning",
"of",
"the",
"row",
"index",
"entry",
"specified",
"backwards",
"means",
"that",
"a",
"previous",
"value",
"is",
"being",
"read",
"and",
"forces",
"the",
"index",
"entry",
"to",
"be",
"restarted",
"otherw... | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L300-L315 |
paypal/SeLion | server/src/main/java/com/paypal/selion/grid/FileDownloader.java | FileDownloader.checkForDownloads | static void checkForDownloads(List<String> artifactNames, boolean checkTimeStamp, boolean cleanup) {
LOGGER.entering();
if (checkTimeStamp && (lastModifiedTime == DOWNLOAD_FILE.lastModified())) {
return;
}
lastModifiedTime = DOWNLOAD_FILE.lastModified();
if (cleanup) {
cleanup();
}
List<URLChecksumEntity> artifactDetails = new ArrayList<ArtifactDetails.URLChecksumEntity>();
try {
artifactDetails = ArtifactDetails.getArtifactDetailsForCurrentPlatformByNames(DOWNLOAD_FILE, artifactNames);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Unable to open download.json file", e);
throw new RuntimeException(e);
}
downloadAndExtractArtifacts(artifactDetails);
LOGGER.exiting();
} | java | static void checkForDownloads(List<String> artifactNames, boolean checkTimeStamp, boolean cleanup) {
LOGGER.entering();
if (checkTimeStamp && (lastModifiedTime == DOWNLOAD_FILE.lastModified())) {
return;
}
lastModifiedTime = DOWNLOAD_FILE.lastModified();
if (cleanup) {
cleanup();
}
List<URLChecksumEntity> artifactDetails = new ArrayList<ArtifactDetails.URLChecksumEntity>();
try {
artifactDetails = ArtifactDetails.getArtifactDetailsForCurrentPlatformByNames(DOWNLOAD_FILE, artifactNames);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Unable to open download.json file", e);
throw new RuntimeException(e);
}
downloadAndExtractArtifacts(artifactDetails);
LOGGER.exiting();
} | [
"static",
"void",
"checkForDownloads",
"(",
"List",
"<",
"String",
">",
"artifactNames",
",",
"boolean",
"checkTimeStamp",
",",
"boolean",
"cleanup",
")",
"{",
"LOGGER",
".",
"entering",
"(",
")",
";",
"if",
"(",
"checkTimeStamp",
"&&",
"(",
"lastModifiedTime"... | Check download.json and download files based on artifact names
@param artifactNames
the artifact names to download
@param checkTimeStamp
whether to check the last modified time stamp of the downlaod.json file. Returns immediately on
subsequent calls if <code>true</code> and last modified is unchanged.
@param cleanup
whether to cleanup previous downloads from a previous call to
checkForDownloads in the same JVM | [
"Check",
"download",
".",
"json",
"and",
"download",
"files",
"based",
"on",
"artifact",
"names"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/FileDownloader.java#L111-L134 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/CatalogUtil.java | CatalogUtil.loadAndUpgradeCatalogFromJar | public static Pair<InMemoryJarfile, String> loadAndUpgradeCatalogFromJar(byte[] catalogBytes, boolean isXDCR)
throws IOException
{
// Throws IOException on load failure.
InMemoryJarfile jarfile = loadInMemoryJarFile(catalogBytes);
return loadAndUpgradeCatalogFromJar(jarfile, isXDCR);
} | java | public static Pair<InMemoryJarfile, String> loadAndUpgradeCatalogFromJar(byte[] catalogBytes, boolean isXDCR)
throws IOException
{
// Throws IOException on load failure.
InMemoryJarfile jarfile = loadInMemoryJarFile(catalogBytes);
return loadAndUpgradeCatalogFromJar(jarfile, isXDCR);
} | [
"public",
"static",
"Pair",
"<",
"InMemoryJarfile",
",",
"String",
">",
"loadAndUpgradeCatalogFromJar",
"(",
"byte",
"[",
"]",
"catalogBytes",
",",
"boolean",
"isXDCR",
")",
"throws",
"IOException",
"{",
"// Throws IOException on load failure.",
"InMemoryJarfile",
"jarf... | Load a catalog from the jar bytes.
@param catalogBytes
@param isXDCR
@return Pair containing updated InMemoryJarFile and upgraded version (or null if it wasn't upgraded)
@throws IOException
If the catalog cannot be loaded because it's incompatible, or
if there is no version information in the catalog. | [
"Load",
"a",
"catalog",
"from",
"the",
"jar",
"bytes",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L254-L261 |
lucee/Lucee | core/src/main/java/lucee/runtime/osgi/OSGiUtil.java | OSGiUtil.installBundle | public static Bundle installBundle(BundleContext context, Resource bundle, boolean checkExistence) throws IOException, BundleException {
if (checkExistence) {
BundleFile bf = new BundleFile(bundle);
if (!bf.isBundle()) throw new BundleException(bundle + " is not a valid bundle!");
Bundle existing = loadBundleFromLocal(context, bf.getSymbolicName(), bf.getVersion(), false, null);
if (existing != null) return existing;
}
return _loadBundle(context, bundle.getAbsolutePath(), bundle.getInputStream(), true);
} | java | public static Bundle installBundle(BundleContext context, Resource bundle, boolean checkExistence) throws IOException, BundleException {
if (checkExistence) {
BundleFile bf = new BundleFile(bundle);
if (!bf.isBundle()) throw new BundleException(bundle + " is not a valid bundle!");
Bundle existing = loadBundleFromLocal(context, bf.getSymbolicName(), bf.getVersion(), false, null);
if (existing != null) return existing;
}
return _loadBundle(context, bundle.getAbsolutePath(), bundle.getInputStream(), true);
} | [
"public",
"static",
"Bundle",
"installBundle",
"(",
"BundleContext",
"context",
",",
"Resource",
"bundle",
",",
"boolean",
"checkExistence",
")",
"throws",
"IOException",
",",
"BundleException",
"{",
"if",
"(",
"checkExistence",
")",
"{",
"BundleFile",
"bf",
"=",
... | only installs a bundle, if the bundle does not already exist, if the bundle exists the existing
bundle is unloaded first.
@param factory
@param context
@param bundle
@return
@throws IOException
@throws BundleException | [
"only",
"installs",
"a",
"bundle",
"if",
"the",
"bundle",
"does",
"not",
"already",
"exist",
"if",
"the",
"bundle",
"exists",
"the",
"existing",
"bundle",
"is",
"unloaded",
"first",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L103-L113 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsSubscriptionDriver.java | CmsSubscriptionDriver.addVisit | protected void addVisit(CmsDbContext dbc, String poolName, CmsVisitEntry visit) throws CmsDbSqlException {
Connection conn = null;
PreparedStatement stmt = null;
try {
if (CmsStringUtil.isNotEmpty(poolName)) {
conn = m_sqlManager.getConnection(poolName);
} else {
conn = m_sqlManager.getConnection(dbc);
}
stmt = m_sqlManager.getPreparedStatement(conn, "C_VISIT_CREATE_3");
stmt.setString(1, visit.getUserId().toString());
stmt.setLong(2, visit.getDate());
stmt.setString(3, visit.getStructureId() == null ? null : visit.getStructureId().toString());
try {
stmt.executeUpdate();
} catch (SQLException e) {
// ignore, most likely a duplicate entry
LOG.debug(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)).key(),
e);
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
try {
m_sqlManager.closeAll(dbc, conn, stmt, null);
} catch (Throwable t) {
// this could happen during shutdown
LOG.debug(t.getLocalizedMessage(), t);
}
}
} | java | protected void addVisit(CmsDbContext dbc, String poolName, CmsVisitEntry visit) throws CmsDbSqlException {
Connection conn = null;
PreparedStatement stmt = null;
try {
if (CmsStringUtil.isNotEmpty(poolName)) {
conn = m_sqlManager.getConnection(poolName);
} else {
conn = m_sqlManager.getConnection(dbc);
}
stmt = m_sqlManager.getPreparedStatement(conn, "C_VISIT_CREATE_3");
stmt.setString(1, visit.getUserId().toString());
stmt.setLong(2, visit.getDate());
stmt.setString(3, visit.getStructureId() == null ? null : visit.getStructureId().toString());
try {
stmt.executeUpdate();
} catch (SQLException e) {
// ignore, most likely a duplicate entry
LOG.debug(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)).key(),
e);
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
try {
m_sqlManager.closeAll(dbc, conn, stmt, null);
} catch (Throwable t) {
// this could happen during shutdown
LOG.debug(t.getLocalizedMessage(), t);
}
}
} | [
"protected",
"void",
"addVisit",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"poolName",
",",
"CmsVisitEntry",
"visit",
")",
"throws",
"CmsDbSqlException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"try",
"{",
"... | Adds an entry to the table of visits.<p>
@param dbc the database context to use
@param poolName the name of the database pool to use
@param visit the visit bean
@throws CmsDbSqlException if the database operation fails | [
"Adds",
"an",
"entry",
"to",
"the",
"table",
"of",
"visits",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSubscriptionDriver.java#L892-L930 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java | ParserDDL.processAlterTableAddUniqueConstraint | void processAlterTableAddUniqueConstraint(Table table, HsqlName name, boolean assumeUnique) {
boolean isAutogeneratedName = false;
if (name == null) {
name = database.nameManager.newAutoName("CT",
table.getSchemaName(), table.getName(),
SchemaObject.CONSTRAINT);
isAutogeneratedName = true;
}
// A VoltDB extension to "readColumnList(table, false)" to support indexed expressions.
java.util.List<Expression> indexExprs = XreadExpressions(null);
OrderedHashSet set = getSimpleColumnNames(indexExprs);
int[] cols = getColumnList(set, table);
/* disable 1 line ...
int[] cols = this.readColumnList(table, false);
... disabled 1 line */
// End of VoltDB extension
session.commit(false);
TableWorks tableWorks = new TableWorks(session, table);
// A VoltDB extension to support indexed expressions and the assume unique attribute
if ((indexExprs != null) && (cols == null)) {
// A VoltDB extension to support indexed expressions.
// Not just indexing columns.
// The meaning of cols shifts here to be
// the set of unique base columns for the indexed expressions.
set = getBaseColumnNames(indexExprs);
cols = getColumnList(set, table);
tableWorks.addUniqueExprConstraint(cols, indexExprs.toArray(new Expression[indexExprs.size()]), name, isAutogeneratedName, assumeUnique);
return;
}
tableWorks.addUniqueConstraint(cols, name, isAutogeneratedName, assumeUnique);
/* disable 1 line ...
tableWorks.addUniqueConstraint(cols, name);
... disabled 1 line */
// End of VoltDB extension
} | java | void processAlterTableAddUniqueConstraint(Table table, HsqlName name, boolean assumeUnique) {
boolean isAutogeneratedName = false;
if (name == null) {
name = database.nameManager.newAutoName("CT",
table.getSchemaName(), table.getName(),
SchemaObject.CONSTRAINT);
isAutogeneratedName = true;
}
// A VoltDB extension to "readColumnList(table, false)" to support indexed expressions.
java.util.List<Expression> indexExprs = XreadExpressions(null);
OrderedHashSet set = getSimpleColumnNames(indexExprs);
int[] cols = getColumnList(set, table);
/* disable 1 line ...
int[] cols = this.readColumnList(table, false);
... disabled 1 line */
// End of VoltDB extension
session.commit(false);
TableWorks tableWorks = new TableWorks(session, table);
// A VoltDB extension to support indexed expressions and the assume unique attribute
if ((indexExprs != null) && (cols == null)) {
// A VoltDB extension to support indexed expressions.
// Not just indexing columns.
// The meaning of cols shifts here to be
// the set of unique base columns for the indexed expressions.
set = getBaseColumnNames(indexExprs);
cols = getColumnList(set, table);
tableWorks.addUniqueExprConstraint(cols, indexExprs.toArray(new Expression[indexExprs.size()]), name, isAutogeneratedName, assumeUnique);
return;
}
tableWorks.addUniqueConstraint(cols, name, isAutogeneratedName, assumeUnique);
/* disable 1 line ...
tableWorks.addUniqueConstraint(cols, name);
... disabled 1 line */
// End of VoltDB extension
} | [
"void",
"processAlterTableAddUniqueConstraint",
"(",
"Table",
"table",
",",
"HsqlName",
"name",
",",
"boolean",
"assumeUnique",
")",
"{",
"boolean",
"isAutogeneratedName",
"=",
"false",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"name",
"=",
"database",
"... | A VoltDB extension to support indexed expressions and the assume unique attribute | [
"A",
"VoltDB",
"extension",
"to",
"support",
"indexed",
"expressions",
"and",
"the",
"assume",
"unique",
"attribute"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3915-L3954 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexController.java | CmsFlexController.updateDates | public void updateDates(long dateLastModified, long dateExpires) {
int pos = m_flexContextInfoList.size() - 1;
if (pos < 0) {
// ensure a valid position is used
return;
}
(m_flexContextInfoList.get(pos)).updateDates(dateLastModified, dateExpires);
} | java | public void updateDates(long dateLastModified, long dateExpires) {
int pos = m_flexContextInfoList.size() - 1;
if (pos < 0) {
// ensure a valid position is used
return;
}
(m_flexContextInfoList.get(pos)).updateDates(dateLastModified, dateExpires);
} | [
"public",
"void",
"updateDates",
"(",
"long",
"dateLastModified",
",",
"long",
"dateExpires",
")",
"{",
"int",
"pos",
"=",
"m_flexContextInfoList",
".",
"size",
"(",
")",
"-",
"1",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"// ensure a valid position is use... | Updates the "last modified" date and the "expires" date
for all resources read during this request with the given values.<p>
The currently stored value for "last modified" is only updated with the new value if
the new value is either larger (i.e. newer) then the stored value,
or if the new value is less then zero, which indicates that the "last modified"
optimization can not be used because the element is dynamic.<p>
The stored "expires" value is only updated if the new value is smaller
then the stored value.<p>
@param dateLastModified the value to update the "last modified" date with
@param dateExpires the value to update the "expires" date with | [
"Updates",
"the",
"last",
"modified",
"date",
"and",
"the",
"expires",
"date",
"for",
"all",
"resources",
"read",
"during",
"this",
"request",
"with",
"the",
"given",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L705-L713 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingRpcService.java | ThrottlingRpcService.newDecorator | public static Function<Service<RpcRequest, RpcResponse>, ThrottlingRpcService>
newDecorator(ThrottlingStrategy<RpcRequest> strategy) {
requireNonNull(strategy, "strategy");
return delegate -> new ThrottlingRpcService(delegate, strategy);
} | java | public static Function<Service<RpcRequest, RpcResponse>, ThrottlingRpcService>
newDecorator(ThrottlingStrategy<RpcRequest> strategy) {
requireNonNull(strategy, "strategy");
return delegate -> new ThrottlingRpcService(delegate, strategy);
} | [
"public",
"static",
"Function",
"<",
"Service",
"<",
"RpcRequest",
",",
"RpcResponse",
">",
",",
"ThrottlingRpcService",
">",
"newDecorator",
"(",
"ThrottlingStrategy",
"<",
"RpcRequest",
">",
"strategy",
")",
"{",
"requireNonNull",
"(",
"strategy",
",",
"\"strate... | Creates a new decorator using the specified {@link ThrottlingStrategy} instance.
@param strategy The {@link ThrottlingStrategy} instance to be used | [
"Creates",
"a",
"new",
"decorator",
"using",
"the",
"specified",
"{",
"@link",
"ThrottlingStrategy",
"}",
"instance",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingRpcService.java#L40-L44 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/LocalDateTime.java | LocalDateTime.ofInstant | public static LocalDateTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
ZoneRules rules = zone.getRules();
ZoneOffset offset = rules.getOffset(instant);
return ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset);
} | java | public static LocalDateTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
ZoneRules rules = zone.getRules();
ZoneOffset offset = rules.getOffset(instant);
return ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset);
} | [
"public",
"static",
"LocalDateTime",
"ofInstant",
"(",
"Instant",
"instant",
",",
"ZoneId",
"zone",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"instant",
",",
"\"instant\"",
")",
";",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"zone",
",",
"\"zone\"",
... | Obtains an instance of {@code LocalDateTime} from an {@code Instant} and zone ID.
<p>
This creates a local date-time based on the specified instant.
First, the offset from UTC/Greenwich is obtained using the zone ID and instant,
which is simple as there is only one valid offset for each instant.
Then, the instant and offset are used to calculate the local date-time.
@param instant the instant to create the date-time from, not null
@param zone the time-zone, which may be an offset, not null
@return the local date-time, not null
@throws DateTimeException if the result exceeds the supported range | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"LocalDateTime",
"}",
"from",
"an",
"{",
"@code",
"Instant",
"}",
"and",
"zone",
"ID",
".",
"<p",
">",
"This",
"creates",
"a",
"local",
"date",
"-",
"time",
"based",
"on",
"the",
"specified",
"instant",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalDateTime.java#L353-L359 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/buttonGroup/ButtonGroupRenderer.java | ButtonGroupRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ButtonGroup buttonGroup = (ButtonGroup) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset(buttonGroup, rw);
rw.endElement("div");
String responsive = Responsive.getResponsiveStyleClass(buttonGroup, false).trim();
if(responsive.length() > 0) {
rw.endElement("div");
}
Tooltip.activateTooltips(context, buttonGroup);
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ButtonGroup buttonGroup = (ButtonGroup) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset(buttonGroup, rw);
rw.endElement("div");
String responsive = Responsive.getResponsiveStyleClass(buttonGroup, false).trim();
if(responsive.length() > 0) {
rw.endElement("div");
}
Tooltip.activateTooltips(context, buttonGroup);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"ButtonGroup",
"button... | This methods generates the HTML code of the current b:buttonGroup.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:buttonGroup.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"buttonGroup",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framewor... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/buttonGroup/ButtonGroupRenderer.java#L112-L126 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_ssl_id_PUT | public void serviceName_ssl_id_PUT(String serviceName, Long id, OvhSsl body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/ssl/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_ssl_id_PUT(String serviceName, Long id, OvhSsl body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/ssl/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_ssl_id_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"id",
",",
"OvhSsl",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/ssl/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"("... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/ssl/{id}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param id [required] Id of your SSL certificate | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1886-L1890 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/util/TextUtils.java | TextUtils.startsWith | public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final CharSequence prefix) {
if (text == null) {
throw new IllegalArgumentException("Text cannot be null");
}
if (prefix == null) {
throw new IllegalArgumentException("Prefix cannot be null");
}
if (text instanceof String && prefix instanceof String) {
return (caseSensitive ? ((String)text).startsWith((String)prefix) : startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length()));
}
return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length());
} | java | public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final CharSequence prefix) {
if (text == null) {
throw new IllegalArgumentException("Text cannot be null");
}
if (prefix == null) {
throw new IllegalArgumentException("Prefix cannot be null");
}
if (text instanceof String && prefix instanceof String) {
return (caseSensitive ? ((String)text).startsWith((String)prefix) : startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length()));
}
return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length());
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"final",
"boolean",
"caseSensitive",
",",
"final",
"CharSequence",
"text",
",",
"final",
"CharSequence",
"prefix",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | <p>
Checks whether a text starts with a specified prefix.
</p>
@param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
@param text the text to be checked for prefixes.
@param prefix the prefix to be searched.
@return whether the text starts with the prefix or not. | [
"<p",
">",
"Checks",
"whether",
"a",
"text",
"starts",
"with",
"a",
"specified",
"prefix",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L334-L349 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java | UserService.retrieveAuthenticatedUser | public ModeledAuthenticatedUser retrieveAuthenticatedUser(AuthenticationProvider authenticationProvider,
Credentials credentials) throws GuacamoleException {
// Get username and password
String username = credentials.getUsername();
String password = credentials.getPassword();
// Retrieve corresponding user model, if such a user exists
UserModel userModel = userMapper.selectOne(username);
if (userModel == null)
return null;
// Verify provided password is correct
byte[] hash = encryptionService.createPasswordHash(password, userModel.getPasswordSalt());
if (!Arrays.equals(hash, userModel.getPasswordHash()))
return null;
// Create corresponding user object, set up cyclic reference
ModeledUser user = getObjectInstance(null, userModel);
user.setCurrentUser(new ModeledAuthenticatedUser(authenticationProvider, user, credentials));
// Return now-authenticated user
return user.getCurrentUser();
} | java | public ModeledAuthenticatedUser retrieveAuthenticatedUser(AuthenticationProvider authenticationProvider,
Credentials credentials) throws GuacamoleException {
// Get username and password
String username = credentials.getUsername();
String password = credentials.getPassword();
// Retrieve corresponding user model, if such a user exists
UserModel userModel = userMapper.selectOne(username);
if (userModel == null)
return null;
// Verify provided password is correct
byte[] hash = encryptionService.createPasswordHash(password, userModel.getPasswordSalt());
if (!Arrays.equals(hash, userModel.getPasswordHash()))
return null;
// Create corresponding user object, set up cyclic reference
ModeledUser user = getObjectInstance(null, userModel);
user.setCurrentUser(new ModeledAuthenticatedUser(authenticationProvider, user, credentials));
// Return now-authenticated user
return user.getCurrentUser();
} | [
"public",
"ModeledAuthenticatedUser",
"retrieveAuthenticatedUser",
"(",
"AuthenticationProvider",
"authenticationProvider",
",",
"Credentials",
"credentials",
")",
"throws",
"GuacamoleException",
"{",
"// Get username and password",
"String",
"username",
"=",
"credentials",
".",
... | Retrieves the user corresponding to the given credentials from the
database. Note that this function will not enforce any additional
account restrictions, including explicitly disabled accounts,
scheduling, and password expiration. It is the responsibility of the
caller to enforce such restrictions, if desired.
@param authenticationProvider
The AuthenticationProvider on behalf of which the user is being
retrieved.
@param credentials
The credentials to use when locating the user.
@return
An AuthenticatedUser containing the existing ModeledUser object if
the credentials given are valid, null otherwise.
@throws GuacamoleException
If the provided credentials to not conform to expectations. | [
"Retrieves",
"the",
"user",
"corresponding",
"to",
"the",
"given",
"credentials",
"from",
"the",
"database",
".",
"Note",
"that",
"this",
"function",
"will",
"not",
"enforce",
"any",
"additional",
"account",
"restrictions",
"including",
"explicitly",
"disabled",
"... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java#L357-L381 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/message/process/TrxMessageListener.java | TrxMessageListener.handleMessage | public int handleMessage(BaseMessage message)
{
String strClassName = this.getMessageProcessorClassName(message);
if ((strClassName == null) || (strClassName.length() == 0))
return this.handleOtherMessage(message);
message.consume(); // I'll be handling this one.
String strParams = Utility.addURLParam(null, DBParams.PROCESS, strClassName);
App application = m_application;
if (message.getProcessedByClientSession() instanceof RemoteTask)
if (message.getProcessedByClientSession() instanceof Task) // Always
application = ((Task)message.getProcessedByClientSession()).getApplication(); // If I have the task session, run this task under the same app
MessageProcessRunnerTask task = new MessageProcessRunnerTask(application, strParams, null);
task.setMessage(message);
m_application.getTaskScheduler().addTask(task);
return DBConstants.NORMAL_RETURN; // No need to call super.
} | java | public int handleMessage(BaseMessage message)
{
String strClassName = this.getMessageProcessorClassName(message);
if ((strClassName == null) || (strClassName.length() == 0))
return this.handleOtherMessage(message);
message.consume(); // I'll be handling this one.
String strParams = Utility.addURLParam(null, DBParams.PROCESS, strClassName);
App application = m_application;
if (message.getProcessedByClientSession() instanceof RemoteTask)
if (message.getProcessedByClientSession() instanceof Task) // Always
application = ((Task)message.getProcessedByClientSession()).getApplication(); // If I have the task session, run this task under the same app
MessageProcessRunnerTask task = new MessageProcessRunnerTask(application, strParams, null);
task.setMessage(message);
m_application.getTaskScheduler().addTask(task);
return DBConstants.NORMAL_RETURN; // No need to call super.
} | [
"public",
"int",
"handleMessage",
"(",
"BaseMessage",
"message",
")",
"{",
"String",
"strClassName",
"=",
"this",
".",
"getMessageProcessorClassName",
"(",
"message",
")",
";",
"if",
"(",
"(",
"strClassName",
"==",
"null",
")",
"||",
"(",
"strClassName",
".",
... | Handle this message.
Get the name of this process and run it. | [
"Handle",
"this",
"message",
".",
"Get",
"the",
"name",
"of",
"this",
"process",
"and",
"run",
"it",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/process/TrxMessageListener.java#L97-L112 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java | Manager.sendMessageDelayed | private void sendMessageDelayed(Crouton crouton, final int messageId, final long delay) {
Message message = obtainMessage(messageId);
message.obj = crouton;
sendMessageDelayed(message, delay);
} | java | private void sendMessageDelayed(Crouton crouton, final int messageId, final long delay) {
Message message = obtainMessage(messageId);
message.obj = crouton;
sendMessageDelayed(message, delay);
} | [
"private",
"void",
"sendMessageDelayed",
"(",
"Crouton",
"crouton",
",",
"final",
"int",
"messageId",
",",
"final",
"long",
"delay",
")",
"{",
"Message",
"message",
"=",
"obtainMessage",
"(",
"messageId",
")",
";",
"message",
".",
"obj",
"=",
"crouton",
";",... | Sends a {@link Crouton} within a delayed {@link Message}.
@param crouton
The {@link Crouton} that should be sent.
@param messageId
The {@link Message} id.
@param delay
The delay in milliseconds. | [
"Sends",
"a",
"{",
"@link",
"Crouton",
"}",
"within",
"a",
"delayed",
"{",
"@link",
"Message",
"}",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java#L142-L146 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.adjustMetaDirectoryNames | protected static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
adjustMetaDirectoryName(conf, DFS_NAMENODE_NAME_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_EDITS_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_CHECKPOINT_DIR_KEY, serviceKey);
adjustMetaDirectoryName(
conf, DFS_NAMENODE_CHECKPOINT_EDITS_DIR_KEY, serviceKey);
} | java | protected static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
adjustMetaDirectoryName(conf, DFS_NAMENODE_NAME_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_EDITS_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_CHECKPOINT_DIR_KEY, serviceKey);
adjustMetaDirectoryName(
conf, DFS_NAMENODE_CHECKPOINT_EDITS_DIR_KEY, serviceKey);
} | [
"protected",
"static",
"void",
"adjustMetaDirectoryNames",
"(",
"Configuration",
"conf",
",",
"String",
"serviceKey",
")",
"{",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_NAMENODE_NAME_DIR_KEY",
",",
"serviceKey",
")",
";",
"adjustMetaDirectoryName",
"(",
"conf",... | Append service name to each meta directory name
@param conf configuration of NameNode
@param serviceKey the non-empty name of the name node service | [
"Append",
"service",
"name",
"to",
"each",
"meta",
"directory",
"name"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L570-L576 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java | ArrayIterate.forEach | public static <T> void forEach(T[] objectArray, int from, int to, Procedure<? super T> procedure)
{
if (objectArray == null)
{
throw new IllegalArgumentException("Cannot perform a forEach on null");
}
ListIterate.rangeCheck(from, to, objectArray.length);
InternalArrayIterate.forEachWithoutChecks(objectArray, from, to, procedure);
} | java | public static <T> void forEach(T[] objectArray, int from, int to, Procedure<? super T> procedure)
{
if (objectArray == null)
{
throw new IllegalArgumentException("Cannot perform a forEach on null");
}
ListIterate.rangeCheck(from, to, objectArray.length);
InternalArrayIterate.forEachWithoutChecks(objectArray, from, to, procedure);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forEach",
"(",
"T",
"[",
"]",
"objectArray",
",",
"int",
"from",
",",
"int",
"to",
",",
"Procedure",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
"if",
"(",
"objectArray",
"==",
"null",
")",
"{",
... | Iterates over the section of the list covered by the specified inclusive indexes. The indexes are
both inclusive. | [
"Iterates",
"over",
"the",
"section",
"of",
"the",
"list",
"covered",
"by",
"the",
"specified",
"inclusive",
"indexes",
".",
"The",
"indexes",
"are",
"both",
"inclusive",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L774-L783 |
Wadpam/guja | guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java | GAEBlobServlet.doPost | @Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getRequestURI().endsWith("upload")) {
uploadCallback(req, resp);
} else {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} | java | @Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getRequestURI().endsWith("upload")) {
uploadCallback(req, resp);
} else {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} | [
"@",
"Override",
"public",
"void",
"doPost",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"if",
"(",
"req",
".",
"getRequestURI",
"(",
")",
".",
"endsWith",
"(",
"\"upload\"",
... | Url paths supported
/api/blob/upload (POST) Default callback after a successful upload | [
"Url",
"paths",
"supported",
"/",
"api",
"/",
"blob",
"/",
"upload",
"(",
"POST",
")",
"Default",
"callback",
"after",
"a",
"successful",
"upload"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java#L75-L82 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.updateClient | public Client updateClient(String clientId, Client client, AccessToken accessToken) {
return getAuthService().updateClient(clientId, client, accessToken);
} | java | public Client updateClient(String clientId, Client client, AccessToken accessToken) {
return getAuthService().updateClient(clientId, client, accessToken);
} | [
"public",
"Client",
"updateClient",
"(",
"String",
"clientId",
",",
"Client",
"client",
",",
"AccessToken",
"accessToken",
")",
"{",
"return",
"getAuthService",
"(",
")",
".",
"updateClient",
"(",
"clientId",
",",
"client",
",",
"accessToken",
")",
";",
"}"
] | Get OSIAM OAuth client by the given ID.
@param clientId the id of the client which should be updated
@param client the client
@param accessToken the access token used to access the service
@return The updated client
@throws UnauthorizedException if the accessToken is not valid
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws ConflictException if the client with the clientId already exists
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured | [
"Get",
"OSIAM",
"OAuth",
"client",
"by",
"the",
"given",
"ID",
"."
] | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L695-L697 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toTitleCase | public static String toTitleCase(Locale locale, String str,
BreakIterator breakiter)
{
return toTitleCase(locale, str, breakiter, 0);
} | java | public static String toTitleCase(Locale locale, String str,
BreakIterator breakiter)
{
return toTitleCase(locale, str, breakiter, 0);
} | [
"public",
"static",
"String",
"toTitleCase",
"(",
"Locale",
"locale",
",",
"String",
"str",
",",
"BreakIterator",
"breakiter",
")",
"{",
"return",
"toTitleCase",
"(",
"locale",
",",
"str",
",",
"breakiter",
",",
"0",
")",
";",
"}"
] | <p>Returns the titlecase version of the argument string.
<p>Position for titlecasing is determined by the argument break
iterator, hence the user can customize his break iterator for
a specialized titlecasing. In this case only the forward iteration
needs to be implemented.
If the break iterator passed in is null, the default Unicode algorithm
will be used to determine the titlecase positions.
<p>Only positions returned by the break iterator will be title cased,
character in between the positions will all be in lower case.
<p>Casing is dependent on the argument locale and context-sensitive
@param locale which string is to be converted in
@param str source string to be performed on
@param breakiter break iterator to determine the positions in which
the character should be title cased.
@return lowercase version of the argument string | [
"<p",
">",
"Returns",
"the",
"titlecase",
"version",
"of",
"the",
"argument",
"string",
".",
"<p",
">",
"Position",
"for",
"titlecasing",
"is",
"determined",
"by",
"the",
"argument",
"break",
"iterator",
"hence",
"the",
"user",
"can",
"customize",
"his",
"br... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4466-L4470 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasModelImport.java | KerasModelImport.importKerasModelAndWeights | public static ComputationGraph importKerasModelAndWeights( InputStream modelHdf5Stream, boolean enforceTrainingConfig)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException{
File f = null;
try{
f = toTempFile(modelHdf5Stream);
return importKerasModelAndWeights(f.getAbsolutePath(), enforceTrainingConfig);
} finally {
if(f != null)
f.delete();
}
} | java | public static ComputationGraph importKerasModelAndWeights( InputStream modelHdf5Stream, boolean enforceTrainingConfig)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException{
File f = null;
try{
f = toTempFile(modelHdf5Stream);
return importKerasModelAndWeights(f.getAbsolutePath(), enforceTrainingConfig);
} finally {
if(f != null)
f.delete();
}
} | [
"public",
"static",
"ComputationGraph",
"importKerasModelAndWeights",
"(",
"InputStream",
"modelHdf5Stream",
",",
"boolean",
"enforceTrainingConfig",
")",
"throws",
"IOException",
",",
"UnsupportedKerasConfigurationException",
",",
"InvalidKerasConfigurationException",
"{",
"File... | Load Keras (Functional API) Model saved using model.save_model(...).
@param modelHdf5Stream InputStream containing HDF5 archive storing Keras Model
@param enforceTrainingConfig whether to enforce training configuration options
@return ComputationGraph
@see ComputationGraph | [
"Load",
"Keras",
"(",
"Functional",
"API",
")",
"Model",
"saved",
"using",
"model",
".",
"save_model",
"(",
"...",
")",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasModelImport.java#L50-L60 |
alkacon/opencms-core | src/org/opencms/report/A_CmsReportThread.java | A_CmsReportThread.initOldHtmlReport | @Deprecated
protected void initOldHtmlReport(Locale locale) {
m_report = new CmsHtmlReport(locale, m_cms.getRequestContext().getSiteRoot(), true, false);
} | java | @Deprecated
protected void initOldHtmlReport(Locale locale) {
m_report = new CmsHtmlReport(locale, m_cms.getRequestContext().getSiteRoot(), true, false);
} | [
"@",
"Deprecated",
"protected",
"void",
"initOldHtmlReport",
"(",
"Locale",
"locale",
")",
"{",
"m_report",
"=",
"new",
"CmsHtmlReport",
"(",
"locale",
",",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
",",
"true",
",",
"false",... | Initialize a HTML report for this Thread.<p>
This method is reserved for older report threads that still use
XML templates to generate their output.<p>
<em>This report type will not work correctly with the new workplace, so don't use it anymore.</em>
@param locale the locale for the report output messages | [
"Initialize",
"a",
"HTML",
"report",
"for",
"this",
"Thread",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/report/A_CmsReportThread.java#L270-L274 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseBitwiseXorExpression | private Expr parseBitwiseXorExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseBitwiseAndExpression(scope, terminated);
if (tryAndMatch(terminated, Caret) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseXor(Type.Byte, new Tuple<>(lhs, rhs)), start);
}
return lhs;
} | java | private Expr parseBitwiseXorExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseBitwiseAndExpression(scope, terminated);
if (tryAndMatch(terminated, Caret) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseXor(Type.Byte, new Tuple<>(lhs, rhs)), start);
}
return lhs;
} | [
"private",
"Expr",
"parseBitwiseXorExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"Expr",
"lhs",
"=",
"parseBitwiseAndExpression",
"(",
"scope",
",",
"terminated",
")",
";",
"if",
"(",
"t... | Parse an bitwise "exclusive or" expression
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"bitwise",
"exclusive",
"or",
"expression"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1790-L1800 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java | ByteBufJsonHelper.findSectionClosingPosition | public static int findSectionClosingPosition(ByteBuf buf, char openingChar, char closingChar) {
return buf.forEachByte(new ClosingPositionBufProcessor(openingChar, closingChar, true));
} | java | public static int findSectionClosingPosition(ByteBuf buf, char openingChar, char closingChar) {
return buf.forEachByte(new ClosingPositionBufProcessor(openingChar, closingChar, true));
} | [
"public",
"static",
"int",
"findSectionClosingPosition",
"(",
"ByteBuf",
"buf",
",",
"char",
"openingChar",
",",
"char",
"closingChar",
")",
"{",
"return",
"buf",
".",
"forEachByte",
"(",
"new",
"ClosingPositionBufProcessor",
"(",
"openingChar",
",",
"closingChar",
... | Finds the position of the correct closing character, taking into account the fact that before the correct one,
other sub section with same opening and closing characters can be encountered.
This implementation starts for the current {@link ByteBuf#readerIndex() readerIndex}.
@param buf the {@link ByteBuf} where to search for the end of a section enclosed in openingChar and closingChar.
@param openingChar the section opening char, used to detect a sub-section.
@param closingChar the section closing char, used to detect the end of a sub-section / this section.
@return the section closing position or -1 if not found. | [
"Finds",
"the",
"position",
"of",
"the",
"correct",
"closing",
"character",
"taking",
"into",
"account",
"the",
"fact",
"that",
"before",
"the",
"correct",
"one",
"other",
"sub",
"section",
"with",
"same",
"opening",
"and",
"closing",
"characters",
"can",
"be"... | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java#L90-L92 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.throwJCEMissingError | public static void throwJCEMissingError(String operation, Exception ex)
throws SnowflakeSQLException
{
// Most likely cause: Unlimited strength policy files not installed
String msg = "Strong encryption with Java JRE requires JCE " +
"Unlimited Strength Jurisdiction Policy files. " +
"Follow JDBC client installation instructions " +
"provided by Snowflake or contact Snowflake Support.";
logger.error("JCE Unlimited Strength policy files missing: {}. {}.",
ex.getMessage(), ex.getCause().getMessage());
String bootLib = java.lang.System.getProperty("sun.boot.library.path");
if (bootLib != null)
{
msg += " The target directory on your system is: " +
Paths.get(bootLib, "security").toString();
logger.error(msg);
}
throw new SnowflakeSQLException(ex, SqlState.SYSTEM_ERROR,
ErrorCode.AWS_CLIENT_ERROR.getMessageCode(), operation, msg);
} | java | public static void throwJCEMissingError(String operation, Exception ex)
throws SnowflakeSQLException
{
// Most likely cause: Unlimited strength policy files not installed
String msg = "Strong encryption with Java JRE requires JCE " +
"Unlimited Strength Jurisdiction Policy files. " +
"Follow JDBC client installation instructions " +
"provided by Snowflake or contact Snowflake Support.";
logger.error("JCE Unlimited Strength policy files missing: {}. {}.",
ex.getMessage(), ex.getCause().getMessage());
String bootLib = java.lang.System.getProperty("sun.boot.library.path");
if (bootLib != null)
{
msg += " The target directory on your system is: " +
Paths.get(bootLib, "security").toString();
logger.error(msg);
}
throw new SnowflakeSQLException(ex, SqlState.SYSTEM_ERROR,
ErrorCode.AWS_CLIENT_ERROR.getMessageCode(), operation, msg);
} | [
"public",
"static",
"void",
"throwJCEMissingError",
"(",
"String",
"operation",
",",
"Exception",
"ex",
")",
"throws",
"SnowflakeSQLException",
"{",
"// Most likely cause: Unlimited strength policy files not installed",
"String",
"msg",
"=",
"\"Strong encryption with Java JRE req... | /*
Handles an InvalidKeyException which indicates that the JCE component
is not installed properly
@param operation a string indicating the the operation type, e.g. upload/download
@param ex The exception to be handled
@throws throws the error as a SnowflakeSQLException | [
"/",
"*",
"Handles",
"an",
"InvalidKeyException",
"which",
"indicates",
"that",
"the",
"JCE",
"component",
"is",
"not",
"installed",
"properly"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2958-L2979 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java | CWF2XML.toXML | public static String toXML(BaseComponent root, String... excludedProperties) {
return XMLUtil.toString(toDocument(root, excludedProperties));
} | java | public static String toXML(BaseComponent root, String... excludedProperties) {
return XMLUtil.toString(toDocument(root, excludedProperties));
} | [
"public",
"static",
"String",
"toXML",
"(",
"BaseComponent",
"root",
",",
"String",
"...",
"excludedProperties",
")",
"{",
"return",
"XMLUtil",
".",
"toString",
"(",
"toDocument",
"(",
"root",
",",
"excludedProperties",
")",
")",
";",
"}"
] | Returns an XML-formatted string that mirrors the CWF component tree starting at the specified
root.
@param root BaseComponent whose subtree is to be traversed.
@param excludedProperties An optional list of properties that should be excluded from the
output. These may either be the property name (e.g., "uuid") or a property name
qualified by a component name (e.g., "window.uuid"). Optionally, an entry may be
followed by an "=" and a value to exclude matches with a specific value. Note that
"innerAttrs" and "outerAttrs" are always excluded.
@return The XML text representation of the component subtree. | [
"Returns",
"an",
"XML",
"-",
"formatted",
"string",
"that",
"mirrors",
"the",
"CWF",
"component",
"tree",
"starting",
"at",
"the",
"specified",
"root",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L90-L92 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jpa/HibernateMetrics.java | HibernateMetrics.monitor | public static void monitor(MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, String... tags) {
monitor(registry, sessionFactory, sessionFactoryName, Tags.of(tags));
} | java | public static void monitor(MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, String... tags) {
monitor(registry, sessionFactory, sessionFactoryName, Tags.of(tags));
} | [
"public",
"static",
"void",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"SessionFactory",
"sessionFactory",
",",
"String",
"sessionFactoryName",
",",
"String",
"...",
"tags",
")",
"{",
"monitor",
"(",
"registry",
",",
"sessionFactory",
",",
"sessionFactoryName... | Create {@code HibernateMetrics} and bind to the specified meter registry.
@param registry meter registry to use
@param sessionFactory session factory to use
@param sessionFactoryName session factory name as a tag value
@param tags additional tags | [
"Create",
"{",
"@code",
"HibernateMetrics",
"}",
"and",
"bind",
"to",
"the",
"specified",
"meter",
"registry",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jpa/HibernateMetrics.java#L58-L60 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU16.java | InterleavedU16.getBand | @Override
public int getBand(int x, int y, int band) {
if (!isInBounds(x, y))
throw new ImageAccessException("Requested pixel is out of bounds.");
if (band < 0 || band >= numBands)
throw new ImageAccessException("Invalid band requested.");
return data[getIndex(x, y, band)] & 0xFFFF;
} | java | @Override
public int getBand(int x, int y, int band) {
if (!isInBounds(x, y))
throw new ImageAccessException("Requested pixel is out of bounds.");
if (band < 0 || band >= numBands)
throw new ImageAccessException("Invalid band requested.");
return data[getIndex(x, y, band)] & 0xFFFF;
} | [
"@",
"Override",
"public",
"int",
"getBand",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"band",
")",
"{",
"if",
"(",
"!",
"isInBounds",
"(",
"x",
",",
"y",
")",
")",
"throw",
"new",
"ImageAccessException",
"(",
"\"Requested pixel is out of bounds.\"",
... | Returns the value of the specified band in the specified pixel.
@param x pixel coordinate.
@param y pixel coordinate.
@param band which color band in the pixel
@return an intensity value. | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"band",
"in",
"the",
"specified",
"pixel",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU16.java#L65-L73 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java | InputUtils.addClassName | public static String addClassName(String className, String key) {
return className.toLowerCase() + "." + key.toLowerCase();
} | java | public static String addClassName(String className, String key) {
return className.toLowerCase() + "." + key.toLowerCase();
} | [
"public",
"static",
"String",
"addClassName",
"(",
"String",
"className",
",",
"String",
"key",
")",
"{",
"return",
"className",
".",
"toLowerCase",
"(",
")",
"+",
"\".\"",
"+",
"key",
".",
"toLowerCase",
"(",
")",
";",
"}"
] | Used by InputHandlers.
Allows combining of few Maps into one Map.
In order to avoid "collisions" - Map Class name is user as prefix
@param className Map Class name
@param key Map key
@return unique key | [
"Used",
"by",
"InputHandlers",
".",
"Allows",
"combining",
"of",
"few",
"Maps",
"into",
"one",
"Map",
".",
"In",
"order",
"to",
"avoid",
"collisions",
"-",
"Map",
"Class",
"name",
"is",
"user",
"as",
"prefix"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java#L112-L114 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/IntArray.java | IntArray.getInstance | public static IntArray getInstance(byte[] buffer, int offset, int length)
{
return getInstance(buffer, offset, length, 8, ByteOrder.BIG_ENDIAN);
} | java | public static IntArray getInstance(byte[] buffer, int offset, int length)
{
return getInstance(buffer, offset, length, 8, ByteOrder.BIG_ENDIAN);
} | [
"public",
"static",
"IntArray",
"getInstance",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"buffer",
",",
"offset",
",",
"length",
",",
"8",
",",
"ByteOrder",
".",
"BIG_ENDIAN",
")"... | Creates IntArray backed by byte array
@param buffer
@param offset
@param length
@return | [
"Creates",
"IntArray",
"backed",
"by",
"byte",
"array"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L73-L76 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.detachVolume | public void detachVolume(String volumeId, String instanceId) {
this.detachVolume(new DetachVolumeRequest().withVolumeId(volumeId).withInstanceId(instanceId));
} | java | public void detachVolume(String volumeId, String instanceId) {
this.detachVolume(new DetachVolumeRequest().withVolumeId(volumeId).withInstanceId(instanceId));
} | [
"public",
"void",
"detachVolume",
"(",
"String",
"volumeId",
",",
"String",
"instanceId",
")",
"{",
"this",
".",
"detachVolume",
"(",
"new",
"DetachVolumeRequest",
"(",
")",
".",
"withVolumeId",
"(",
"volumeId",
")",
".",
"withInstanceId",
"(",
"instanceId",
"... | Detaching the specified volume from a specified instance.
You can detach the specified volume from a specified instance only
when the instance is Running or Stopped ,
otherwise,it's will get <code>409</code> errorCode.
@param volumeId The id of the volume which has been attached to specified instance.
@param instanceId The id of the instance which will be detached a volume. | [
"Detaching",
"the",
"specified",
"volume",
"from",
"a",
"specified",
"instance",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L998-L1000 |
soabase/exhibitor | exhibitor-core/src/main/java/com/netflix/exhibitor/core/analyze/PathAnalyzer.java | PathAnalyzer.analyze | public Analysis analyze() throws Exception
{
AtomicReference<String> error = new AtomicReference<String>(null);
Map<String, PathComplete> loadedPaths = loadedPaths(paths, error);
if ( error.get() != null )
{
return new Analysis(error.get(), Lists.<PathComplete>newArrayList(), Lists.<Set<String>>newArrayList());
}
List<Node> resourceAllocationGraph = buildResourceAllocationGraph(loadedPaths);
List<Set<String>> possibleCycles = checkForCycles(resourceAllocationGraph, loadedPaths);
return new Analysis(null, loadedPaths.values(), possibleCycles);
} | java | public Analysis analyze() throws Exception
{
AtomicReference<String> error = new AtomicReference<String>(null);
Map<String, PathComplete> loadedPaths = loadedPaths(paths, error);
if ( error.get() != null )
{
return new Analysis(error.get(), Lists.<PathComplete>newArrayList(), Lists.<Set<String>>newArrayList());
}
List<Node> resourceAllocationGraph = buildResourceAllocationGraph(loadedPaths);
List<Set<String>> possibleCycles = checkForCycles(resourceAllocationGraph, loadedPaths);
return new Analysis(null, loadedPaths.values(), possibleCycles);
} | [
"public",
"Analysis",
"analyze",
"(",
")",
"throws",
"Exception",
"{",
"AtomicReference",
"<",
"String",
">",
"error",
"=",
"new",
"AtomicReference",
"<",
"String",
">",
"(",
"null",
")",
";",
"Map",
"<",
"String",
",",
"PathComplete",
">",
"loadedPaths",
... | Perform the analysis and return the results. Always check {@link Analysis#getError()}
to see if there was an error generating the results.
@return analysis
@throws Exception unrecoverable errors | [
"Perform",
"the",
"analysis",
"and",
"return",
"the",
"results",
".",
"Always",
"check",
"{",
"@link",
"Analysis#getError",
"()",
"}",
"to",
"see",
"if",
"there",
"was",
"an",
"error",
"generating",
"the",
"results",
"."
] | train | https://github.com/soabase/exhibitor/blob/d345d2d45c75b0694b562b6c346f8594f3a5d166/exhibitor-core/src/main/java/com/netflix/exhibitor/core/analyze/PathAnalyzer.java#L77-L90 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java | ManagedPropertyPersistenceHelper.generateFieldPersistance | public static void generateFieldPersistance(BindTypeContext context, List<? extends ManagedModelProperty> collection, PersistType persistType, boolean forceName, Modifier... modifiers) {
for (ManagedModelProperty property : collection) {
if (property.bindProperty != null && !property.hasTypeAdapter()) {
// if defined a forced typeName, we use it to define every json
// mapping, to allow comparison with parameters
if (forceName)
property.bindProperty.label = DEFAULT_FIELD_NAME;
BindTransformer.checkIfIsInUnsupportedPackage(property.bindProperty.getPropertyType().getTypeName());
generateFieldSerialize(context, persistType, property.bindProperty, modifiers);
generateFieldParser(context, persistType, property.bindProperty, modifiers);
}
}
} | java | public static void generateFieldPersistance(BindTypeContext context, List<? extends ManagedModelProperty> collection, PersistType persistType, boolean forceName, Modifier... modifiers) {
for (ManagedModelProperty property : collection) {
if (property.bindProperty != null && !property.hasTypeAdapter()) {
// if defined a forced typeName, we use it to define every json
// mapping, to allow comparison with parameters
if (forceName)
property.bindProperty.label = DEFAULT_FIELD_NAME;
BindTransformer.checkIfIsInUnsupportedPackage(property.bindProperty.getPropertyType().getTypeName());
generateFieldSerialize(context, persistType, property.bindProperty, modifiers);
generateFieldParser(context, persistType, property.bindProperty, modifiers);
}
}
} | [
"public",
"static",
"void",
"generateFieldPersistance",
"(",
"BindTypeContext",
"context",
",",
"List",
"<",
"?",
"extends",
"ManagedModelProperty",
">",
"collection",
",",
"PersistType",
"persistType",
",",
"boolean",
"forceName",
",",
"Modifier",
"...",
"modifiers",... | Manage field's persistence for both in SharedPreference and SQLite flavours.
@param context the context
@param collection the collection
@param persistType the persist type
@param forceName the force name
@param modifiers the modifiers | [
"Manage",
"field",
"s",
"persistence",
"for",
"both",
"in",
"SharedPreference",
"and",
"SQLite",
"flavours",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java#L75-L91 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/xml/XmlBeanAssert.java | XmlBeanAssert.assertEquals | public static void assertEquals(String message, XmlObject expected, XmlObject actual)
{
assertEquals(message, expected.newCursor(), actual.newCursor());
} | java | public static void assertEquals(String message, XmlObject expected, XmlObject actual)
{
assertEquals(message, expected.newCursor(), actual.newCursor());
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"message",
",",
"XmlObject",
"expected",
",",
"XmlObject",
"actual",
")",
"{",
"assertEquals",
"(",
"message",
",",
"expected",
".",
"newCursor",
"(",
")",
",",
"actual",
".",
"newCursor",
"(",
")",
... | Asserts that two XmlBeans are equivalent based on a deep compare (ignoring
whitespace and ordering of element attributes). If the two XmlBeans are
not equivalent, an AssertionFailedError is thrown, failing the test case.
Note: we can't provide line numbers since XmlBeans only makes these available
if we're using the Picollo parser. We'll get line numbers when we upgrade to
XmlBeans 2.0.
@param message to display on test failure (may be null)
@param expected
@param actual | [
"Asserts",
"that",
"two",
"XmlBeans",
"are",
"equivalent",
"based",
"on",
"a",
"deep",
"compare",
"(",
"ignoring",
"whitespace",
"and",
"ordering",
"of",
"element",
"attributes",
")",
".",
"If",
"the",
"two",
"XmlBeans",
"are",
"not",
"equivalent",
"an",
"As... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/xml/XmlBeanAssert.java#L67-L70 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.exclusiveBetween | @SuppressWarnings("boxing")
public static double exclusiveBetween(double start, double end, double value) {
return INSTANCE.exclusiveBetween(start, end, value);
} | java | @SuppressWarnings("boxing")
public static double exclusiveBetween(double start, double end, double value) {
return INSTANCE.exclusiveBetween(start, end, value);
} | [
"@",
"SuppressWarnings",
"(",
"\"boxing\"",
")",
"public",
"static",
"double",
"exclusiveBetween",
"(",
"double",
"start",
",",
"double",
"end",
",",
"double",
"value",
")",
"{",
"return",
"INSTANCE",
".",
"exclusiveBetween",
"(",
"start",
",",
"end",
",",
"... | Validate that the specified primitive value falls between the two exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0.1, 2.1, 1.1);</pre>
@param start
the exclusive start value
@param end
the exclusive end value
@param value
the value to validate
@return the value
@throws IllegalArgumentValidationException
if the value falls out of the boundaries | [
"Validate",
"that",
"the",
"specified",
"primitive",
"value",
"falls",
"between",
"the",
"two",
"exclusive",
"values",
"specified",
";",
"otherwise",
"throws",
"an",
"exception",
".",
"<pre",
">",
"Validate",
".",
"exclusiveBetween",
"(",
"0",
".",
"1",
"2",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1662-L1665 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.rotationXYZ | public Quaternionf rotationXYZ(float angleX, float angleY, float angleZ) {
float sx = (float) Math.sin(angleX * 0.5);
float cx = (float) Math.cosFromSin(sx, angleX * 0.5);
float sy = (float) Math.sin(angleY * 0.5);
float cy = (float) Math.cosFromSin(sy, angleY * 0.5);
float sz = (float) Math.sin(angleZ * 0.5);
float cz = (float) Math.cosFromSin(sz, angleZ * 0.5);
float cycz = cy * cz;
float sysz = sy * sz;
float sycz = sy * cz;
float cysz = cy * sz;
w = cx*cycz - sx*sysz;
x = sx*cycz + cx*sysz;
y = cx*sycz - sx*cysz;
z = cx*cysz + sx*sycz;
return this;
} | java | public Quaternionf rotationXYZ(float angleX, float angleY, float angleZ) {
float sx = (float) Math.sin(angleX * 0.5);
float cx = (float) Math.cosFromSin(sx, angleX * 0.5);
float sy = (float) Math.sin(angleY * 0.5);
float cy = (float) Math.cosFromSin(sy, angleY * 0.5);
float sz = (float) Math.sin(angleZ * 0.5);
float cz = (float) Math.cosFromSin(sz, angleZ * 0.5);
float cycz = cy * cz;
float sysz = sy * sz;
float sycz = sy * cz;
float cysz = cy * sz;
w = cx*cycz - sx*sysz;
x = sx*cycz + cx*sysz;
y = cx*sycz - sx*cysz;
z = cx*cysz + sx*sycz;
return this;
} | [
"public",
"Quaternionf",
"rotationXYZ",
"(",
"float",
"angleX",
",",
"float",
"angleY",
",",
"float",
"angleZ",
")",
"{",
"float",
"sx",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"angleX",
"*",
"0.5",
")",
";",
"float",
"cx",
"=",
"(",
"float"... | Set this quaternion from the supplied euler angles (in radians) with rotation order XYZ.
<p>
This method is equivalent to calling: <code>rotationX(angleX).rotateY(angleY).rotateZ(angleZ)</code>
<p>
Reference: <a href="http://gamedev.stackexchange.com/questions/13436/glm-euler-angles-to-quaternion#answer-13446">this stackexchange answer</a>
@param angleX
the angle in radians to rotate about x
@param angleY
the angle in radians to rotate about y
@param angleZ
the angle in radians to rotate about z
@return this | [
"Set",
"this",
"quaternion",
"from",
"the",
"supplied",
"euler",
"angles",
"(",
"in",
"radians",
")",
"with",
"rotation",
"order",
"XYZ",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"rotationX",
"(",
"angleX",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L1635-L1653 |
yidongnan/grpc-spring-boot-starter | grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/autoconfigure/GrpcServerFactoryAutoConfiguration.java | GrpcServerFactoryAutoConfiguration.shadedNettyGrpcServerFactory | @ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel",
"io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder"})
@Bean
public ShadedNettyGrpcServerFactory shadedNettyGrpcServerFactory(final GrpcServerProperties properties,
final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) {
final ShadedNettyGrpcServerFactory factory = new ShadedNettyGrpcServerFactory(properties, serverConfigurers);
for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) {
factory.addService(service);
}
return factory;
} | java | @ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel",
"io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder"})
@Bean
public ShadedNettyGrpcServerFactory shadedNettyGrpcServerFactory(final GrpcServerProperties properties,
final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) {
final ShadedNettyGrpcServerFactory factory = new ShadedNettyGrpcServerFactory(properties, serverConfigurers);
for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) {
factory.addService(service);
}
return factory;
} | [
"@",
"ConditionalOnClass",
"(",
"name",
"=",
"{",
"\"io.grpc.netty.shaded.io.netty.channel.Channel\"",
",",
"\"io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder\"",
"}",
")",
"@",
"Bean",
"public",
"ShadedNettyGrpcServerFactory",
"shadedNettyGrpcServerFactory",
"(",
"final",
... | Creates a GrpcServerFactory using the shaded netty. This is the recommended default for gRPC.
@param properties The properties used to configure the server.
@param serviceDiscoverer The discoverer used to identify the services that should be served.
@param serverConfigurers The server configurers that contain additional configuration for the server.
@return The shadedNettyGrpcServerFactory bean. | [
"Creates",
"a",
"GrpcServerFactory",
"using",
"the",
"shaded",
"netty",
".",
"This",
"is",
"the",
"recommended",
"default",
"for",
"gRPC",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/autoconfigure/GrpcServerFactoryAutoConfiguration.java#L60-L70 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java | AOStream.removeConsumerKey | public final void removeConsumerKey(String selector, JSRemoteConsumerPoint aock)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerKey", new Object[] { selector, aock });
synchronized (this)
{
JSRemoteConsumerPoint aock2 = (JSRemoteConsumerPoint) consumerKeyTable.get(selector);
if (aock2 == aock)
{ // the object is still in the table
consumerKeyTable.remove(selector);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerKey");
} | java | public final void removeConsumerKey(String selector, JSRemoteConsumerPoint aock)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerKey", new Object[] { selector, aock });
synchronized (this)
{
JSRemoteConsumerPoint aock2 = (JSRemoteConsumerPoint) consumerKeyTable.get(selector);
if (aock2 == aock)
{ // the object is still in the table
consumerKeyTable.remove(selector);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerKey");
} | [
"public",
"final",
"void",
"removeConsumerKey",
"(",
"String",
"selector",
",",
"JSRemoteConsumerPoint",
"aock",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry... | Method to remove the given JSRemoteConsumerPoint from the consumerKeyTable
@param selector The string representation of the SelectionCriteria(s) of this JSRemoteConsumerPoint
@param aock The JSRemoteConsumerPoint to remove | [
"Method",
"to",
"remove",
"the",
"given",
"JSRemoteConsumerPoint",
"from",
"the",
"consumerKeyTable"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L1068-L1084 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java | AbstractSequenceClassifier.makePlainTextReaderAndWriter | public DocumentReaderAndWriter<IN> makePlainTextReaderAndWriter() {
String readerClassName = flags.plainTextDocumentReaderAndWriter;
// We set this default here if needed because there may be models
// which don't have the reader flag set
if (readerClassName == null) {
readerClassName = SeqClassifierFlags.DEFAULT_PLAIN_TEXT_READER;
}
DocumentReaderAndWriter<IN> readerAndWriter;
try {
readerAndWriter = ((DocumentReaderAndWriter<IN>) Class.forName(readerClassName).newInstance());
} catch (Exception e) {
throw new RuntimeException(String.format("Error loading flags.plainTextDocumentReaderAndWriter: '%s'", flags.plainTextDocumentReaderAndWriter), e);
}
readerAndWriter.init(flags);
return readerAndWriter;
} | java | public DocumentReaderAndWriter<IN> makePlainTextReaderAndWriter() {
String readerClassName = flags.plainTextDocumentReaderAndWriter;
// We set this default here if needed because there may be models
// which don't have the reader flag set
if (readerClassName == null) {
readerClassName = SeqClassifierFlags.DEFAULT_PLAIN_TEXT_READER;
}
DocumentReaderAndWriter<IN> readerAndWriter;
try {
readerAndWriter = ((DocumentReaderAndWriter<IN>) Class.forName(readerClassName).newInstance());
} catch (Exception e) {
throw new RuntimeException(String.format("Error loading flags.plainTextDocumentReaderAndWriter: '%s'", flags.plainTextDocumentReaderAndWriter), e);
}
readerAndWriter.init(flags);
return readerAndWriter;
} | [
"public",
"DocumentReaderAndWriter",
"<",
"IN",
">",
"makePlainTextReaderAndWriter",
"(",
")",
"{",
"String",
"readerClassName",
"=",
"flags",
".",
"plainTextDocumentReaderAndWriter",
";",
"// We set this default here if needed because there may be models\r",
"// which don't have t... | Makes a DocumentReaderAndWriter based on
flags.plainTextReaderAndWriter. Useful for reading in
untokenized text documents or reading plain text from the command
line. An example of a way to use this would be to return a
edu.stanford.nlp.wordseg.Sighan2005DocumentReaderAndWriter for
the Chinese Segmenter. | [
"Makes",
"a",
"DocumentReaderAndWriter",
"based",
"on",
"flags",
".",
"plainTextReaderAndWriter",
".",
"Useful",
"for",
"reading",
"in",
"untokenized",
"text",
"documents",
"or",
"reading",
"plain",
"text",
"from",
"the",
"command",
"line",
".",
"An",
"example",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L224-L239 |
kaazing/gateway | mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java | NioDatagramPipelineSink.eventSunk | public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e)
throws Exception {
final NioDatagramChannel channel = (NioDatagramChannel) e.getChannel();
final ChannelFuture future = e.getFuture();
if (e instanceof ChannelStateEvent) {
final ChannelStateEvent stateEvent = (ChannelStateEvent) e;
final ChannelState state = stateEvent.getState();
final Object value = stateEvent.getValue();
switch (state) {
case OPEN:
if (Boolean.FALSE.equals(value)) {
channel.worker.close(channel, future);
}
break;
case BOUND:
if (value != null) {
bind(channel, future, (InetSocketAddress) value);
} else {
channel.worker.close(channel, future);
}
break;
case CONNECTED:
if (value != null) {
connect(channel, future, (InetSocketAddress) value);
} else {
NioServerDatagramBoss.disconnect(channel, future);
}
break;
case INTEREST_OPS:
channel.worker.setInterestOps(channel, future, ((Integer) value).intValue());
break;
}
} else if (e instanceof MessageEvent) {
final MessageEvent event = (MessageEvent) e;
final boolean offered = channel.writeBufferQueue.offer(event);
assert offered;
channel.worker.writeFromUserCode(channel);
}
} | java | public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e)
throws Exception {
final NioDatagramChannel channel = (NioDatagramChannel) e.getChannel();
final ChannelFuture future = e.getFuture();
if (e instanceof ChannelStateEvent) {
final ChannelStateEvent stateEvent = (ChannelStateEvent) e;
final ChannelState state = stateEvent.getState();
final Object value = stateEvent.getValue();
switch (state) {
case OPEN:
if (Boolean.FALSE.equals(value)) {
channel.worker.close(channel, future);
}
break;
case BOUND:
if (value != null) {
bind(channel, future, (InetSocketAddress) value);
} else {
channel.worker.close(channel, future);
}
break;
case CONNECTED:
if (value != null) {
connect(channel, future, (InetSocketAddress) value);
} else {
NioServerDatagramBoss.disconnect(channel, future);
}
break;
case INTEREST_OPS:
channel.worker.setInterestOps(channel, future, ((Integer) value).intValue());
break;
}
} else if (e instanceof MessageEvent) {
final MessageEvent event = (MessageEvent) e;
final boolean offered = channel.writeBufferQueue.offer(event);
assert offered;
channel.worker.writeFromUserCode(channel);
}
} | [
"public",
"void",
"eventSunk",
"(",
"final",
"ChannelPipeline",
"pipeline",
",",
"final",
"ChannelEvent",
"e",
")",
"throws",
"Exception",
"{",
"final",
"NioDatagramChannel",
"channel",
"=",
"(",
"NioDatagramChannel",
")",
"e",
".",
"getChannel",
"(",
")",
";",
... | Handle downstream event.
@param pipeline the {@link ChannelPipeline} that passes down the
downstream event.
@param e The downstream event. | [
"Handle",
"downstream",
"event",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java#L58-L96 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java | UtilMath.getRound | public static double getRound(double speed, double value)
{
if (speed < 0)
{
return Math.floor(value);
}
return Math.ceil(value);
} | java | public static double getRound(double speed, double value)
{
if (speed < 0)
{
return Math.floor(value);
}
return Math.ceil(value);
} | [
"public",
"static",
"double",
"getRound",
"(",
"double",
"speed",
",",
"double",
"value",
")",
"{",
"if",
"(",
"speed",
"<",
"0",
")",
"{",
"return",
"Math",
".",
"floor",
"(",
"value",
")",
";",
"}",
"return",
"Math",
".",
"ceil",
"(",
"value",
")... | Get the rounded floor or ceil value depending of the speed.
@param speed The speed value.
@param value The value to round.
@return The floor value if negative speed, ceil if positive speed. | [
"Get",
"the",
"rounded",
"floor",
"or",
"ceil",
"value",
"depending",
"of",
"the",
"speed",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L35-L42 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/listeners/AddResourcesListener.java | AddResourcesListener.findBsfComponent | public static UIComponent findBsfComponent(UIComponent parent, String targetLib) {
if (targetLib.equalsIgnoreCase((String) parent.getAttributes().get("library"))) {
return parent;
}
Iterator<UIComponent> kids = parent.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent found = findBsfComponent(kids.next(), targetLib);
if (found != null) {
return found;
}
}
return null;
} | java | public static UIComponent findBsfComponent(UIComponent parent, String targetLib) {
if (targetLib.equalsIgnoreCase((String) parent.getAttributes().get("library"))) {
return parent;
}
Iterator<UIComponent> kids = parent.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent found = findBsfComponent(kids.next(), targetLib);
if (found != null) {
return found;
}
}
return null;
} | [
"public",
"static",
"UIComponent",
"findBsfComponent",
"(",
"UIComponent",
"parent",
",",
"String",
"targetLib",
")",
"{",
"if",
"(",
"targetLib",
".",
"equalsIgnoreCase",
"(",
"(",
"String",
")",
"parent",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"\... | Check all components in page to find one that has as resource library the
target library. I use this method to check existence of a BsF component
because, at this level, the getComponentResource returns always null
@param parent the parent component
@param targetLib the lib to search
@return | [
"Check",
"all",
"components",
"in",
"page",
"to",
"find",
"one",
"that",
"has",
"as",
"resource",
"library",
"the",
"target",
"library",
".",
"I",
"use",
"this",
"method",
"to",
"check",
"existence",
"of",
"a",
"BsF",
"component",
"because",
"at",
"this",
... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/listeners/AddResourcesListener.java#L183-L195 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java | CertificateOperations.cancelDeleteCertificate | public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateCancelDeletionOptions options = new CertificateCancelDeletionOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().cancelDeletion(thumbprintAlgorithm, thumbprint, options);
} | java | public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateCancelDeletionOptions options = new CertificateCancelDeletionOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().cancelDeletion(thumbprintAlgorithm, thumbprint, options);
} | [
"public",
"void",
"cancelDeleteCertificate",
"(",
"String",
"thumbprintAlgorithm",
",",
"String",
"thumbprint",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"CertificateCancelDeletion... | Cancels a failed deletion of the specified certificate. This operation can be performed only when
the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores
the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state.
@param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
@param thumbprint The thumbprint of the certificate that failed to delete.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Cancels",
"a",
"failed",
"deletion",
"of",
"the",
"specified",
"certificate",
".",
"This",
"operation",
"can",
"be",
"performed",
"only",
"when",
"the",
"certificate",
"is",
"in",
"the",
"{",
"@link",
"com",
".",
"microsoft",
".",
"azure",
".",
"batch",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L180-L186 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/NullProducer.java | NullProducer.produceResults | public void produceResults(Consumer<T> consumer, ProducerContext context) {
consumer.onNewResult((T) null, Consumer.IS_LAST);
} | java | public void produceResults(Consumer<T> consumer, ProducerContext context) {
consumer.onNewResult((T) null, Consumer.IS_LAST);
} | [
"public",
"void",
"produceResults",
"(",
"Consumer",
"<",
"T",
">",
"consumer",
",",
"ProducerContext",
"context",
")",
"{",
"consumer",
".",
"onNewResult",
"(",
"(",
"T",
")",
"null",
",",
"Consumer",
".",
"IS_LAST",
")",
";",
"}"
] | Start producing results for given context. Provided consumer is notified whenever progress is
made (new value is ready or error occurs).
@param consumer
@param context | [
"Start",
"producing",
"results",
"for",
"given",
"context",
".",
"Provided",
"consumer",
"is",
"notified",
"whenever",
"progress",
"is",
"made",
"(",
"new",
"value",
"is",
"ready",
"or",
"error",
"occurs",
")",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/NullProducer.java#L24-L26 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/contact/Grid.java | Grid.addAtoms | public void addAtoms(Atom[] atoms, BoundingBox bounds) {
this.iAtoms = Calc.atomsToPoints(atoms);
this.iAtomObjects = atoms;
if (bounds!=null) {
this.ibounds = bounds;
} else {
this.ibounds = new BoundingBox(iAtoms);
}
this.jAtoms = null;
this.jAtomObjects = null;
this.jbounds = null;
fillGrid();
} | java | public void addAtoms(Atom[] atoms, BoundingBox bounds) {
this.iAtoms = Calc.atomsToPoints(atoms);
this.iAtomObjects = atoms;
if (bounds!=null) {
this.ibounds = bounds;
} else {
this.ibounds = new BoundingBox(iAtoms);
}
this.jAtoms = null;
this.jAtomObjects = null;
this.jbounds = null;
fillGrid();
} | [
"public",
"void",
"addAtoms",
"(",
"Atom",
"[",
"]",
"atoms",
",",
"BoundingBox",
"bounds",
")",
"{",
"this",
".",
"iAtoms",
"=",
"Calc",
".",
"atomsToPoints",
"(",
"atoms",
")",
";",
"this",
".",
"iAtomObjects",
"=",
"atoms",
";",
"if",
"(",
"bounds",... | Adds a set of atoms, subsequent call to {@link #getIndicesContacts()} or {@link #getAtomContacts()} will produce the interatomic contacts.
The bounds calculated elsewhere can be passed, or if null they are computed.
@param atoms
@param bounds | [
"Adds",
"a",
"set",
"of",
"atoms",
"subsequent",
"call",
"to",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/Grid.java#L175-L190 |
ronmamo/reflections | src/main/java/org/reflections/Reflections.java | Reflections.getMethodsAnnotatedWith | public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) {
Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName());
return getMethodsFromDescriptors(methods, loaders());
} | java | public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) {
Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName());
return getMethodsFromDescriptors(methods, loaders());
} | [
"public",
"Set",
"<",
"Method",
">",
"getMethodsAnnotatedWith",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"Iterable",
"<",
"String",
">",
"methods",
"=",
"store",
".",
"get",
"(",
"index",
"(",
"MethodAnnotationsS... | get all methods annotated with a given annotation
<p/>depends on MethodAnnotationsScanner configured | [
"get",
"all",
"methods",
"annotated",
"with",
"a",
"given",
"annotation",
"<p",
"/",
">",
"depends",
"on",
"MethodAnnotationsScanner",
"configured"
] | train | https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L486-L489 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.