repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
JodaOrg/joda-time | src/main/java/org/joda/time/format/FormatUtils.java | FormatUtils.appendPaddedInteger | public static void appendPaddedInteger(StringBuffer buf, long value, int size) {
try {
appendPaddedInteger((Appendable)buf, value, size);
} catch (IOException e) {
// StringBuffer does not throw IOException
}
} | java | public static void appendPaddedInteger(StringBuffer buf, long value, int size) {
try {
appendPaddedInteger((Appendable)buf, value, size);
} catch (IOException e) {
// StringBuffer does not throw IOException
}
} | [
"public",
"static",
"void",
"appendPaddedInteger",
"(",
"StringBuffer",
"buf",
",",
"long",
"value",
",",
"int",
"size",
")",
"{",
"try",
"{",
"appendPaddedInteger",
"(",
"(",
"Appendable",
")",
"buf",
",",
"value",
",",
"size",
")",
";",
"}",
"catch",
"... | Converts an integer to a string, prepended with a variable amount of '0'
pad characters, and appends it to the given buffer.
<p>This method is optimized for converting small values to strings.
@param buf receives integer converted to a string
@param value value to convert to a string
@param size minimum amount of digits to append | [
"Converts",
"an",
"integer",
"to",
"a",
"string",
"prepended",
"with",
"a",
"variable",
"amount",
"of",
"0",
"pad",
"characters",
"and",
"appends",
"it",
"to",
"the",
"given",
"buffer",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/FormatUtils.java#L123-L129 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/util/AstUtil.java | AstUtil.isMethodCall | public static boolean isMethodCall(Expression expression, String methodName, int numArguments) {
return expression instanceof MethodCallExpression
&& isMethodNamed((MethodCallExpression) expression, methodName)
&& getMethodArguments(expression).size() == numArguments;
} | java | public static boolean isMethodCall(Expression expression, String methodName, int numArguments) {
return expression instanceof MethodCallExpression
&& isMethodNamed((MethodCallExpression) expression, methodName)
&& getMethodArguments(expression).size() == numArguments;
} | [
"public",
"static",
"boolean",
"isMethodCall",
"(",
"Expression",
"expression",
",",
"String",
"methodName",
",",
"int",
"numArguments",
")",
"{",
"return",
"expression",
"instanceof",
"MethodCallExpression",
"&&",
"isMethodNamed",
"(",
"(",
"MethodCallExpression",
")... | Tells you if the expression is a method call for a certain method name with a certain
number of arguments.
@param expression
the (potentially) method call
@param methodName
the name of the method expected
@param numArguments
number of expected arguments
@return
as described | [
"Tells",
"you",
"if",
"the",
"expression",
"is",
"a",
"method",
"call",
"for",
"a",
"certain",
"method",
"name",
"with",
"a",
"certain",
"number",
"of",
"arguments",
"."
] | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L390-L394 |
aws/aws-sdk-java | aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementDescription.java | PlacementDescription.withAttributes | public PlacementDescription withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public PlacementDescription withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"PlacementDescription",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The user-defined attributes associated with the placement.
</p>
@param attributes
The user-defined attributes associated with the placement.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"user",
"-",
"defined",
"attributes",
"associated",
"with",
"the",
"placement",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementDescription.java#L178-L181 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/NonAcceleratedOverlay.java | NonAcceleratedOverlay.onDraw | protected void onDraw(Canvas c, Canvas acceleratedCanvas, MapView osmv, boolean shadow) {
onDraw(c, osmv, shadow);
} | java | protected void onDraw(Canvas c, Canvas acceleratedCanvas, MapView osmv, boolean shadow) {
onDraw(c, osmv, shadow);
} | [
"protected",
"void",
"onDraw",
"(",
"Canvas",
"c",
",",
"Canvas",
"acceleratedCanvas",
",",
"MapView",
"osmv",
",",
"boolean",
"shadow",
")",
"{",
"onDraw",
"(",
"c",
",",
"osmv",
",",
"shadow",
")",
";",
"}"
] | Override if you really want access to the original (possibly) accelerated canvas. | [
"Override",
"if",
"you",
"really",
"want",
"access",
"to",
"the",
"original",
"(",
"possibly",
")",
"accelerated",
"canvas",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/NonAcceleratedOverlay.java#L56-L58 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java | HostsResource.jobPatch | @PATCH
@Path("/{host}/jobs/{job}")
@Produces(APPLICATION_JSON)
@Timed
@ExceptionMetered
public SetGoalResponse jobPatch(@PathParam("host") final String host,
@PathParam("job") final JobId jobId,
@Valid final Deployment deployment,
@QueryParam("token") @DefaultValue("") final String token) {
if (!deployment.getJobId().equals(jobId)) {
throw badRequest(new SetGoalResponse(SetGoalResponse.Status.ID_MISMATCH, host, jobId));
}
try {
model.updateDeployment(host, deployment, token);
} catch (HostNotFoundException e) {
throw notFound(new SetGoalResponse(SetGoalResponse.Status.HOST_NOT_FOUND, host, jobId));
} catch (JobNotDeployedException e) {
throw notFound(new SetGoalResponse(SetGoalResponse.Status.JOB_NOT_DEPLOYED, host, jobId));
} catch (TokenVerificationException e) {
throw forbidden(new SetGoalResponse(SetGoalResponse.Status.FORBIDDEN, host, jobId));
}
log.info("patched job {} on host {}", deployment, host);
return new SetGoalResponse(SetGoalResponse.Status.OK, host, jobId);
} | java | @PATCH
@Path("/{host}/jobs/{job}")
@Produces(APPLICATION_JSON)
@Timed
@ExceptionMetered
public SetGoalResponse jobPatch(@PathParam("host") final String host,
@PathParam("job") final JobId jobId,
@Valid final Deployment deployment,
@QueryParam("token") @DefaultValue("") final String token) {
if (!deployment.getJobId().equals(jobId)) {
throw badRequest(new SetGoalResponse(SetGoalResponse.Status.ID_MISMATCH, host, jobId));
}
try {
model.updateDeployment(host, deployment, token);
} catch (HostNotFoundException e) {
throw notFound(new SetGoalResponse(SetGoalResponse.Status.HOST_NOT_FOUND, host, jobId));
} catch (JobNotDeployedException e) {
throw notFound(new SetGoalResponse(SetGoalResponse.Status.JOB_NOT_DEPLOYED, host, jobId));
} catch (TokenVerificationException e) {
throw forbidden(new SetGoalResponse(SetGoalResponse.Status.FORBIDDEN, host, jobId));
}
log.info("patched job {} on host {}", deployment, host);
return new SetGoalResponse(SetGoalResponse.Status.OK, host, jobId);
} | [
"@",
"PATCH",
"@",
"Path",
"(",
"\"/{host}/jobs/{job}\"",
")",
"@",
"Produces",
"(",
"APPLICATION_JSON",
")",
"@",
"Timed",
"@",
"ExceptionMetered",
"public",
"SetGoalResponse",
"jobPatch",
"(",
"@",
"PathParam",
"(",
"\"host\"",
")",
"final",
"String",
"host",
... | Alters the current deployment of a deployed job identified by its job id on the specified
host.
@param host The host.
@param jobId The ID of the job.
@param deployment The new deployment.
@param token The authorization token for this job.
@return The response. | [
"Alters",
"the",
"current",
"deployment",
"of",
"a",
"deployed",
"job",
"identified",
"by",
"its",
"job",
"id",
"on",
"the",
"specified",
"host",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java#L323-L346 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.4.0_fat/fat/src/com/ibm/ws/fat/wc/WCApplicationHelper.java | WCApplicationHelper.waitForAppStart | public static void waitForAppStart(String appName, String className, LibertyServer server) {
LOG.info("Setup : wait for the app startup complete (CWWKZ0001I) message for " + appName);
String appStarted = server.waitForStringInLog("CWWKZ0001I.* " + appName, APP_STARTUP_TIMEOUT);
if (appStarted == null) {
Assert.fail(className + ": application " + appName + " failed to start within " + APP_STARTUP_TIMEOUT +"ms");
}
} | java | public static void waitForAppStart(String appName, String className, LibertyServer server) {
LOG.info("Setup : wait for the app startup complete (CWWKZ0001I) message for " + appName);
String appStarted = server.waitForStringInLog("CWWKZ0001I.* " + appName, APP_STARTUP_TIMEOUT);
if (appStarted == null) {
Assert.fail(className + ": application " + appName + " failed to start within " + APP_STARTUP_TIMEOUT +"ms");
}
} | [
"public",
"static",
"void",
"waitForAppStart",
"(",
"String",
"appName",
",",
"String",
"className",
",",
"LibertyServer",
"server",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Setup : wait for the app startup complete (CWWKZ0001I) message for \"",
"+",
"appName",
")",
";",
... | Wait for APP_STARTUP_TIMEOUT (120s) for an application's start message (CWWKZ0001I)
@param String appName
@param String testName
@param LibertyServer server | [
"Wait",
"for",
"APP_STARTUP_TIMEOUT",
"(",
"120s",
")",
"for",
"an",
"application",
"s",
"start",
"message",
"(",
"CWWKZ0001I",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.4.0_fat/fat/src/com/ibm/ws/fat/wc/WCApplicationHelper.java#L150-L157 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.addDeprecation | @Deprecated
public static void addDeprecation(String key, String[] newKeys,
String customMessage) {
addDeprecations(new DeprecationDelta[] {
new DeprecationDelta(key, newKeys, customMessage)
});
} | java | @Deprecated
public static void addDeprecation(String key, String[] newKeys,
String customMessage) {
addDeprecations(new DeprecationDelta[] {
new DeprecationDelta(key, newKeys, customMessage)
});
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"addDeprecation",
"(",
"String",
"key",
",",
"String",
"[",
"]",
"newKeys",
",",
"String",
"customMessage",
")",
"{",
"addDeprecations",
"(",
"new",
"DeprecationDelta",
"[",
"]",
"{",
"new",
"DeprecationDelta",
"(... | Adds the deprecated key to the global deprecation map.
It does not override any existing entries in the deprecation map.
This is to be used only by the developers in order to add deprecation of
keys, and attempts to call this method after loading resources once,
would lead to <tt>UnsupportedOperationException</tt>
If a key is deprecated in favor of multiple keys, they are all treated as
aliases of each other, and setting any one of them resets all the others
to the new value.
If you have multiple deprecation entries to add, it is more efficient to
use #addDeprecations(DeprecationDelta[] deltas) instead.
@param key
@param newKeys
@param customMessage
@deprecated use {@link #addDeprecation(String key, String newKey,
String customMessage)} instead | [
"Adds",
"the",
"deprecated",
"key",
"to",
"the",
"global",
"deprecation",
"map",
".",
"It",
"does",
"not",
"override",
"any",
"existing",
"entries",
"in",
"the",
"deprecation",
"map",
".",
"This",
"is",
"to",
"be",
"used",
"only",
"by",
"the",
"developers"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L484-L490 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java | AddressCache.put | public void put(String hostname, int netId, InetAddress[] addresses) {
cache.put(new AddressCacheKey(hostname, netId), new AddressCacheEntry(addresses));
} | java | public void put(String hostname, int netId, InetAddress[] addresses) {
cache.put(new AddressCacheKey(hostname, netId), new AddressCacheEntry(addresses));
} | [
"public",
"void",
"put",
"(",
"String",
"hostname",
",",
"int",
"netId",
",",
"InetAddress",
"[",
"]",
"addresses",
")",
"{",
"cache",
".",
"put",
"(",
"new",
"AddressCacheKey",
"(",
"hostname",
",",
"netId",
")",
",",
"new",
"AddressCacheEntry",
"(",
"a... | Associates the given 'addresses' with 'hostname'. The association will expire after a
certain length of time. | [
"Associates",
"the",
"given",
"addresses",
"with",
"hostname",
".",
"The",
"association",
"will",
"expire",
"after",
"a",
"certain",
"length",
"of",
"time",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java#L117-L119 |
Coveros/selenified | src/main/java/com/coveros/selenified/Selenified.java | Selenified.getServicePassCredential | private static String getServicePassCredential(String clazz, ITestContext context) {
if (System.getenv("SERVICES_PASS") != null) {
return System.getenv("SERVICES_PASS");
}
if (context.getAttribute(clazz + SERVICES_PASS) != null) {
return (String) context.getAttribute(clazz + SERVICES_PASS);
} else {
return "";
}
} | java | private static String getServicePassCredential(String clazz, ITestContext context) {
if (System.getenv("SERVICES_PASS") != null) {
return System.getenv("SERVICES_PASS");
}
if (context.getAttribute(clazz + SERVICES_PASS) != null) {
return (String) context.getAttribute(clazz + SERVICES_PASS);
} else {
return "";
}
} | [
"private",
"static",
"String",
"getServicePassCredential",
"(",
"String",
"clazz",
",",
"ITestContext",
"context",
")",
"{",
"if",
"(",
"System",
".",
"getenv",
"(",
"\"SERVICES_PASS\"",
")",
"!=",
"null",
")",
"{",
"return",
"System",
".",
"getenv",
"(",
"\... | Obtains the web services password provided for the current test suite being executed. Anything passed in from
the command line will first be taken, to override any other values. Next, values being set in the classes will
be checked for. If neither of these are set, an empty string will be returned
@param clazz - the test suite class, used for making threadsafe storage of
application, allowing suites to have independent applications
under test, run at the same time
@param context - the TestNG context associated with the test suite, used for
storing app url information
@return String: the web services password to use for authentication | [
"Obtains",
"the",
"web",
"services",
"password",
"provided",
"for",
"the",
"current",
"test",
"suite",
"being",
"executed",
".",
"Anything",
"passed",
"in",
"from",
"the",
"command",
"line",
"will",
"first",
"be",
"taken",
"to",
"override",
"any",
"other",
"... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L267-L276 |
JodaOrg/joda-time | src/main/java/org/joda/time/MutablePeriod.java | MutablePeriod.setPeriod | public void setPeriod(long duration, Chronology chrono) {
chrono = DateTimeUtils.getChronology(chrono);
setValues(chrono.get(this, duration));
} | java | public void setPeriod(long duration, Chronology chrono) {
chrono = DateTimeUtils.getChronology(chrono);
setValues(chrono.get(this, duration));
} | [
"public",
"void",
"setPeriod",
"(",
"long",
"duration",
",",
"Chronology",
"chrono",
")",
"{",
"chrono",
"=",
"DateTimeUtils",
".",
"getChronology",
"(",
"chrono",
")",
";",
"setValues",
"(",
"chrono",
".",
"get",
"(",
"this",
",",
"duration",
")",
")",
... | Sets all the fields in one go from a millisecond duration.
<p>
When dividing the duration, only precise fields in the period type will be used.
For large durations, all the remaining duration will be stored in the largest
available precise field.
@param duration the duration, in milliseconds
@param chrono the chronology to use, null means ISO chronology
@throws ArithmeticException if the set exceeds the capacity of the period | [
"Sets",
"all",
"the",
"fields",
"in",
"one",
"go",
"from",
"a",
"millisecond",
"duration",
".",
"<p",
">",
"When",
"dividing",
"the",
"duration",
"only",
"precise",
"fields",
"in",
"the",
"period",
"type",
"will",
"be",
"used",
".",
"For",
"large",
"dura... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MutablePeriod.java#L609-L612 |
voldemort/voldemort | src/java/voldemort/utils/pool/QueuedKeyedResourcePool.java | QueuedKeyedResourcePool.internalNonBlockingGet | public V internalNonBlockingGet(K key) throws Exception {
Pool<V> resourcePool = getResourcePoolForKey(key);
return attemptNonBlockingCheckout(key, resourcePool);
} | java | public V internalNonBlockingGet(K key) throws Exception {
Pool<V> resourcePool = getResourcePoolForKey(key);
return attemptNonBlockingCheckout(key, resourcePool);
} | [
"public",
"V",
"internalNonBlockingGet",
"(",
"K",
"key",
")",
"throws",
"Exception",
"{",
"Pool",
"<",
"V",
">",
"resourcePool",
"=",
"getResourcePoolForKey",
"(",
"key",
")",
";",
"return",
"attemptNonBlockingCheckout",
"(",
"key",
",",
"resourcePool",
")",
... | Used only for unit testing. Please do not use this method in other ways.
@param key
@return
@throws Exception | [
"Used",
"only",
"for",
"unit",
"testing",
".",
"Please",
"do",
"not",
"use",
"this",
"method",
"in",
"other",
"ways",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/pool/QueuedKeyedResourcePool.java#L131-L134 |
k0shk0sh/PermissionHelper | permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java | PermissionFragmentHelper.declinedPermission | @Nullable public static String declinedPermission(@NonNull Fragment context, @NonNull String[] permissions) {
for (String permission : permissions) {
if (isPermissionDeclined(context, permission)) {
return permission;
}
}
return null;
} | java | @Nullable public static String declinedPermission(@NonNull Fragment context, @NonNull String[] permissions) {
for (String permission : permissions) {
if (isPermissionDeclined(context, permission)) {
return permission;
}
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"declinedPermission",
"(",
"@",
"NonNull",
"Fragment",
"context",
",",
"@",
"NonNull",
"String",
"[",
"]",
"permissions",
")",
"{",
"for",
"(",
"String",
"permission",
":",
"permissions",
")",
"{",
"if",
"(",
... | be aware as it might return null (do check if the returned result is not null!)
<p/>
can be used outside of activity. | [
"be",
"aware",
"as",
"it",
"might",
"return",
"null",
"(",
"do",
"check",
"if",
"the",
"returned",
"result",
"is",
"not",
"null!",
")",
"<p",
"/",
">",
"can",
"be",
"used",
"outside",
"of",
"activity",
"."
] | train | https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java#L302-L309 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java | FeatureTileTableCoreLinker.isLinked | public boolean isLinked(String featureTable, String tileTable) {
FeatureTileLink link = getLink(featureTable, tileTable);
return link != null;
} | java | public boolean isLinked(String featureTable, String tileTable) {
FeatureTileLink link = getLink(featureTable, tileTable);
return link != null;
} | [
"public",
"boolean",
"isLinked",
"(",
"String",
"featureTable",
",",
"String",
"tileTable",
")",
"{",
"FeatureTileLink",
"link",
"=",
"getLink",
"(",
"featureTable",
",",
"tileTable",
")",
";",
"return",
"link",
"!=",
"null",
";",
"}"
] | Determine if the feature table is linked to the tile table
@param featureTable
feature table
@param tileTable
tile table
@return true if linked | [
"Determine",
"if",
"the",
"feature",
"table",
"is",
"linked",
"to",
"the",
"tile",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java#L122-L125 |
JDBDT/jdbdt | src/main/java/org/jdbdt/JDBDT.java | JDBDT.assertState | public static void assertState(String message, DataSet dataSet) throws DBAssertionError {
DBAssert.stateAssertion(CallInfo.create(message), dataSet);
} | java | public static void assertState(String message, DataSet dataSet) throws DBAssertionError {
DBAssert.stateAssertion(CallInfo.create(message), dataSet);
} | [
"public",
"static",
"void",
"assertState",
"(",
"String",
"message",
",",
"DataSet",
"dataSet",
")",
"throws",
"DBAssertionError",
"{",
"DBAssert",
".",
"stateAssertion",
"(",
"CallInfo",
".",
"create",
"(",
"message",
")",
",",
"dataSet",
")",
";",
"}"
] | Assert that the database state matches the given data set (error message variant).
@param message Assertion error message.
@param dataSet Data set.
@throws DBAssertionError if the assertion fails.
@see #assertEmpty(String, DataSource) | [
"Assert",
"that",
"the",
"database",
"state",
"matches",
"the",
"given",
"data",
"set",
"(",
"error",
"message",
"variant",
")",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L611-L613 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java | TopologyManager.addSubPartition | public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) {
AbstractLabel abstractLabel = partition.getAbstractLabel();
addSubPartition(
sqlgGraph,
partition.getParentPartition().getParentPartition() != null,
abstractLabel instanceof VertexLabel,
abstractLabel.getSchema().getName(),
abstractLabel.getName(),
partition.getParentPartition().getName(),
partition.getName(),
partition.getPartitionType(),
partition.getPartitionExpression(),
partition.getFrom(),
partition.getTo(),
partition.getIn()
);
} | java | public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) {
AbstractLabel abstractLabel = partition.getAbstractLabel();
addSubPartition(
sqlgGraph,
partition.getParentPartition().getParentPartition() != null,
abstractLabel instanceof VertexLabel,
abstractLabel.getSchema().getName(),
abstractLabel.getName(),
partition.getParentPartition().getName(),
partition.getName(),
partition.getPartitionType(),
partition.getPartitionExpression(),
partition.getFrom(),
partition.getTo(),
partition.getIn()
);
} | [
"public",
"static",
"void",
"addSubPartition",
"(",
"SqlgGraph",
"sqlgGraph",
",",
"Partition",
"partition",
")",
"{",
"AbstractLabel",
"abstractLabel",
"=",
"partition",
".",
"getAbstractLabel",
"(",
")",
";",
"addSubPartition",
"(",
"sqlgGraph",
",",
"partition",
... | Adds the partition to a partition. A new Vertex with label Partition is added and in linked to its parent with
the SQLG_SCHEMA_PARTITION_PARTITION_EDGE edge label.
@param sqlgGraph | [
"Adds",
"the",
"partition",
"to",
"a",
"partition",
".",
"A",
"new",
"Vertex",
"with",
"label",
"Partition",
"is",
"added",
"and",
"in",
"linked",
"to",
"its",
"parent",
"with",
"the",
"SQLG_SCHEMA_PARTITION_PARTITION_EDGE",
"edge",
"label",
"."
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L1215-L1232 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_GET | public OvhStream serviceName_output_graylog_stream_streamId_GET(String serviceName, String streamId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}";
StringBuilder sb = path(qPath, serviceName, streamId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhStream.class);
} | java | public OvhStream serviceName_output_graylog_stream_streamId_GET(String serviceName, String streamId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}";
StringBuilder sb = path(qPath, serviceName, streamId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhStream.class);
} | [
"public",
"OvhStream",
"serviceName_output_graylog_stream_streamId_GET",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}\"",
";",
"StringBuilder",
"... | Returns details of specified graylog stream
REST: GET /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}
@param serviceName [required] Service name
@param streamId [required] Stream ID | [
"Returns",
"details",
"of",
"specified",
"graylog",
"stream"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1286-L1291 |
carewebframework/carewebframework-core | org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/BaseAuthenticationProvider.java | BaseAuthenticationProvider.authenticate | @Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
CWFAuthenticationDetails details = (CWFAuthenticationDetails) authentication.getDetails();
String username = (String) authentication.getPrincipal();
String password = (String) authentication.getCredentials();
String domain = null;
if (log.isDebugEnabled()) {
log.debug("User: " + username);
log.debug("Details, RA: " + details == null ? "null" : details.getRemoteAddress());
}
if (username != null && username.contains("\\")) {
String pcs[] = username.split("\\\\", 2);
domain = pcs[0];
username = pcs.length > 1 ? pcs[1] : null;
}
ISecurityDomain securityDomain = SecurityDomainRegistry.getSecurityDomain(domain);
if (username == null || password == null || securityDomain == null) {
throw new BadCredentialsException("Missing security credentials.");
}
IUser user = securityDomain.authenticate(username, password);
details.setDetail("user", user);
Set<String> mergedAuthorities = mergeAuthorities(securityDomain.getGrantedAuthorities(user),
systemGrantedAuthorities);
List<GrantedAuthority> userAuthorities = new ArrayList<>();
for (String authority : mergedAuthorities) {
if (!authority.isEmpty()) {
userAuthorities.add(new SimpleGrantedAuthority(authority));
}
}
User principal = new User(username, password, true, true, true, true, userAuthorities);
authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(),
principal.getAuthorities());
((UsernamePasswordAuthenticationToken) authentication).setDetails(details);
return authentication;
} | java | @Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
CWFAuthenticationDetails details = (CWFAuthenticationDetails) authentication.getDetails();
String username = (String) authentication.getPrincipal();
String password = (String) authentication.getCredentials();
String domain = null;
if (log.isDebugEnabled()) {
log.debug("User: " + username);
log.debug("Details, RA: " + details == null ? "null" : details.getRemoteAddress());
}
if (username != null && username.contains("\\")) {
String pcs[] = username.split("\\\\", 2);
domain = pcs[0];
username = pcs.length > 1 ? pcs[1] : null;
}
ISecurityDomain securityDomain = SecurityDomainRegistry.getSecurityDomain(domain);
if (username == null || password == null || securityDomain == null) {
throw new BadCredentialsException("Missing security credentials.");
}
IUser user = securityDomain.authenticate(username, password);
details.setDetail("user", user);
Set<String> mergedAuthorities = mergeAuthorities(securityDomain.getGrantedAuthorities(user),
systemGrantedAuthorities);
List<GrantedAuthority> userAuthorities = new ArrayList<>();
for (String authority : mergedAuthorities) {
if (!authority.isEmpty()) {
userAuthorities.add(new SimpleGrantedAuthority(authority));
}
}
User principal = new User(username, password, true, true, true, true, userAuthorities);
authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(),
principal.getAuthorities());
((UsernamePasswordAuthenticationToken) authentication).setDetails(details);
return authentication;
} | [
"@",
"Override",
"public",
"Authentication",
"authenticate",
"(",
"Authentication",
"authentication",
")",
"throws",
"AuthenticationException",
"{",
"CWFAuthenticationDetails",
"details",
"=",
"(",
"CWFAuthenticationDetails",
")",
"authentication",
".",
"getDetails",
"(",
... | Produces a trusted <code>UsernamePasswordAuthenticationToken</code> if authentication was
successful.
@param authentication The authentication context.
@return authentication Authentication object if authentication succeeded.
@throws AuthenticationException Exception on authentication failure. | [
"Produces",
"a",
"trusted",
"<code",
">",
"UsernamePasswordAuthenticationToken<",
"/",
"code",
">",
"if",
"authentication",
"was",
"successful",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/BaseAuthenticationProvider.java#L87-L128 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/ngmf/ui/calc/RandomNormal.java | RandomNormal.nextRatio | public float nextRatio() {
float u, v, x, xx;
do {
// u and v are two uniformly-distributed random values
// in [0, 1), and u != 0.
while ((u = gen.nextFloat()) == 0); // try again if 0
v = gen.nextFloat();
float y = C1*(v - 0.5f); // y coord of point (u, y)
x = y/u; // ratio of point's coords
xx = x*x;
} while (
(xx > 5f - C2*u) // quick acceptance
&&
( (xx >= C3/u + 1.4f) || // quick rejection
(xx > (float) (-4*Math.log(u))) ) // final test
);
return stddev*x + mean;
} | java | public float nextRatio() {
float u, v, x, xx;
do {
// u and v are two uniformly-distributed random values
// in [0, 1), and u != 0.
while ((u = gen.nextFloat()) == 0); // try again if 0
v = gen.nextFloat();
float y = C1*(v - 0.5f); // y coord of point (u, y)
x = y/u; // ratio of point's coords
xx = x*x;
} while (
(xx > 5f - C2*u) // quick acceptance
&&
( (xx >= C3/u + 1.4f) || // quick rejection
(xx > (float) (-4*Math.log(u))) ) // final test
);
return stddev*x + mean;
} | [
"public",
"float",
"nextRatio",
"(",
")",
"{",
"float",
"u",
",",
"v",
",",
"x",
",",
"xx",
";",
"do",
"{",
"// u and v are two uniformly-distributed random values",
"// in [0, 1), and u != 0.",
"while",
"(",
"(",
"u",
"=",
"gen",
".",
"nextFloat",
"(",
")",
... | Compute the next random value using the ratio algorithm.
Requires two uniformly-distributed random values in [0, 1). | [
"Compute",
"the",
"next",
"random",
"value",
"using",
"the",
"ratio",
"algorithm",
".",
"Requires",
"two",
"uniformly",
"-",
"distributed",
"random",
"values",
"in",
"[",
"0",
"1",
")",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/ui/calc/RandomNormal.java#L108-L127 |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java | HadoopStoreBuilderUtils.getDataFileChunkSet | public static DataFileChunkSet getDataFileChunkSet(FileSystem fs, FileStatus[] files)
throws IOException {
// Make sure it satisfies the partitionId_replicaType format
List<FileStatus> fileList = Lists.newArrayList();
for(FileStatus file: files) {
if(!ReadOnlyUtils.isFormatCorrect(file.getPath().getName(),
ReadOnlyStorageFormat.READONLY_V2)) {
throw new VoldemortException("Incorrect data file name format for "
+ file.getPath().getName() + ". Unsupported by "
+ ReadOnlyStorageFormat.READONLY_V2);
}
fileList.add(file);
}
// Return it in sorted order
Collections.sort(fileList, new Comparator<FileStatus>() {
public int compare(FileStatus f1, FileStatus f2) {
int chunkId1 = ReadOnlyUtils.getChunkId(f1.getPath().getName());
int chunkId2 = ReadOnlyUtils.getChunkId(f2.getPath().getName());
return chunkId1 - chunkId2;
}
});
List<DataFileChunk> dataFiles = Lists.newArrayList();
List<Integer> dataFileSizes = Lists.newArrayList();
for(FileStatus file: fileList) {
dataFiles.add(new HdfsDataFileChunk(fs, file));
dataFileSizes.add((int) file.getLen());
}
return new DataFileChunkSet(dataFiles, dataFileSizes);
} | java | public static DataFileChunkSet getDataFileChunkSet(FileSystem fs, FileStatus[] files)
throws IOException {
// Make sure it satisfies the partitionId_replicaType format
List<FileStatus> fileList = Lists.newArrayList();
for(FileStatus file: files) {
if(!ReadOnlyUtils.isFormatCorrect(file.getPath().getName(),
ReadOnlyStorageFormat.READONLY_V2)) {
throw new VoldemortException("Incorrect data file name format for "
+ file.getPath().getName() + ". Unsupported by "
+ ReadOnlyStorageFormat.READONLY_V2);
}
fileList.add(file);
}
// Return it in sorted order
Collections.sort(fileList, new Comparator<FileStatus>() {
public int compare(FileStatus f1, FileStatus f2) {
int chunkId1 = ReadOnlyUtils.getChunkId(f1.getPath().getName());
int chunkId2 = ReadOnlyUtils.getChunkId(f2.getPath().getName());
return chunkId1 - chunkId2;
}
});
List<DataFileChunk> dataFiles = Lists.newArrayList();
List<Integer> dataFileSizes = Lists.newArrayList();
for(FileStatus file: fileList) {
dataFiles.add(new HdfsDataFileChunk(fs, file));
dataFileSizes.add((int) file.getLen());
}
return new DataFileChunkSet(dataFiles, dataFileSizes);
} | [
"public",
"static",
"DataFileChunkSet",
"getDataFileChunkSet",
"(",
"FileSystem",
"fs",
",",
"FileStatus",
"[",
"]",
"files",
")",
"throws",
"IOException",
"{",
"// Make sure it satisfies the partitionId_replicaType format",
"List",
"<",
"FileStatus",
">",
"fileList",
"="... | Convert list of FileStatus[] files to DataFileChunkSet. The input to this
is generally the output of getChunkFiles function.
Works only for {@link ReadOnlyStorageFormat.READONLY_V2}
@param fs Filesystem used
@param files List of data chunk files
@return DataFileChunkSet Returns the corresponding data chunk set
@throws IOException | [
"Convert",
"list",
"of",
"FileStatus",
"[]",
"files",
"to",
"DataFileChunkSet",
".",
"The",
"input",
"to",
"this",
"is",
"generally",
"the",
"output",
"of",
"getChunkFiles",
"function",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java#L149-L182 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java | JShellTool.hard | @Override
public void hard(String format, Object... args) {
rawout(prefix(format), args);
} | java | @Override
public void hard(String format, Object... args) {
rawout(prefix(format), args);
} | [
"@",
"Override",
"public",
"void",
"hard",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"rawout",
"(",
"prefix",
"(",
"format",
")",
",",
"args",
")",
";",
"}"
] | Must show command output
@param format printf format
@param args printf args | [
"Must",
"show",
"command",
"output"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L667-L670 |
LMAX-Exchange/disruptor | src/main/java/com/lmax/disruptor/dsl/Disruptor.java | Disruptor.publishEvents | public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg)
{
ringBuffer.publishEvents(eventTranslator, arg);
} | java | public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg)
{
ringBuffer.publishEvents(eventTranslator, arg);
} | [
"public",
"<",
"A",
">",
"void",
"publishEvents",
"(",
"final",
"EventTranslatorOneArg",
"<",
"T",
",",
"A",
">",
"eventTranslator",
",",
"final",
"A",
"[",
"]",
"arg",
")",
"{",
"ringBuffer",
".",
"publishEvents",
"(",
"eventTranslator",
",",
"arg",
")",
... | Publish a batch of events to the ring buffer.
@param <A> Class of the user supplied argument.
@param eventTranslator the translator that will load data into the event.
@param arg An array single arguments to load into the events. One Per event. | [
"Publish",
"a",
"batch",
"of",
"events",
"to",
"the",
"ring",
"buffer",
"."
] | train | https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/dsl/Disruptor.java#L353-L356 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java | JmxUtil.unregisterMBeans | public static int unregisterMBeans(String filter, MBeanServer mBeanServer) {
try {
ObjectName filterObjName = new ObjectName(filter);
Set<ObjectInstance> mbeans = mBeanServer.queryMBeans(filterObjName, null);
for (ObjectInstance mbean : mbeans) {
ObjectName name = mbean.getObjectName();
if (trace)
log.trace("Unregistering mbean with name: " + name);
SecurityActions.unregisterMBean(name, mBeanServer);
}
return mbeans.size();
} catch (Exception e) {
throw new CacheException(
"Unable to register mbeans with filter=" + filter, e);
}
} | java | public static int unregisterMBeans(String filter, MBeanServer mBeanServer) {
try {
ObjectName filterObjName = new ObjectName(filter);
Set<ObjectInstance> mbeans = mBeanServer.queryMBeans(filterObjName, null);
for (ObjectInstance mbean : mbeans) {
ObjectName name = mbean.getObjectName();
if (trace)
log.trace("Unregistering mbean with name: " + name);
SecurityActions.unregisterMBean(name, mBeanServer);
}
return mbeans.size();
} catch (Exception e) {
throw new CacheException(
"Unable to register mbeans with filter=" + filter, e);
}
} | [
"public",
"static",
"int",
"unregisterMBeans",
"(",
"String",
"filter",
",",
"MBeanServer",
"mBeanServer",
")",
"{",
"try",
"{",
"ObjectName",
"filterObjName",
"=",
"new",
"ObjectName",
"(",
"filter",
")",
";",
"Set",
"<",
"ObjectInstance",
">",
"mbeans",
"=",... | Unregister all mbeans whose object names match a given filter.
@param filter ObjectName-style formatted filter
@param mBeanServer mbean server from which to unregister mbeans
@return number of mbeans unregistered | [
"Unregister",
"all",
"mbeans",
"whose",
"object",
"names",
"match",
"a",
"given",
"filter",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java#L94-L110 |
hal/elemento | core/src/main/java/org/jboss/gwt/elemento/core/Elements.java | Elements.lazyInsertBefore | public static void lazyInsertBefore(Element parent, Element child, Element before) {
if (!parent.contains(child)) {
parent.insertBefore(child, before);
}
} | java | public static void lazyInsertBefore(Element parent, Element child, Element before) {
if (!parent.contains(child)) {
parent.insertBefore(child, before);
}
} | [
"public",
"static",
"void",
"lazyInsertBefore",
"(",
"Element",
"parent",
",",
"Element",
"child",
",",
"Element",
"before",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"contains",
"(",
"child",
")",
")",
"{",
"parent",
".",
"insertBefore",
"(",
"child",
",... | Inserts the specified element into the parent element if not already present. If parent already contains child,
this method does nothing. | [
"Inserts",
"the",
"specified",
"element",
"into",
"the",
"parent",
"element",
"if",
"not",
"already",
"present",
".",
"If",
"parent",
"already",
"contains",
"child",
"this",
"method",
"does",
"nothing",
"."
] | train | https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L698-L702 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsButtonBarHandler.java | CmsButtonBarHandler.setButtonBarVisibility | private void setButtonBarVisibility(Widget buttonBar, boolean visible) {
String hoverStyle = I_CmsLayoutBundle.INSTANCE.form().hoverButton();
if (visible) {
buttonBar.addStyleName(hoverStyle);
} else {
buttonBar.removeStyleName(hoverStyle);
}
if (buttonBar instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar).setContentHighlightingVisible(visible);
}
if (buttonBar.getParent() instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar.getParent()).setContentHighlightingVisible(visible);
}
} | java | private void setButtonBarVisibility(Widget buttonBar, boolean visible) {
String hoverStyle = I_CmsLayoutBundle.INSTANCE.form().hoverButton();
if (visible) {
buttonBar.addStyleName(hoverStyle);
} else {
buttonBar.removeStyleName(hoverStyle);
}
if (buttonBar instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar).setContentHighlightingVisible(visible);
}
if (buttonBar.getParent() instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar.getParent()).setContentHighlightingVisible(visible);
}
} | [
"private",
"void",
"setButtonBarVisibility",
"(",
"Widget",
"buttonBar",
",",
"boolean",
"visible",
")",
"{",
"String",
"hoverStyle",
"=",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"form",
"(",
")",
".",
"hoverButton",
"(",
")",
";",
"if",
"(",
"visible",
"... | Sets the button bar visibility.<p>
@param buttonBar the button bar
@param visible <code>true</code> to show the button bar | [
"Sets",
"the",
"button",
"bar",
"visibility",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsButtonBarHandler.java#L354-L368 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getNTLMv2Response | public static byte[] getNTLMv2Response(String target, String user,
String password, byte[] targetInformation, byte[] challenge,
byte[] clientNonce, long time) throws Exception {
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
byte[] blob = createBlob(targetInformation, clientNonce, time);
return lmv2Response(ntlmv2Hash, blob, challenge);
} | java | public static byte[] getNTLMv2Response(String target, String user,
String password, byte[] targetInformation, byte[] challenge,
byte[] clientNonce, long time) throws Exception {
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
byte[] blob = createBlob(targetInformation, clientNonce, time);
return lmv2Response(ntlmv2Hash, blob, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getNTLMv2Response",
"(",
"String",
"target",
",",
"String",
"user",
",",
"String",
"password",
",",
"byte",
"[",
"]",
"targetInformation",
",",
"byte",
"[",
"]",
"challenge",
",",
"byte",
"[",
"]",
"clientNonce",
",",... | Calculates the NTLMv2 Response for the given challenge, using the
specified authentication target, username, password, target information
block, and client nonce.
@param target The authentication target (i.e., domain).
@param user The username.
@param password The user's password.
@param targetInformation The target information block from the Type 2
message.
@param challenge The Type 2 challenge from the server.
@param clientNonce The random 8-byte client nonce.
@param time The time stamp.
@return The NTLMv2 Response. | [
"Calculates",
"the",
"NTLMv2",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"authentication",
"target",
"username",
"password",
"target",
"information",
"block",
"and",
"client",
"nonce",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L121-L127 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java | DistributedFileSystem.concat | public void concat(Path trg, Path [] psrcs, boolean restricted) throws IOException {
String [] srcs = new String [psrcs.length];
for(int i=0; i<psrcs.length; i++) {
srcs[i] = getPathName(psrcs[i]);
}
dfs.concat(getPathName(trg), srcs, restricted);
} | java | public void concat(Path trg, Path [] psrcs, boolean restricted) throws IOException {
String [] srcs = new String [psrcs.length];
for(int i=0; i<psrcs.length; i++) {
srcs[i] = getPathName(psrcs[i]);
}
dfs.concat(getPathName(trg), srcs, restricted);
} | [
"public",
"void",
"concat",
"(",
"Path",
"trg",
",",
"Path",
"[",
"]",
"psrcs",
",",
"boolean",
"restricted",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"srcs",
"=",
"new",
"String",
"[",
"psrcs",
".",
"length",
"]",
";",
"for",
"(",
"int... | THIS IS DFS only operations, it is not part of FileSystem
move blocks from srcs to trg
and delete srcs afterwards
@param trg existing file to append to
@param psrcs list of files (same block size, same replication)
@param restricted - should the equal block sizes be enforced
@throws IOException | [
"THIS",
"IS",
"DFS",
"only",
"operations",
"it",
"is",
"not",
"part",
"of",
"FileSystem",
"move",
"blocks",
"from",
"srcs",
"to",
"trg",
"and",
"delete",
"srcs",
"afterwards"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java#L406-L412 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.putAll | public void putAll(final Map<String, String> map) {
for (final Map.Entry<String, ?> entry : map.entrySet()) {
data.putValue(entry.getKey(), entry.getValue());
}
} | java | public void putAll(final Map<String, String> map) {
for (final Map.Entry<String, ?> entry : map.entrySet()) {
data.putValue(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"putAll",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"data",
".",
... | Adds all the elements from the specified Map.
@param map The Map to add. | [
"Adds",
"all",
"the",
"elements",
"from",
"the",
"specified",
"Map",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L202-L206 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendTextBlocking | public static void sendTextBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.TEXT, wsChannel);
} | java | public static void sendTextBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.TEXT, wsChannel);
} | [
"public",
"static",
"void",
"sendTextBlocking",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendBlockingInternal",
"(",
"pooledData",
",",
"WebSocketFrameType",
".",
"TEXT",
",",
"w... | Sends a complete text message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"text",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L220-L222 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java | AbstractMySQLQuery.calcFoundRows | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C calcFoundRows() {
return addFlag(Position.AFTER_SELECT, SQL_CALC_FOUND_ROWS);
} | java | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C calcFoundRows() {
return addFlag(Position.AFTER_SELECT, SQL_CALC_FOUND_ROWS);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"MySQLQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"calcFoundRows",
"(",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"AFTER_SELECT",
",",
"SQL_CALC_FOUND_ROWS",
")",
";",
"}... | SQL_CALC_FOUND_ROWS tells MySQL to calculate how many rows there would be in the result set,
disregarding any LIMIT clause. The number of rows can then be retrieved with SELECT FOUND_ROWS().
@return the current object | [
"SQL_CALC_FOUND_ROWS",
"tells",
"MySQL",
"to",
"calculate",
"how",
"many",
"rows",
"there",
"would",
"be",
"in",
"the",
"result",
"set",
"disregarding",
"any",
"LIMIT",
"clause",
".",
"The",
"number",
"of",
"rows",
"can",
"then",
"be",
"retrieved",
"with",
"... | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L111-L114 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java | ProjectiveInitializeAllCommon.selectInitialTriplet | boolean selectInitialTriplet( View seed , GrowQueue_I32 motions , int selected[] ) {
double bestScore = 0;
for (int i = 0; i < motions.size; i++) {
View viewB = seed.connections.get(i).other(seed);
for (int j = i+1; j < motions.size; j++) {
View viewC = seed.connections.get(j).other(seed);
double s = scoreTripleView(seed,viewB,viewC);
if( s > bestScore ) {
bestScore = s;
selected[0] = i;
selected[1] = j;
}
}
}
return bestScore != 0;
} | java | boolean selectInitialTriplet( View seed , GrowQueue_I32 motions , int selected[] ) {
double bestScore = 0;
for (int i = 0; i < motions.size; i++) {
View viewB = seed.connections.get(i).other(seed);
for (int j = i+1; j < motions.size; j++) {
View viewC = seed.connections.get(j).other(seed);
double s = scoreTripleView(seed,viewB,viewC);
if( s > bestScore ) {
bestScore = s;
selected[0] = i;
selected[1] = j;
}
}
}
return bestScore != 0;
} | [
"boolean",
"selectInitialTriplet",
"(",
"View",
"seed",
",",
"GrowQueue_I32",
"motions",
",",
"int",
"selected",
"[",
"]",
")",
"{",
"double",
"bestScore",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"motions",
".",
"size",
";",
"... | Exhaustively look at all triplets that connect with the seed view | [
"Exhaustively",
"look",
"at",
"all",
"triplets",
"that",
"connect",
"with",
"the",
"seed",
"view"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java#L185-L202 |
dkmfbk/knowledgestore | ks-core/src/main/java/eu/fbk/knowledgestore/data/Record.java | Record.getUnique | @SuppressWarnings("unchecked")
@Nullable
public <T> T getUnique(final URI property, final Class<T> valueClass)
throws IllegalStateException, IllegalArgumentException {
final Object result;
synchronized (this) {
result = doGet(property, valueClass);
}
if (result == null) {
return null;
} else if (result instanceof List<?>) {
final List<T> list = (List<T>) result;
final StringBuilder builder = new StringBuilder("Expected one value for property ")
.append(property).append(", found ").append(list.size()).append(" values: ");
for (int i = 0; i < Math.min(3, list.size()); ++i) {
builder.append(i > 0 ? ", " : "").append(list.get(i));
}
builder.append(list.size() > 3 ? ", ..." : "");
throw new IllegalStateException(builder.toString());
} else {
return (T) result;
}
} | java | @SuppressWarnings("unchecked")
@Nullable
public <T> T getUnique(final URI property, final Class<T> valueClass)
throws IllegalStateException, IllegalArgumentException {
final Object result;
synchronized (this) {
result = doGet(property, valueClass);
}
if (result == null) {
return null;
} else if (result instanceof List<?>) {
final List<T> list = (List<T>) result;
final StringBuilder builder = new StringBuilder("Expected one value for property ")
.append(property).append(", found ").append(list.size()).append(" values: ");
for (int i = 0; i < Math.min(3, list.size()); ++i) {
builder.append(i > 0 ? ", " : "").append(list.get(i));
}
builder.append(list.size() > 3 ? ", ..." : "");
throw new IllegalStateException(builder.toString());
} else {
return (T) result;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Nullable",
"public",
"<",
"T",
">",
"T",
"getUnique",
"(",
"final",
"URI",
"property",
",",
"final",
"Class",
"<",
"T",
">",
"valueClass",
")",
"throws",
"IllegalStateException",
",",
"IllegalArgumentEx... | Returns the unique value of the property converted to an instance of a certain class, or
null if the property has no value. Note that this method fails if the property has multiple
values or its unique value cannot be converted to the requested class; if this is not the
desired behavior, use {@link #getUnique(URI, Class, Object)} supplying an appropriate
default value to be returned in case of failure.
@param property
the property to read
@param valueClass
the class to convert the value to
@param <T>
the type of result
@return the unique value of the property, converted to the class specified; null if the
property has no value
@throws IllegalStateException
in case the property has multiple values
@throws IllegalArgumentException
in case the unique property value cannot be converted to the class specified | [
"Returns",
"the",
"unique",
"value",
"of",
"the",
"property",
"converted",
"to",
"an",
"instance",
"of",
"a",
"certain",
"class",
"or",
"null",
"if",
"the",
"property",
"has",
"no",
"value",
".",
"Note",
"that",
"this",
"method",
"fails",
"if",
"the",
"p... | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/Record.java#L514-L536 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java | OmemoManager.getInstanceFor | public static synchronized OmemoManager getInstanceFor(XMPPConnection connection, Integer deviceId) {
if (deviceId == null || deviceId < 1) {
throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0.");
}
TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection);
if (managersOfConnection == null) {
managersOfConnection = new TreeMap<>();
INSTANCES.put(connection, managersOfConnection);
}
OmemoManager manager = managersOfConnection.get(deviceId);
if (manager == null) {
manager = new OmemoManager(connection, deviceId);
managersOfConnection.put(deviceId, manager);
}
return manager;
} | java | public static synchronized OmemoManager getInstanceFor(XMPPConnection connection, Integer deviceId) {
if (deviceId == null || deviceId < 1) {
throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0.");
}
TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection);
if (managersOfConnection == null) {
managersOfConnection = new TreeMap<>();
INSTANCES.put(connection, managersOfConnection);
}
OmemoManager manager = managersOfConnection.get(deviceId);
if (manager == null) {
manager = new OmemoManager(connection, deviceId);
managersOfConnection.put(deviceId, manager);
}
return manager;
} | [
"public",
"static",
"synchronized",
"OmemoManager",
"getInstanceFor",
"(",
"XMPPConnection",
"connection",
",",
"Integer",
"deviceId",
")",
"{",
"if",
"(",
"deviceId",
"==",
"null",
"||",
"deviceId",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Return an OmemoManager instance for the given connection and deviceId.
If there was an OmemoManager for the connection and id before, return it. Otherwise create a new OmemoManager
instance and return it.
@param connection XmppConnection.
@param deviceId MUST NOT be null and MUST be greater than 0.
@return manager | [
"Return",
"an",
"OmemoManager",
"instance",
"for",
"the",
"given",
"connection",
"and",
"deviceId",
".",
"If",
"there",
"was",
"an",
"OmemoManager",
"for",
"the",
"connection",
"and",
"id",
"before",
"return",
"it",
".",
"Otherwise",
"create",
"a",
"new",
"O... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L154-L172 |
roboconf/roboconf-platform | miscellaneous/roboconf-swagger/src/main/java/net/roboconf/swagger/UpdateSwaggerJson.java | UpdateSwaggerJson.convertToTypes | public static void convertToTypes( String serialization, String className, JsonObject newDef ) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonTree = jsonParser.parse( serialization );
// Creating the swagger definition
JsonObject innerObject = new JsonObject();
// Start adding basic properties
innerObject.addProperty( "title", className );
innerObject.addProperty( "definition", "" );
innerObject.addProperty( "type", jsonTree.isJsonObject() ? "object" : jsonTree.isJsonArray() ? "array" : "string" );
// Prevent errors with classic Swagger UI
innerObject.addProperty( "properties", "" );
// Inner properties
innerObject.add( "example", jsonTree.getAsJsonObject());
// Update our global definition
newDef.add( "json_" + className, innerObject );
} | java | public static void convertToTypes( String serialization, String className, JsonObject newDef ) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonTree = jsonParser.parse( serialization );
// Creating the swagger definition
JsonObject innerObject = new JsonObject();
// Start adding basic properties
innerObject.addProperty( "title", className );
innerObject.addProperty( "definition", "" );
innerObject.addProperty( "type", jsonTree.isJsonObject() ? "object" : jsonTree.isJsonArray() ? "array" : "string" );
// Prevent errors with classic Swagger UI
innerObject.addProperty( "properties", "" );
// Inner properties
innerObject.add( "example", jsonTree.getAsJsonObject());
// Update our global definition
newDef.add( "json_" + className, innerObject );
} | [
"public",
"static",
"void",
"convertToTypes",
"(",
"String",
"serialization",
",",
"String",
"className",
",",
"JsonObject",
"newDef",
")",
"{",
"JsonParser",
"jsonParser",
"=",
"new",
"JsonParser",
"(",
")",
";",
"JsonElement",
"jsonTree",
"=",
"jsonParser",
".... | Creates a JSon object from a serialization result.
@param serialization the serialization result
@param className a class or type name
@param newDef the new definition object to update | [
"Creates",
"a",
"JSon",
"object",
"from",
"a",
"serialization",
"result",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-swagger/src/main/java/net/roboconf/swagger/UpdateSwaggerJson.java#L307-L328 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveNodeDirectory | private File getEffectiveNodeDirectory ()
{
if (this.nodeDirectory != null)
return this.nodeDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveNodePackageName ()));
return null;
} | java | private File getEffectiveNodeDirectory ()
{
if (this.nodeDirectory != null)
return this.nodeDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveNodePackageName ()));
return null;
} | [
"private",
"File",
"getEffectiveNodeDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"nodeDirectory",
"!=",
"null",
")",
"return",
"this",
".",
"nodeDirectory",
";",
"if",
"(",
"this",
".",
"outputDirectory",
"!=",
"null",
")",
"return",
"new",
"File",
"... | Gets the absolute path to the output directory for the syntax tree files.
@return The absolute path to the output directory for the syntax tree
files, only <code>null</code> if neither {@link #outputDirectory}
nor {@link #nodeDirectory} have been set. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"syntax",
"tree",
"files",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L212-L219 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/util/cli/ArgParser.java | ArgParser.getName | private static String getName(Opt option, Field field) {
if (option.name().equals(Opt.DEFAULT_STRING)) {
return field.getName();
} else {
return option.name();
}
} | java | private static String getName(Opt option, Field field) {
if (option.name().equals(Opt.DEFAULT_STRING)) {
return field.getName();
} else {
return option.name();
}
} | [
"private",
"static",
"String",
"getName",
"(",
"Opt",
"option",
",",
"Field",
"field",
")",
"{",
"if",
"(",
"option",
".",
"name",
"(",
")",
".",
"equals",
"(",
"Opt",
".",
"DEFAULT_STRING",
")",
")",
"{",
"return",
"field",
".",
"getName",
"(",
")",... | Gets the name specified in @Opt(name=...) if present, or the name of the field otherwise. | [
"Gets",
"the",
"name",
"specified",
"in"
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/util/cli/ArgParser.java#L157-L163 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java | PasswordManager.getInstance | public static PasswordManager getInstance(Path masterPwdLoc) {
State state = new State();
state.setProp(ConfigurationKeys.ENCRYPT_KEY_LOC, masterPwdLoc.toString());
state.setProp(ConfigurationKeys.ENCRYPT_KEY_FS_URI, masterPwdLoc.toUri());
try {
return CACHED_INSTANCES
.get(new CachedInstanceKey(state));
} catch (ExecutionException e) {
throw new RuntimeException("Unable to get an instance of PasswordManager", e);
}
} | java | public static PasswordManager getInstance(Path masterPwdLoc) {
State state = new State();
state.setProp(ConfigurationKeys.ENCRYPT_KEY_LOC, masterPwdLoc.toString());
state.setProp(ConfigurationKeys.ENCRYPT_KEY_FS_URI, masterPwdLoc.toUri());
try {
return CACHED_INSTANCES
.get(new CachedInstanceKey(state));
} catch (ExecutionException e) {
throw new RuntimeException("Unable to get an instance of PasswordManager", e);
}
} | [
"public",
"static",
"PasswordManager",
"getInstance",
"(",
"Path",
"masterPwdLoc",
")",
"{",
"State",
"state",
"=",
"new",
"State",
"(",
")",
";",
"state",
".",
"setProp",
"(",
"ConfigurationKeys",
".",
"ENCRYPT_KEY_LOC",
",",
"masterPwdLoc",
".",
"toString",
... | Get an instance. The master password file is given by masterPwdLoc. | [
"Get",
"an",
"instance",
".",
"The",
"master",
"password",
"file",
"is",
"given",
"by",
"masterPwdLoc",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java#L178-L188 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Maps.java | Maps.putIntoValueArrayList | public static <K, V> void putIntoValueArrayList(Map<K, List<V>> map, K key, V value) {
CollectionFactory<V> factory = CollectionFactory.arrayListFactory();
putIntoValueCollection(map, key, value, factory);
} | java | public static <K, V> void putIntoValueArrayList(Map<K, List<V>> map, K key, V value) {
CollectionFactory<V> factory = CollectionFactory.arrayListFactory();
putIntoValueCollection(map, key, value, factory);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"putIntoValueArrayList",
"(",
"Map",
"<",
"K",
",",
"List",
"<",
"V",
">",
">",
"map",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"CollectionFactory",
"<",
"V",
">",
"factory",
"=",
"Collectio... | Adds the value to the ArrayList given by map.get(key), creating a new ArrayList if needed. | [
"Adds",
"the",
"value",
"to",
"the",
"ArrayList",
"given",
"by",
"map",
".",
"get",
"(",
"key",
")",
"creating",
"a",
"new",
"ArrayList",
"if",
"needed",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Maps.java#L34-L37 |
forge/core | dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/collection/DependencyNodeUtil.java | DependencyNodeUtil.selectFirst | public static <T> T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter)
{
while (nodeIterator.hasNext())
{
T element = nodeIterator.next();
if (filter.accept(element))
{
return element;
}
}
return null;
} | java | public static <T> T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter)
{
while (nodeIterator.hasNext())
{
T element = nodeIterator.next();
if (filter.accept(element))
{
return element;
}
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"selectFirst",
"(",
"Iterator",
"<",
"T",
">",
"nodeIterator",
",",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{",
"while",
"(",
"nodeIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"T",
"element",
"=",
"nodeIt... | Returns the first {@link DependencyNode} object found that satisfy the filter.
@param nodeIterator A tree iterator
@param filter the {@link DependencyNodeFilter} being used
@return the first element that matches the filter. null if nothing is found
@see #breadthFirstIterator(DependencyNode)
@see #depthFirstIterator(DependencyNode)
@see #preorderIterator(DependencyNode) | [
"Returns",
"the",
"first",
"{",
"@link",
"DependencyNode",
"}",
"object",
"found",
"that",
"satisfy",
"the",
"filter",
"."
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/collection/DependencyNodeUtil.java#L50-L61 |
cache2k/cache2k | cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java | Cache2kConfiguration.setListeners | public void setListeners(Collection<CustomizationSupplier<CacheEntryOperationListener<K,V>>> c) {
getListeners().addAll(c);
} | java | public void setListeners(Collection<CustomizationSupplier<CacheEntryOperationListener<K,V>>> c) {
getListeners().addAll(c);
} | [
"public",
"void",
"setListeners",
"(",
"Collection",
"<",
"CustomizationSupplier",
"<",
"CacheEntryOperationListener",
"<",
"K",
",",
"V",
">",
">",
">",
"c",
")",
"{",
"getListeners",
"(",
")",
".",
"addAll",
"(",
"c",
")",
";",
"}"
] | Adds the collection of customizations to the existing list. This method is intended to
improve integration with bean configuration mechanisms that use the set method and
construct a set or list, like Springs' bean XML configuration. | [
"Adds",
"the",
"collection",
"of",
"customizations",
"to",
"the",
"existing",
"list",
".",
"This",
"method",
"is",
"intended",
"to",
"improve",
"integration",
"with",
"bean",
"configuration",
"mechanisms",
"that",
"use",
"the",
"set",
"method",
"and",
"construct... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/configuration/Cache2kConfiguration.java#L533-L535 |
flex-oss/flex-fruit | fruit-core/src/main/java/org/cdlflex/fruit/Range.java | Range.includes | public boolean includes(T value, boolean inclusive) {
if (inclusive) {
return value.compareTo(getStart()) >= 0 && value.compareTo(getEnd()) <= 0;
} else {
return value.compareTo(getStart()) > 0 && value.compareTo(getEnd()) < 0;
}
} | java | public boolean includes(T value, boolean inclusive) {
if (inclusive) {
return value.compareTo(getStart()) >= 0 && value.compareTo(getEnd()) <= 0;
} else {
return value.compareTo(getStart()) > 0 && value.compareTo(getEnd()) < 0;
}
} | [
"public",
"boolean",
"includes",
"(",
"T",
"value",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"inclusive",
")",
"{",
"return",
"value",
".",
"compareTo",
"(",
"getStart",
"(",
")",
")",
">=",
"0",
"&&",
"value",
".",
"compareTo",
"(",
"getEnd",... | Checks whether the given value is included in this range. If inclusive is set to true, checking for 1 in the
range of 1,10 will return true.
@param value the value to check
@param inclusive whether or not the range is open (the value is included)
@return true if the value is inside this range, false otherwise | [
"Checks",
"whether",
"the",
"given",
"value",
"is",
"included",
"in",
"this",
"range",
".",
"If",
"inclusive",
"is",
"set",
"to",
"true",
"checking",
"for",
"1",
"in",
"the",
"range",
"of",
"1",
"10",
"will",
"return",
"true",
"."
] | train | https://github.com/flex-oss/flex-fruit/blob/30d7eca5ee796b829f96c9932a95b259ca9738d9/fruit-core/src/main/java/org/cdlflex/fruit/Range.java#L73-L80 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/PennTreeReader.java | PennTreeReader.main | public static void main(String[] args) {
try {
TreeFactory tf = new LabeledScoredTreeFactory();
Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8"));
TreeReader tr = new PennTreeReader(r, tf);
Tree t = tr.readTree();
while (t != null) {
System.out.println(t);
System.out.println();
t = tr.readTree();
}
r.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
} | java | public static void main(String[] args) {
try {
TreeFactory tf = new LabeledScoredTreeFactory();
Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8"));
TreeReader tr = new PennTreeReader(r, tf);
Tree t = tr.readTree();
while (t != null) {
System.out.println(t);
System.out.println();
t = tr.readTree();
}
r.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"TreeFactory",
"tf",
"=",
"new",
"LabeledScoredTreeFactory",
"(",
")",
";",
"Reader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",... | Loads treebank data from first argument and prints it.
@param args Array of command-line arguments: specifies a filename | [
"Loads",
"treebank",
"data",
"from",
"first",
"argument",
"and",
"prints",
"it",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/PennTreeReader.java#L240-L255 |
alkacon/opencms-core | src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java | CmsSqlConsoleExecutor.executeQuery | @SuppressWarnings("resource")
private CmsSqlConsoleResults executeQuery(String sentence, String poolName) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
CmsSqlManager sqlManager = m_sqlManager;
try {
conn = sqlManager.getConnection(poolName);
stmt = sqlManager.getPreparedStatementForSql(conn, sentence);
res = stmt.executeQuery();
// add headings
ResultSetMetaData metadata = res.getMetaData();
List<String> heading = new ArrayList<>();
for (int i = 0; i < metadata.getColumnCount(); i++) {
heading.add(metadata.getColumnName(i + 1));
}
List<List<Object>> data = new ArrayList<List<Object>>();
// add contents
while (res.next()) {
List<Object> row = new ArrayList<Object>();
for (int i = 0; i < metadata.getColumnCount(); i++) {
Object value = res.getObject(i + 1);
if ((value instanceof String)
|| (value instanceof Integer)
|| (value instanceof Long)
|| (value instanceof Float)
|| (value instanceof Double)) {
row.add(value);
} else if (value == null) {
row.add(null);
} else {
row.add(String.valueOf(value));
}
}
data.add(row);
}
return new CmsSqlConsoleResults(heading, data);
} finally {
sqlManager.closeAll(null, conn, stmt, res);
}
} | java | @SuppressWarnings("resource")
private CmsSqlConsoleResults executeQuery(String sentence, String poolName) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
CmsSqlManager sqlManager = m_sqlManager;
try {
conn = sqlManager.getConnection(poolName);
stmt = sqlManager.getPreparedStatementForSql(conn, sentence);
res = stmt.executeQuery();
// add headings
ResultSetMetaData metadata = res.getMetaData();
List<String> heading = new ArrayList<>();
for (int i = 0; i < metadata.getColumnCount(); i++) {
heading.add(metadata.getColumnName(i + 1));
}
List<List<Object>> data = new ArrayList<List<Object>>();
// add contents
while (res.next()) {
List<Object> row = new ArrayList<Object>();
for (int i = 0; i < metadata.getColumnCount(); i++) {
Object value = res.getObject(i + 1);
if ((value instanceof String)
|| (value instanceof Integer)
|| (value instanceof Long)
|| (value instanceof Float)
|| (value instanceof Double)) {
row.add(value);
} else if (value == null) {
row.add(null);
} else {
row.add(String.valueOf(value));
}
}
data.add(row);
}
return new CmsSqlConsoleResults(heading, data);
} finally {
sqlManager.closeAll(null, conn, stmt, res);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"CmsSqlConsoleResults",
"executeQuery",
"(",
"String",
"sentence",
",",
"String",
"poolName",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
... | Executes a single <code>SELECT</code> sql sentence.<p>
@param sentence the sentence to execute
@param poolName the name of the pool to use
@return the list of rows returned by the rdbms
@throws SQLException in the case of a error | [
"Executes",
"a",
"single",
"<code",
">",
"SELECT<",
"/",
"code",
">",
"sql",
"sentence",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java#L179-L224 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java | MessageResponse.withEndpointResult | public MessageResponse withEndpointResult(java.util.Map<String, EndpointMessageResult> endpointResult) {
setEndpointResult(endpointResult);
return this;
} | java | public MessageResponse withEndpointResult(java.util.Map<String, EndpointMessageResult> endpointResult) {
setEndpointResult(endpointResult);
return this;
} | [
"public",
"MessageResponse",
"withEndpointResult",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"EndpointMessageResult",
">",
"endpointResult",
")",
"{",
"setEndpointResult",
"(",
"endpointResult",
")",
";",
"return",
"this",
";",
"}"
] | A map containing a multi part response for each address, with the endpointId as the key and the result as the
value.
@param endpointResult
A map containing a multi part response for each address, with the endpointId as the key and the result as
the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"map",
"containing",
"a",
"multi",
"part",
"response",
"for",
"each",
"address",
"with",
"the",
"endpointId",
"as",
"the",
"key",
"and",
"the",
"result",
"as",
"the",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java#L113-L116 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java | DisksInner.beginDelete | public OperationStatusResponseInner beginDelete(String resourceGroupName, String diskName) {
return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body();
} | java | public OperationStatusResponseInner beginDelete(String resourceGroupName, String diskName) {
return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body();
} | [
"public",
"OperationStatusResponseInner",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
")",
"{",
"return",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",... | Deletes a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@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 OperationStatusResponseInner object if successful. | [
"Deletes",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java#L642-L644 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.addDeprecation | public static void addDeprecation(String key, String newKey) {
addDeprecation(key, new String[] {newKey}, null);
} | java | public static void addDeprecation(String key, String newKey) {
addDeprecation(key, new String[] {newKey}, null);
} | [
"public",
"static",
"void",
"addDeprecation",
"(",
"String",
"key",
",",
"String",
"newKey",
")",
"{",
"addDeprecation",
"(",
"key",
",",
"new",
"String",
"[",
"]",
"{",
"newKey",
"}",
",",
"null",
")",
";",
"}"
] | Adds the deprecated key to the global deprecation map when no custom
message is provided.
It does not override any existing entries in the deprecation map.
This is to be used only by the developers in order to add deprecation of
keys, and attempts to call this method after loading resources once,
would lead to <tt>UnsupportedOperationException</tt>
If you have multiple deprecation entries to add, it is more efficient to
use #addDeprecations(DeprecationDelta[] deltas) instead.
@param key Key that is to be deprecated
@param newKey key that takes up the value of deprecated key | [
"Adds",
"the",
"deprecated",
"key",
"to",
"the",
"global",
"deprecation",
"map",
"when",
"no",
"custom",
"message",
"is",
"provided",
".",
"It",
"does",
"not",
"override",
"any",
"existing",
"entries",
"in",
"the",
"deprecation",
"map",
".",
"This",
"is",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L549-L551 |
ibm-bluemix-mobile-services/bms-clientsdk-android-push | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java | MFPPush.getSubscriptions | public void getSubscriptions(
final MFPPushResponseListener<List<String>> listener) {
MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId);
String path = builder.getSubscriptionsUrl(deviceId, null);
if (path == DEVICE_ID_NULL) {
listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API"));
return;
}
MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret);
invoker.setResponseListener(new ResponseListener() {
@Override
public void onSuccess(Response response) {
List<String> tagNames = new ArrayList<String>();
try {
JSONArray tags = (JSONArray) (new JSONObject(response.getResponseText()))
.get(SUBSCRIPTIONS);
int tagsCnt = tags.length();
for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) {
tagNames.add(tags.getJSONObject(tagsIdx)
.getString(TAG_NAME));
}
listener.onSuccess(tagNames);
} catch (JSONException e) {
logger.error("MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: " + e.getMessage());
listener.onFailure(new MFPPushException(e));
}
}
@Override
public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) {
//Error while getSubscriptions.
logger.error("MFPPush: Error while getSubscriptions");
listener.onFailure(getException(response,throwable,jsonObject));
}
});
invoker.execute();
} | java | public void getSubscriptions(
final MFPPushResponseListener<List<String>> listener) {
MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId);
String path = builder.getSubscriptionsUrl(deviceId, null);
if (path == DEVICE_ID_NULL) {
listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API"));
return;
}
MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret);
invoker.setResponseListener(new ResponseListener() {
@Override
public void onSuccess(Response response) {
List<String> tagNames = new ArrayList<String>();
try {
JSONArray tags = (JSONArray) (new JSONObject(response.getResponseText()))
.get(SUBSCRIPTIONS);
int tagsCnt = tags.length();
for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) {
tagNames.add(tags.getJSONObject(tagsIdx)
.getString(TAG_NAME));
}
listener.onSuccess(tagNames);
} catch (JSONException e) {
logger.error("MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: " + e.getMessage());
listener.onFailure(new MFPPushException(e));
}
}
@Override
public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) {
//Error while getSubscriptions.
logger.error("MFPPush: Error while getSubscriptions");
listener.onFailure(getException(response,throwable,jsonObject));
}
});
invoker.execute();
} | [
"public",
"void",
"getSubscriptions",
"(",
"final",
"MFPPushResponseListener",
"<",
"List",
"<",
"String",
">",
">",
"listener",
")",
"{",
"MFPPushUrlBuilder",
"builder",
"=",
"new",
"MFPPushUrlBuilder",
"(",
"applicationId",
")",
";",
"String",
"path",
"=",
"bu... | Get the list of tags subscribed to
@param listener Mandatory listener class. When the list of tags subscribed to
are successfully retrieved the {@link MFPPushResponseListener}
.onSuccess method is called with the list of tagNames
{@link MFPPushResponseListener}.onFailure method is called
otherwise | [
"Get",
"the",
"list",
"of",
"tags",
"subscribed",
"to"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L596-L637 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java | State.getPropAsShortWithRadix | public short getPropAsShortWithRadix(String key, short def, int radix) {
return contains(key) ? Short.parseShort(getProp(key), radix) : def;
} | java | public short getPropAsShortWithRadix(String key, short def, int radix) {
return contains(key) ? Short.parseShort(getProp(key), radix) : def;
} | [
"public",
"short",
"getPropAsShortWithRadix",
"(",
"String",
"key",
",",
"short",
"def",
",",
"int",
"radix",
")",
"{",
"return",
"contains",
"(",
"key",
")",
"?",
"Short",
".",
"parseShort",
"(",
"getProp",
"(",
"key",
")",
",",
"radix",
")",
":",
"de... | Get the value of a property as an short, using the given default value if the property is not set.
@param key property key
@param def default value
@param radix radix used to parse the value
@return short value associated with the key or the default value if the property is not set | [
"Get",
"the",
"value",
"of",
"a",
"property",
"as",
"an",
"short",
"using",
"the",
"given",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"set",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L428-L430 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java | OdsElements.finalizeContent | public void finalizeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException {
this.contentElement.flushTables(xmlUtil, writer);
this.contentElement.writePostamble(xmlUtil, writer);
} | java | public void finalizeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException {
this.contentElement.flushTables(xmlUtil, writer);
this.contentElement.writePostamble(xmlUtil, writer);
} | [
"public",
"void",
"finalizeContent",
"(",
"final",
"XMLUtil",
"xmlUtil",
",",
"final",
"ZipUTF8Writer",
"writer",
")",
"throws",
"IOException",
"{",
"this",
".",
"contentElement",
".",
"flushTables",
"(",
"xmlUtil",
",",
"writer",
")",
";",
"this",
".",
"conte... | Flush tables and write end of document
@param xmlUtil the util
@param writer the stream to write
@throws IOException when write fails | [
"Flush",
"tables",
"and",
"write",
"end",
"of",
"document"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L257-L260 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.getAsync | public Observable<VersionInfo> getAsync(UUID appId, String versionId) {
return getWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<VersionInfo>, VersionInfo>() {
@Override
public VersionInfo call(ServiceResponse<VersionInfo> response) {
return response.body();
}
});
} | java | public Observable<VersionInfo> getAsync(UUID appId, String versionId) {
return getWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<VersionInfo>, VersionInfo>() {
@Override
public VersionInfo call(ServiceResponse<VersionInfo> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VersionInfo",
">",
"getAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",... | Gets the version info.
@param appId The application ID.
@param versionId The version ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VersionInfo object | [
"Gets",
"the",
"version",
"info",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L474-L481 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/analysis/DataAnalysis.java | DataAnalysis.fromJson | public static DataAnalysis fromJson(String json) {
try{
return new JsonSerializer().getObjectMapper().readValue(json, DataAnalysis.class);
} catch (Exception e){
//Legacy format
ObjectMapper om = new JsonSerializer().getObjectMapper();
return fromMapper(om, json);
}
} | java | public static DataAnalysis fromJson(String json) {
try{
return new JsonSerializer().getObjectMapper().readValue(json, DataAnalysis.class);
} catch (Exception e){
//Legacy format
ObjectMapper om = new JsonSerializer().getObjectMapper();
return fromMapper(om, json);
}
} | [
"public",
"static",
"DataAnalysis",
"fromJson",
"(",
"String",
"json",
")",
"{",
"try",
"{",
"return",
"new",
"JsonSerializer",
"(",
")",
".",
"getObjectMapper",
"(",
")",
".",
"readValue",
"(",
"json",
",",
"DataAnalysis",
".",
"class",
")",
";",
"}",
"... | Deserialize a JSON DataAnalysis String that was previously serialized with {@link #toJson()} | [
"Deserialize",
"a",
"JSON",
"DataAnalysis",
"String",
"that",
"was",
"previously",
"serialized",
"with",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/analysis/DataAnalysis.java#L116-L124 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/MathUtils.java | MathUtils.isAliquot | public static <T extends Number> boolean isAliquot(final T dividend, final T divisor) {
return dividend.doubleValue() % divisor.doubleValue() == 0;
} | java | public static <T extends Number> boolean isAliquot(final T dividend, final T divisor) {
return dividend.doubleValue() % divisor.doubleValue() == 0;
} | [
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"boolean",
"isAliquot",
"(",
"final",
"T",
"dividend",
",",
"final",
"T",
"divisor",
")",
"{",
"return",
"dividend",
".",
"doubleValue",
"(",
")",
"%",
"divisor",
".",
"doubleValue",
"(",
")",
"==",... | Judge divisor is an aliquot part of dividend.</br> 判断被除数是否能被除数整除。
@param dividend
number to be handled.被除数。
@param divisor
number to be handled.除数。
@return true if divisor is an aliquot part of dividend, otherwise
false.是否能被整除。 | [
"Judge",
"divisor",
"is",
"an",
"aliquot",
"part",
"of",
"dividend",
".",
"<",
"/",
"br",
">",
"判断被除数是否能被除数整除。"
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/MathUtils.java#L221-L224 |
ManfredTremmel/gwt-bean-validators | gwtp-spring-integration/src/main/java/de/knightsoftnet/gwtp/spring/server/security/CsrfCookieHandler.java | CsrfCookieHandler.setCookie | public void setCookie(final HttpServletRequest prequest, final HttpServletResponse presponse)
throws IOException {
final CsrfToken csrf = (CsrfToken) prequest.getAttribute(CsrfToken.class.getName());
if (csrf != null) {
Cookie cookie = WebUtils.getCookie(prequest, ResourcePaths.XSRF_COOKIE);
final String token = csrf.getToken();
if (cookie == null || token != null && !token.equals(cookie.getValue())) {
cookie = new Cookie(ResourcePaths.XSRF_COOKIE, token);
cookie.setPath(
StringUtils.defaultString(StringUtils.trimToNull(prequest.getContextPath()), "/"));
presponse.addCookie(cookie);
}
}
} | java | public void setCookie(final HttpServletRequest prequest, final HttpServletResponse presponse)
throws IOException {
final CsrfToken csrf = (CsrfToken) prequest.getAttribute(CsrfToken.class.getName());
if (csrf != null) {
Cookie cookie = WebUtils.getCookie(prequest, ResourcePaths.XSRF_COOKIE);
final String token = csrf.getToken();
if (cookie == null || token != null && !token.equals(cookie.getValue())) {
cookie = new Cookie(ResourcePaths.XSRF_COOKIE, token);
cookie.setPath(
StringUtils.defaultString(StringUtils.trimToNull(prequest.getContextPath()), "/"));
presponse.addCookie(cookie);
}
}
} | [
"public",
"void",
"setCookie",
"(",
"final",
"HttpServletRequest",
"prequest",
",",
"final",
"HttpServletResponse",
"presponse",
")",
"throws",
"IOException",
"{",
"final",
"CsrfToken",
"csrf",
"=",
"(",
"CsrfToken",
")",
"prequest",
".",
"getAttribute",
"(",
"Csr... | set csrf/xsrf cookie.
@param prequest http servlet request
@param presponse http servlet response
@throws IOException when io operation fails | [
"set",
"csrf",
"/",
"xsrf",
"cookie",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/java/de/knightsoftnet/gwtp/spring/server/security/CsrfCookieHandler.java#L46-L59 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Reference.java | Reference.newInstance | public static Reference newInstance(Requirement requirement, Specification specification, SystemUnderTest sut, String sections)
{
Reference reference = new Reference();
reference.setSections(sections);
reference.setRequirement(requirement);
reference.setSpecification(specification);
reference.setSystemUnderTest(sut);
requirement.getReferences().add(reference);
specification.getReferences().add(reference);
return reference;
} | java | public static Reference newInstance(Requirement requirement, Specification specification, SystemUnderTest sut, String sections)
{
Reference reference = new Reference();
reference.setSections(sections);
reference.setRequirement(requirement);
reference.setSpecification(specification);
reference.setSystemUnderTest(sut);
requirement.getReferences().add(reference);
specification.getReferences().add(reference);
return reference;
} | [
"public",
"static",
"Reference",
"newInstance",
"(",
"Requirement",
"requirement",
",",
"Specification",
"specification",
",",
"SystemUnderTest",
"sut",
",",
"String",
"sections",
")",
"{",
"Reference",
"reference",
"=",
"new",
"Reference",
"(",
")",
";",
"referen... | <p>newInstance.</p>
@param requirement a {@link com.greenpepper.server.domain.Requirement} object.
@param specification a {@link com.greenpepper.server.domain.Specification} object.
@param sut a {@link com.greenpepper.server.domain.SystemUnderTest} object.
@param sections a {@link java.lang.String} object.
@return a {@link com.greenpepper.server.domain.Reference} object. | [
"<p",
">",
"newInstance",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Reference.java#L67-L79 |
VoltDB/voltdb | src/frontend/org/voltdb/SnapshotSiteProcessor.java | SnapshotSiteProcessor.startSnapshotWithTargets | public void startSnapshotWithTargets(Collection<SnapshotDataTarget> targets, long now)
{
// TRAIL [SnapSave:9] 5 [all SP] Start snapshot by putting task into the site queue.
//Basically asserts that there are no tasks with null targets at this point
//getTarget checks and crashes
for (SnapshotTableTask t : m_snapshotTableTasks.values()) {
t.getTarget();
}
ArrayList<SnapshotDataTarget> targetsToClose = Lists.newArrayList();
for (final SnapshotDataTarget target : targets) {
if (target.needsFinalClose()) {
targetsToClose.add(target);
}
}
m_snapshotTargets = targetsToClose;
// Queue the first snapshot task
VoltDB.instance().schedulePriorityWork(
new Runnable() {
@Override
public void run()
{
m_siteTaskerQueue.offer(new SnapshotTask());
}
},
(m_quietUntil + (5 * m_snapshotPriority) - now),
0,
TimeUnit.MILLISECONDS);
m_quietUntil += 5 * m_snapshotPriority;
} | java | public void startSnapshotWithTargets(Collection<SnapshotDataTarget> targets, long now)
{
// TRAIL [SnapSave:9] 5 [all SP] Start snapshot by putting task into the site queue.
//Basically asserts that there are no tasks with null targets at this point
//getTarget checks and crashes
for (SnapshotTableTask t : m_snapshotTableTasks.values()) {
t.getTarget();
}
ArrayList<SnapshotDataTarget> targetsToClose = Lists.newArrayList();
for (final SnapshotDataTarget target : targets) {
if (target.needsFinalClose()) {
targetsToClose.add(target);
}
}
m_snapshotTargets = targetsToClose;
// Queue the first snapshot task
VoltDB.instance().schedulePriorityWork(
new Runnable() {
@Override
public void run()
{
m_siteTaskerQueue.offer(new SnapshotTask());
}
},
(m_quietUntil + (5 * m_snapshotPriority) - now),
0,
TimeUnit.MILLISECONDS);
m_quietUntil += 5 * m_snapshotPriority;
} | [
"public",
"void",
"startSnapshotWithTargets",
"(",
"Collection",
"<",
"SnapshotDataTarget",
">",
"targets",
",",
"long",
"now",
")",
"{",
"// TRAIL [SnapSave:9] 5 [all SP] Start snapshot by putting task into the site queue.",
"//Basically asserts that there are no tasks with null targe... | This is called from the snapshot IO thread when the deferred setup is finished. It sets
the data targets and queues a snapshot task onto the site thread. | [
"This",
"is",
"called",
"from",
"the",
"snapshot",
"IO",
"thread",
"when",
"the",
"deferred",
"setup",
"is",
"finished",
".",
"It",
"sets",
"the",
"data",
"targets",
"and",
"queues",
"a",
"snapshot",
"task",
"onto",
"the",
"site",
"thread",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/SnapshotSiteProcessor.java#L452-L482 |
alkacon/opencms-core | src/org/opencms/file/collectors/CmsDefaultResourceCollector.java | CmsDefaultResourceCollector.allInFolderDateReleasedDesc | protected List<CmsResource> allInFolderDateReleasedDesc(CmsObject cms, String param, boolean tree, int numResults)
throws CmsException {
CmsCollectorData data = new CmsCollectorData(param);
String foldername = CmsResource.getFolderPath(data.getFileName());
CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(data.getType()).addExcludeFlags(
CmsResource.FLAG_TEMPFILE);
if (data.isExcludeTimerange() && !cms.getRequestContext().getCurrentProject().isOnlineProject()) {
// include all not yet released and expired resources in an offline project
filter = filter.addExcludeTimerange();
}
List<CmsResource> result = cms.readResources(foldername, filter, tree);
Collections.sort(result, I_CmsResource.COMPARE_DATE_RELEASED);
return shrinkToFit(result, data.getCount(), numResults);
} | java | protected List<CmsResource> allInFolderDateReleasedDesc(CmsObject cms, String param, boolean tree, int numResults)
throws CmsException {
CmsCollectorData data = new CmsCollectorData(param);
String foldername = CmsResource.getFolderPath(data.getFileName());
CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(data.getType()).addExcludeFlags(
CmsResource.FLAG_TEMPFILE);
if (data.isExcludeTimerange() && !cms.getRequestContext().getCurrentProject().isOnlineProject()) {
// include all not yet released and expired resources in an offline project
filter = filter.addExcludeTimerange();
}
List<CmsResource> result = cms.readResources(foldername, filter, tree);
Collections.sort(result, I_CmsResource.COMPARE_DATE_RELEASED);
return shrinkToFit(result, data.getCount(), numResults);
} | [
"protected",
"List",
"<",
"CmsResource",
">",
"allInFolderDateReleasedDesc",
"(",
"CmsObject",
"cms",
",",
"String",
"param",
",",
"boolean",
"tree",
",",
"int",
"numResults",
")",
"throws",
"CmsException",
"{",
"CmsCollectorData",
"data",
"=",
"new",
"CmsCollecto... | Returns a List of all resources in the folder pointed to by the parameter
sorted by the release date, descending.<p>
@param cms the current CmsObject
@param param the folder name to use
@param tree if true, look in folder and all child folders, if false, look only in given folder
@param numResults the number of results
@return a List of all resources in the folder pointed to by the parameter
sorted by the release date, descending
@throws CmsException if something goes wrong | [
"Returns",
"a",
"List",
"of",
"all",
"resources",
"in",
"the",
"folder",
"pointed",
"to",
"by",
"the",
"parameter",
"sorted",
"by",
"the",
"release",
"date",
"descending",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/CmsDefaultResourceCollector.java#L225-L242 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java | CmsGalleryControllerHandler.setCategoriesTabContent | public void setCategoriesTabContent(List<CmsCategoryTreeEntry> categoryRoot, List<String> selected) {
m_galleryDialog.getCategoriesTab().fillContent(categoryRoot, selected);
} | java | public void setCategoriesTabContent(List<CmsCategoryTreeEntry> categoryRoot, List<String> selected) {
m_galleryDialog.getCategoriesTab().fillContent(categoryRoot, selected);
} | [
"public",
"void",
"setCategoriesTabContent",
"(",
"List",
"<",
"CmsCategoryTreeEntry",
">",
"categoryRoot",
",",
"List",
"<",
"String",
">",
"selected",
")",
"{",
"m_galleryDialog",
".",
"getCategoriesTab",
"(",
")",
".",
"fillContent",
"(",
"categoryRoot",
",",
... | Sets the list content of the category tab.<p>
@param categoryRoot the root category tree entry
@param selected the selected categories | [
"Sets",
"the",
"list",
"content",
"of",
"the",
"category",
"tab",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L438-L441 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/ComplexNumber.java | ComplexNumber.Swap | public static void Swap(ComplexNumber[] z) {
for (int i = 0; i < z.length; i++) {
z[i] = new ComplexNumber(z[i].imaginary, z[i].real);
}
} | java | public static void Swap(ComplexNumber[] z) {
for (int i = 0; i < z.length; i++) {
z[i] = new ComplexNumber(z[i].imaginary, z[i].real);
}
} | [
"public",
"static",
"void",
"Swap",
"(",
"ComplexNumber",
"[",
"]",
"z",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"z",
".",
"length",
";",
"i",
"++",
")",
"{",
"z",
"[",
"i",
"]",
"=",
"new",
"ComplexNumber",
"(",
"z",
"[",
... | Swap values between real and imaginary.
@param z Complex number. | [
"Swap",
"values",
"between",
"real",
"and",
"imaginary",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L174-L178 |
classgraph/classgraph | src/main/java/io/github/classgraph/Classfile.java | Classfile.readAnnotationElementValue | private Object readAnnotationElementValue() throws IOException {
final int tag = (char) inputStreamOrByteBuffer.readUnsignedByte();
switch (tag) {
case 'B':
return (byte) cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'C':
return (char) cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'D':
return Double.longBitsToDouble(cpReadLong(inputStreamOrByteBuffer.readUnsignedShort()));
case 'F':
return Float.intBitsToFloat(cpReadInt(inputStreamOrByteBuffer.readUnsignedShort()));
case 'I':
return cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'J':
return cpReadLong(inputStreamOrByteBuffer.readUnsignedShort());
case 'S':
return (short) cpReadUnsignedShort(inputStreamOrByteBuffer.readUnsignedShort());
case 'Z':
return cpReadInt(inputStreamOrByteBuffer.readUnsignedShort()) != 0;
case 's':
return getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
case 'e': {
// Return type is AnnotationEnumVal.
final String annotationClassName = getConstantPoolClassDescriptor(
inputStreamOrByteBuffer.readUnsignedShort());
final String annotationConstName = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
return new AnnotationEnumValue(annotationClassName, annotationConstName);
}
case 'c':
// Return type is AnnotationClassRef (for class references in annotations)
final String classRefTypeDescriptor = getConstantPoolString(
inputStreamOrByteBuffer.readUnsignedShort());
return new AnnotationClassRef(classRefTypeDescriptor);
case '@':
// Complex (nested) annotation. Return type is AnnotationInfo.
return readAnnotation();
case '[':
// Return type is Object[] (of nested annotation element values)
final int count = inputStreamOrByteBuffer.readUnsignedShort();
final Object[] arr = new Object[count];
for (int i = 0; i < count; ++i) {
// Nested annotation element value
arr[i] = readAnnotationElementValue();
}
return arr;
default:
throw new ClassfileFormatException("Class " + className + " has unknown annotation element type tag '"
+ ((char) tag) + "': element size unknown, cannot continue reading class. "
+ "Please report this at https://github.com/classgraph/classgraph/issues");
}
} | java | private Object readAnnotationElementValue() throws IOException {
final int tag = (char) inputStreamOrByteBuffer.readUnsignedByte();
switch (tag) {
case 'B':
return (byte) cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'C':
return (char) cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'D':
return Double.longBitsToDouble(cpReadLong(inputStreamOrByteBuffer.readUnsignedShort()));
case 'F':
return Float.intBitsToFloat(cpReadInt(inputStreamOrByteBuffer.readUnsignedShort()));
case 'I':
return cpReadInt(inputStreamOrByteBuffer.readUnsignedShort());
case 'J':
return cpReadLong(inputStreamOrByteBuffer.readUnsignedShort());
case 'S':
return (short) cpReadUnsignedShort(inputStreamOrByteBuffer.readUnsignedShort());
case 'Z':
return cpReadInt(inputStreamOrByteBuffer.readUnsignedShort()) != 0;
case 's':
return getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
case 'e': {
// Return type is AnnotationEnumVal.
final String annotationClassName = getConstantPoolClassDescriptor(
inputStreamOrByteBuffer.readUnsignedShort());
final String annotationConstName = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
return new AnnotationEnumValue(annotationClassName, annotationConstName);
}
case 'c':
// Return type is AnnotationClassRef (for class references in annotations)
final String classRefTypeDescriptor = getConstantPoolString(
inputStreamOrByteBuffer.readUnsignedShort());
return new AnnotationClassRef(classRefTypeDescriptor);
case '@':
// Complex (nested) annotation. Return type is AnnotationInfo.
return readAnnotation();
case '[':
// Return type is Object[] (of nested annotation element values)
final int count = inputStreamOrByteBuffer.readUnsignedShort();
final Object[] arr = new Object[count];
for (int i = 0; i < count; ++i) {
// Nested annotation element value
arr[i] = readAnnotationElementValue();
}
return arr;
default:
throw new ClassfileFormatException("Class " + className + " has unknown annotation element type tag '"
+ ((char) tag) + "': element size unknown, cannot continue reading class. "
+ "Please report this at https://github.com/classgraph/classgraph/issues");
}
} | [
"private",
"Object",
"readAnnotationElementValue",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"tag",
"=",
"(",
"char",
")",
"inputStreamOrByteBuffer",
".",
"readUnsignedByte",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"'",
"'",
":",... | Read annotation element value from classfile.
@return the annotation element value
@throws IOException
If an IO exception occurs. | [
"Read",
"annotation",
"element",
"value",
"from",
"classfile",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/Classfile.java#L831-L881 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java | AbstractLayoutManager.setBandFinalHeight | private void setBandFinalHeight(JRDesignBand band, int currHeigth, boolean fitToContent) {
if (band != null) {
int finalHeight = LayoutUtils.findVerticalOffset(band);
//noinspection StatementWithEmptyBody
if (finalHeight < currHeigth && !fitToContent) {
//nothing
} else {
band.setHeight(finalHeight);
}
}
} | java | private void setBandFinalHeight(JRDesignBand band, int currHeigth, boolean fitToContent) {
if (band != null) {
int finalHeight = LayoutUtils.findVerticalOffset(band);
//noinspection StatementWithEmptyBody
if (finalHeight < currHeigth && !fitToContent) {
//nothing
} else {
band.setHeight(finalHeight);
}
}
} | [
"private",
"void",
"setBandFinalHeight",
"(",
"JRDesignBand",
"band",
",",
"int",
"currHeigth",
",",
"boolean",
"fitToContent",
")",
"{",
"if",
"(",
"band",
"!=",
"null",
")",
"{",
"int",
"finalHeight",
"=",
"LayoutUtils",
".",
"findVerticalOffset",
"(",
"band... | Removes empty space when "fitToContent" is true and real height of object is
taller than current bands height, otherwise, it is not modified
@param band
@param currHeigth
@param fitToContent | [
"Removes",
"empty",
"space",
"when",
"fitToContent",
"is",
"true",
"and",
"real",
"height",
"of",
"object",
"is",
"taller",
"than",
"current",
"bands",
"height",
"otherwise",
"it",
"is",
"not",
"modified"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L742-L753 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java | OverlayHelper.attachOverlay | public static void attachOverlay(JComponent overlay, JComponent overlayTarget, int center, int xOffset, int yOffset)
{
new OverlayHelper(overlay, overlayTarget, center, xOffset, yOffset);
} | java | public static void attachOverlay(JComponent overlay, JComponent overlayTarget, int center, int xOffset, int yOffset)
{
new OverlayHelper(overlay, overlayTarget, center, xOffset, yOffset);
} | [
"public",
"static",
"void",
"attachOverlay",
"(",
"JComponent",
"overlay",
",",
"JComponent",
"overlayTarget",
",",
"int",
"center",
",",
"int",
"xOffset",
",",
"int",
"yOffset",
")",
"{",
"new",
"OverlayHelper",
"(",
"overlay",
",",
"overlayTarget",
",",
"cen... | Attaches an overlay to the specified component.
@param overlay the overlay component
@param overlayTarget the component over which <code>overlay</code> will be
attached
@param center position relative to <code>overlayTarget</code> that overlay
should be centered. May be one of the
<code>SwingConstants</code> compass positions or
<code>SwingConstants.CENTER</code>.
@param xOffset x offset from center
@param yOffset y offset from center
@see SwingConstants | [
"Attaches",
"an",
"overlay",
"to",
"the",
"specified",
"component",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/OverlayHelper.java#L67-L70 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java | NavigationLauncher.startNavigation | public static void startNavigation(Activity activity, NavigationLauncherOptions options) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = preferences.edit();
storeDirectionsRouteValue(options, editor);
storeConfiguration(options, editor);
storeThemePreferences(options, editor);
storeOfflinePath(options, editor);
storeOfflineVersion(options, editor);
editor.apply();
Intent navigationActivity = new Intent(activity, MapboxNavigationActivity.class);
storeInitialMapPosition(options, navigationActivity);
activity.startActivity(navigationActivity);
} | java | public static void startNavigation(Activity activity, NavigationLauncherOptions options) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = preferences.edit();
storeDirectionsRouteValue(options, editor);
storeConfiguration(options, editor);
storeThemePreferences(options, editor);
storeOfflinePath(options, editor);
storeOfflineVersion(options, editor);
editor.apply();
Intent navigationActivity = new Intent(activity, MapboxNavigationActivity.class);
storeInitialMapPosition(options, navigationActivity);
activity.startActivity(navigationActivity);
} | [
"public",
"static",
"void",
"startNavigation",
"(",
"Activity",
"activity",
",",
"NavigationLauncherOptions",
"options",
")",
"{",
"SharedPreferences",
"preferences",
"=",
"PreferenceManager",
".",
"getDefaultSharedPreferences",
"(",
"activity",
")",
";",
"SharedPreferenc... | Starts the UI with a {@link DirectionsRoute} already retrieved from
{@link com.mapbox.services.android.navigation.v5.navigation.NavigationRoute}
@param activity must be launched from another {@link Activity}
@param options with fields to customize the navigation view | [
"Starts",
"the",
"UI",
"with",
"a",
"{",
"@link",
"DirectionsRoute",
"}",
"already",
"retrieved",
"from",
"{",
"@link",
"com",
".",
"mapbox",
".",
"services",
".",
"android",
".",
"navigation",
".",
"v5",
".",
"navigation",
".",
"NavigationRoute",
"}"
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java#L33-L49 |
netty/netty | buffer/src/main/java/io/netty/buffer/PoolThreadCache.java | PoolThreadCache.allocateTiny | boolean allocateTiny(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) {
return allocate(cacheForTiny(area, normCapacity), buf, reqCapacity);
} | java | boolean allocateTiny(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) {
return allocate(cacheForTiny(area, normCapacity), buf, reqCapacity);
} | [
"boolean",
"allocateTiny",
"(",
"PoolArena",
"<",
"?",
">",
"area",
",",
"PooledByteBuf",
"<",
"?",
">",
"buf",
",",
"int",
"reqCapacity",
",",
"int",
"normCapacity",
")",
"{",
"return",
"allocate",
"(",
"cacheForTiny",
"(",
"area",
",",
"normCapacity",
")... | Try to allocate a tiny buffer out of the cache. Returns {@code true} if successful {@code false} otherwise | [
"Try",
"to",
"allocate",
"a",
"tiny",
"buffer",
"out",
"of",
"the",
"cache",
".",
"Returns",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolThreadCache.java#L165-L167 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java | PolylineSplitMerge.initializeScore | private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) {
// Score each side
Element<Corner> e = list.getHead();
Element<Corner> end = loops ? null : list.getTail();
while( e != end ) {
if (convex && !isSideConvex(contour, e))
return false;
Element<Corner> n = e.next;
double error;
if( n == null ) {
error = computeSideError(contour,e.object.index, list.getHead().object.index);
} else {
error = computeSideError(contour,e.object.index, n.object.index);
}
e.object.sideError = error;
e = n;
}
// Compute what would happen if a side was split
e = list.getHead();
while( e != end ) {
computePotentialSplitScore(contour,e,list.size() < minSides);
e = e.next;
}
return true;
} | java | private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) {
// Score each side
Element<Corner> e = list.getHead();
Element<Corner> end = loops ? null : list.getTail();
while( e != end ) {
if (convex && !isSideConvex(contour, e))
return false;
Element<Corner> n = e.next;
double error;
if( n == null ) {
error = computeSideError(contour,e.object.index, list.getHead().object.index);
} else {
error = computeSideError(contour,e.object.index, n.object.index);
}
e.object.sideError = error;
e = n;
}
// Compute what would happen if a side was split
e = list.getHead();
while( e != end ) {
computePotentialSplitScore(contour,e,list.size() < minSides);
e = e.next;
}
return true;
} | [
"private",
"boolean",
"initializeScore",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"boolean",
"loops",
")",
"{",
"// Score each side",
"Element",
"<",
"Corner",
">",
"e",
"=",
"list",
".",
"getHead",
"(",
")",
";",
"Element",
"<",
"Corner",
">"... | Computes the score and potential split for each side
@param contour
@return | [
"Computes",
"the",
"score",
"and",
"potential",
"split",
"for",
"each",
"side"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L349-L377 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericOneIdentOrColor | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
|| genericTermColor(d.get(0), d.getProperty(),
colorIdentification, properties, values);
} | java | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
|| genericTermColor(d.get(0), d.getProperty(),
colorIdentification, properties, values);
} | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericOneIdentOrColor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"colorIdentification",
",",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"... | Processes declaration which is supposed to contain one identification
term or one TermColor
@param <T>
Type of CSSProperty
@param type
Class of enum to be stored
@param colorIdentification
Instance of CSSProperty stored into properties to indicate
that additional value of type TermColor is stored in values
@param d
Declaration to be parsed
@param properties
Properties map where to store enum
@param values
@return <code>true</code> in case of success, <code>false</code>
elsewhere | [
"Processes",
"declaration",
"which",
"is",
"supposed",
"to",
"contain",
"one",
"identification",
"term",
"or",
"one",
"TermColor"
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L481-L492 |
alkacon/opencms-core | src/org/opencms/relations/CmsLinkUpdateUtil.java | CmsLinkUpdateUtil.updateType | public static void updateType(Element element, CmsRelationType type) {
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, type.getNameForXml());
} | java | public static void updateType(Element element, CmsRelationType type) {
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, type.getNameForXml());
} | [
"public",
"static",
"void",
"updateType",
"(",
"Element",
"element",
",",
"CmsRelationType",
"type",
")",
"{",
"updateAttribute",
"(",
"element",
",",
"CmsLink",
".",
"ATTRIBUTE_TYPE",
",",
"type",
".",
"getNameForXml",
"(",
")",
")",
";",
"}"
] | Updates the type for a link xml element node.<p>
@param element the link element node to update
@param type the relation type to set | [
"Updates",
"the",
"type",
"for",
"a",
"link",
"xml",
"element",
"node",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLinkUpdateUtil.java#L55-L58 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.castArg | public SmartBinder castArg(String name, Class<?> type) {
Signature newSig = signature().replaceArg(name, name, type);
return new SmartBinder(this, newSig, binder.cast(newSig.type()));
} | java | public SmartBinder castArg(String name, Class<?> type) {
Signature newSig = signature().replaceArg(name, name, type);
return new SmartBinder(this, newSig, binder.cast(newSig.type()));
} | [
"public",
"SmartBinder",
"castArg",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"Signature",
"newSig",
"=",
"signature",
"(",
")",
".",
"replaceArg",
"(",
"name",
",",
"name",
",",
"type",
")",
";",
"return",
"new",
"SmartBind... | Cast the named argument to the given type.
@param name the name of the argument to cast
@param type the type to which that argument will be cast
@return a new SmartBinder with the cast applied | [
"Cast",
"the",
"named",
"argument",
"to",
"the",
"given",
"type",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L906-L909 |
jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.relatedTo | private boolean relatedTo(@Nonnull AbstractBuild<?, ?> b) {
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
} | java | private boolean relatedTo(@Nonnull AbstractBuild<?, ?> b) {
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"relatedTo",
"(",
"@",
"Nonnull",
"AbstractBuild",
"<",
"?",
",",
"?",
">",
"b",
")",
"{",
"if",
"(",
"b",
".",
"hasParticipant",
"(",
"this",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"Cause",
"cause",
":",
"b",
... | true if {@link AbstractBuild#hasParticipant} or {@link hudson.model.Cause.UserIdCause} | [
"true",
"if",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L668-L681 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.bucketSort | public static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) {
Array.bucketSort(c, cmp);
} | java | public static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) {
Array.bucketSort(c, cmp);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"bucketSort",
"(",
"final",
"List",
"<",
"?",
"extends",
"T",
">",
"c",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"cmp",
")",
"{",
"Array",
".",
"bucketSort",
"(",
"c",
",",
"cmp",
")",
";... | Note: All the objects with same value will be replaced with first element with the same value.
@param c
@param cmp | [
"Note",
":",
"All",
"the",
"objects",
"with",
"same",
"value",
"will",
"be",
"replaced",
"with",
"first",
"element",
"with",
"the",
"same",
"value",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12054-L12056 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java | ValueMap.withBinarySet | public ValueMap withBinarySet(String key, byte[] ... val) {
super.put(key, new LinkedHashSet<byte[]>(Arrays.asList(val)));
return this;
} | java | public ValueMap withBinarySet(String key, byte[] ... val) {
super.put(key, new LinkedHashSet<byte[]>(Arrays.asList(val)));
return this;
} | [
"public",
"ValueMap",
"withBinarySet",
"(",
"String",
"key",
",",
"byte",
"[",
"]",
"...",
"val",
")",
"{",
"super",
".",
"put",
"(",
"key",
",",
"new",
"LinkedHashSet",
"<",
"byte",
"[",
"]",
">",
"(",
"Arrays",
".",
"asList",
"(",
"val",
")",
")"... | Sets the value of the specified key in the current ValueMap to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"key",
"in",
"the",
"current",
"ValueMap",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L149-L152 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java | ChunkBlockHandler.addCoord | private void addCoord(World world, BlockPos pos, int size)
{
getAffectedChunks(world, pos.getX(), pos.getZ(), size).forEach(c -> addCoord(c, pos));
} | java | private void addCoord(World world, BlockPos pos, int size)
{
getAffectedChunks(world, pos.getX(), pos.getZ(), size).forEach(c -> addCoord(c, pos));
} | [
"private",
"void",
"addCoord",
"(",
"World",
"world",
",",
"BlockPos",
"pos",
",",
"int",
"size",
")",
"{",
"getAffectedChunks",
"(",
"world",
",",
"pos",
".",
"getX",
"(",
")",
",",
"pos",
".",
"getZ",
"(",
")",
",",
"size",
")",
".",
"forEach",
"... | Adds a coordinate for the {@link Chunk Chunks} around {@link BlockPos}.
@param world the world
@param pos the pos
@param size the size | [
"Adds",
"a",
"coordinate",
"for",
"the",
"{",
"@link",
"Chunk",
"Chunks",
"}",
"around",
"{",
"@link",
"BlockPos",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java#L148-L151 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java | CommonOps_ZDRM.fill | public static void fill(ZMatrixD1 a, double real, double imaginary)
{
int N = a.getDataLength();
for (int i = 0; i < N; i += 2) {
a.data[i] = real;
a.data[i+1] = imaginary;
}
} | java | public static void fill(ZMatrixD1 a, double real, double imaginary)
{
int N = a.getDataLength();
for (int i = 0; i < N; i += 2) {
a.data[i] = real;
a.data[i+1] = imaginary;
}
} | [
"public",
"static",
"void",
"fill",
"(",
"ZMatrixD1",
"a",
",",
"double",
"real",
",",
"double",
"imaginary",
")",
"{",
"int",
"N",
"=",
"a",
".",
"getDataLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"... | <p>
Sets every element in the matrix to the specified value.<br>
<br>
a<sub>ij</sub> = value
<p>
@param a A matrix whose elements are about to be set. Modified.
@param real The real component
@param imaginary The imaginary component | [
"<p",
">",
"Sets",
"every",
"element",
"in",
"the",
"matrix",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"value",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L261-L268 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java | Metric.minimumExistingDatapoints | public void minimumExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
Double existingValue = _datapoints.get(entry.getKey());
if(existingValue == null){
_datapoints.put(entry.getKey(), entry.getValue());
} else if (existingValue > entry.getValue()) {
_datapoints.put(entry.getKey(), entry.getValue());
}
}
}
} | java | public void minimumExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
Double existingValue = _datapoints.get(entry.getKey());
if(existingValue == null){
_datapoints.put(entry.getKey(), entry.getValue());
} else if (existingValue > entry.getValue()) {
_datapoints.put(entry.getKey(), entry.getValue());
}
}
}
} | [
"public",
"void",
"minimumExistingDatapoints",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"datapoints",
")",
"{",
"if",
"(",
"datapoints",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"Long",
",",
"Double",
">",
"entry",
":",
"datapoints",
".",
... | If current set already has a value at that timestamp then sets the minimum of the two values for that timestamp at coinciding cutoff boundary,
else adds the new data points to the current set.
@param datapoints The set of data points to add. If null or empty, no operation is performed. | [
"If",
"current",
"set",
"already",
"has",
"a",
"value",
"at",
"that",
"timestamp",
"then",
"sets",
"the",
"minimum",
"of",
"the",
"two",
"values",
"for",
"that",
"timestamp",
"at",
"coinciding",
"cutoff",
"boundary",
"else",
"adds",
"the",
"new",
"data",
"... | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L207-L219 |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.configureAuthentication | private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username;
this.password = password;
this.realm = StringUtils.defaultIfBlank(realm, "restolino");
authenticationEnabled = true;
}
} | java | private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username;
this.password = password;
this.realm = StringUtils.defaultIfBlank(realm, "restolino");
authenticationEnabled = true;
}
} | [
"private",
"void",
"configureAuthentication",
"(",
"String",
"username",
",",
"String",
"password",
",",
"String",
"realm",
")",
"{",
"// If the username is set, set up authentication:",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"username",
")",
")",
"{",
"t... | Sets up authentication.
@param username The HTTP basic authentication username.
@param password The HTTP basic authentication password.
@param realm Optional. Defaults to "restolino". | [
"Sets",
"up",
"authentication",
"."
] | train | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L229-L240 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.addConnector | public void addConnector(String name, ConnectorConfiguration connectorConfig) throws Exception {
ModelNode fullRequest;
final Address connectorAddress = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
final ModelNode connectorRequest = createRequest(ADD, connectorAddress);
setPossibleExpression(connectorRequest, "executor", connectorConfig.getExecutor());
setPossibleExpression(connectorRequest, "max-connections", connectorConfig.getMaxConnections());
setPossibleExpression(connectorRequest, "max-post-size", connectorConfig.getMaxPostSize());
setPossibleExpression(connectorRequest, "max-save-post-size", connectorConfig.getMaxSavePostSize());
setPossibleExpression(connectorRequest, "protocol", connectorConfig.getProtocol());
setPossibleExpression(connectorRequest, "proxy-name", connectorConfig.getProxyName());
setPossibleExpression(connectorRequest, "proxy-port", connectorConfig.getProxyPort());
setPossibleExpression(connectorRequest, "scheme", connectorConfig.getScheme());
setPossibleExpression(connectorRequest, "socket-binding", connectorConfig.getSocketBinding());
setPossibleExpression(connectorRequest, "redirect-port", connectorConfig.getRedirectPort());
setPossibleExpression(connectorRequest, "enabled", String.valueOf(connectorConfig.isEnabled()));
setPossibleExpression(connectorRequest, "enable-lookups", String.valueOf(connectorConfig.isEnableLookups()));
setPossibleExpression(connectorRequest, "secure", String.valueOf(connectorConfig.isSecure()));
SSLConfiguration sslConfig = connectorConfig.getSslConfiguration();
if (sslConfig != null) {
final Address sslAddress = connectorAddress.clone().add(SSL, "configuration"); // MUST be "configuration"
final ModelNode sslRequest = createRequest(ADD, sslAddress);
setPossibleExpression(sslRequest, "ca-certificate-file", sslConfig.getCaCertificateFile());
setPossibleExpression(sslRequest, "ca-certificate-password", sslConfig.getCaCertificatePassword());
setPossibleExpression(sslRequest, "ca-revocation-url", sslConfig.getCaRevocationUrl());
setPossibleExpression(sslRequest, "certificate-file", sslConfig.getCertificateFile());
setPossibleExpression(sslRequest, "certificate-key-file", sslConfig.getCertificateKeyFile());
setPossibleExpression(sslRequest, "cipher-suite", sslConfig.getCipherSuite());
setPossibleExpression(sslRequest, "key-alias", sslConfig.getKeyAlias());
setPossibleExpression(sslRequest, "keystore-type", sslConfig.getKeystoreType());
setPossibleExpression(sslRequest, "name", sslConfig.getName());
setPossibleExpression(sslRequest, "password", sslConfig.getPassword());
setPossibleExpression(sslRequest, "protocol", sslConfig.getProtocol());
setPossibleExpression(sslRequest, "session-cache-size", sslConfig.getSessionCacheSize());
setPossibleExpression(sslRequest, "session-timeout", sslConfig.getSessionTimeout());
setPossibleExpression(sslRequest, "truststore-type", sslConfig.getTruststoreType());
setPossibleExpression(sslRequest, "verify-client", sslConfig.getVerifyClient());
setPossibleExpression(sslRequest, "verify-depth", sslConfig.getVerifyDepth());
fullRequest = createBatchRequest(connectorRequest, sslRequest);
} else {
fullRequest = connectorRequest;
}
final ModelNode response = execute(fullRequest);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to add new connector [" + name + "]");
}
return;
} | java | public void addConnector(String name, ConnectorConfiguration connectorConfig) throws Exception {
ModelNode fullRequest;
final Address connectorAddress = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
final ModelNode connectorRequest = createRequest(ADD, connectorAddress);
setPossibleExpression(connectorRequest, "executor", connectorConfig.getExecutor());
setPossibleExpression(connectorRequest, "max-connections", connectorConfig.getMaxConnections());
setPossibleExpression(connectorRequest, "max-post-size", connectorConfig.getMaxPostSize());
setPossibleExpression(connectorRequest, "max-save-post-size", connectorConfig.getMaxSavePostSize());
setPossibleExpression(connectorRequest, "protocol", connectorConfig.getProtocol());
setPossibleExpression(connectorRequest, "proxy-name", connectorConfig.getProxyName());
setPossibleExpression(connectorRequest, "proxy-port", connectorConfig.getProxyPort());
setPossibleExpression(connectorRequest, "scheme", connectorConfig.getScheme());
setPossibleExpression(connectorRequest, "socket-binding", connectorConfig.getSocketBinding());
setPossibleExpression(connectorRequest, "redirect-port", connectorConfig.getRedirectPort());
setPossibleExpression(connectorRequest, "enabled", String.valueOf(connectorConfig.isEnabled()));
setPossibleExpression(connectorRequest, "enable-lookups", String.valueOf(connectorConfig.isEnableLookups()));
setPossibleExpression(connectorRequest, "secure", String.valueOf(connectorConfig.isSecure()));
SSLConfiguration sslConfig = connectorConfig.getSslConfiguration();
if (sslConfig != null) {
final Address sslAddress = connectorAddress.clone().add(SSL, "configuration"); // MUST be "configuration"
final ModelNode sslRequest = createRequest(ADD, sslAddress);
setPossibleExpression(sslRequest, "ca-certificate-file", sslConfig.getCaCertificateFile());
setPossibleExpression(sslRequest, "ca-certificate-password", sslConfig.getCaCertificatePassword());
setPossibleExpression(sslRequest, "ca-revocation-url", sslConfig.getCaRevocationUrl());
setPossibleExpression(sslRequest, "certificate-file", sslConfig.getCertificateFile());
setPossibleExpression(sslRequest, "certificate-key-file", sslConfig.getCertificateKeyFile());
setPossibleExpression(sslRequest, "cipher-suite", sslConfig.getCipherSuite());
setPossibleExpression(sslRequest, "key-alias", sslConfig.getKeyAlias());
setPossibleExpression(sslRequest, "keystore-type", sslConfig.getKeystoreType());
setPossibleExpression(sslRequest, "name", sslConfig.getName());
setPossibleExpression(sslRequest, "password", sslConfig.getPassword());
setPossibleExpression(sslRequest, "protocol", sslConfig.getProtocol());
setPossibleExpression(sslRequest, "session-cache-size", sslConfig.getSessionCacheSize());
setPossibleExpression(sslRequest, "session-timeout", sslConfig.getSessionTimeout());
setPossibleExpression(sslRequest, "truststore-type", sslConfig.getTruststoreType());
setPossibleExpression(sslRequest, "verify-client", sslConfig.getVerifyClient());
setPossibleExpression(sslRequest, "verify-depth", sslConfig.getVerifyDepth());
fullRequest = createBatchRequest(connectorRequest, sslRequest);
} else {
fullRequest = connectorRequest;
}
final ModelNode response = execute(fullRequest);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to add new connector [" + name + "]");
}
return;
} | [
"public",
"void",
"addConnector",
"(",
"String",
"name",
",",
"ConnectorConfiguration",
"connectorConfig",
")",
"throws",
"Exception",
"{",
"ModelNode",
"fullRequest",
";",
"final",
"Address",
"connectorAddress",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
... | Add a new web connector, which may be a secure SSL connector (HTTPS) or not (HTTP).
@param name name of new connector to add
@param connectorConfig the connector's configuration
@throws Exception any error | [
"Add",
"a",
"new",
"web",
"connector",
"which",
"may",
"be",
"a",
"secure",
"SSL",
"connector",
"(",
"HTTPS",
")",
"or",
"not",
"(",
"HTTP",
")",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L133-L182 |
akberc/ceylon-maven-plugin | src/main/java/com/dgwave/car/common/CeylonUtil.java | CeylonUtil.mkdirs | public static void mkdirs(final File outdir, final String path) {
File d = new File(outdir, path);
if (!d.exists()) {
d.mkdirs();
}
} | java | public static void mkdirs(final File outdir, final String path) {
File d = new File(outdir, path);
if (!d.exists()) {
d.mkdirs();
}
} | [
"public",
"static",
"void",
"mkdirs",
"(",
"final",
"File",
"outdir",
",",
"final",
"String",
"path",
")",
"{",
"File",
"d",
"=",
"new",
"File",
"(",
"outdir",
",",
"path",
")",
";",
"if",
"(",
"!",
"d",
".",
"exists",
"(",
")",
")",
"{",
"d",
... | Creates directories from an existing file to an additional path.
@param outdir Existing directory
@param path Additional path | [
"Creates",
"directories",
"from",
"an",
"existing",
"file",
"to",
"an",
"additional",
"path",
"."
] | train | https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/common/CeylonUtil.java#L238-L243 |
stripe/stripe-android | example/src/main/java/com/stripe/example/adapter/RedirectAdapter.java | RedirectAdapter.onBindViewHolder | @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
final ViewModel model = mDataset.get(position);
holder.setFinalStatus(model.mFinalStatus);
holder.setRedirectStatus(model.mRedirectStatus);
holder.setSourceId(model.mSourceId);
holder.setSourceType(model.mSourceType);
} | java | @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
final ViewModel model = mDataset.get(position);
holder.setFinalStatus(model.mFinalStatus);
holder.setRedirectStatus(model.mRedirectStatus);
holder.setSourceId(model.mSourceId);
holder.setSourceType(model.mSourceType);
} | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"@",
"NonNull",
"ViewHolder",
"holder",
",",
"int",
"position",
")",
"{",
"// - get element from your dataset at this position",
"// - replace the contents of the view with that element",
"final",
"ViewModel",
"model",... | Replace the contents of a view (invoked by the layout manager) | [
"Replace",
"the",
"contents",
"of",
"a",
"view",
"(",
"invoked",
"by",
"the",
"layout",
"manager",
")"
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/example/src/main/java/com/stripe/example/adapter/RedirectAdapter.java#L97-L106 |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.newMappedDataLoader | public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithContext<K, V> batchLoadFunction) {
return newMappedDataLoader(batchLoadFunction, null);
} | java | public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithContext<K, V> batchLoadFunction) {
return newMappedDataLoader(batchLoadFunction, null);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"DataLoader",
"<",
"K",
",",
"V",
">",
"newMappedDataLoader",
"(",
"MappedBatchLoaderWithContext",
"<",
"K",
",",
"V",
">",
"batchLoadFunction",
")",
"{",
"return",
"newMappedDataLoader",
"(",
"batchLoadFunction",
"... | Creates new DataLoader with the specified mapped batch loader function and default options
(batching, caching and unlimited batch size).
@param batchLoadFunction the batch load function to use
@param <K> the key type
@param <V> the value type
@return a new DataLoader | [
"Creates",
"new",
"DataLoader",
"with",
"the",
"specified",
"mapped",
"batch",
"loader",
"function",
"and",
"default",
"options",
"(",
"batching",
"caching",
"and",
"unlimited",
"batch",
"size",
")",
"."
] | train | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L278-L280 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/Validators.java | Validators.maxLength | public static Validator<CharSequence> maxLength(@NonNull final Context context,
@StringRes final int resourceId,
final int maxLength) {
return new MaxLengthValidator(context, resourceId, maxLength);
} | java | public static Validator<CharSequence> maxLength(@NonNull final Context context,
@StringRes final int resourceId,
final int maxLength) {
return new MaxLengthValidator(context, resourceId, maxLength);
} | [
"public",
"static",
"Validator",
"<",
"CharSequence",
">",
"maxLength",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"StringRes",
"final",
"int",
"resourceId",
",",
"final",
"int",
"maxLength",
")",
"{",
"return",
"new",
"MaxLengthValidator",
... | Creates and returns a validator, which allows to validate texts to ensure, that they are not
longer than a specific length.
@param context
The context, which should be used to retrieve the error message, as an instance of
the class {@link Context}. The context may not be null
@param resourceId
The resource ID of the string resource, which contains the error message, which
should be set, as an {@link Integer} value. The resource ID must correspond to a
valid string resource
@param maxLength
The maximum length a text may have as an {@link Integer} value. The maximum length
must be at least 1
@return The validator, which has been created, as an instance of the type {@link Validator} | [
"Creates",
"and",
"returns",
"a",
"validator",
"which",
"allows",
"to",
"validate",
"texts",
"to",
"ensure",
"that",
"they",
"are",
"not",
"longer",
"than",
"a",
"specific",
"length",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L482-L486 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createReadAttributeRequest | public static ModelNode createReadAttributeRequest(String attributeName, Address address) {
return createReadAttributeRequest(false, attributeName, address);
} | java | public static ModelNode createReadAttributeRequest(String attributeName, Address address) {
return createReadAttributeRequest(false, attributeName, address);
} | [
"public",
"static",
"ModelNode",
"createReadAttributeRequest",
"(",
"String",
"attributeName",
",",
"Address",
"address",
")",
"{",
"return",
"createReadAttributeRequest",
"(",
"false",
",",
"attributeName",
",",
"address",
")",
";",
"}"
] | Convienence method that allows you to create request that reads a single attribute
value to a resource.
@param attributeName the name of the attribute whose value is to be read
@param address identifies the resource
@return the request | [
"Convienence",
"method",
"that",
"allows",
"you",
"to",
"create",
"request",
"that",
"reads",
"a",
"single",
"attribute",
"value",
"to",
"a",
"resource",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L82-L84 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java | WSubMenu.handleRequest | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"if",
"(",
"isMenuPresent",
"... | Override handleRequest in order to perform processing for this component. This implementation checks for submenu
selection and executes the associated action if it has been set.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"for",
"submenu",
"selection",
"and",
"executes",
"the",
"associated",
"action",
"if",
"it",
"has",
"been",
"set",
"."... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java#L519-L553 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_domainPacks_GET | public ArrayList<OvhDomainPacksProductInformation> cart_cartId_domainPacks_GET(String cartId, String domain) throws IOException {
String qPath = "/order/cart/{cartId}/domainPacks";
StringBuilder sb = path(qPath, cartId);
query(sb, "domain", domain);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhDomainPacksProductInformation> cart_cartId_domainPacks_GET(String cartId, String domain) throws IOException {
String qPath = "/order/cart/{cartId}/domainPacks";
StringBuilder sb = path(qPath, cartId);
query(sb, "domain", domain);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhDomainPacksProductInformation",
">",
"cart_cartId_domainPacks_GET",
"(",
"String",
"cartId",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/domainPacks\"",
";",
"StringBuilder",
"... | Get informations about Domain packs offers (AllDom)
REST: GET /order/cart/{cartId}/domainPacks
@param cartId [required] Cart identifier
@param domain [required] Domain name requested
API beta | [
"Get",
"informations",
"about",
"Domain",
"packs",
"offers",
"(",
"AllDom",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L11486-L11492 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.actAsync | public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException {
try {
DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<>(callable);
for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) {
wrapper = factory.wrap(wrapper);
}
return (channel!=null ? channel : localChannel)
.callAsync(wrapper);
} catch (IOException e) {
// wrap it into a new IOException so that we get the caller's stack trace as well.
throw new IOException("remote file operation failed",e);
}
} | java | public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException {
try {
DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<>(callable);
for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) {
wrapper = factory.wrap(wrapper);
}
return (channel!=null ? channel : localChannel)
.callAsync(wrapper);
} catch (IOException e) {
// wrap it into a new IOException so that we get the caller's stack trace as well.
throw new IOException("remote file operation failed",e);
}
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"actAsync",
"(",
"final",
"FileCallable",
"<",
"T",
">",
"callable",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"try",
"{",
"DelegatingCallable",
"<",
"T",
",",
"IOException",
">",
"wra... | Executes some program on the machine that this {@link FilePath} exists,
so that one can perform local file operations. | [
"Executes",
"some",
"program",
"on",
"the",
"machine",
"that",
"this",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L1138-L1150 |
JoeKerouac/utils | src/main/java/com/joe/utils/collection/CollectionUtil.java | CollectionUtil.calcStackDeep | public static <T> int calcStackDeep(List<T> input, List<T> output) {
int max = 0;
//当前已有交集大小
int helper = 0;
for (int i = 0; i < output.size(); i++) {
// 求出出栈元素在原队列中的位置index,然后算出原队列0-index区间与出栈队列0-i区间的交集,用index-该交集长度加上当前元素占用
// 位置就是当前栈深度,然后遍历出栈队列取最大栈深度即可
Object obj = output.get(i);
int index = input.indexOf(obj);
if ((index - Math.min(index, i) + 1 - helper) <= max) {
continue;
}
int repeat = helper = intersection(input, 0, index, output, 0, i).size();
int temp = index - repeat + 1;
max = temp > max ? temp : max;
}
return max;
} | java | public static <T> int calcStackDeep(List<T> input, List<T> output) {
int max = 0;
//当前已有交集大小
int helper = 0;
for (int i = 0; i < output.size(); i++) {
// 求出出栈元素在原队列中的位置index,然后算出原队列0-index区间与出栈队列0-i区间的交集,用index-该交集长度加上当前元素占用
// 位置就是当前栈深度,然后遍历出栈队列取最大栈深度即可
Object obj = output.get(i);
int index = input.indexOf(obj);
if ((index - Math.min(index, i) + 1 - helper) <= max) {
continue;
}
int repeat = helper = intersection(input, 0, index, output, 0, i).size();
int temp = index - repeat + 1;
max = temp > max ? temp : max;
}
return max;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"calcStackDeep",
"(",
"List",
"<",
"T",
">",
"input",
",",
"List",
"<",
"T",
">",
"output",
")",
"{",
"int",
"max",
"=",
"0",
";",
"//当前已有交集大小",
"int",
"helper",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"... | 给定原顺序队列与出栈顺序队列求出栈最小深度
@param input 原队列,不能包含重复元素
@param output 出栈队列
@param <T> 数据类型
@return 栈的最小深度 | [
"给定原顺序队列与出栈顺序队列求出栈最小深度"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/collection/CollectionUtil.java#L96-L113 |
knowm/XChange | xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java | BitstampAdapters.adaptAccountInfo | public static AccountInfo adaptAccountInfo(BitstampBalance bitstampBalance, String userName) {
// Adapt to XChange DTOs
List<Balance> balances = new ArrayList<>();
for (org.knowm.xchange.bitstamp.dto.account.BitstampBalance.Balance b :
bitstampBalance.getBalances()) {
Balance xchangeBalance =
new Balance(
Currency.getInstance(b.getCurrency().toUpperCase()),
b.getBalance(),
b.getAvailable(),
b.getReserved(),
ZERO,
ZERO,
b.getBalance().subtract(b.getAvailable()).subtract(b.getReserved()),
ZERO);
balances.add(xchangeBalance);
}
return new AccountInfo(userName, bitstampBalance.getFee(), new Wallet(balances));
} | java | public static AccountInfo adaptAccountInfo(BitstampBalance bitstampBalance, String userName) {
// Adapt to XChange DTOs
List<Balance> balances = new ArrayList<>();
for (org.knowm.xchange.bitstamp.dto.account.BitstampBalance.Balance b :
bitstampBalance.getBalances()) {
Balance xchangeBalance =
new Balance(
Currency.getInstance(b.getCurrency().toUpperCase()),
b.getBalance(),
b.getAvailable(),
b.getReserved(),
ZERO,
ZERO,
b.getBalance().subtract(b.getAvailable()).subtract(b.getReserved()),
ZERO);
balances.add(xchangeBalance);
}
return new AccountInfo(userName, bitstampBalance.getFee(), new Wallet(balances));
} | [
"public",
"static",
"AccountInfo",
"adaptAccountInfo",
"(",
"BitstampBalance",
"bitstampBalance",
",",
"String",
"userName",
")",
"{",
"// Adapt to XChange DTOs",
"List",
"<",
"Balance",
">",
"balances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
... | Adapts a BitstampBalance to an AccountInfo
@param bitstampBalance The Bitstamp balance
@param userName The user name
@return The account info | [
"Adapts",
"a",
"BitstampBalance",
"to",
"an",
"AccountInfo"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java#L54-L73 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForText | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll, boolean onlyVisible, boolean hardStoppage) {
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, onlyVisible, hardStoppage);
} | java | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll, boolean onlyVisible, boolean hardStoppage) {
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, onlyVisible, hardStoppage);
} | [
"public",
"TextView",
"waitForText",
"(",
"String",
"text",
",",
"int",
"expectedMinimumNumberOfMatches",
",",
"long",
"timeout",
",",
"boolean",
"scroll",
",",
"boolean",
"onlyVisible",
",",
"boolean",
"hardStoppage",
")",
"{",
"return",
"waitForText",
"(",
"Text... | Waits for a text to be shown.
@param text the text that needs to be shown, specified as a regular expression.
@param expectedMinimumNumberOfMatches the minimum number of matches of text that must be shown. {@code 0} means any number of matches
@param timeout the amount of time in milliseconds to wait
@param scroll {@code true} if scrolling should be performed
@param onlyVisible {@code true} if only visible text views should be waited for
@param hardStoppage {@code true} if search is to be stopped when timeout expires
@return {@code true} if text is found and {@code false} if it is not found before the timeout | [
"Waits",
"for",
"a",
"text",
"to",
"be",
"shown",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L598-L600 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | java | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"Util",
".",
"notNull",
"(",
"data",
",",
"\"Date\"",
")",
";",
"return",
"addData",
"(",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
";",
"}"
] | Adds data to the digest using the specified array of bytes, starting at an offset of 0.
@param data the array of bytes.
@return The same {@link DataHasher} object for chaining calls.
@throws NullPointerException when input data is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"array",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L161-L165 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SuspensionRecord.java | SuspensionRecord.findInfractionCount | public static int findInfractionCount(EntityManager em, PrincipalUser user, SubSystem subSystem, long startTime) {
List<SuspensionRecord> records;
if (subSystem == null) {
records = findByUser(em, user);
} else {
SuspensionRecord record = findByUserAndSubsystem(em, user, subSystem);
records = record == null ? new ArrayList<SuspensionRecord>(0) : Arrays.asList(new SuspensionRecord[] { record });
}
int count = 0;
for (SuspensionRecord record : records) {
List<Long> timestamps = record.getInfractionHistory();
for (Long timestamp : timestamps) {
if (timestamp > startTime) {
count++;
}
}
}
return count;
} | java | public static int findInfractionCount(EntityManager em, PrincipalUser user, SubSystem subSystem, long startTime) {
List<SuspensionRecord> records;
if (subSystem == null) {
records = findByUser(em, user);
} else {
SuspensionRecord record = findByUserAndSubsystem(em, user, subSystem);
records = record == null ? new ArrayList<SuspensionRecord>(0) : Arrays.asList(new SuspensionRecord[] { record });
}
int count = 0;
for (SuspensionRecord record : records) {
List<Long> timestamps = record.getInfractionHistory();
for (Long timestamp : timestamps) {
if (timestamp > startTime) {
count++;
}
}
}
return count;
} | [
"public",
"static",
"int",
"findInfractionCount",
"(",
"EntityManager",
"em",
",",
"PrincipalUser",
"user",
",",
"SubSystem",
"subSystem",
",",
"long",
"startTime",
")",
"{",
"List",
"<",
"SuspensionRecord",
">",
"records",
";",
"if",
"(",
"subSystem",
"==",
"... | Finds the number of user infractions for a subsystem that have occurred since the given start time.
@param em The entity manager to use. Cannot be null.
@param user The user. Cannot be null.
@param subSystem The subsystem. If null, infractions for all subsystems are counted.
@param startTime The start time threshold.
@return The number of infractions. | [
"Finds",
"the",
"number",
"of",
"user",
"infractions",
"for",
"a",
"subsystem",
"that",
"have",
"occurred",
"since",
"the",
"given",
"start",
"time",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SuspensionRecord.java#L137-L160 |
undertow-io/undertow | core/src/main/java/io/undertow/util/QueryParameterUtils.java | QueryParameterUtils.parseQueryString | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
} | java | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
} | [
"@",
"Deprecated",
"public",
"static",
"Map",
"<",
"String",
",",
"Deque",
"<",
"String",
">",
">",
"parseQueryString",
"(",
"final",
"String",
"newQueryString",
")",
"{",
"return",
"parseQueryString",
"(",
"newQueryString",
",",
"null",
")",
";",
"}"
] | Parses a query string into a map
@param newQueryString The query string
@return The map of key value parameters | [
"Parses",
"a",
"query",
"string",
"into",
"a",
"map"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/QueryParameterUtils.java#L77-L80 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.checkAmbiguousValues | private void checkAmbiguousValues(Option o, Map<String, String> data) throws RequiredParametersException{
if (data.containsKey(o.getAlt()) && !Objects.equals(data.get(o.getAlt()), ParameterTool.NO_VALUE_KEY)) {
throw new RequiredParametersException("Value passed for parameter " + o.getName() +
" is ambiguous. Value passed for short and long name.");
}
} | java | private void checkAmbiguousValues(Option o, Map<String, String> data) throws RequiredParametersException{
if (data.containsKey(o.getAlt()) && !Objects.equals(data.get(o.getAlt()), ParameterTool.NO_VALUE_KEY)) {
throw new RequiredParametersException("Value passed for parameter " + o.getName() +
" is ambiguous. Value passed for short and long name.");
}
} | [
"private",
"void",
"checkAmbiguousValues",
"(",
"Option",
"o",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"data",
".",
"containsKey",
"(",
"o",
".",
"getAlt",
"(",
")",
")",
"&&",
... | check if it also contains a value for the shortName in option (if any is defined) | [
"check",
"if",
"it",
"also",
"contains",
"a",
"value",
"for",
"the",
"shortName",
"in",
"option",
"(",
"if",
"any",
"is",
"defined",
")"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L166-L171 |
devnewton/jnuit | tablelayout/src/main/java/com/esotericsoftware/tablelayout/Value.java | Value.percentWidth | static public <C, T extends C> Value<C, T> percentWidth (Toolkit<C, T> toolkit, final float percent, final C widget) {
return new Value<C, T>(toolkit) {
@Override
public float get (Cell<C, T> cell) {
return toolkit.getWidth(widget) * percent;
}
@Override
public float get (Object table) {
return toolkit.getWidth(widget) * percent;
}
};
} | java | static public <C, T extends C> Value<C, T> percentWidth (Toolkit<C, T> toolkit, final float percent, final C widget) {
return new Value<C, T>(toolkit) {
@Override
public float get (Cell<C, T> cell) {
return toolkit.getWidth(widget) * percent;
}
@Override
public float get (Object table) {
return toolkit.getWidth(widget) * percent;
}
};
} | [
"static",
"public",
"<",
"C",
",",
"T",
"extends",
"C",
">",
"Value",
"<",
"C",
",",
"T",
">",
"percentWidth",
"(",
"Toolkit",
"<",
"C",
",",
"T",
">",
"toolkit",
",",
"final",
"float",
"percent",
",",
"final",
"C",
"widget",
")",
"{",
"return",
... | Returns a value that is a percentage of the specified widget's width. | [
"Returns",
"a",
"value",
"that",
"is",
"a",
"percentage",
"of",
"the",
"specified",
"widget",
"s",
"width",
"."
] | train | https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/Value.java#L89-L101 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java | ThriftClient.populateData | private List populateData(EntityMetadata m, List<KeySlice> keySlices, List<Object> entities, boolean isRelational,
List<String> relationNames)
{
try
{
if (m.getType().isSuperColumnFamilyMetadata())
{
List<Object> rowKeys = ThriftDataResultHelper.getRowKeys(keySlices, m);
Object[] rowIds = rowKeys.toArray();
entities.addAll(findAll(m.getEntityClazz(), null, rowIds));
}
else
{
for (KeySlice keySlice : keySlices)
{
byte[] key = keySlice.getKey();
List<ColumnOrSuperColumn> coscList = keySlice.getColumns();
List<Column> columns = ThriftDataResultHelper.transformThriftResult(coscList,
ColumnFamilyType.COLUMN, null);
Object e = null;
Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key);
e = dataHandler.populateEntity(new ThriftRow(id, m.getTableName(), columns,
new ArrayList<SuperColumn>(0), new ArrayList<CounterColumn>(0),
new ArrayList<CounterSuperColumn>(0)), m, KunderaCoreUtils.getEntity(e), relationNames,
isRelational);
entities.add(e);
}
}
}
catch (Exception e)
{
log.error("Error while populating data for relations of column family {}, Caused by: .", m.getTableName(),
e);
throw new KunderaException(e);
}
return entities;
} | java | private List populateData(EntityMetadata m, List<KeySlice> keySlices, List<Object> entities, boolean isRelational,
List<String> relationNames)
{
try
{
if (m.getType().isSuperColumnFamilyMetadata())
{
List<Object> rowKeys = ThriftDataResultHelper.getRowKeys(keySlices, m);
Object[] rowIds = rowKeys.toArray();
entities.addAll(findAll(m.getEntityClazz(), null, rowIds));
}
else
{
for (KeySlice keySlice : keySlices)
{
byte[] key = keySlice.getKey();
List<ColumnOrSuperColumn> coscList = keySlice.getColumns();
List<Column> columns = ThriftDataResultHelper.transformThriftResult(coscList,
ColumnFamilyType.COLUMN, null);
Object e = null;
Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key);
e = dataHandler.populateEntity(new ThriftRow(id, m.getTableName(), columns,
new ArrayList<SuperColumn>(0), new ArrayList<CounterColumn>(0),
new ArrayList<CounterSuperColumn>(0)), m, KunderaCoreUtils.getEntity(e), relationNames,
isRelational);
entities.add(e);
}
}
}
catch (Exception e)
{
log.error("Error while populating data for relations of column family {}, Caused by: .", m.getTableName(),
e);
throw new KunderaException(e);
}
return entities;
} | [
"private",
"List",
"populateData",
"(",
"EntityMetadata",
"m",
",",
"List",
"<",
"KeySlice",
">",
"keySlices",
",",
"List",
"<",
"Object",
">",
"entities",
",",
"boolean",
"isRelational",
",",
"List",
"<",
"String",
">",
"relationNames",
")",
"{",
"try",
"... | Populate data.
@param m
the m
@param keySlices
the key slices
@param entities
the entities
@param isRelational
the is relational
@param relationNames
the relation names
@return the list | [
"Populate",
"data",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java#L1000-L1039 |
alkacon/opencms-core | src-gwt/org/opencms/ugc/client/export/CmsClientUgcSession.java | CmsClientUgcSession.initFormElement | @NoExport
public void initFormElement(Element formElement) {
m_formWrapper = new CmsUgcWrapper(formElement, getSessionId());
m_formWrapper.setFormSession(this);
} | java | @NoExport
public void initFormElement(Element formElement) {
m_formWrapper = new CmsUgcWrapper(formElement, getSessionId());
m_formWrapper.setFormSession(this);
} | [
"@",
"NoExport",
"public",
"void",
"initFormElement",
"(",
"Element",
"formElement",
")",
"{",
"m_formWrapper",
"=",
"new",
"CmsUgcWrapper",
"(",
"formElement",
",",
"getSessionId",
"(",
")",
")",
";",
"m_formWrapper",
".",
"setFormSession",
"(",
"this",
")",
... | Initializes the form belonging to this session.<p>
@param formElement the form element | [
"Initializes",
"the",
"form",
"belonging",
"to",
"this",
"session",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ugc/client/export/CmsClientUgcSession.java#L173-L178 |
h2oai/h2o-3 | h2o-core/src/main/java/water/parser/ParseSetup.java | ParseSetup.getFinalSetup | public final ParseSetup getFinalSetup(Key[] inputKeys, ParseSetup demandedSetup) {
ParserProvider pp = ParserService.INSTANCE.getByInfo(_parse_type);
if (pp != null) {
ParseSetup ps = pp.createParserSetup(inputKeys, demandedSetup);
if (demandedSetup._decrypt_tool != null)
ps._decrypt_tool = demandedSetup._decrypt_tool;
ps.setSkippedColumns(demandedSetup.getSkippedColumns());
ps.setParseColumnIndices(demandedSetup.getNumberColumns(), demandedSetup.getSkippedColumns()); // final consistent check between skipped_columns and parse_columns_indices
return ps;
}
throw new H2OIllegalArgumentException("Unknown parser configuration! Configuration=" + this);
} | java | public final ParseSetup getFinalSetup(Key[] inputKeys, ParseSetup demandedSetup) {
ParserProvider pp = ParserService.INSTANCE.getByInfo(_parse_type);
if (pp != null) {
ParseSetup ps = pp.createParserSetup(inputKeys, demandedSetup);
if (demandedSetup._decrypt_tool != null)
ps._decrypt_tool = demandedSetup._decrypt_tool;
ps.setSkippedColumns(demandedSetup.getSkippedColumns());
ps.setParseColumnIndices(demandedSetup.getNumberColumns(), demandedSetup.getSkippedColumns()); // final consistent check between skipped_columns and parse_columns_indices
return ps;
}
throw new H2OIllegalArgumentException("Unknown parser configuration! Configuration=" + this);
} | [
"public",
"final",
"ParseSetup",
"getFinalSetup",
"(",
"Key",
"[",
"]",
"inputKeys",
",",
"ParseSetup",
"demandedSetup",
")",
"{",
"ParserProvider",
"pp",
"=",
"ParserService",
".",
"INSTANCE",
".",
"getByInfo",
"(",
"_parse_type",
")",
";",
"if",
"(",
"pp",
... | Return create a final parser-specific setup
for this configuration.
@param inputKeys inputs
@param demandedSetup setup demanded by a user
@return a parser specific setup based on demanded setup | [
"Return",
"create",
"a",
"final",
"parser",
"-",
"specific",
"setup",
"for",
"this",
"configuration",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParseSetup.java#L267-L279 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java | PluginManager.loadClass | public void loadClass(String className) throws Exception {
ClassInformation classInfo = classInformation.get(className);
logger.info("Loading plugin.: {}, {}", className, classInfo.pluginPath);
// get URL for proxylib
// need to load this also otherwise the annotations cannot be found later on
File libFile = new File(proxyLibPath);
URL libUrl = libFile.toURI().toURL();
// store the last modified time of the plugin
File pluginDirectoryFile = new File(classInfo.pluginPath);
classInfo.lastModified = pluginDirectoryFile.lastModified();
// load the plugin directory
URL classURL = new File(classInfo.pluginPath).toURI().toURL();
URL[] urls = new URL[] {classURL};
URLClassLoader child = new URLClassLoader(urls, this.getClass().getClassLoader());
// load the class
Class<?> cls = child.loadClass(className);
// put loaded class into classInfo
classInfo.loadedClass = cls;
classInfo.loaded = true;
classInformation.put(className, classInfo);
logger.info("Loaded plugin: {}, {} method(s)", cls.toString(), cls.getDeclaredMethods().length);
} | java | public void loadClass(String className) throws Exception {
ClassInformation classInfo = classInformation.get(className);
logger.info("Loading plugin.: {}, {}", className, classInfo.pluginPath);
// get URL for proxylib
// need to load this also otherwise the annotations cannot be found later on
File libFile = new File(proxyLibPath);
URL libUrl = libFile.toURI().toURL();
// store the last modified time of the plugin
File pluginDirectoryFile = new File(classInfo.pluginPath);
classInfo.lastModified = pluginDirectoryFile.lastModified();
// load the plugin directory
URL classURL = new File(classInfo.pluginPath).toURI().toURL();
URL[] urls = new URL[] {classURL};
URLClassLoader child = new URLClassLoader(urls, this.getClass().getClassLoader());
// load the class
Class<?> cls = child.loadClass(className);
// put loaded class into classInfo
classInfo.loadedClass = cls;
classInfo.loaded = true;
classInformation.put(className, classInfo);
logger.info("Loaded plugin: {}, {} method(s)", cls.toString(), cls.getDeclaredMethods().length);
} | [
"public",
"void",
"loadClass",
"(",
"String",
"className",
")",
"throws",
"Exception",
"{",
"ClassInformation",
"classInfo",
"=",
"classInformation",
".",
"get",
"(",
"className",
")",
";",
"logger",
".",
"info",
"(",
"\"Loading plugin.: {}, {}\"",
",",
"className... | Loads the specified class name and stores it in the hash
@param className class name
@throws Exception exception | [
"Loads",
"the",
"specified",
"class",
"name",
"and",
"stores",
"it",
"in",
"the",
"hash"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java#L218-L248 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.hasPermissionsById | public boolean hasPermissionsById(String id, String... permissions) {
List<Permission> resolvedPermissions = Lists.newArrayListWithCapacity(permissions.length);
for (String permission : permissions) {
resolvedPermissions.add(getPermissionResolver().resolvePermission(permission));
}
return hasPermissionsById(id, resolvedPermissions);
} | java | public boolean hasPermissionsById(String id, String... permissions) {
List<Permission> resolvedPermissions = Lists.newArrayListWithCapacity(permissions.length);
for (String permission : permissions) {
resolvedPermissions.add(getPermissionResolver().resolvePermission(permission));
}
return hasPermissionsById(id, resolvedPermissions);
} | [
"public",
"boolean",
"hasPermissionsById",
"(",
"String",
"id",
",",
"String",
"...",
"permissions",
")",
"{",
"List",
"<",
"Permission",
">",
"resolvedPermissions",
"=",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"permissions",
".",
"length",
")",
";",
"for... | Test for whether an API key has specific permissions using its ID. | [
"Test",
"for",
"whether",
"an",
"API",
"key",
"has",
"specific",
"permissions",
"using",
"its",
"ID",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L447-L453 |
VoltDB/voltdb | src/frontend/org/voltcore/messaging/HostMessenger.java | HostMessenger.sendPoisonPill | public void sendPoisonPill(Collection<Integer> hostIds, String err, int cause) {
for (int hostId : hostIds) {
Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator();
// No need to overdose the poison pill
if (it.hasNext()) {
ForeignHost fh = it.next();
if (fh.isUp()) {
fh.sendPoisonPill(err, cause);
}
}
}
} | java | public void sendPoisonPill(Collection<Integer> hostIds, String err, int cause) {
for (int hostId : hostIds) {
Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator();
// No need to overdose the poison pill
if (it.hasNext()) {
ForeignHost fh = it.next();
if (fh.isUp()) {
fh.sendPoisonPill(err, cause);
}
}
}
} | [
"public",
"void",
"sendPoisonPill",
"(",
"Collection",
"<",
"Integer",
">",
"hostIds",
",",
"String",
"err",
",",
"int",
"cause",
")",
"{",
"for",
"(",
"int",
"hostId",
":",
"hostIds",
")",
"{",
"Iterator",
"<",
"ForeignHost",
">",
"it",
"=",
"m_foreignH... | /*
Foreign hosts that share the same host id belong to the same machine, one
poison pill is deadly enough | [
"/",
"*",
"Foreign",
"hosts",
"that",
"share",
"the",
"same",
"host",
"id",
"belong",
"to",
"the",
"same",
"machine",
"one",
"poison",
"pill",
"is",
"deadly",
"enough"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1774-L1785 |
overturetool/overture | ide/ui/src/main/java/org/overture/ide/ui/navigator/VdmDropAdapterAssistent.java | VdmDropAdapterAssistent.mergeStatus | private void mergeStatus(MultiStatus status, IStatus toMerge) {
if (!toMerge.isOK()) {
status.merge(toMerge);
}
} | java | private void mergeStatus(MultiStatus status, IStatus toMerge) {
if (!toMerge.isOK()) {
status.merge(toMerge);
}
} | [
"private",
"void",
"mergeStatus",
"(",
"MultiStatus",
"status",
",",
"IStatus",
"toMerge",
")",
"{",
"if",
"(",
"!",
"toMerge",
".",
"isOK",
"(",
")",
")",
"{",
"status",
".",
"merge",
"(",
"toMerge",
")",
";",
"}",
"}"
] | Adds the given status to the list of problems. Discards OK statuses. If
the status is a multi-status, only its children are added. | [
"Adds",
"the",
"given",
"status",
"to",
"the",
"list",
"of",
"problems",
".",
"Discards",
"OK",
"statuses",
".",
"If",
"the",
"status",
"is",
"a",
"multi",
"-",
"status",
"only",
"its",
"children",
"are",
"added",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/navigator/VdmDropAdapterAssistent.java#L546-L550 |
nextreports/nextreports-engine | src/ro/nextreports/engine/querybuilder/sql/dialect/AbstractDialect.java | AbstractDialect.registerColumnType | protected void registerColumnType(String columnType, int jdbcType) {
columnTypeMatchers.add(new ColumnTypeMatcher(columnType));
jdbcTypes.put(columnType, jdbcType);
} | java | protected void registerColumnType(String columnType, int jdbcType) {
columnTypeMatchers.add(new ColumnTypeMatcher(columnType));
jdbcTypes.put(columnType, jdbcType);
} | [
"protected",
"void",
"registerColumnType",
"(",
"String",
"columnType",
",",
"int",
"jdbcType",
")",
"{",
"columnTypeMatchers",
".",
"add",
"(",
"new",
"ColumnTypeMatcher",
"(",
"columnType",
")",
")",
";",
"jdbcTypes",
".",
"put",
"(",
"columnType",
",",
"jdb... | Subclasses register a typename for the given type code.
@param columnType the database column type
@param jdbcType <tt>java.sql.Types</tt> typecode | [
"Subclasses",
"register",
"a",
"typename",
"for",
"the",
"given",
"type",
"code",
"."
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/querybuilder/sql/dialect/AbstractDialect.java#L116-L119 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java | EventListenerListHelper.fireEventByReflection | private void fireEventByReflection(String methodName, Object[] eventArgs) {
Method eventMethod = (Method)methodCache.get(new MethodCacheKey(listenerClass, methodName, eventArgs.length));
Object[] listenersCopy = listeners;
for (int i = 0; i < listenersCopy.length; i++) {
try {
eventMethod.invoke(listenersCopy[i], eventArgs);
}
catch (InvocationTargetException e) {
throw new EventBroadcastException("Exception thrown by listener", e.getCause());
}
catch (IllegalAccessException e) {
throw new EventBroadcastException("Unable to invoke listener", e);
}
}
} | java | private void fireEventByReflection(String methodName, Object[] eventArgs) {
Method eventMethod = (Method)methodCache.get(new MethodCacheKey(listenerClass, methodName, eventArgs.length));
Object[] listenersCopy = listeners;
for (int i = 0; i < listenersCopy.length; i++) {
try {
eventMethod.invoke(listenersCopy[i], eventArgs);
}
catch (InvocationTargetException e) {
throw new EventBroadcastException("Exception thrown by listener", e.getCause());
}
catch (IllegalAccessException e) {
throw new EventBroadcastException("Unable to invoke listener", e);
}
}
} | [
"private",
"void",
"fireEventByReflection",
"(",
"String",
"methodName",
",",
"Object",
"[",
"]",
"eventArgs",
")",
"{",
"Method",
"eventMethod",
"=",
"(",
"Method",
")",
"methodCache",
".",
"get",
"(",
"new",
"MethodCacheKey",
"(",
"listenerClass",
",",
"meth... | Invokes the method with the given name on each of the listeners registered with this list
helper. The given arguments are passed to each method invocation.
@param methodName The name of the method to be invoked on the listeners.
@param eventArgs The arguments that will be passed to each method invocation. The number
of arguments is also used to determine the method to be invoked.
@throws EventBroadcastException if an error occurs invoking the event method on any of the
listeners. | [
"Invokes",
"the",
"method",
"with",
"the",
"given",
"name",
"on",
"each",
"of",
"the",
"listeners",
"registered",
"with",
"this",
"list",
"helper",
".",
"The",
"given",
"arguments",
"are",
"passed",
"to",
"each",
"method",
"invocation",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L395-L409 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.getContentMedia | public ApiSuccessResponse getContentMedia(String mediatype, String id, GetContentData getContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getContentMediaWithHttpInfo(mediatype, id, getContentData);
return resp.getData();
} | java | public ApiSuccessResponse getContentMedia(String mediatype, String id, GetContentData getContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getContentMediaWithHttpInfo(mediatype, id, getContentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"getContentMedia",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"GetContentData",
"getContentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"getContentMediaWithHttpInfo",
"(... | Get the UCS content of the interaction
Get the UCS content of the interaction
@param mediatype media-type of interaction (required)
@param id id of the interaction (required)
@param getContentData (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"UCS",
"content",
"of",
"the",
"interaction",
"Get",
"the",
"UCS",
"content",
"of",
"the",
"interaction"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L1940-L1943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.