repo stringlengths 7 59 | path stringlengths 3 222 | func_name stringlengths 3 127 | original_string stringlengths 0 466k | language stringclasses 1
value | code stringlengths 0 466k | code_tokens listlengths 0 68.3k | docstring stringlengths 0 21.3k | docstring_tokens listlengths 0 1.93k | sha stringlengths 0 40 | url stringlengths 0 339 | partition stringclasses 3
values | summary stringlengths 0 250 | instruction stringlengths 38 3.13k | input stringclasses 1
value | output stringlengths 146 466k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java program to create a thread which prints the numbers from 10 to 0 in reverse order after every 1 second. Additionally, the program should display a message "Thread is interrupted" if the thread is interrupted before completing its task. | Here is the Java program that creates a thread to print numbers from 10 to 0 in reverse order after every 1 second:
```java
public class ReverseNumberThread extends Thread {
@Override
public void run() {
try {
for (int i = 10; i >= 0; i--) {
System.out.println(i);
... | |||||||
google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringInternal.java | SpannableStringInternal.removeSpan | void removeSpan(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
int[] data = mSpanData;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int ostart = data[i * COLUMNS + START];
int oend = data[i * COLUMNS + END];
... | java | void removeSpan(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
int[] data = mSpanData;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int ostart = data[i * COLUMNS + START];
int oend = data[i * COLUMNS + END];
... | [
"void",
"removeSpan",
"(",
"Object",
"what",
")",
"{",
"int",
"count",
"=",
"mSpanCount",
";",
"Object",
"[",
"]",
"spans",
"=",
"mSpans",
";",
"int",
"[",
"]",
"data",
"=",
"mSpanData",
";",
"for",
"(",
"int",
"i",
"=",
"count",
"-",
"1",
";",
"... | /* package | [
"/",
"*",
"package"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringInternal.java#L139-L161 | train | Remove a span from the log. | Create a Java method that does the following: "Remove a span from the log.". | Of course, here is the Java code you requested:
```java
void removeSpan(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
int[] data = mSpanData;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int ostart = data[i * COLUMNS + STA... | |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/platform/grid/browsercapabilities/FireFoxCapabilitiesBuilder.java | FireFoxCapabilitiesBuilder.getDefaultFirefoxOptions | private FirefoxOptions getDefaultFirefoxOptions() {
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.INFO);
options.setHeadless(Boolean.parseBoolean(getLocalConfigProperty(ConfigProperty.BROWSER_RUN_HEADLESS)));
return options;
} | java | private FirefoxOptions getDefaultFirefoxOptions() {
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.INFO);
options.setHeadless(Boolean.parseBoolean(getLocalConfigProperty(ConfigProperty.BROWSER_RUN_HEADLESS)));
return options;
} | [
"private",
"FirefoxOptions",
"getDefaultFirefoxOptions",
"(",
")",
"{",
"FirefoxOptions",
"options",
"=",
"new",
"FirefoxOptions",
"(",
")",
";",
"options",
".",
"setLogLevel",
"(",
"FirefoxDriverLogLevel",
".",
"INFO",
")",
";",
"options",
".",
"setHeadless",
"("... | /*
Returns the default {@link FirefoxOptions} used by this capabilities builder. | [
"/",
"*",
"Returns",
"the",
"default",
"{"
] | 694d12d0df76db48d0360b16192770c6a4fbdfd2 | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/grid/browsercapabilities/FireFoxCapabilitiesBuilder.java#L62-L68 | train | Get the default firefox options. | Create a Java method that does the following: "Get the default firefox options.". | Of course, here is the Java code you requested:
```java
private FirefoxOptions getDefaultFirefoxOptions() {
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.INFO);
options.setHeadless(Boolean.parseBoolean(getLocalConfigProperty(ConfigProperty.BROWSER_RUN_... | |
aws/aws-sdk-java | aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/transform/ResourceQueryMarshaller.java | ResourceQueryMarshaller.marshall | public void marshall(ResourceQuery resourceQuery, ProtocolMarshaller protocolMarshaller) {
if (resourceQuery == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resourceQuery.getType(), TYPE_BINDING);
... | java | public void marshall(ResourceQuery resourceQuery, ProtocolMarshaller protocolMarshaller) {
if (resourceQuery == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resourceQuery.getType(), TYPE_BINDING);
... | [
"public",
"void",
"marshall",
"(",
"ResourceQuery",
"resourceQuery",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"resourceQuery",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to marshall(...)\"",
... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/transform/ResourceQueryMarshaller.java#L44-L56 | train | marshalls the given resource query to the JSON object. | Create a Java method that does the following: "marshalls the given resource query to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(ResourceQuery resourceQuery, ProtocolMarshaller protocolMarshaller) {
if (resourceQuery == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMar... | |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.start | synchronized void start(final ManagedServerBootCmdFactory factory) {
final InternalState required = this.requiredState;
// Ignore if the server is already started
if(required == InternalState.SERVER_STARTED) {
return;
}
// In case the server failed to start, try to st... | java | synchronized void start(final ManagedServerBootCmdFactory factory) {
final InternalState required = this.requiredState;
// Ignore if the server is already started
if(required == InternalState.SERVER_STARTED) {
return;
}
// In case the server failed to start, try to st... | [
"synchronized",
"void",
"start",
"(",
"final",
"ManagedServerBootCmdFactory",
"factory",
")",
"{",
"final",
"InternalState",
"required",
"=",
"this",
".",
"requiredState",
";",
"// Ignore if the server is already started",
"if",
"(",
"required",
"==",
"InternalState",
"... | Start a managed server.
@param factory the boot command factory | [
"Start",
"a",
"managed",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L247-L266 | train | Start the managed server. | Create a Java method that does the following: "Start the managed server.". | Of course, here is the Java code you requested:
```java
synchronized void start(final ManagedServerBootCmdFactory factory) {
final InternalState required = this.requiredState;
// Ignore if the server is already started
if(required == InternalState.SERVER_STARTED) {
return;
}... | |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.failedFuture | public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
return new CompletableFuture<U>(new AltResult(Objects.requireNonNull(ex)));
} | java | public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
return new CompletableFuture<U>(new AltResult(Objects.requireNonNull(ex)));
} | [
"public",
"static",
"<",
"U",
">",
"CompletableFuture",
"<",
"U",
">",
"failedFuture",
"(",
"Throwable",
"ex",
")",
"{",
"return",
"new",
"CompletableFuture",
"<",
"U",
">",
"(",
"new",
"AltResult",
"(",
"Objects",
".",
"requireNonNull",
"(",
"ex",
")",
... | Returns a new CompletableFuture that is already completed exceptionally with the given
exception.
@param ex the exception
@param <U> the type of the value
@return the exceptionally completed CompletableFuture
@since 9 | [
"Returns",
"a",
"new",
"CompletableFuture",
"that",
"is",
"already",
"completed",
"exceptionally",
"with",
"the",
"given",
"exception",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L562-L564 | train | Returns a new CompletableFuture that is completed with exception. | Create a Java method that does the following: "Returns a new CompletableFuture that is completed with exception.". | Of course, here is the Java code you requested:
```java
public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
return new CompletableFuture<U>(new AltResult(Objects.requireNonNull(ex)));
}
```
Hope this helps! | |
Tirasa/ADSDDL | src/main/java/net/tirasa/adsddl/ntsd/utils/NumberFacility.java | NumberFacility.getUInt | public static long getUInt(final byte... bytes) {
if (bytes.length > 4) {
throw new InvalidParameterException("Invalid number of bytes");
}
long res = 0;
for (int i = 0; i < bytes.length; i++) {
res |= bytes[i] & 0xFF;
if (i < bytes.length - 1) {
... | java | public static long getUInt(final byte... bytes) {
if (bytes.length > 4) {
throw new InvalidParameterException("Invalid number of bytes");
}
long res = 0;
for (int i = 0; i < bytes.length; i++) {
res |= bytes[i] & 0xFF;
if (i < bytes.length - 1) {
... | [
"public",
"static",
"long",
"getUInt",
"(",
"final",
"byte",
"...",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
">",
"4",
")",
"{",
"throw",
"new",
"InvalidParameterException",
"(",
"\"Invalid number of bytes\"",
")",
";",
"}",
"long",
"res",
"="... | Gets unsigned integer value corresponding to the given bytes.
@param bytes bytes.
@return unsigned integer. | [
"Gets",
"unsigned",
"integer",
"value",
"corresponding",
"to",
"the",
"given",
"bytes",
"."
] | 16dad53e1222c7faa904c64394af94ba18f6d09c | https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/utils/NumberFacility.java#L183-L197 | train | Get the unsigned integer from the byte array. | Create a Java method that does the following: "Get the unsigned integer from the byte array.". | Of course, here is the Java code you requested:
```java
public static long getUInt(final byte... bytes) {
if (bytes.length > 4) {
throw new InvalidParameterException("Invalid number of bytes");
}
long res = 0;
for (int i = 0; i < bytes.length; i++) {
res |= byte... | |
kiegroup/jbpm | jbpm-bpmn2-emfextmodel/src/main/java/bpsim/impl/PoissonDistributionTypeImpl.java | PoissonDistributionTypeImpl.eGet | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BpsimPackage.POISSON_DISTRIBUTION_TYPE__MEAN:
return getMean();
}
return super.eGet(featureID, resolve, coreType);
} | java | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BpsimPackage.POISSON_DISTRIBUTION_TYPE__MEAN:
return getMean();
}
return super.eGet(featureID, resolve, coreType);
} | [
"@",
"Override",
"public",
"Object",
"eGet",
"(",
"int",
"featureID",
",",
"boolean",
"resolve",
",",
"boolean",
"coreType",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"BpsimPackage",
".",
"POISSON_DISTRIBUTION_TYPE__MEAN",
":",
"return",
"getMean",... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/bpsim/impl/PoissonDistributionTypeImpl.java#L143-L150 | train | Override eGet to return the value of the CRAs C | Create a Java method that does the following: "Override eGet to return the value of the CRAs C". | Of course, here is the Java code you requested:
```java
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BpsimPackage.POISSON_DISTRIBUTION_TYPE__MEAN:
return getMean();
}
return super.eGet(featureID, resolve, coreType);
}
```
Hope this helps! | |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dropZone | public static Cluster dropZone(Cluster intermediateCluster, int dropZoneId) {
// Filter out nodes that don't belong to the zone being dropped
Set<Node> survivingNodes = new HashSet<Node>();
for(int nodeId: intermediateCluster.getNodeIds()) {
if(intermediateCluster.getNodeById(nodeId)... | java | public static Cluster dropZone(Cluster intermediateCluster, int dropZoneId) {
// Filter out nodes that don't belong to the zone being dropped
Set<Node> survivingNodes = new HashSet<Node>();
for(int nodeId: intermediateCluster.getNodeIds()) {
if(intermediateCluster.getNodeById(nodeId)... | [
"public",
"static",
"Cluster",
"dropZone",
"(",
"Cluster",
"intermediateCluster",
",",
"int",
"dropZoneId",
")",
"{",
"// Filter out nodes that don't belong to the zone being dropped",
"Set",
"<",
"Node",
">",
"survivingNodes",
"=",
"new",
"HashSet",
"<",
"Node",
">",
... | Given a interim cluster with a previously vacated zone, constructs a new
cluster object with the drop zone completely removed
@param intermediateCluster
@param dropZoneId
@return adjusted cluster with the zone dropped | [
"Given",
"a",
"interim",
"cluster",
"with",
"a",
"previously",
"vacated",
"zone",
"constructs",
"a",
"new",
"cluster",
"object",
"with",
"the",
"drop",
"zone",
"completely",
"removed"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L335-L359 | train | Drop the zone from the intermediate cluster. | Create a Java method that does the following: "Drop the zone from the intermediate cluster.". | Of course, here is the Java code you requested:
```java
public static Cluster dropZone(Cluster intermediateCluster, int dropZoneId) {
// Filter out nodes that don't belong to the zone being dropped
Set<Node> survivingNodes = new HashSet<Node>();
for(int nodeId: intermediateCluster.getNodeIds())... | |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java | ItemIdValueImpl.fromIri | static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | java | static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | [
"static",
"ItemIdValueImpl",
"fromIri",
"(",
"String",
"iri",
")",
"{",
"int",
"separator",
"=",
"iri",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"try",
"{",
"return",
"new",
"ItemIdValueImpl",
"(",
"iri",
".",
"substring",
"(",
"separator",... | Parses an item IRI
@param iri
the item IRI like http://www.wikidata.org/entity/Q42
@throws IllegalArgumentException
if the IRI is invalid or does not ends with an item id | [
"Parses",
"an",
"item",
"IRI"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java#L67-L74 | train | Creates an ItemIdValue from a Wikibase entity IRI. | Create a Java method that does the following: "Creates an ItemIdValue from a Wikibase entity IRI.". | Of course, here is the Java code you requested:
```java
static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("... | |
jenkinsci/jenkins | core/src/main/java/jenkins/install/SetupWizard.java | SetupWizard.completeSetup | void completeSetup() throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
InstallUtil.saveLastExecVersion();
setCurrentLevel(Jenkins.getVersion());
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
} | java | void completeSetup() throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
InstallUtil.saveLastExecVersion();
setCurrentLevel(Jenkins.getVersion());
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
} | [
"void",
"completeSetup",
"(",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"Jenkins",
".",
"get",
"(",
")",
".",
"checkPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
";",
"InstallUtil",
".",
"saveLastExecVersion",
"(",
")",
";",
"setCurren... | /*package | [
"/",
"*",
"package"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/SetupWizard.java#L554-L559 | train | Called when the setup has completed. | Create a Java method that does the following: "Called when the setup has completed.". | Of course, here is the Java code you requested:
```java
void completeSetup() throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
InstallUtil.saveLastExecVersion();
setCurrentLevel(Jenkins.getVersion());
InstallUtil.proceedToNextStateFrom(InstallStat... | |
mapbox/mapbox-navigation-android | libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java | RouteFetcher.findRouteFromRouteProgress | public void findRouteFromRouteProgress(Location location, RouteProgress routeProgress) {
this.routeProgress = routeProgress;
NavigationRoute.Builder builder = buildRequestFrom(location, routeProgress);
findRouteWith(builder);
} | java | public void findRouteFromRouteProgress(Location location, RouteProgress routeProgress) {
this.routeProgress = routeProgress;
NavigationRoute.Builder builder = buildRequestFrom(location, routeProgress);
findRouteWith(builder);
} | [
"public",
"void",
"findRouteFromRouteProgress",
"(",
"Location",
"location",
",",
"RouteProgress",
"routeProgress",
")",
"{",
"this",
".",
"routeProgress",
"=",
"routeProgress",
";",
"NavigationRoute",
".",
"Builder",
"builder",
"=",
"buildRequestFrom",
"(",
"location... | Calculates a new {@link com.mapbox.api.directions.v5.models.DirectionsRoute} given
the current {@link Location} and {@link RouteProgress} along the route.
<p>
Uses {@link RouteOptions#coordinates()} and {@link RouteProgress#remainingWaypoints()}
to determine the amount of remaining waypoints there are along the given r... | [
"Calculates",
"a",
"new",
"{",
"@link",
"com",
".",
"mapbox",
".",
"api",
".",
"directions",
".",
"v5",
".",
"models",
".",
"DirectionsRoute",
"}",
"given",
"the",
"current",
"{",
"@link",
"Location",
"}",
"and",
"{",
"@link",
"RouteProgress",
"}",
"alon... | 375a89c017d360b9defc2c90d0c03468165162ec | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java#L98-L102 | train | Find route from route progress. | Create a Java method that does the following: "Find route from route progress.". | Of course, here is the Java code you requested:
```java
public void findRouteFromRouteProgress(Location location, RouteProgress routeProgress) {
this.routeProgress = routeProgress;
NavigationRoute.Builder builder = buildRequestFrom(location, routeProgress);
findRouteWith(builder);
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKey.java | RemoteQPConsumerKey.updateLastNotReadyTime | protected final void updateLastNotReadyTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "updateLastNotReadyTime");
if (readAhead)
{ // only relevant when prefetching
synchronized (this)
{
// it is possible that both the CP and the R... | java | protected final void updateLastNotReadyTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "updateLastNotReadyTime");
if (readAhead)
{ // only relevant when prefetching
synchronized (this)
{
// it is possible that both the CP and the R... | [
"protected",
"final",
"void",
"updateLastNotReadyTime",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"updateLastNotRe... | Update the time when the consumer became not ready | [
"Update",
"the",
"time",
"when",
"the",
"consumer",
"became",
"not",
"ready"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKey.java#L377-L396 | train | Update the lastNotReadyTime field in the CCP or RCD object. | Create a Java method that does the following: "Update the lastNotReadyTime field in the CCP or RCD object.". | Of course, here is the Java code you requested:
```java
protected final void updateLastNotReadyTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "updateLastNotReadyTime");
if (readAhead)
{ // only relevant when prefetching
synchronized (this)
... | |
tomgibara/bits | src/main/java/com/tomgibara/bits/ByteBasedBitReader.java | ByteBasedBitReader.setPosition | public long setPosition(long position) {
BitStreams.checkPosition(position);
if (position != this.position) {
// is this necessary? preferable? position = Math.min(position, size);
long index = seekByte(position >> 3);
if (index < 0L) { // seeking not supported - skip whole distance
long count = positi... | java | public long setPosition(long position) {
BitStreams.checkPosition(position);
if (position != this.position) {
// is this necessary? preferable? position = Math.min(position, size);
long index = seekByte(position >> 3);
if (index < 0L) { // seeking not supported - skip whole distance
long count = positi... | [
"public",
"long",
"setPosition",
"(",
"long",
"position",
")",
"{",
"BitStreams",
".",
"checkPosition",
"(",
"position",
")",
";",
"if",
"(",
"position",
"!=",
"this",
".",
"position",
")",
"{",
"// is this necessary? preferable? position = Math.min(position, size);",... | public methods | [
"public",
"methods"
] | 56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97 | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/ByteBasedBitReader.java#L121-L135 | train | Sets the position of the bit stream. | Create a Java method that does the following: "Sets the position of the bit stream.". | Of course, here is the Java code you requested:
```java
public long setPosition(long position) {
BitStreams.checkPosition(position);
if (position != this.position) {
// is this necessary? preferable? position = Math.min(position, size);
long index = seekByte(position >> 3);
if (index < 0L) { // seeking no... | |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java | LocalConnection.checkPermission | public final void checkPermission( String resource , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
securityContext.checkPermission(resource, action);
} | java | public final void checkPermission( String resource , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
securityContext.checkPermission(resource, action);
} | [
"public",
"final",
"void",
"checkPermission",
"(",
"String",
"resource",
",",
"String",
"action",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"securityContext",
"==",
"null",
")",
"return",
";",
"// Security is disabled",
"securityContext",
".",
"checkPermission"... | Check if the connection has the required credentials to use the given resource | [
"Check",
"if",
"the",
"connection",
"has",
"the",
"required",
"credentials",
"to",
"use",
"the",
"given",
"resource"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java#L203-L209 | train | Check if the security context has the required permissions. | Create a Java method that does the following: "Check if the security context has the required permissions.". | Of course, here is the Java code you requested:
```java
public final void checkPermission( String resource , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
securityContext.checkPermission(resource, action);
}
```
Hope thi... | |
threerings/narya | core/src/main/java/com/threerings/crowd/data/BodyObject.java | BodyObject.setAwayMessage | @Generated(value={"com.threerings.presents.tools.GenDObjectTask"})
public void setAwayMessage (String value)
{
String ovalue = this.awayMessage;
requestAttributeChange(
AWAY_MESSAGE, value, ovalue);
this.awayMessage = value;
} | java | @Generated(value={"com.threerings.presents.tools.GenDObjectTask"})
public void setAwayMessage (String value)
{
String ovalue = this.awayMessage;
requestAttributeChange(
AWAY_MESSAGE, value, ovalue);
this.awayMessage = value;
} | [
"@",
"Generated",
"(",
"value",
"=",
"{",
"\"com.threerings.presents.tools.GenDObjectTask\"",
"}",
")",
"public",
"void",
"setAwayMessage",
"(",
"String",
"value",
")",
"{",
"String",
"ovalue",
"=",
"this",
".",
"awayMessage",
";",
"requestAttributeChange",
"(",
"... | Requests that the <code>awayMessage</code> field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received ... | [
"Requests",
"that",
"the",
"<code",
">",
"awayMessage<",
"/",
"code",
">",
"field",
"be",
"set",
"to",
"the",
"specified",
"value",
".",
"The",
"local",
"value",
"will",
"be",
"updated",
"immediately",
"and",
"an",
"event",
"will",
"be",
"propagated",
"thr... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/data/BodyObject.java#L204-L211 | train | Sets the value of the AwayMessage property. | Create a Java method that does the following: "Sets the value of the AwayMessage property.". | Of course, here is the Java code you requested:
```java
@Generated(value={"com.threerings.presents.tools.GenDObjectTask"})
public void setAwayMessage (String value)
{
String ovalue = this.awayMessage;
requestAttributeChange(
AWAY_MESSAGE, value, ovalue);
this.awayMessage = v... | |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getFirstDayOfWeek | public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return ... | java | public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return ... | [
"public",
"static",
"int",
"getFirstDayOfWeek",
"(",
"Context",
"context",
")",
"{",
"int",
"startDay",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
".",
"getFirstDayOfWeek",
"(",
")",
";",
"if",
"(",
"startDay",
"==",
"Calendar",
".",
"SATURDAY",
")",
"... | Get first day of week as android.text.format.Time constant.
@return the first day of week in android.text.format.Time | [
"Get",
"first",
"day",
"of",
"week",
"as",
"android",
".",
"text",
".",
"format",
".",
"Time",
"constant",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L380-L390 | train | Get the first day of the calendar. | Create a Java method that does the following: "Get the first day of the calendar.". | Of course, here is the Java code you requested:
```java
public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
... | |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java | XMLGISElementUtil.writeMapElement | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
public static Element writeMapElement(MapElement primitive, String primitiveNodeName,
XMLBuilder builder, XMLResources resources) throws IOException {
Element primitiveNode = null;
if (primitive instanceof MapPonctualElement) {... | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
public static Element writeMapElement(MapElement primitive, String primitiveNodeName,
XMLBuilder builder, XMLResources resources) throws IOException {
Element primitiveNode = null;
if (primitive instanceof MapPonctualElement) {... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
"}",
")",
"public",
"static",
"Element",
"writeMapElement",
"(",
"MapElement",
"primitive",
",",
"String",
"primitiveNodeName",
",",
"XMLBuilder",
"builder",
"... | Write the XML description for the given map element.
@param primitive is the map element to output.
@param primitiveNodeName is the name of the XML node that should contains the map element data.
It may be {@code null} to use the default name.
@param builder is the tool to create XML nodes.
@param resources is the too... | [
"Write",
"the",
"XML",
"description",
"for",
"the",
"given",
"map",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L154-L226 | train | Write a MapElement to the XML. | Create a Java method that does the following: "Write a MapElement to the XML.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
public static Element writeMapElement(MapElement primitive, String primitiveNodeName,
XMLBuilder builder, XMLResources resources) throws IOException {
Element primitiveNode... | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/AfplibFactoryImpl.java | AfplibFactoryImpl.createGCBIMGRESFromString | public GCBIMGRES createGCBIMGRESFromString(EDataType eDataType, String initialValue) {
GCBIMGRES result = GCBIMGRES.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | java | public GCBIMGRES createGCBIMGRESFromString(EDataType eDataType, String initialValue) {
GCBIMGRES result = GCBIMGRES.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | [
"public",
"GCBIMGRES",
"createGCBIMGRESFromString",
"(",
"EDataType",
"eDataType",
",",
"String",
"initialValue",
")",
"{",
"GCBIMGRES",
"result",
"=",
"GCBIMGRES",
".",
"get",
"(",
"initialValue",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"throw",
"ne... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/afplib/impl/AfplibFactoryImpl.java#L7328-L7332 | train | Create a GCBIMGRES object from a String value. | Create a Java method that does the following: "Create a GCBIMGRES object from a String value.". | Of course, here is the Java code you requested:
```java
public GCBIMGRES createGCBIMGRESFromString(EDataType eDataType, String initialValue) {
GCBIMGRES result = GCBIMGRES.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + e... | |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/ResolutionPreference.java | ResolutionPreference.obtainWidthHint | private void obtainWidthHint(@NonNull final TypedArray typedArray) {
CharSequence obtainedHint = typedArray.getText(R.styleable.ResolutionPreference_widthHint);
if (obtainedHint == null) {
obtainedHint = getContext().getText(R.string.resolution_preference_width_hint);
}
set... | java | private void obtainWidthHint(@NonNull final TypedArray typedArray) {
CharSequence obtainedHint = typedArray.getText(R.styleable.ResolutionPreference_widthHint);
if (obtainedHint == null) {
obtainedHint = getContext().getText(R.string.resolution_preference_width_hint);
}
set... | [
"private",
"void",
"obtainWidthHint",
"(",
"@",
"NonNull",
"final",
"TypedArray",
"typedArray",
")",
"{",
"CharSequence",
"obtainedHint",
"=",
"typedArray",
".",
"getText",
"(",
"R",
".",
"styleable",
".",
"ResolutionPreference_widthHint",
")",
";",
"if",
"(",
"... | Obtains the hint of the edit text widget, which allows to enter the width of the resolution,
from a specific typed array.
@param typedArray
The typed array, the hint should be obtained from, as an instance of the class {@link
TypedArray}. The typed array may not be null | [
"Obtains",
"the",
"hint",
"of",
"the",
"edit",
"text",
"widget",
"which",
"allows",
"to",
"enter",
"the",
"width",
"of",
"the",
"resolution",
"from",
"a",
"specific",
"typed",
"array",
"."
] | 73a7e449458313bd041fc8d6038e290506b68eb1 | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/ResolutionPreference.java#L250-L258 | train | Obtains the hint of the width of the calendar from a specific typed array. | Create a Java method that does the following: "Obtains the hint of the width of the calendar from a specific typed array.". | Of course, here is the Java code you requested:
```java
private void obtainWidthHint(@NonNull final TypedArray typedArray) {
CharSequence obtainedHint = typedArray.getText(R.styleable.ResolutionPreference_widthHint);
if (obtainedHint == null) {
obtainedHint = getContext().getText(R.string.... | |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/activities/engine/javase/FixedThreadPoolEngine.java | FixedThreadPoolEngine.submit | @Override
protected Future<ActivityData> submit(ActivityCallable callable) {
if(service == null) {
service = Executors.newFixedThreadPool(threads);
}
logger.trace("submitting activity to thread pool...");
return service.submit(callable);
} | java | @Override
protected Future<ActivityData> submit(ActivityCallable callable) {
if(service == null) {
service = Executors.newFixedThreadPool(threads);
}
logger.trace("submitting activity to thread pool...");
return service.submit(callable);
} | [
"@",
"Override",
"protected",
"Future",
"<",
"ActivityData",
">",
"submit",
"(",
"ActivityCallable",
"callable",
")",
"{",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"service",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"threads",
")",
";",
"}",
... | Assigns the given activity to the thread pool for background execution.
@param callable
the callable object for the {@code Activity} to be executed asynchronously.
@return
the activity's {@code Future} object, for result retrieval.
@see
org.dihedron.patterns.activities.concurrent.ActivityExecutor#submit(org.dihedron.p... | [
"Assigns",
"the",
"given",
"activity",
"to",
"the",
"thread",
"pool",
"for",
"background",
"execution",
"."
] | a5194cdaa0d6417ef4aade6ea407a1cad6e8458e | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/engine/javase/FixedThreadPoolEngine.java#L78-L85 | train | Submits an activity to the thread pool. | Create a Java method that does the following: "Submits an activity to the thread pool.". | Of course, here is the Java code you requested:
```java
@Override
protected Future<ActivityData> submit(ActivityCallable callable) {
if(service == null) {
service = Executors.newFixedThreadPool(threads);
}
logger.trace("submitting activity to thread pool...");
return service.submit(callable);
}
```
Hope ... | |
protegeproject/jpaul | src/main/java/jpaul/Misc/ActionPredicate.java | ActionPredicate.fromAction | public static <T> ActionPredicate<T> fromAction
(final Action<T> action,
final boolean predicateResult) {
return new ActionPredicate<T>() {
public boolean actionPredicate(T obj) {
action.action(obj);
return predicateResult;
}
};
} | java | public static <T> ActionPredicate<T> fromAction
(final Action<T> action,
final boolean predicateResult) {
return new ActionPredicate<T>() {
public boolean actionPredicate(T obj) {
action.action(obj);
return predicateResult;
}
};
} | [
"public",
"static",
"<",
"T",
">",
"ActionPredicate",
"<",
"T",
">",
"fromAction",
"(",
"final",
"Action",
"<",
"T",
">",
"action",
",",
"final",
"boolean",
"predicateResult",
")",
"{",
"return",
"new",
"ActionPredicate",
"<",
"T",
">",
"(",
")",
"{",
... | Creates an <code>ActionPredicate</code> whose
<code>actionPredicate</code> method first invokes the action
from <code>action</code> and next returns the constant boolean
value <code>predicateResult</code>. | [
"Creates",
"an",
"<code",
">",
"ActionPredicate<",
"/",
"code",
">",
"whose",
"<code",
">",
"actionPredicate<",
"/",
"code",
">",
"method",
"first",
"invokes",
"the",
"action",
"from",
"<code",
">",
"action<",
"/",
"code",
">",
"and",
"next",
"returns",
"t... | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/ActionPredicate.java#L40-L50 | train | Creates an ActionPredicate from an Action object. | Create a Java method that does the following: "Creates an ActionPredicate from an Action object.". | Of course, here is the Java code you requested:
```java
public static <T> ActionPredicate<T> fromAction
(final Action<T> action,
final boolean predicateResult) {
return new ActionPredicate<T>() {
public boolean actionPredicate(T obj) {
action.action(obj);
return predicateResult;
}
};
}
```
Ho... | |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftInvertedIndexHandler.java | ThriftInvertedIndexHandler.getSuperColumnForRow | @Override
protected SuperColumn getSuperColumnForRow(ConsistencyLevel consistencyLevel, String columnFamilyName,
String rowKey, byte[] superColumnName, String persistenceUnit)
{
ColumnPath cp = new ColumnPath(columnFamilyName);
cp.setSuper_column(superColumnName);
ColumnOrSup... | java | @Override
protected SuperColumn getSuperColumnForRow(ConsistencyLevel consistencyLevel, String columnFamilyName,
String rowKey, byte[] superColumnName, String persistenceUnit)
{
ColumnPath cp = new ColumnPath(columnFamilyName);
cp.setSuper_column(superColumnName);
ColumnOrSup... | [
"@",
"Override",
"protected",
"SuperColumn",
"getSuperColumnForRow",
"(",
"ConsistencyLevel",
"consistencyLevel",
",",
"String",
"columnFamilyName",
",",
"String",
"rowKey",
",",
"byte",
"[",
"]",
"superColumnName",
",",
"String",
"persistenceUnit",
")",
"{",
"ColumnP... | /* (non-Javadoc)
@see com.impetus.client.cassandra.index.InvertedIndexHandlerBase#getSuperColumnForRow(org.apache.cassandra.thrift.ConsistencyLevel, java.lang.String, java.lang.String, byte[], java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 268958ab1ec09d14ec4d9184f0c8ded7a9158908 | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftInvertedIndexHandler.java#L240-L284 | train | Gets the SuperColumn for the row. | Create a Java method that does the following: "Gets the SuperColumn for the row.". | Of course, here is the Java code you requested:
```java
@Override
protected SuperColumn getSuperColumnForRow(ConsistencyLevel consistencyLevel, String columnFamilyName,
String rowKey, byte[] superColumnName, String persistenceUnit)
{
ColumnPath cp = new ColumnPath(columnFamilyName);
... | |
fabric8io/fabric8-maven-plugin | enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/DefaultServiceEnricher.java | DefaultServiceEnricher.addPortIfNotNull | private void addPortIfNotNull(List<ServicePort> ret, ServicePort port) {
if (port != null) {
ret.add(port);
}
} | java | private void addPortIfNotNull(List<ServicePort> ret, ServicePort port) {
if (port != null) {
ret.add(port);
}
} | [
"private",
"void",
"addPortIfNotNull",
"(",
"List",
"<",
"ServicePort",
">",
"ret",
",",
"ServicePort",
"port",
")",
"{",
"if",
"(",
"port",
"!=",
"null",
")",
"{",
"ret",
".",
"add",
"(",
"port",
")",
";",
"}",
"}"
] | null ports can happen for ignored mappings | [
"null",
"ports",
"can",
"happen",
"for",
"ignored",
"mappings"
] | b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3 | https://github.com/fabric8io/fabric8-maven-plugin/blob/b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3/enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/DefaultServiceEnricher.java#L353-L357 | test | Add a ServicePort to a list of ServicePort. | Create a Java method that does the following: "Add a ServicePort to a list of ServicePort.". | Of course, here is the Java code you requested:
```java
private void addPortIfNotNull(List<ServicePort> ret, ServicePort port) {
if (port != null) {
ret.add(port);
}
}
```
Hope this helps! | |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java | PersistenceValidator.validateEntityAttributes | private <X extends Class, T extends Object> void validateEntityAttributes(Object entity,
KunderaMetadata kunderaMetadata)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
MetamodelImpl metaModel = (MetamodelImpl) kunderaMet... | java | private <X extends Class, T extends Object> void validateEntityAttributes(Object entity,
KunderaMetadata kunderaMetadata)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
MetamodelImpl metaModel = (MetamodelImpl) kunderaMet... | [
"private",
"<",
"X",
"extends",
"Class",
",",
"T",
"extends",
"Object",
">",
"void",
"validateEntityAttributes",
"(",
"Object",
"entity",
",",
"KunderaMetadata",
"kunderaMetadata",
")",
"{",
"EntityMetadata",
"entityMetadata",
"=",
"KunderaMetadataManager",
".",
"ge... | Validates an entity object for CRUD operations
@param entity
Instance of entity object | [
"Validates",
"an",
"entity",
"object",
"for",
"CRUD",
"operations"
] | 268958ab1ec09d14ec4d9184f0c8ded7a9158908 | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java#L104-L153 | train | Validate entity attributes. | Create a Java method that does the following: "Validate entity attributes.". | Of course, here is the Java code you requested:
```java
private <X extends Class, T extends Object> void validateEntityAttributes(Object entity,
KunderaMetadata kunderaMetadata)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
... | |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/Scale.java | Scale.doTransform | @Override
protected void doTransform(ITransformable.Scale transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? this.fromY : this.toY;
float fromZ = reversed ? this.toZ... | java | @Override
protected void doTransform(ITransformable.Scale transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? this.fromY : this.toY;
float fromZ = reversed ? this.toZ... | [
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"ITransformable",
".",
"Scale",
"transformable",
",",
"float",
"comp",
")",
"{",
"float",
"fromX",
"=",
"reversed",
"?",
"this",
".",
"toX",
":",
"this",
".",
"fromX",
";",
"float",
"toX",
"=",
"r... | Calculate the transformation.
@param transformable the transformable
@param comp the comp | [
"Calculate",
"the",
"transformation",
"."
] | 4f8e1fa462d5c372fc23414482ba9f429881cc54 | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Scale.java#L135-L147 | train | Override the doTransform method. | Create a Java method that does the following: "Override the doTransform method.". | Of course, here is the Java code you requested:
```java
@Override
protected void doTransform(ITransformable.Scale transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? t... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java | AnycastOutputHandler.forceFlushAtSource | public void forceFlushAtSource(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forceFlushAtSource", new Object[] {remoteUuid, gatheringTargetDestUuid});
StreamInfo sinfo;
boolean success = false;
String ... | java | public void forceFlushAtSource(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forceFlushAtSource", new Object[] {remoteUuid, gatheringTargetDestUuid});
StreamInfo sinfo;
boolean success = false;
String ... | [
"public",
"void",
"forceFlushAtSource",
"(",
"SIBUuid8",
"remoteUuid",
",",
"SIBUuid12",
"gatheringTargetDestUuid",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entr... | If the RME has been deleted then the stream needs to be flushed to unlock
any messaqes on this DME.
@param remoteME the uuid of the remote ME | [
"If",
"the",
"RME",
"has",
"been",
"deleted",
"then",
"the",
"stream",
"needs",
"to",
"be",
"flushed",
"to",
"unlock",
"any",
"messaqes",
"on",
"this",
"DME",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L3086-L3203 | train | This method is called by the AOStream when a flush is requested for a remote ME. | Create a Java method that does the following: "This method is called by the AOStream when a flush is requested for a remote ME.". | Of course, here is the Java code you requested:
```java
public void forceFlushAtSource(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forceFlushAtSource", new Object[] {remoteUuid, gatheringTargetDestUuid});
S... | |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/math/ArrayMath.java | ArrayMath.norm_1 | public static double norm_1(double[] a) {
double sum = 0;
for (double anA : a) {
sum += (anA < 0 ? -anA : anA);
}
return sum;
} | java | public static double norm_1(double[] a) {
double sum = 0;
for (double anA : a) {
sum += (anA < 0 ? -anA : anA);
}
return sum;
} | [
"public",
"static",
"double",
"norm_1",
"(",
"double",
"[",
"]",
"a",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"double",
"anA",
":",
"a",
")",
"{",
"sum",
"+=",
"(",
"anA",
"<",
"0",
"?",
"-",
"anA",
":",
"anA",
")",
";",
"}",
... | Computes 1-norm of vector
@param a A vector of double
@return 1-norm of a | [
"Computes",
"1",
"-",
"norm",
"of",
"vector"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L610-L616 | train | Norm 1 of a double array. | Create a Java method that does the following: "Norm 1 of a double array.". | Of course, here is the Java code you requested:
```java
public static double norm_1(double[] a) {
double sum = 0;
for (double anA : a) {
sum += (anA < 0 ? -anA : anA);
}
return sum;
}
```
Hope this helps! | |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.getClientID | @Override
public String getClientID() throws JMSException
{
externalAccessLock.readLock().lock();
try
{
if (clientID == null)
throw new InvalidClientIDException("Client ID not set");
return clientID;
}
finally
{
externalAccessLock.readLock().unlock();
... | java | @Override
public String getClientID() throws JMSException
{
externalAccessLock.readLock().lock();
try
{
if (clientID == null)
throw new InvalidClientIDException("Client ID not set");
return clientID;
}
finally
{
externalAccessLock.readLock().unlock();
... | [
"@",
"Override",
"public",
"String",
"getClientID",
"(",
")",
"throws",
"JMSException",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"clientID",
"==",
"null",
")",
"throw",
"new",
"InvalidClientID... | /* (non-Javadoc)
@see javax.jms.Connection#getClientID() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L98-L112 | train | Returns the client ID. | Create a Java method that does the following: "Returns the client ID.". | Of course, here is the Java code you requested:
```java
@Override
public String getClientID() throws JMSException
{
externalAccessLock.readLock().lock();
try
{
if (clientID == null)
throw new InvalidClientIDException("Client ID not set");
return clientID;
}
finall... | |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteOptions.java | JobScheduleDeleteOptions.withIfUnmodifiedSince | public JobScheduleDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null;
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince);
}
return this;
} | java | public JobScheduleDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null;
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince);
}
return this;
} | [
"public",
"JobScheduleDeleteOptions",
"withIfUnmodifiedSince",
"(",
"DateTime",
"ifUnmodifiedSince",
")",
"{",
"if",
"(",
"ifUnmodifiedSince",
"==",
"null",
")",
"{",
"this",
".",
"ifUnmodifiedSince",
"=",
"null",
";",
"}",
"else",
"{",
"this",
".",
"ifUnmodifiedS... | Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.
@param ifUnmodifiedSince the ifUnmodifiedSince value to set
@return the JobScheduleDeleteOptions object itself. | [
"Set",
"a",
"timestamp",
"indicating",
"the",
"last",
"modified",
"time",
"of",
"the",
"resource",
"known",
"to",
"the",
"client",
".",
"The",
"operation",
"will",
"be",
"performed",
"only",
"if",
"the",
"resource",
"on",
"the",
"service",
"has",
"not",
"b... | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteOptions.java#L249-L256 | train | Sets the ifUnmodifiedSince value. | Create a Java method that does the following: "Sets the ifUnmodifiedSince value.". | Of course, here is the Java code you requested:
```java
public JobScheduleDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null;
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince);
... | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java | FSDirectoryManager.delete | public boolean delete(final String name)
{
return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
{
public Boolean run()
{
File directory = new File(baseDir, name);
// trivial if it does not exist anymore
if (!directory.exists())
... | java | public boolean delete(final String name)
{
return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
{
public Boolean run()
{
File directory = new File(baseDir, name);
// trivial if it does not exist anymore
if (!directory.exists())
... | [
"public",
"boolean",
"delete",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"SecurityHelper",
".",
"doPrivilegedAction",
"(",
"new",
"PrivilegedAction",
"<",
"Boolean",
">",
"(",
")",
"{",
"public",
"Boolean",
"run",
"(",
")",
"{",
"File",
"directory"... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java#L218-L250 | train | Delete a single file or directory. | Create a Java method that does the following: "Delete a single file or directory.". | Of course, here is the Java code you requested:
```java
public boolean delete(final String name)
{
return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
{
public Boolean run()
{
File directory = new File(baseDir, name);
// trivial if it does n... | |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.setSplash | public ServerUpdater setSplash(InputStream splash, String fileType) {
delegate.setSplash(splash, fileType);
return this;
} | java | public ServerUpdater setSplash(InputStream splash, String fileType) {
delegate.setSplash(splash, fileType);
return this;
} | [
"public",
"ServerUpdater",
"setSplash",
"(",
"InputStream",
"splash",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setSplash",
"(",
"splash",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Queues the splash to be updated.
@param splash The new splash of the server.
@param fileType The type of the splash, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Queues",
"the",
"splash",
"to",
"be",
"updated",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L365-L368 | train | Sets the splash of the server. | Create a Java method that does the following: "Sets the splash of the server.". | Of course, here is the Java code you requested:
```java
public ServerUpdater setSplash(InputStream splash, String fileType) {
delegate.setSplash(splash, fileType);
return this;
}
```
Hope this helps! | |
oblac/jodd | jodd-joy/src/main/java/jodd/joy/auth/simtok/SimTokCoder.java | SimTokCoder.encode | public String encode(final SimTok simTok) {
final String json = JsonSerializer.create().deep(true).serialize(simTok);
final String p1 = Base64.encodeToString("JoddSimTok" + SALT_ROUNDS);
final String p2 = Base64.encodeToString(json);
final String salt = BCrypt.gensalt(SALT_ROUNDS);
final String p3 = BCrypt.... | java | public String encode(final SimTok simTok) {
final String json = JsonSerializer.create().deep(true).serialize(simTok);
final String p1 = Base64.encodeToString("JoddSimTok" + SALT_ROUNDS);
final String p2 = Base64.encodeToString(json);
final String salt = BCrypt.gensalt(SALT_ROUNDS);
final String p3 = BCrypt.... | [
"public",
"String",
"encode",
"(",
"final",
"SimTok",
"simTok",
")",
"{",
"final",
"String",
"json",
"=",
"JsonSerializer",
".",
"create",
"(",
")",
".",
"deep",
"(",
"true",
")",
".",
"serialize",
"(",
"simTok",
")",
";",
"final",
"String",
"p1",
"=",... | Encodes the {@link SimTok} to JSON string. | [
"Encodes",
"the",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-joy/src/main/java/jodd/joy/auth/simtok/SimTokCoder.java#L46-L56 | test | Encode the SimTok object to Base64. | Create a Java method that does the following: "Encode the SimTok object to Base64.". | Of course, here is the Java code you requested:
```java
public String encode(final SimTok simTok) {
final String json = JsonSerializer.create().deep(true).serialize(simTok);
final String p1 = Base64.encodeToString("JoddSimTok" + SALT_ROUNDS);
final String p2 = Base64.encodeToString(json);
final String salt =... | |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/RandomVariableLazyEvaluation.java | RandomVariableLazyEvaluation.mult | @Override
public RandomVariable mult(double value) {
return apply(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return x * value;
}
});
} | java | @Override
public RandomVariable mult(double value) {
return apply(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return x * value;
}
});
} | [
"@",
"Override",
"public",
"RandomVariable",
"mult",
"(",
"double",
"value",
")",
"{",
"return",
"apply",
"(",
"new",
"DoubleUnaryOperator",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"applyAsDouble",
"(",
"double",
"x",
")",
"{",
"return",
"x",
"... | /* (non-Javadoc)
@see net.finmath.stochastic.RandomVariable#mult(double) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/RandomVariableLazyEvaluation.java#L961-L969 | train | Multiplies this random variable by the given value. | Create a Java method that does the following: "Multiplies this random variable by the given value.". | Of course, here is the Java code you requested:
```java
@Override
public RandomVariable mult(double value) {
return apply(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return x * value;
}
});
}
```
Hope this helps! | |
jenkinsci/jenkins | core/src/main/java/hudson/model/queue/Tasks.java | Tasks.getItemOf | @CheckForNull
public static hudson.model.Item getItemOf(@Nonnull SubTask t) {
Queue.Task p = t.getOwnerTask();
while (!(p instanceof hudson.model.Item)) {
Queue.Task o = p.getOwnerTask();
if (o == p) {
break;
}
p = o;
}
... | java | @CheckForNull
public static hudson.model.Item getItemOf(@Nonnull SubTask t) {
Queue.Task p = t.getOwnerTask();
while (!(p instanceof hudson.model.Item)) {
Queue.Task o = p.getOwnerTask();
if (o == p) {
break;
}
p = o;
}
... | [
"@",
"CheckForNull",
"public",
"static",
"hudson",
".",
"model",
".",
"Item",
"getItemOf",
"(",
"@",
"Nonnull",
"SubTask",
"t",
")",
"{",
"Queue",
".",
"Task",
"p",
"=",
"t",
".",
"getOwnerTask",
"(",
")",
";",
"while",
"(",
"!",
"(",
"p",
"instanceo... | Gets the {@link hudson.model.Item} most closely associated with the supplied {@link SubTask}.
@param t the {@link SubTask}.
@return the {@link hudson.model.Item} associated with the {@link SubTask} or {@code null} if this
{@link SubTask} is not associated with an {@link hudson.model.Item}
@since 2.55 | [
"Gets",
"the",
"{"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/Tasks.java#L70-L81 | train | Get the item of a subtask. | Create a Java method that does the following: "Get the item of a subtask.". | Of course, here is the Java code you requested:
```java
@CheckForNull
public static hudson.model.Item getItemOf(@Nonnull SubTask t) {
Queue.Task p = t.getOwnerTask();
while (!(p instanceof hudson.model.Item)) {
Queue.Task o = p.getOwnerTask();
if (o == p) {
b... | |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/calibration/CalibratedCurves.java | CalibratedCurves.add | private String add(CalibrationSpec calibrationSpec) throws CloneNotSupportedException
{
calibrationSpecs.add(calibrationSpec);
/*
* Add one point to the calibration curve and one new objective function
*/
// Create calibration product (will also create the curve if necessary)
calibrationProducts.add(ge... | java | private String add(CalibrationSpec calibrationSpec) throws CloneNotSupportedException
{
calibrationSpecs.add(calibrationSpec);
/*
* Add one point to the calibration curve and one new objective function
*/
// Create calibration product (will also create the curve if necessary)
calibrationProducts.add(ge... | [
"private",
"String",
"add",
"(",
"CalibrationSpec",
"calibrationSpec",
")",
"throws",
"CloneNotSupportedException",
"{",
"calibrationSpecs",
".",
"add",
"(",
"calibrationSpec",
")",
";",
"/*\n\t\t * Add one point to the calibration curve and one new objective function\n\t\t */",
... | Add a calibration product to the set of calibration instruments.
@param calibrationSpec The spec of the calibration product.
@throws CloneNotSupportedException Thrown if a curve could not be cloned / created. | [
"Add",
"a",
"calibration",
"product",
"to",
"the",
"set",
"of",
"calibration",
"instruments",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/calibration/CalibratedCurves.java#L701-L754 | train | Add a calibration specification to the list of calibration objects. | Create a Java method that does the following: "Add a calibration specification to the list of calibration objects.". | Of course, here is the Java code you requested:
```java
private String add(CalibrationSpec calibrationSpec) throws CloneNotSupportedException
{
calibrationSpecs.add(calibrationSpec);
/*
* Add one point to the calibration curve and one new objective function
*/
// Create calibration product (will also cr... | |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.readXMLFragment | public static DocumentFragment readXMLFragment(Reader reader) throws IOException, SAXException,
ParserConfigurationException {
return readXMLFragment(reader, false);
} | java | public static DocumentFragment readXMLFragment(Reader reader) throws IOException, SAXException,
ParserConfigurationException {
return readXMLFragment(reader, false);
} | [
"public",
"static",
"DocumentFragment",
"readXMLFragment",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"return",
"readXMLFragment",
"(",
"reader",
",",
"false",
")",
";",
"}"
] | Read an XML fragment from an XML file.
The XML file is well-formed. It means that the fragment will contains a single element: the root element
within the input stream.
@param reader is the stream to read
@return the fragment from the {@code reader}.
@throws IOException if the stream cannot be read.
@throws SAXExcepti... | [
"Read",
"an",
"XML",
"fragment",
"from",
"an",
"XML",
"file",
".",
"The",
"XML",
"file",
"is",
"well",
"-",
"formed",
".",
"It",
"means",
"that",
"the",
"fragment",
"will",
"contains",
"a",
"single",
"element",
":",
"the",
"root",
"element",
"within",
... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2041-L2044 | train | Read an XML fragment from the specified reader. | Create a Java method that does the following: "Read an XML fragment from the specified reader.". | Of course, here is the Java code you requested:
```java
public static DocumentFragment readXMLFragment(Reader reader) throws IOException, SAXException,
ParserConfigurationException {
return readXMLFragment(reader, false);
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/transform/KeyPairMarshaller.java | KeyPairMarshaller.marshall | public void marshall(KeyPair keyPair, ProtocolMarshaller protocolMarshaller) {
if (keyPair == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keyPair.getPublicKey(), PUBLICKEY_BINDING);
pr... | java | public void marshall(KeyPair keyPair, ProtocolMarshaller protocolMarshaller) {
if (keyPair == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keyPair.getPublicKey(), PUBLICKEY_BINDING);
pr... | [
"public",
"void",
"marshall",
"(",
"KeyPair",
"keyPair",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"keyPair",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to marshall(...)\"",
")",
";",
"}"... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/transform/KeyPairMarshaller.java#L44-L56 | train | marshalls the given keyPair to the JSON - compatible parameter object. | Create a Java method that does the following: "marshalls the given keyPair to the JSON - compatible parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(KeyPair keyPair, ProtocolMarshaller protocolMarshaller) {
if (keyPair == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(k... | |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/WordForm.java | WordForm.getPOS | public String getPOS() {
if (WordForm_Type.featOkTst && ((WordForm_Type)jcasType).casFeat_POS == null)
jcasType.jcas.throwFeatMissing("POS", "com.digitalpebble.rasp.WordForm");
return jcasType.ll_cas.ll_getStringValue(addr, ((WordForm_Type)jcasType).casFeatCode_POS);} | java | public String getPOS() {
if (WordForm_Type.featOkTst && ((WordForm_Type)jcasType).casFeat_POS == null)
jcasType.jcas.throwFeatMissing("POS", "com.digitalpebble.rasp.WordForm");
return jcasType.ll_cas.ll_getStringValue(addr, ((WordForm_Type)jcasType).casFeatCode_POS);} | [
"public",
"String",
"getPOS",
"(",
")",
"{",
"if",
"(",
"WordForm_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"WordForm_Type",
")",
"jcasType",
")",
".",
"casFeat_POS",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"POS\"",
",",
... | getter for POS - gets POS tag for a given form
@generated
@return value of the feature | [
"getter",
"for",
"POS",
"-",
"gets",
"POS",
"tag",
"for",
"a",
"given",
"form"
] | 793ea3f46761dce72094e057a56cddfa677156ae | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/WordForm.java#L108-L111 | train | getter for POS - gets POS phrase of the word | Create a Java method that does the following: "getter for POS - gets POS phrase of the word". | Of course, here is the Java code you requested:
```java
public String getPOS() {
if (WordForm_Type.featOkTst && ((WordForm_Type)jcasType).casFeat_POS == null)
jcasType.jcas.throwFeatMissing("POS", "com.digitalpebble.rasp.WordForm");
return jcasType.ll_cas.ll_getStringValue(addr, ((WordForm_Type)jcasType)... | |
knowm/XChange | xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/KucoinAdapters.java | KucoinAdapters.adaptMetadata | public static ExchangeMetaData adaptMetadata(
ExchangeMetaData exchangeMetaData, List<SymbolResponse> kucoinSymbols) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs();
Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies();
for (Symbo... | java | public static ExchangeMetaData adaptMetadata(
ExchangeMetaData exchangeMetaData, List<SymbolResponse> kucoinSymbols) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs();
Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies();
for (Symbo... | [
"public",
"static",
"ExchangeMetaData",
"adaptMetadata",
"(",
"ExchangeMetaData",
"exchangeMetaData",
",",
"List",
"<",
"SymbolResponse",
">",
"kucoinSymbols",
")",
"{",
"Map",
"<",
"CurrencyPair",
",",
"CurrencyPairMetaData",
">",
"currencyPairs",
"=",
"exchangeMetaDat... | Imperfect implementation. Kucoin appears to enforce a base <strong>and</strong> quote min
<strong>and max</strong> amount that the XChange API current doesn't take account of.
@param exchangeMetaData The static exchange metadata.
@param kucoinSymbols Kucoin symbol data.
@return Exchange metadata. | [
"Imperfect",
"implementation",
".",
"Kucoin",
"appears",
"to",
"enforce",
"a",
"base",
"<strong",
">",
"and<",
"/",
"strong",
">",
"quote",
"min",
"<strong",
">",
"and",
"max<",
"/",
"strong",
">",
"amount",
"that",
"the",
"XChange",
"API",
"current",
"doe... | e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186 | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/KucoinAdapters.java#L91-L124 | train | Adapts a list of kucoin symbol response objects to an exchange meta data object | Create a Java method that does the following: "Adapts a list of kucoin symbol response objects to an exchange meta data object". | Of course, here is the Java code you requested:
```java
public static ExchangeMetaData adaptMetadata(
ExchangeMetaData exchangeMetaData, List<SymbolResponse> kucoinSymbols) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs();
Map<Currency, CurrencyMetaData> curre... | |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java | CassandraCell.create | public static Cell create(String cellName) {
return create(cellName, (Object) null, Boolean.FALSE, Boolean.FALSE);
} | java | public static Cell create(String cellName) {
return create(cellName, (Object) null, Boolean.FALSE, Boolean.FALSE);
} | [
"public",
"static",
"Cell",
"create",
"(",
"String",
"cellName",
")",
"{",
"return",
"create",
"(",
"cellName",
",",
"(",
"Object",
")",
"null",
",",
"Boolean",
".",
"FALSE",
",",
"Boolean",
".",
"FALSE",
")",
";",
"}"
] | Factory method, builds a new CassandraCell (isPartitionKey = false and isClusterKey = false) with value = null.
The validator will be automatically calculated using the value object type.
@param cellName the cell name
@return an instance of a Cell object for the provided parameters. | [
"Factory",
"method",
"builds",
"a",
"new",
"CassandraCell",
"(",
"isPartitionKey",
"=",
"false",
"and",
"isClusterKey",
"=",
"false",
")",
"with",
"value",
"=",
"null",
".",
"The",
"validator",
"will",
"be",
"automatically",
"calculated",
"using",
"the",
"valu... | b9621c9b7a6d996f80fce1d073d696a157bed095 | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java#L83-L85 | train | Create a new cell with the specified name. | Create a Java method that does the following: "Create a new cell with the specified name.". | Of course, here is the Java code you requested:
```java
public static Cell create(String cellName) {
return create(cellName, (Object) null, Boolean.FALSE, Boolean.FALSE);
}
```
Hope this helps! | |
blakepettersson/reactmann | reactmann-core/src/main/java/reactmann/subscribers/RiemannParser.java | RiemannParser.handle | public void handle(Buffer buffer) {
if (buff == null) {
buff = buffer;
} else {
buff.appendBuffer(buffer);
}
if(recordSize == -1) {
fixedSizeMode(buff.getInt(0) + 4);
}
handleParsing();
} | java | public void handle(Buffer buffer) {
if (buff == null) {
buff = buffer;
} else {
buff.appendBuffer(buffer);
}
if(recordSize == -1) {
fixedSizeMode(buff.getInt(0) + 4);
}
handleParsing();
} | [
"public",
"void",
"handle",
"(",
"Buffer",
"buffer",
")",
"{",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"buff",
"=",
"buffer",
";",
"}",
"else",
"{",
"buff",
".",
"appendBuffer",
"(",
"buffer",
")",
";",
"}",
"if",
"(",
"recordSize",
"==",
"-",
... | This method is called to provide the parser with data.
@param buffer | [
"This",
"method",
"is",
"called",
"to",
"provide",
"the",
"parser",
"with",
"data",
"."
] | cebb113c8a8db3a27b3d728e00d8f0b2585e9157 | https://github.com/blakepettersson/reactmann/blob/cebb113c8a8db3a27b3d728e00d8f0b2585e9157/reactmann-core/src/main/java/reactmann/subscribers/RiemannParser.java#L70-L82 | train | Handle the processing of a single record. | Create a Java method that does the following: "Handle the processing of a single record.". | Of course, here is the Java code you requested:
```java
public void handle(Buffer buffer) {
if (buff == null) {
buff = buffer;
} else {
buff.appendBuffer(buffer);
}
if(recordSize == -1) {
fixedSizeMode(buff.getInt(0) + 4);
}
handlePa... | |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForFragment | public boolean waitForFragment(String tag, int id, int timeout){
long endTime = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() <= endTime) {
if(getSupportFragment(tag, id) != null)
return true;
if(getFragment(tag, id) != null)
return true;
}
return false;
} | java | public boolean waitForFragment(String tag, int id, int timeout){
long endTime = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() <= endTime) {
if(getSupportFragment(tag, id) != null)
return true;
if(getFragment(tag, id) != null)
return true;
}
return false;
} | [
"public",
"boolean",
"waitForFragment",
"(",
"String",
"tag",
",",
"int",
"id",
",",
"int",
"timeout",
")",
"{",
"long",
"endTime",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
"+",
"timeout",
";",
"while",
"(",
"SystemClock",
".",
"uptimeMillis",
"(... | Waits for a Fragment with a given tag or id to appear.
@param tag the name of the tag or null if no tag
@param id the id of the tag
@param timeout the amount of time in milliseconds to wait
@return true if fragment appears and false if it does not appear before the timeout | [
"Waits",
"for",
"a",
"Fragment",
"with",
"a",
"given",
"tag",
"or",
"id",
"to",
"appear",
"."
] | 75e567c38f26a6a87dc8bef90b3886a20e28d291 | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L682-L693 | train | Waits until a fragment with the specified tag and id is found. | Create a Java method that does the following: "Waits until a fragment with the specified tag and id is found.". | Of course, here is the Java code you requested:
```java
public boolean waitForFragment(String tag, int id, int timeout){
long endTime = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() <= endTime) {
if(getSupportFragment(tag, id) != null)
return true;
if(getFragment(tag, id) != n... | |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.buildUpdate | private DeviceUpdate buildUpdate(DatagramPacket packet) {
final int length = packet.getLength();
final Util.PacketType kind = Util.validateHeader(packet, UPDATE_PORT);
if (kind == null) {
logger.warn("Ignoring unrecognized packet sent to update port.");
return null;
... | java | private DeviceUpdate buildUpdate(DatagramPacket packet) {
final int length = packet.getLength();
final Util.PacketType kind = Util.validateHeader(packet, UPDATE_PORT);
if (kind == null) {
logger.warn("Ignoring unrecognized packet sent to update port.");
return null;
... | [
"private",
"DeviceUpdate",
"buildUpdate",
"(",
"DatagramPacket",
"packet",
")",
"{",
"final",
"int",
"length",
"=",
"packet",
".",
"getLength",
"(",
")",
";",
"final",
"Util",
".",
"PacketType",
"kind",
"=",
"Util",
".",
"validateHeader",
"(",
"packet",
",",... | Given an update packet sent to us, create the appropriate object to describe it.
@param packet the packet received on our update port
@return the corresponding {@link DeviceUpdate} subclass, or {@code nil} if the packet was not recognizable | [
"Given",
"an",
"update",
"packet",
"sent",
"to",
"us",
"create",
"the",
"appropriate",
"object",
"to",
"describe",
"it",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L337-L384 | train | Build a DeviceUpdate object from a datagram packet. | Create a Java method that does the following: "Build a DeviceUpdate object from a datagram packet.". | Of course, here is the Java code you requested:
```java
private DeviceUpdate buildUpdate(DatagramPacket packet) {
final int length = packet.getLength();
final Util.PacketType kind = Util.validateHeader(packet, UPDATE_PORT);
if (kind == null) {
logger.warn("Ignoring unrecognized pac... | |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/SARLAgentLaunchConfigurationDelegate.java | SARLAgentLaunchConfigurationDelegate.getAgentName | protected String getAgentName(ILaunchConfiguration configuration) throws CoreException {
final String agentName = getConfigurationAccessor().getAgent(configuration);
if (agentName == null) {
return null;
}
return VariablesPlugin.getDefault().getStringVariableManager()
.performStringSubstitution(agentName... | java | protected String getAgentName(ILaunchConfiguration configuration) throws CoreException {
final String agentName = getConfigurationAccessor().getAgent(configuration);
if (agentName == null) {
return null;
}
return VariablesPlugin.getDefault().getStringVariableManager()
.performStringSubstitution(agentName... | [
"protected",
"String",
"getAgentName",
"(",
"ILaunchConfiguration",
"configuration",
")",
"throws",
"CoreException",
"{",
"final",
"String",
"agentName",
"=",
"getConfigurationAccessor",
"(",
")",
".",
"getAgent",
"(",
"configuration",
")",
";",
"if",
"(",
"agentNam... | Returns the main type name specified by the given launch configuration,
or <code>null</code> if none.
@param configuration launch configuration
@return the main type name specified by the given launch configuration,
or <code>null</code> if none
@throws CoreException if unable to retrieve the attribute | [
"Returns",
"the",
"main",
"type",
"name",
"specified",
"by",
"the",
"given",
"launch",
"configuration",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"none",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/SARLAgentLaunchConfigurationDelegate.java#L135-L142 | train | Get the name of the agent that is being used for the given configuration. | Create a Java method that does the following: "Get the name of the agent that is being used for the given configuration.". | Of course, here is the Java code you requested:
```java
protected String getAgentName(ILaunchConfiguration configuration) throws CoreException {
final String agentName = getConfigurationAccessor().getAgent(configuration);
if (agentName == null) {
return null;
}
return VariablesPlugin.getDefault().getStringV... | |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/path/FormMappingOption.java | FormMappingOption.getRequestParameterMapFilter | public OptionalThing<Function<Map<String, Object>, Map<String, Object>>> getRequestParameterMapFilter() {
return requestParameterMapFilter;
} | java | public OptionalThing<Function<Map<String, Object>, Map<String, Object>>> getRequestParameterMapFilter() {
return requestParameterMapFilter;
} | [
"public",
"OptionalThing",
"<",
"Function",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
">",
"getRequestParameterMapFilter",
"(",
")",
"{",
"return",
"requestParameterMapFilter",
";",
"}"
] | ------------- | [
"-------------"
] | 17b56dda8322e4c6d79043532c1dda917d6b60a8 | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/path/FormMappingOption.java#L189-L191 | train | Gets the request parameter map filter. | Create a Java method that does the following: "Gets the request parameter map filter.". | Of course, here is the Java code you requested:
```java
public OptionalThing<Function<Map<String, Object>, Map<String, Object>>> getRequestParameterMapFilter() {
return requestParameterMapFilter;
}
```
Hope this helps! | |
icode/ameba | src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java | CommonExprTransformer.transform | @Override
public Transformed<Val<Expression>> transform(String field, String operator,
Val<Expression>[] args,
EbeanExprInvoker invoker,
QueryExprMeta parent) {
... | java | @Override
public Transformed<Val<Expression>> transform(String field, String operator,
Val<Expression>[] args,
EbeanExprInvoker invoker,
QueryExprMeta parent) {
... | [
"@",
"Override",
"public",
"Transformed",
"<",
"Val",
"<",
"Expression",
">",
">",
"transform",
"(",
"String",
"field",
",",
"String",
"operator",
",",
"Val",
"<",
"Expression",
">",
"[",
"]",
"args",
",",
"EbeanExprInvoker",
"invoker",
",",
"QueryExprMeta",... | {@inheritDoc} | [
"{"
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java#L681-L875 | train | Override to override the default implementation of the transform method. | Create a Java method that does the following: "Override to override the default implementation of the transform method.". | Of course, here is the Java code you requested:
```java
@Override
public Transformed<Val<Expression>> transform(String field, String operator,
Val<Expression>[] args,
EbeanExprInvoker invoker,
... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java | BufferedValueModel.revert | public final void revert() {
if (isBuffering()) {
if (logger.isDebugEnabled()) {
logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'");
}
setValue(wrappedModel.getValue());
}
else {
... | java | public final void revert() {
if (isBuffering()) {
if (logger.isDebugEnabled()) {
logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'");
}
setValue(wrappedModel.getValue());
}
else {
... | [
"public",
"final",
"void",
"revert",
"(",
")",
"{",
"if",
"(",
"isBuffering",
"(",
")",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Reverting buffered value '\"",
"+",
"getValue",
"(",
")",
... | Reverts the value held by the value model back to the value held by the
wrapped value model. | [
"Reverts",
"the",
"value",
"held",
"by",
"the",
"value",
"model",
"back",
"to",
"the",
"value",
"held",
"by",
"the",
"wrapped",
"value",
"model",
"."
] | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/BufferedValueModel.java#L229-L241 | train | Revert the value of the attribute to the original value. | Create a Java method that does the following: "Revert the value of the attribute to the original value.". | Of course, here is the Java code you requested:
```java
public final void revert() {
if (isBuffering()) {
if (logger.isDebugEnabled()) {
logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'");
}
setValue(wrapp... | |
google/closure-templates | java/src/com/google/template/soy/tofu/internal/BaseTofu.java | BaseTofu.render | @Deprecated
@Override
public String render(
SoyTemplateInfo templateInfo, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle) {
return (new RendererImpl(this, templateInfo.getName()))
.setData(data)
.setMsgBundle(msgBundle)
.render();
} | java | @Deprecated
@Override
public String render(
SoyTemplateInfo templateInfo, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle) {
return (new RendererImpl(this, templateInfo.getName()))
.setData(data)
.setMsgBundle(msgBundle)
.render();
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"String",
"render",
"(",
"SoyTemplateInfo",
"templateInfo",
",",
"@",
"Nullable",
"SoyRecord",
"data",
",",
"@",
"Nullable",
"SoyMsgBundle",
"msgBundle",
")",
"{",
"return",
"(",
"new",
"RendererImpl",
"(",
"this",
... | Old render methods. | [
"Old",
"render",
"methods",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/tofu/internal/BaseTofu.java#L509-L517 | train | Renders a sequence of records. | Create a Java method that does the following: "Renders a sequence of records.". | Of course, here is the Java code you requested:
```java
@Deprecated
@Override
public String render(
SoyTemplateInfo templateInfo, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle) {
return (new RendererImpl(this, templateInfo.getName()))
.setData(data)
.setMsgBundle(msgBundle)
... | |
zrlio/disni | src/main/java/com/ibm/disni/verbs/IbvQP.java | IbvQP.postSend | public SVCPostSend postSend(List<IbvSendWR> wrList, List<IbvSendWR> badwrList) throws IOException {
return verbs.postSend(this, wrList, badwrList);
} | java | public SVCPostSend postSend(List<IbvSendWR> wrList, List<IbvSendWR> badwrList) throws IOException {
return verbs.postSend(this, wrList, badwrList);
} | [
"public",
"SVCPostSend",
"postSend",
"(",
"List",
"<",
"IbvSendWR",
">",
"wrList",
",",
"List",
"<",
"IbvSendWR",
">",
"badwrList",
")",
"throws",
"IOException",
"{",
"return",
"verbs",
".",
"postSend",
"(",
"this",
",",
"wrList",
",",
"badwrList",
")",
";... | ---------- oo-verbs | [
"----------",
"oo",
"-",
"verbs"
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/verbs/IbvQP.java#L171-L173 | train | Send a list of outgoing messages. | Create a Java method that does the following: "Send a list of outgoing messages.". | Of course, here is the Java code you requested:
```java
public SVCPostSend postSend(List<IbvSendWR> wrList, List<IbvSendWR> badwrList) throws IOException {
return verbs.postSend(this, wrList, badwrList);
}
```
Hope this helps! | |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java | ValueValidator.checkAndGet | public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) {
if (v.validate(value)) {
return value;
}
return defaultValue;
} | java | public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) {
if (v.validate(value)) {
return value;
}
return defaultValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkAndGet",
"(",
"T",
"value",
",",
"T",
"defaultValue",
",",
"Validator",
"<",
"T",
">",
"v",
")",
"{",
"if",
"(",
"v",
".",
"validate",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"return... | 对目标值进行校验,并根据校验结果取值
使用示例(校验目标值是否大于0, 如果小于 0 则取值为 1)
ValueValidator.checkAndGet(idleTime, 1, Validator.INTEGER_GT_ZERO_VALIDATOR)
@param value 校验值
@param defaultValue 校验失败默认值
@param v 校验器
@return 经Validator校验后的返回值,校验成功返回 value, 校验失败返回 defaultValue | [
"对目标值进行校验,并根据校验结果取值"
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java#L30-L36 | train | Check if the given value is valid and return the value. | Create a Java method that does the following: "Check if the given value is valid and return the value.". | Of course, here is the Java code you requested:
```java
public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) {
if (v.validate(value)) {
return value;
}
return defaultValue;
}
```
Hope this helps! | |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java | MealyFilter.retainTransitionsWithOutput | public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
Collection<? super O> outputs) {
return filterByOut... | java | public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
Collection<? super O> outputs) {
return filterByOut... | [
"public",
"static",
"<",
"I",
",",
"O",
">",
"CompactMealy",
"<",
"I",
",",
"O",
">",
"retainTransitionsWithOutput",
"(",
"MealyMachine",
"<",
"?",
",",
"I",
",",
"?",
",",
"O",
">",
"in",
",",
"Alphabet",
"<",
"I",
">",
"inputs",
",",
"Collection",
... | Returns a Mealy machine with all transitions removed that have an output not among the specified values. The
resulting Mealy machine will not contain any unreachable states.
@param in
the input Mealy machine
@param inputs
the input alphabet
@param outputs
the outputs to retain
@return a Mealy machine with all transit... | [
"Returns",
"a",
"Mealy",
"machine",
"with",
"all",
"transitions",
"removed",
"that",
"have",
"an",
"output",
"not",
"among",
"the",
"specified",
"values",
".",
"The",
"resulting",
"Mealy",
"machine",
"will",
"not",
"contain",
"any",
"unreachable",
"states",
".... | 8a462ec52f6eaab9f8996e344f2163a72cb8aa6e | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java#L138-L142 | train | Retains all transitions with outputs from the given Mealy machine. | Create a Java method that does the following: "Retains all transitions with outputs from the given Mealy machine.". | Of course, here is the Java code you requested:
```java
public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
Co... | |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/NetworkService.java | NetworkService.update | public OperationFuture<List<Network>> update(List<Network> networkList, UpdateNetworkConfig config) {
networkList.forEach(network -> update(network, config));
return new OperationFuture<>(networkList, new NoWaitingJobFuture());
} | java | public OperationFuture<List<Network>> update(List<Network> networkList, UpdateNetworkConfig config) {
networkList.forEach(network -> update(network, config));
return new OperationFuture<>(networkList, new NoWaitingJobFuture());
} | [
"public",
"OperationFuture",
"<",
"List",
"<",
"Network",
">",
">",
"update",
"(",
"List",
"<",
"Network",
">",
"networkList",
",",
"UpdateNetworkConfig",
"config",
")",
"{",
"networkList",
".",
"forEach",
"(",
"network",
"->",
"update",
"(",
"network",
",",... | Update the network
@param networkList network list
@param config update config
@return OperationFuture wrapper for network list | [
"Update",
"the",
"network"
] | c026322f077dea71b1acf9f2d665253d79d9bf85 | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/NetworkService.java#L129-L133 | train | Update a list of networks | Create a Java method that does the following: "Update a list of networks". | Of course, here is the Java code you requested:
```java
public OperationFuture<List<Network>> update(List<Network> networkList, UpdateNetworkConfig config) {
networkList.forEach(network -> update(network, config));
return new OperationFuture<>(networkList, new NoWaitingJobFuture());
}
```
Hope th... | |
nutzam/nutz | src/org/nutz/repo/org/objectweb/asm/ByteVector.java | ByteVector.putInt | public ByteVector putInt(final int i) {
int length = this.length;
if (length + 4 > data.length) {
enlarge(4);
}
byte[] data = this.data;
data[length++] = (byte) (i >>> 24);
data[length++] = (byte) (i >>> 16);
data[length++] = (byte) (i >>> 8);
... | java | public ByteVector putInt(final int i) {
int length = this.length;
if (length + 4 > data.length) {
enlarge(4);
}
byte[] data = this.data;
data[length++] = (byte) (i >>> 24);
data[length++] = (byte) (i >>> 16);
data[length++] = (byte) (i >>> 8);
... | [
"public",
"ByteVector",
"putInt",
"(",
"final",
"int",
"i",
")",
"{",
"int",
"length",
"=",
"this",
".",
"length",
";",
"if",
"(",
"length",
"+",
"4",
">",
"data",
".",
"length",
")",
"{",
"enlarge",
"(",
"4",
")",
";",
"}",
"byte",
"[",
"]",
"... | Puts an int into this byte vector. The byte vector is automatically
enlarged if necessary.
@param i
an int.
@return this byte vector. | [
"Puts",
"an",
"int",
"into",
"this",
"byte",
"vector",
".",
"The",
"byte",
"vector",
"is",
"automatically",
"enlarged",
"if",
"necessary",
"."
] | a38694d5cbda2692e7931ab093c168487a6a4bfe | https://github.com/nutzam/nutz/blob/a38694d5cbda2692e7931ab093c168487a6a4bfe/src/org/nutz/repo/org/objectweb/asm/ByteVector.java#L160-L172 | valid | Puts an int into the byte vector. | Create a Java method that does the following: "Puts an int into the byte vector.". | Of course, here is the Java code you requested:
```java
public ByteVector putInt(final int i) {
int length = this.length;
if (length + 4 > data.length) {
enlarge(4);
}
byte[] data = this.data;
data[length++] = (byte) (i >>> 24);
data[length++] = (byte) (i >>>... | |
nutzam/nutzboot | nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java | ElasticsearchUtil.isExistsIndex | public boolean isExistsIndex(String indexName) {
IndicesExistsResponse response =
getClient().admin().indices().exists(
new IndicesExistsRequest().indices(new String[]{indexName})).actionGet();
return response.isExists();
} | java | public boolean isExistsIndex(String indexName) {
IndicesExistsResponse response =
getClient().admin().indices().exists(
new IndicesExistsRequest().indices(new String[]{indexName})).actionGet();
return response.isExists();
} | [
"public",
"boolean",
"isExistsIndex",
"(",
"String",
"indexName",
")",
"{",
"IndicesExistsResponse",
"response",
"=",
"getClient",
"(",
")",
".",
"admin",
"(",
")",
".",
"indices",
"(",
")",
".",
"exists",
"(",
"new",
"IndicesExistsRequest",
"(",
")",
".",
... | 判断指定的索引是否存在
@param indexName 索引名
@return true/false | [
"判断指定的索引是否存在"
] | fd33fd4fdce058eab594f28e4d3202f997e3c66a | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java#L43-L48 | train | Checks if an index exists. | Create a Java method that does the following: "Checks if an index exists.". | Of course, here is the Java code you requested:
```java
public boolean isExistsIndex(String indexName) {
IndicesExistsResponse response =
getClient().admin().indices().exists(
new IndicesExistsRequest().indices(new String[]{indexName})).actionGet();
return respon... | |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.bindHelper | protected void bindHelper(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject, int bindMask)
throws IOException, GVRScriptException
{
for (GVRScriptBindingEntry entry : scriptBundle.file.binding) {
GVRAndroidResource rc;
if (entry.volumeType == null || entry.volu... | java | protected void bindHelper(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject, int bindMask)
throws IOException, GVRScriptException
{
for (GVRScriptBindingEntry entry : scriptBundle.file.binding) {
GVRAndroidResource rc;
if (entry.volumeType == null || entry.volu... | [
"protected",
"void",
"bindHelper",
"(",
"GVRScriptBundle",
"scriptBundle",
",",
"GVRSceneObject",
"rootSceneObject",
",",
"int",
"bindMask",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"for",
"(",
"GVRScriptBindingEntry",
"entry",
":",
"scriptBundle",
... | Helper function to bind script bundler to various targets | [
"Helper",
"function",
"to",
"bind",
"script",
"bundler",
"to",
"various",
"targets"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L339-L393 | train | Binds the script files to the scene objects in the GVRSceneObject. | Create a Java method that does the following: "Binds the script files to the scene objects in the GVRSceneObject.". | Of course, here is the Java code you requested:
```java
protected void bindHelper(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject, int bindMask)
throws IOException, GVRScriptException
{
for (GVRScriptBindingEntry entry : scriptBundle.file.binding) {
GVRAndroidResource r... | |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.objectEquals | public final static boolean objectEquals(Object a, Object b) {
return a == null ?
b == null ? true : false :
b == null ? false : a.equals(b);
} | java | public final static boolean objectEquals(Object a, Object b) {
return a == null ?
b == null ? true : false :
b == null ? false : a.equals(b);
} | [
"public",
"final",
"static",
"boolean",
"objectEquals",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"?",
"b",
"==",
"null",
"?",
"true",
":",
"false",
":",
"b",
"==",
"null",
"?",
"false",
":",
"a",
".",
"equals",... | Convenience utility. Does null checks on objects, then calls equals. | [
"Convenience",
"utility",
".",
"Does",
"null",
"checks",
"on",
"objects",
"then",
"calls",
"equals",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L191-L195 | train | Checks if two records are equal. | Create a Java method that does the following: "Checks if two records are equal.". | Of course, here is the Java code you requested:
```java
public final static boolean objectEquals(Object a, Object b) {
return a == null ?
b == null ? true : false :
b == null ? false : a.equals(b);
}
```
Hope this helps! | |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.ignoringFieldScopeForValues | public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | java | public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"ignoringFieldScopeForValues",
"(",
"FieldScope",
"fieldScope",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"ignoringFieldScope",
"(",
"checkNotNull",
"(",
"fieldScope",
",",
"\"fieldScope\"",
")",... | Excludes all specific field paths under the argument {@link FieldScope} from the comparison.
<p>This method is additive and has well-defined ordering semantics. If the invoking {@link
ProtoFluentAssertion} is already scoped to a {@link FieldScope} {@code X}, and this method is
invoked with {@link FieldScope} {@code Y}... | [
"Excludes",
"all",
"specific",
"field",
"paths",
"under",
"the",
"argument",
"{",
"@link",
"FieldScope",
"}",
"from",
"the",
"comparison",
"."
] | 60eceffd2e8c3297655d33ed87d965cf5af51108 | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L719-L721 | train | Fails if the map is ignoring the field scope for values. | Create a Java method that does the following: "Fails if the map is ignoring the field scope for values.". | Of course, here is the Java code you requested:
```java
public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
}
```
Hope this helps! | |
google/closure-compiler | src/com/google/javascript/jscomp/PolymerClassRewriter.java | PolymerClassRewriter.rewritePolymerClassDeclaration | void rewritePolymerClassDeclaration(
Node clazz, NodeTraversal traversal, final PolymerClassDefinition cls) {
if (cls.descriptor != null) {
addTypesToFunctions(cls.descriptor, cls.target.getQualifiedName(), cls.defType);
}
PolymerPassStaticUtils.switchDollarSignPropsToBrackets(
NodeUtil... | java | void rewritePolymerClassDeclaration(
Node clazz, NodeTraversal traversal, final PolymerClassDefinition cls) {
if (cls.descriptor != null) {
addTypesToFunctions(cls.descriptor, cls.target.getQualifiedName(), cls.defType);
}
PolymerPassStaticUtils.switchDollarSignPropsToBrackets(
NodeUtil... | [
"void",
"rewritePolymerClassDeclaration",
"(",
"Node",
"clazz",
",",
"NodeTraversal",
"traversal",
",",
"final",
"PolymerClassDefinition",
"cls",
")",
"{",
"if",
"(",
"cls",
".",
"descriptor",
"!=",
"null",
")",
"{",
"addTypesToFunctions",
"(",
"cls",
".",
"desc... | Rewrites a class which extends Polymer.Element to a set of declarations and assignments which
can be understood by the compiler.
@param clazz The class node
@param cls The extracted {@link PolymerClassDefinition} for the Polymer element created by this
call. | [
"Rewrites",
"a",
"class",
"which",
"extends",
"Polymer",
".",
"Element",
"to",
"a",
"set",
"of",
"declarations",
"and",
"assignments",
"which",
"can",
"be",
"understood",
"by",
"the",
"compiler",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L197-L297 | train | Rewrite a Polymer class declaration. | Create a Java method that does the following: "Rewrite a Polymer class declaration.". | Of course, here is the Java code you requested:
```java
void rewritePolymerClassDeclaration(
Node clazz, NodeTraversal traversal, final PolymerClassDefinition cls) {
if (cls.descriptor != null) {
addTypesToFunctions(cls.descriptor, cls.target.getQualifiedName(), cls.defType);
}
PolymerPassStat... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/collaborator/CollaboratorUtils.java | CollaboratorUtils.getUserRegistryRealm | public String getUserRegistryRealm(AtomicServiceReference<SecurityService> securityServiceRef) {
String realm = "defaultRealm";
try {
SecurityService securityService = securityServiceRef.getService();
UserRegistryService userRegistryService = securityService.getUserRegistryServic... | java | public String getUserRegistryRealm(AtomicServiceReference<SecurityService> securityServiceRef) {
String realm = "defaultRealm";
try {
SecurityService securityService = securityServiceRef.getService();
UserRegistryService userRegistryService = securityService.getUserRegistryServic... | [
"public",
"String",
"getUserRegistryRealm",
"(",
"AtomicServiceReference",
"<",
"SecurityService",
">",
"securityServiceRef",
")",
"{",
"String",
"realm",
"=",
"\"defaultRealm\"",
";",
"try",
"{",
"SecurityService",
"securityService",
"=",
"securityServiceRef",
".",
"ge... | Attempt to retrieve the registry realm for the configured registry.
<p>
It is possible that no registry is configured. If that is the case,
return the default realm name.
@return realm name. {@code null} is not returned. | [
"Attempt",
"to",
"retrieve",
"the",
"registry",
"realm",
"for",
"the",
"configured",
"registry",
".",
"<p",
">",
"It",
"is",
"possible",
"that",
"no",
"registry",
"is",
"configured",
".",
"If",
"that",
"is",
"the",
"case",
"return",
"the",
"default",
"real... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/collaborator/CollaboratorUtils.java#L171-L185 | train | Gets the realm from the UserRegistry service reference. | Create a Java method that does the following: "Gets the realm from the UserRegistry service reference.". | Of course, here is the Java code you requested:
```java
public String getUserRegistryRealm(AtomicServiceReference<SecurityService> securityServiceRef) {
String realm = "defaultRealm";
try {
SecurityService securityService = securityServiceRef.getService();
UserRegistryService us... | |
grpc/grpc-java | cronet/src/main/java/io/grpc/cronet/CronetChannelBuilder.java | CronetChannelBuilder.forAddress | public static CronetChannelBuilder forAddress(String host, int port, CronetEngine cronetEngine) {
Preconditions.checkNotNull(cronetEngine, "cronetEngine");
return new CronetChannelBuilder(host, port, cronetEngine);
} | java | public static CronetChannelBuilder forAddress(String host, int port, CronetEngine cronetEngine) {
Preconditions.checkNotNull(cronetEngine, "cronetEngine");
return new CronetChannelBuilder(host, port, cronetEngine);
} | [
"public",
"static",
"CronetChannelBuilder",
"forAddress",
"(",
"String",
"host",
",",
"int",
"port",
",",
"CronetEngine",
"cronetEngine",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"cronetEngine",
",",
"\"cronetEngine\"",
")",
";",
"return",
"new",
"Cron... | Creates a new builder for the given server host, port and CronetEngine. | [
"Creates",
"a",
"new",
"builder",
"for",
"the",
"given",
"server",
"host",
"port",
"and",
"CronetEngine",
"."
] | 973885457f9609de232d2553b82c67f6c3ff57bf | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/cronet/src/main/java/io/grpc/cronet/CronetChannelBuilder.java#L56-L59 | train | Create a new CronetChannelBuilder for the given host and port. | Create a Java method that does the following: "Create a new CronetChannelBuilder for the given host and port.". | Of course, here is the Java code you requested:
```java
public static CronetChannelBuilder forAddress(String host, int port, CronetEngine cronetEngine) {
Preconditions.checkNotNull(cronetEngine, "cronetEngine");
return new CronetChannelBuilder(host, port, cronetEngine);
}
```
Hope this helps! | |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java | ThriftRangeUtils.tokenAsString | @SuppressWarnings("unchecked")
public String tokenAsString(Comparable tokenAsComparable) {
ByteBuffer bb = tokenType.decompose(tokenAsComparable);
Token token = tokenFactory.fromByteArray(bb);
return tokenFactory.toString(token);
} | java | @SuppressWarnings("unchecked")
public String tokenAsString(Comparable tokenAsComparable) {
ByteBuffer bb = tokenType.decompose(tokenAsComparable);
Token token = tokenFactory.fromByteArray(bb);
return tokenFactory.toString(token);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"tokenAsString",
"(",
"Comparable",
"tokenAsComparable",
")",
"{",
"ByteBuffer",
"bb",
"=",
"tokenType",
".",
"decompose",
"(",
"tokenAsComparable",
")",
";",
"Token",
"token",
"=",
"tokenFact... | Returns the specified token as a {@link java.lang.String}.
@param tokenAsComparable a token represented as a {@link java.lang.Comparable}.
@return the specified token as a {@link java.lang.String}. | [
"Returns",
"the",
"specified",
"token",
"as",
"a",
"{",
"@link",
"java",
".",
"lang",
".",
"String",
"}",
"."
] | b9621c9b7a6d996f80fce1d073d696a157bed095 | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java#L225-L230 | train | Returns the token as a string. | Create a Java method that does the following: "Returns the token as a string.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public String tokenAsString(Comparable tokenAsComparable) {
ByteBuffer bb = tokenType.decompose(tokenAsComparable);
Token token = tokenFactory.fromByteArray(bb);
return tokenFactory.toString(token);
}... | |
wstrange/GoogleAuth | src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java | GoogleAuthenticator.checkCode | private boolean checkCode(
String secret,
long code,
long timestamp,
int window)
{
byte[] decodedKey = decodeSecret(secret);
// convert unix time into a 30 second "window" as specified by the
// TOTP specification. Using Google's default inter... | java | private boolean checkCode(
String secret,
long code,
long timestamp,
int window)
{
byte[] decodedKey = decodeSecret(secret);
// convert unix time into a 30 second "window" as specified by the
// TOTP specification. Using Google's default inter... | [
"private",
"boolean",
"checkCode",
"(",
"String",
"secret",
",",
"long",
"code",
",",
"long",
"timestamp",
",",
"int",
"window",
")",
"{",
"byte",
"[",
"]",
"decodedKey",
"=",
"decodeSecret",
"(",
"secret",
")",
";",
"// convert unix time into a 30 second \"wind... | This method implements the algorithm specified in RFC 6238 to check if a
validation code is valid in a given instant of time for the given secret
key.
@param secret the Base32 encoded secret key.
@param code the code to validate.
@param timestamp the instant of time to use during the validation process.
@param... | [
"This",
"method",
"implements",
"the",
"algorithm",
"specified",
"in",
"RFC",
"6238",
"to",
"check",
"if",
"a",
"validation",
"code",
"is",
"valid",
"in",
"a",
"given",
"instant",
"of",
"time",
"for",
"the",
"given",
"secret",
"key",
"."
] | 03f37333f8b3e411e10e63a7c85c4d2155929321 | https://github.com/wstrange/GoogleAuth/blob/03f37333f8b3e411e10e63a7c85c4d2155929321/src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java#L289-L319 | train | Check the verification code of a secret key. | Create a Java method that does the following: "Check the verification code of a secret key.". | Of course, here is the Java code you requested:
```java
private boolean checkCode(
String secret,
long code,
long timestamp,
int window)
{
byte[] decodedKey = decodeSecret(secret);
// convert unix time into a 30 second "window" as specified by the
... | |
VoltDB/voltdb | src/frontend/org/voltdb/TheHashinator.java | TheHashinator.getPartitionKeys | public static VoltTable getPartitionKeys(TheHashinator hashinator, VoltType type) {
// get partitionKeys response table so we can copy it
final VoltTable partitionKeys;
switch (type) {
case INTEGER:
partitionKeys = hashinator.m_integerPartitionKeys.get();
... | java | public static VoltTable getPartitionKeys(TheHashinator hashinator, VoltType type) {
// get partitionKeys response table so we can copy it
final VoltTable partitionKeys;
switch (type) {
case INTEGER:
partitionKeys = hashinator.m_integerPartitionKeys.get();
... | [
"public",
"static",
"VoltTable",
"getPartitionKeys",
"(",
"TheHashinator",
"hashinator",
",",
"VoltType",
"type",
")",
"{",
"// get partitionKeys response table so we can copy it",
"final",
"VoltTable",
"partitionKeys",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"INT... | Get a VoltTable containing the partition keys for each partition that can be found for the given hashinator.
May be missing some partitions during elastic rebalance when the partitions don't own
enough of the ring to be probed
If the type is not supported returns null
@param hashinator a particular hashinator to get p... | [
"Get",
"a",
"VoltTable",
"containing",
"the",
"partition",
"keys",
"for",
"each",
"partition",
"that",
"can",
"be",
"found",
"for",
"the",
"given",
"hashinator",
".",
"May",
"be",
"missing",
"some",
"partitions",
"during",
"elastic",
"rebalance",
"when",
"the"... | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/TheHashinator.java#L529-L551 | train | Get the partitionKeys response table for the given type. | Create a Java method that does the following: "Get the partitionKeys response table for the given type.". | Of course, here is the Java code you requested:
```java
public static VoltTable getPartitionKeys(TheHashinator hashinator, VoltType type) {
// get partitionKeys response table so we can copy it
final VoltTable partitionKeys;
switch (type) {
case INTEGER:
partitionKe... | |
liferay/com-liferay-commerce | commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceAddressUtil.java | CommerceAddressUtil.findByCommerceRegionId | public static List<CommerceAddress> findByCommerceRegionId(
long commerceRegionId, int start, int end) {
return getPersistence()
.findByCommerceRegionId(commerceRegionId, start, end);
} | java | public static List<CommerceAddress> findByCommerceRegionId(
long commerceRegionId, int start, int end) {
return getPersistence()
.findByCommerceRegionId(commerceRegionId, start, end);
} | [
"public",
"static",
"List",
"<",
"CommerceAddress",
">",
"findByCommerceRegionId",
"(",
"long",
"commerceRegionId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"getPersistence",
"(",
")",
".",
"findByCommerceRegionId",
"(",
"commerceRegionId",
",",... | Returns a range of all the commerce addresses where commerceRegionId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in... | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"addresses",
"where",
"commerceRegionId",
"=",
"?",
";",
"."
] | 9e54362d7f59531fc684016ba49ee7cdc3a2f22b | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceAddressUtil.java#L138-L142 | train | Returns a range of commerce addresses where commerceRegionId = ? ; and start < = end. | Create a Java method that does the following: "Returns a range of commerce addresses where commerceRegionId = ? ; and start < = end.". | Of course, here is the Java code you requested:
```java
public static List<CommerceAddress> findByCommerceRegionId(
long commerceRegionId, int start, int end) {
return getPersistence()
.findByCommerceRegionId(commerceRegionId, start, end);
}
```
Hope this helps! | |
aseovic/coherence-tools | core/src/main/java/com/seovic/core/updater/ExpressionUpdater.java | ExpressionUpdater.update | public void update(Object target, Object value) {
if (target == null) {
throw new IllegalArgumentException("Updater target cannot be null");
}
expression.evaluateAndSet(target, value);
} | java | public void update(Object target, Object value) {
if (target == null) {
throw new IllegalArgumentException("Updater target cannot be null");
}
expression.evaluateAndSet(target, value);
} | [
"public",
"void",
"update",
"(",
"Object",
"target",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Updater target cannot be null\"",
")",
";",
"}",
"expression",
".",
"evaluat... | {@inheritDoc} | [
"{"
] | 561a1d7e572ad98657fcd26beb1164891b0cd6fe | https://github.com/aseovic/coherence-tools/blob/561a1d7e572ad98657fcd26beb1164891b0cd6fe/core/src/main/java/com/seovic/core/updater/ExpressionUpdater.java#L81-L86 | train | Update the value of the calendar attribute. | Create a Java method that does the following: "Update the value of the calendar attribute.". | Of course, here is the Java code you requested:
```java
public void update(Object target, Object value) {
if (target == null) {
throw new IllegalArgumentException("Updater target cannot be null");
}
expression.evaluateAndSet(target, value);
}
```
Hope this helps! | |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java | ComponentExposedTypeGenerator.addFieldsForComputedMethod | private void addFieldsForComputedMethod(TypeElement component, Set<String> alreadyDone) {
getMethodsWithAnnotation(component, Computed.class).forEach(method -> {
String propertyName = computedPropertyNameToFieldName(getComputedPropertyName(method));
if (alreadyDone.contains(propertyName)) {
ret... | java | private void addFieldsForComputedMethod(TypeElement component, Set<String> alreadyDone) {
getMethodsWithAnnotation(component, Computed.class).forEach(method -> {
String propertyName = computedPropertyNameToFieldName(getComputedPropertyName(method));
if (alreadyDone.contains(propertyName)) {
ret... | [
"private",
"void",
"addFieldsForComputedMethod",
"(",
"TypeElement",
"component",
",",
"Set",
"<",
"String",
">",
"alreadyDone",
")",
"{",
"getMethodsWithAnnotation",
"(",
"component",
",",
"Computed",
".",
"class",
")",
".",
"forEach",
"(",
"method",
"->",
"{",... | Add fields for computed methods so they are visible in the template
@param component Component we are currently processing
@param alreadyDone Already processed computed properties (in case there is a getter and a | [
"Add",
"fields",
"for",
"computed",
"methods",
"so",
"they",
"are",
"visible",
"in",
"the",
"template"
] | 961cd83aed6fe8e2dd80c279847f1b3f62918a1f | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L415-L436 | train | Add fields for computed methods. | Create a Java method that does the following: "Add fields for computed methods.". | Of course, here is the Java code you requested:
```java
private void addFieldsForComputedMethod(TypeElement component, Set<String> alreadyDone) {
getMethodsWithAnnotation(component, Computed.class).forEach(method -> {
String propertyName = computedPropertyNameToFieldName(getComputedPropertyName(method));
... | |
hawtio/hawtio | hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java | IdeFacade.findClassAbsoluteFileName | @Override
public String findClassAbsoluteFileName(String fileName, String className, List<String> sourceRoots) {
// usually the fileName is just the name of the file without any package information
// so lets turn the package name into a path
int lastIdx = className.lastIndexOf('.');
... | java | @Override
public String findClassAbsoluteFileName(String fileName, String className, List<String> sourceRoots) {
// usually the fileName is just the name of the file without any package information
// so lets turn the package name into a path
int lastIdx = className.lastIndexOf('.');
... | [
"@",
"Override",
"public",
"String",
"findClassAbsoluteFileName",
"(",
"String",
"fileName",
",",
"String",
"className",
",",
"List",
"<",
"String",
">",
"sourceRoots",
")",
"{",
"// usually the fileName is just the name of the file without any package information",
"// so le... | Given a class name and a file name, try to find the absolute file name of the
source file on the users machine or null if it cannot be found | [
"Given",
"a",
"class",
"name",
"and",
"a",
"file",
"name",
"try",
"to",
"find",
"the",
"absolute",
"file",
"name",
"of",
"the",
"source",
"file",
"on",
"the",
"users",
"machine",
"or",
"null",
"if",
"it",
"cannot",
"be",
"found"
] | d8b1c8f246307c0313ba297a494106d0859f3ffd | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java#L63-L81 | train | Find the absolute file name of a class. | Create a Java method that does the following: "Find the absolute file name of a class.". | Of course, here is the Java code you requested:
```java
@Override
public String findClassAbsoluteFileName(String fileName, String className, List<String> sourceRoots) {
// usually the fileName is just the name of the file without any package information
// so lets turn the package name into a path
... | |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java | AbsAAFLur.fish | public boolean fish(String bait, Permission pond) {
if(isDebug(bait)) {
boolean rv = false;
StringBuilder sb = new StringBuilder("Log for ");
sb.append(bait);
if(supports(bait)) {
User<PERM> user = getUser(bait);
if(user==null) {
sb.append("\n\tUser is not in Cache");
} else {
if(use... | java | public boolean fish(String bait, Permission pond) {
if(isDebug(bait)) {
boolean rv = false;
StringBuilder sb = new StringBuilder("Log for ");
sb.append(bait);
if(supports(bait)) {
User<PERM> user = getUser(bait);
if(user==null) {
sb.append("\n\tUser is not in Cache");
} else {
if(use... | [
"public",
"boolean",
"fish",
"(",
"String",
"bait",
",",
"Permission",
"pond",
")",
"{",
"if",
"(",
"isDebug",
"(",
"bait",
")",
")",
"{",
"boolean",
"rv",
"=",
"false",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"Log for \"",
")",
... | This is where you build AAF CLient Code. Answer the question "Is principal "bait" in the "pond" | [
"This",
"is",
"where",
"you",
"build",
"AAF",
"CLient",
"Code",
".",
"Answer",
"the",
"question",
"Is",
"principal",
"bait",
"in",
"the",
"pond"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java#L76-L134 | train | Fish a bait and pond | Create a Java method that does the following: "Fish a bait and pond". | Of course, here is the Java code you requested:
```java
public boolean fish(String bait, Permission pond) {
if(isDebug(bait)) {
boolean rv = false;
StringBuilder sb = new StringBuilder("Log for ");
sb.append(bait);
if(supports(bait)) {
User<PERM> user = getUser(bait);
if(user==null) {
sb.app... | |
workplacesystems/utilsj | src/main/java/com/workplacesystems/utilsj/collections/decorators/SynchronizedFilterableCollection.java | SynchronizedFilterableCollection.decorate | public static <E> FilterableCollection<E> decorate(FilterableCollection<E> collection) {
return new SynchronizedFilterableCollection<E>(collection);
} | java | public static <E> FilterableCollection<E> decorate(FilterableCollection<E> collection) {
return new SynchronizedFilterableCollection<E>(collection);
} | [
"public",
"static",
"<",
"E",
">",
"FilterableCollection",
"<",
"E",
">",
"decorate",
"(",
"FilterableCollection",
"<",
"E",
">",
"collection",
")",
"{",
"return",
"new",
"SynchronizedFilterableCollection",
"<",
"E",
">",
"(",
"collection",
")",
";",
"}"
] | Factory method to create a synchronized map.
@param map the map to decorate, must not be null
@throws IllegalArgumentException if map is null | [
"Factory",
"method",
"to",
"create",
"a",
"synchronized",
"map",
"."
] | 1b638be51997eafac4d368c14f62a16624a08d3e | https://github.com/workplacesystems/utilsj/blob/1b638be51997eafac4d368c14f62a16624a08d3e/src/main/java/com/workplacesystems/utilsj/collections/decorators/SynchronizedFilterableCollection.java#L35-L37 | test | Decorate a filterable collection with a SynchronizedFilterableCollection. | Create a Java method that does the following: "Decorate a filterable collection with a SynchronizedFilterableCollection.". | Of course, here is the Java code you requested:
```java
public static <E> FilterableCollection<E> decorate(FilterableCollection<E> collection) {
return new SynchronizedFilterableCollection<E>(collection);
}
```
Hope this helps! | |
RestComm/jain-slee | container/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java | ServiceManagementImpl.uninstallService | public void uninstallService(final ServiceComponent serviceComponent)
throws SystemException, UnrecognizedServiceException,
InstanceNotFoundException, MBeanRegistrationException,
NullPointerException, UnrecognizedResourceAdaptorEntityException,
ManagementException, InvalidStateException {
if (logger.isDe... | java | public void uninstallService(final ServiceComponent serviceComponent)
throws SystemException, UnrecognizedServiceException,
InstanceNotFoundException, MBeanRegistrationException,
NullPointerException, UnrecognizedResourceAdaptorEntityException,
ManagementException, InvalidStateException {
if (logger.isDe... | [
"public",
"void",
"uninstallService",
"(",
"final",
"ServiceComponent",
"serviceComponent",
")",
"throws",
"SystemException",
",",
"UnrecognizedServiceException",
",",
"InstanceNotFoundException",
",",
"MBeanRegistrationException",
",",
"NullPointerException",
",",
"Unrecognize... | uninstall a service.
@throws SystemException
@throws UnrecognizedServiceException
@throws MBeanRegistrationException
@throws InstanceNotFoundException
@throws UnrecognizedResourceAdaptorEntityException
@throws NullPointerException
@throws InvalidStateException | [
"uninstall",
"a",
"service",
"."
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java#L713-L808 | test | Uninstalls a service | Create a Java method that does the following: "Uninstalls a service". | Of course, here is the Java code you requested:
```java
public void uninstallService(final ServiceComponent serviceComponent)
throws SystemException, UnrecognizedServiceException,
InstanceNotFoundException, MBeanRegistrationException,
NullPointerException, UnrecognizedResourceAdaptorEntityException,
Manage... | |
kkopacz/agiso-core | bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java | BeanUtils.checkBeanFactory | private static void checkBeanFactory(long waitTime, String bean) {
if(beanFactory != null) {
return;
}
// Jeśli czas oczekiwania jest określony, to wstrzymujemy bieżący wątek
// do momentu ustawienia fabryki bean'ów. Dla ujemnej wartości czasu
// oczekiwania - do skutku. Jeśli wartość jest dodatnia - aż u... | java | private static void checkBeanFactory(long waitTime, String bean) {
if(beanFactory != null) {
return;
}
// Jeśli czas oczekiwania jest określony, to wstrzymujemy bieżący wątek
// do momentu ustawienia fabryki bean'ów. Dla ujemnej wartości czasu
// oczekiwania - do skutku. Jeśli wartość jest dodatnia - aż u... | [
"private",
"static",
"void",
"checkBeanFactory",
"(",
"long",
"waitTime",
",",
"String",
"bean",
")",
"{",
"if",
"(",
"beanFactory",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"// Jeśli czas oczekiwania jest określony, to wstrzymujemy bieżący wątek",
"// do momentu ust... | -------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------"
] | b994ec0146be1fe3f10829d69cd719bdbdebe1c5 | https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java#L156-L179 | train | check bean factory | Create a Java method that does the following: "check bean factory". | Of course, here is the Java code you requested:
```java
private static void checkBeanFactory(long waitTime, String bean) {
if(beanFactory != null) {
return;
}
// Jeśli czas oczekiwania jest określony, to wstrzymujemy bieżący wątek
// do momentu ustawienia fabryki bean'ów. Dla ujemnej wartości czasu
// oc... | |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java | BasicBondGenerator.getParameters | @Override
public List<IGeneratorParameter<?>> getParameters() {
return Arrays.asList(new IGeneratorParameter<?>[]{bondWidth, defaultBondColor, wedgeWidth, bondDistance,
ringCenterProportion});
} | java | @Override
public List<IGeneratorParameter<?>> getParameters() {
return Arrays.asList(new IGeneratorParameter<?>[]{bondWidth, defaultBondColor, wedgeWidth, bondDistance,
ringCenterProportion});
} | [
"@",
"Override",
"public",
"List",
"<",
"IGeneratorParameter",
"<",
"?",
">",
">",
"getParameters",
"(",
")",
"{",
"return",
"Arrays",
".",
"asList",
"(",
"new",
"IGeneratorParameter",
"<",
"?",
">",
"[",
"]",
"{",
"bondWidth",
",",
"defaultBondColor",
","... | {@inheritDoc} | [
"{"
] | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L511-L515 | train | Returns the parameters of the
. | Create a Java method that does the following: "Returns the parameters of the
.". | Of course, here is the Java code you requested:
```java
@Override
public List<IGeneratorParameter<?>> getParameters() {
return Arrays.asList(new IGeneratorParameter<?>[]{bondWidth, defaultBondColor, wedgeWidth, bondDistance,
ringCenterProportion});
}
```
Hope this helps! | |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/IECssBundleGenerator.java | IECssBundleGenerator.getVariantKey | private String getVariantKey(String contextPath) {
// Remove first slash
String resultPath = contextPath.substring(1);
String variantKey = "";
// eval the existence of a suffix
String prefix = resultPath.substring(0, resultPath.indexOf(JawrConstant.URL_SEPARATOR));
// The prefix also contains variant info... | java | private String getVariantKey(String contextPath) {
// Remove first slash
String resultPath = contextPath.substring(1);
String variantKey = "";
// eval the existence of a suffix
String prefix = resultPath.substring(0, resultPath.indexOf(JawrConstant.URL_SEPARATOR));
// The prefix also contains variant info... | [
"private",
"String",
"getVariantKey",
"(",
"String",
"contextPath",
")",
"{",
"// Remove first slash",
"String",
"resultPath",
"=",
"contextPath",
".",
"substring",
"(",
"1",
")",
";",
"String",
"variantKey",
"=",
"\"\"",
";",
"// eval the existence of a suffix",
"S... | Returns the variant key from the context path.
@param contextPath
the path
@return the variant key | [
"Returns",
"the",
"variant",
"key",
"from",
"the",
"context",
"path",
"."
] | 5381f6acf461cd2502593c67a77bd6ef9eab848d | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/IECssBundleGenerator.java#L250-L264 | train | Get the variant key from the context path | Create a Java method that does the following: "Get the variant key from the context path". | Of course, here is the Java code you requested:
```java
private String getVariantKey(String contextPath) {
// Remove first slash
String resultPath = contextPath.substring(1);
String variantKey = "";
// eval the existence of a suffix
String prefix = resultPath.substring(0, resultPath.indexOf(JawrConstant.URL... | |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java | EngineeringObjectEnhancer.enhanceCommitUpdates | private void enhanceCommitUpdates(EKBCommit commit) throws EKBException {
Map<Object, AdvancedModelWrapper> updated = new HashMap<Object, AdvancedModelWrapper>();
List<AdvancedModelWrapper> result = recursiveUpdateEnhancement(
convertOpenEngSBModelList(commit.getUpdates()), updated, commit);... | java | private void enhanceCommitUpdates(EKBCommit commit) throws EKBException {
Map<Object, AdvancedModelWrapper> updated = new HashMap<Object, AdvancedModelWrapper>();
List<AdvancedModelWrapper> result = recursiveUpdateEnhancement(
convertOpenEngSBModelList(commit.getUpdates()), updated, commit);... | [
"private",
"void",
"enhanceCommitUpdates",
"(",
"EKBCommit",
"commit",
")",
"throws",
"EKBException",
"{",
"Map",
"<",
"Object",
",",
"AdvancedModelWrapper",
">",
"updated",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"AdvancedModelWrapper",
">",
"(",
")",
";",
... | Enhances the EKBCommit for the updates of EngineeringObjects. | [
"Enhances",
"the",
"EKBCommit",
"for",
"the",
"updates",
"of",
"EngineeringObjects",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java#L96-L101 | train | Enhances the EKBCommit updates. | Create a Java method that does the following: "Enhances the EKBCommit updates.". | Of course, here is the Java code you requested:
```java
private void enhanceCommitUpdates(EKBCommit commit) throws EKBException {
Map<Object, AdvancedModelWrapper> updated = new HashMap<Object, AdvancedModelWrapper>();
List<AdvancedModelWrapper> result = recursiveUpdateEnhancement(
convertO... | |
softindex/datakernel | core-http/src/main/java/io/datakernel/http/AsyncHttpClient.java | AsyncHttpClient.request | @Override
public Promise<HttpResponse> request(HttpRequest request) {
assert eventloop.inEventloopThread();
if (inspector != null) inspector.onRequest(request);
String host = request.getUrl().getHost();
assert host != null;
return asyncDnsClient.resolve4(host)
.thenEx((dnsResponse, e) -> {
if (e =... | java | @Override
public Promise<HttpResponse> request(HttpRequest request) {
assert eventloop.inEventloopThread();
if (inspector != null) inspector.onRequest(request);
String host = request.getUrl().getHost();
assert host != null;
return asyncDnsClient.resolve4(host)
.thenEx((dnsResponse, e) -> {
if (e =... | [
"@",
"Override",
"public",
"Promise",
"<",
"HttpResponse",
">",
"request",
"(",
"HttpRequest",
"request",
")",
"{",
"assert",
"eventloop",
".",
"inEventloopThread",
"(",
")",
";",
"if",
"(",
"inspector",
"!=",
"null",
")",
"inspector",
".",
"onRequest",
"(",... | Sends the request to server, waits the result timeout and handles result with callback
@param request request for server | [
"Sends",
"the",
"request",
"to",
"server",
"waits",
"the",
"result",
"timeout",
"and",
"handles",
"result",
"with",
"callback"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-http/src/main/java/io/datakernel/http/AsyncHttpClient.java#L333-L357 | train | A request method that resolves a DNS query. | Create a Java method that does the following: "A request method that resolves a DNS query.". | Of course, here is the Java code you requested:
```java
@Override
public Promise<HttpResponse> request(HttpRequest request) {
assert eventloop.inEventloopThread();
if (inspector != null) inspector.onRequest(request);
String host = request.getUrl().getHost();
assert host != null;
return asyncDnsClient.reso... | |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java | SM2.setMode | public SM2 setMode(SM2Mode mode) {
this.mode = mode;
if (null != this.engine) {
this.engine.setMode(mode);
}
return this;
} | java | public SM2 setMode(SM2Mode mode) {
this.mode = mode;
if (null != this.engine) {
this.engine.setMode(mode);
}
return this;
} | [
"public",
"SM2",
"setMode",
"(",
"SM2Mode",
"mode",
")",
"{",
"this",
".",
"mode",
"=",
"mode",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"engine",
")",
"{",
"this",
".",
"engine",
".",
"setMode",
"(",
"mode",
")",
";",
"}",
"return",
"this",
";... | 设置加密类型
@param mode {@link SM2Mode}
@return this | [
"设置加密类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L243-L249 | train | Sets the mode of the SM2 object. | Create a Java method that does the following: "Sets the mode of the SM2 object.". | Of course, here is the Java code you requested:
```java
public SM2 setMode(SM2Mode mode) {
this.mode = mode;
if (null != this.engine) {
this.engine.setMode(mode);
}
return this;
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/AmazonRoute53Client.java | AmazonRoute53Client.createVPCAssociationAuthorization | @Override
public CreateVPCAssociationAuthorizationResult createVPCAssociationAuthorization(CreateVPCAssociationAuthorizationRequest request) {
request = beforeClientExecution(request);
return executeCreateVPCAssociationAuthorization(request);
} | java | @Override
public CreateVPCAssociationAuthorizationResult createVPCAssociationAuthorization(CreateVPCAssociationAuthorizationRequest request) {
request = beforeClientExecution(request);
return executeCreateVPCAssociationAuthorization(request);
} | [
"@",
"Override",
"public",
"CreateVPCAssociationAuthorizationResult",
"createVPCAssociationAuthorization",
"(",
"CreateVPCAssociationAuthorizationRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeCreateVPCAssociati... | <p>
Authorizes the AWS account that created a specified VPC to submit an <code>AssociateVPCWithHostedZone</code>
request to associate the VPC with a specified hosted zone that was created by a different account. To submit a
<code>CreateVPCAssociationAuthorization</code> request, you must use the account that created th... | [
"<p",
">",
"Authorizes",
"the",
"AWS",
"account",
"that",
"created",
"a",
"specified",
"VPC",
"to",
"submit",
"an",
"<code",
">",
"AssociateVPCWithHostedZone<",
"/",
"code",
">",
"request",
"to",
"associate",
"the",
"VPC",
"with",
"a",
"specified",
"hosted",
... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/AmazonRoute53Client.java#L1655-L1659 | train | Creates a VPC association authorization. | Create a Java method that does the following: "Creates a VPC association authorization.". | Of course, here is the Java code you requested:
```java
@Override
public CreateVPCAssociationAuthorizationResult createVPCAssociationAuthorization(CreateVPCAssociationAuthorizationRequest request) {
request = beforeClientExecution(request);
return executeCreateVPCAssociationAuthorization(request);
... | |
linkedin/parseq | subprojects/parseq/src/main/java/com/linkedin/parseq/promise/Promises.java | Promises.value | @SuppressWarnings("unchecked")
public static <T> Promise<T> value(final T value) {
if (value == null) {
if (VOID == null) {
return new ResolvedValue<T>(value);
} else {
return (Promise<T>) VOID;
}
}
return new ResolvedValue<T>(value);
} | java | @SuppressWarnings("unchecked")
public static <T> Promise<T> value(final T value) {
if (value == null) {
if (VOID == null) {
return new ResolvedValue<T>(value);
} else {
return (Promise<T>) VOID;
}
}
return new ResolvedValue<T>(value);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Promise",
"<",
"T",
">",
"value",
"(",
"final",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"VOID",
"==",
"null",
")",
"{",
... | Creates a new promise that is already resolved with the given value.
@param value the value for the new promise
@param <T> the type of the value for the promise
@return the promise | [
"Creates",
"a",
"new",
"promise",
"that",
"is",
"already",
"resolved",
"with",
"the",
"given",
"value",
"."
] | 35b194c2837ad45c36e80c2333c5feeb561ca24e | https://github.com/linkedin/parseq/blob/35b194c2837ad45c36e80c2333c5feeb561ca24e/subprojects/parseq/src/main/java/com/linkedin/parseq/promise/Promises.java#L44-L54 | valid | Returns a resolved value for the given value. | Create a Java method that does the following: "Returns a resolved value for the given value.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> Promise<T> value(final T value) {
if (value == null) {
if (VOID == null) {
return new ResolvedValue<T>(value);
} else {
return (Promise<T>) VOID;
}
}
return new Resol... | |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/SearchUrl.java | SearchUrl.deleteSearchTuningRuleUrl | public static MozuUrl deleteSearchTuningRuleUrl(String searchTuningRuleCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}");
formatter.formatUrl("searchTuningRuleCode", searchTuningRuleCode);
return new MozuUrl(formatter.getResourceU... | java | public static MozuUrl deleteSearchTuningRuleUrl(String searchTuningRuleCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}");
formatter.formatUrl("searchTuningRuleCode", searchTuningRuleCode);
return new MozuUrl(formatter.getResourceU... | [
"public",
"static",
"MozuUrl",
"deleteSearchTuningRuleUrl",
"(",
"String",
"searchTuningRuleCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}\"",
")",
";",
"formatter",
"... | Get Resource Url for DeleteSearchTuningRule
@param searchTuningRuleCode The unique identifier of the search tuning rule.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteSearchTuningRule"
] | 5beadde73601a859f845e3e2fc1077b39c8bea83 | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/SearchUrl.java#L217-L222 | train | Get Resource Url for DeleteSearchTuningRule | Create a Java method that does the following: "Get Resource Url for DeleteSearchTuningRule". | Of course, here is the Java code you requested:
```java
public static MozuUrl deleteSearchTuningRuleUrl(String searchTuningRuleCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}");
formatter.formatUrl("searchTuningRuleCode", searchTuni... | |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java | CodeJamSession.createSession | public static CodeJamSession createSession(final HttpRequestExecutor executor, final Round round) throws IOException {
final ContestInfo info = ContestInfo.get(executor, round);
final InitialValues values = InitialValues.get(executor, round);
return new CodeJamSession(executor, round, info, values);
} | java | public static CodeJamSession createSession(final HttpRequestExecutor executor, final Round round) throws IOException {
final ContestInfo info = ContestInfo.get(executor, round);
final InitialValues values = InitialValues.get(executor, round);
return new CodeJamSession(executor, round, info, values);
} | [
"public",
"static",
"CodeJamSession",
"createSession",
"(",
"final",
"HttpRequestExecutor",
"executor",
",",
"final",
"Round",
"round",
")",
"throws",
"IOException",
"{",
"final",
"ContestInfo",
"info",
"=",
"ContestInfo",
".",
"get",
"(",
"executor",
",",
"round"... | <p>Static factory method that should be used for creating a session.
Loads associated contest info and initial values from the given
<tt>round</tt>, using the given <tt>executor</tt>.</p>
@param executor {@link HttpRequestExecutor} instance to use.
@param round Contextual {@link Round} instance this session is bound t... | [
"<p",
">",
"Static",
"factory",
"method",
"that",
"should",
"be",
"used",
"for",
"creating",
"a",
"session",
".",
"Loads",
"associated",
"contest",
"info",
"and",
"initial",
"values",
"from",
"the",
"given",
"<tt",
">",
"round<",
"/",
"tt",
">",
"using",
... | 84a5fed4e049dca48994dc3f70213976aaff4bd3 | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java#L368-L372 | train | Create a new session. | Create a Java method that does the following: "Create a new session.". | Of course, here is the Java code you requested:
```java
public static CodeJamSession createSession(final HttpRequestExecutor executor, final Round round) throws IOException {
final ContestInfo info = ContestInfo.get(executor, round);
final InitialValues values = InitialValues.get(executor, round);
return new Cod... | |
tango-controls/JTango | dao/src/main/java/fr/esrf/TangoApi/ConnectionDAODefaultImpl.java | ConnectionDAODefaultImpl.init | public void init(final Connection connection, final String devname, final String host,
final String port) throws DevFailed {
connection.url = new TangoUrl(buildUrlName(host, port, devname));
connection.devname = connection.url.devname;
connection.setDevice_is_dbase(false);
// Check if connection is possi... | java | public void init(final Connection connection, final String devname, final String host,
final String port) throws DevFailed {
connection.url = new TangoUrl(buildUrlName(host, port, devname));
connection.devname = connection.url.devname;
connection.setDevice_is_dbase(false);
// Check if connection is possi... | [
"public",
"void",
"init",
"(",
"final",
"Connection",
"connection",
",",
"final",
"String",
"devname",
",",
"final",
"String",
"host",
",",
"final",
"String",
"port",
")",
"throws",
"DevFailed",
"{",
"connection",
".",
"url",
"=",
"new",
"TangoUrl",
"(",
"... | =================================================================== | [
"==================================================================="
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoApi/ConnectionDAODefaultImpl.java#L247-L257 | train | Initialize a connection object. | Create a Java method that does the following: "Initialize a connection object.". | Of course, here is the Java code you requested:
```java
public void init(final Connection connection, final String devname, final String host,
final String port) throws DevFailed {
connection.url = new TangoUrl(buildUrlName(host, port, devname));
connection.devname = connection.url.devname;
connection.setD... | |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java | TeaToolsUtils.getTeaContextMethodDescriptors | public MethodDescriptor[] getTeaContextMethodDescriptors(
Class<?> contextClass,
boolean specifiedClassOnly) {
Vector<MethodDescriptor> v = new Vector<MethodDescriptor>();
MethodDescriptor[] methodDescrip... | java | public MethodDescriptor[] getTeaContextMethodDescriptors(
Class<?> contextClass,
boolean specifiedClassOnly) {
Vector<MethodDescriptor> v = new Vector<MethodDescriptor>();
MethodDescriptor[] methodDescrip... | [
"public",
"MethodDescriptor",
"[",
"]",
"getTeaContextMethodDescriptors",
"(",
"Class",
"<",
"?",
">",
"contextClass",
",",
"boolean",
"specifiedClassOnly",
")",
"{",
"Vector",
"<",
"MethodDescriptor",
">",
"v",
"=",
"new",
"Vector",
"<",
"MethodDescriptor",
">",
... | Gets the MethodDescriptors of the specified context class
@param contextClass the Tea context Class to introspect (any class will
work fine)
@param specifiedClassOnly true indicates that this function should
only return MethodDescriptors declared by the specified Class. | [
"Gets",
"the",
"MethodDescriptors",
"of",
"the",
"specified",
"context",
"class"
] | 7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L906-L948 | train | Get the method descriptors for a single context class. | Create a Java method that does the following: "Get the method descriptors for a single context class.". | Of course, here is the Java code you requested:
```java
public MethodDescriptor[] getTeaContextMethodDescriptors(
Class<?> contextClass,
boolean specifiedClassOnly) {
Vector<MethodDescriptor> v = new Vector<Metho... | |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageStatistics.java | ImageStatistics.sum | public static float sum( GrayF32 img ) {
if( BoofConcurrency.USE_CONCURRENT ) {
return ImplImageStatistics_MT.sum(img);
} else {
return ImplImageStatistics.sum(img);
}
} | java | public static float sum( GrayF32 img ) {
if( BoofConcurrency.USE_CONCURRENT ) {
return ImplImageStatistics_MT.sum(img);
} else {
return ImplImageStatistics.sum(img);
}
} | [
"public",
"static",
"float",
"sum",
"(",
"GrayF32",
"img",
")",
"{",
"if",
"(",
"BoofConcurrency",
".",
"USE_CONCURRENT",
")",
"{",
"return",
"ImplImageStatistics_MT",
".",
"sum",
"(",
"img",
")",
";",
"}",
"else",
"{",
"return",
"ImplImageStatistics",
".",
... | <p>
Returns the sum of all the pixels in the image.
</p>
@param img Input image. Not modified. | [
"<p",
">",
"Returns",
"the",
"sum",
"of",
"all",
"the",
"pixels",
"in",
"the",
"image",
".",
"<",
"/",
"p",
">"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageStatistics.java#L1582-L1589 | train | Returns the sum of the image. | Create a Java method that does the following: "Returns the sum of the image.". | Of course, here is the Java code you requested:
```java
public static float sum( GrayF32 img ) {
if( BoofConcurrency.USE_CONCURRENT ) {
return ImplImageStatistics_MT.sum(img);
} else {
return ImplImageStatistics.sum(img);
}
}
```
Hope this helps! | |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java | JoinableResourceBundleImpl.getAvailableVariant | private String getAvailableVariant(Map<String, String> curVariants) {
String variantKey = null;
if (variants != null) {
Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
variantKey = VariantUtils.getVariantKey(availableVariants);
}
return variantKey... | java | private String getAvailableVariant(Map<String, String> curVariants) {
String variantKey = null;
if (variants != null) {
Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
variantKey = VariantUtils.getVariantKey(availableVariants);
}
return variantKey... | [
"private",
"String",
"getAvailableVariant",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"curVariants",
")",
"{",
"String",
"variantKey",
"=",
"null",
";",
"if",
"(",
"variants",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"availa... | Resolves a registered path from a variant key.
@param variantKey
the requested variant key
@return the variant key to use | [
"Resolves",
"a",
"registered",
"path",
"from",
"a",
"variant",
"key",
"."
] | 5381f6acf461cd2502593c67a77bd6ef9eab848d | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java#L683-L692 | train | Gets the variant key from the variant map. | Create a Java method that does the following: "Gets the variant key from the variant map.". | Of course, here is the Java code you requested:
```java
private String getAvailableVariant(Map<String, String> curVariants) {
String variantKey = null;
if (variants != null) {
Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
variantKey = VariantUtils.g... | |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/HikariDataSource.java | HikariDataSource.close | @Override
public void close()
{
if (isShutdown.getAndSet(true)) {
return;
}
HikariPool p = pool;
if (p != null) {
try {
LOGGER.info("{} - Shutdown initiated...", getPoolName());
p.shutdown();
LOGGER.info("{} - Shutdown completed.", get... | java | @Override
public void close()
{
if (isShutdown.getAndSet(true)) {
return;
}
HikariPool p = pool;
if (p != null) {
try {
LOGGER.info("{} - Shutdown initiated...", getPoolName());
p.shutdown();
LOGGER.info("{} - Shutdown completed.", get... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"isShutdown",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"return",
";",
"}",
"HikariPool",
"p",
"=",
"pool",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"try",
"{",
"LOGGER... | Shutdown the DataSource and its associated pool. | [
"Shutdown",
"the",
"DataSource",
"and",
"its",
"associated",
"pool",
"."
] | c509ec1a3f1e19769ee69323972f339cf098ff4b | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/HikariDataSource.java#L340-L359 | train | Close the HikariPool. | Create a Java method that does the following: "Close the HikariPool.". | Of course, here is the Java code you requested:
```java
@Override
public void close()
{
if (isShutdown.getAndSet(true)) {
return;
}
HikariPool p = pool;
if (p != null) {
try {
LOGGER.info("{} - Shutdown initiated...", getPoolName());
p.shutdown()... | |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java | nsdhcpparams.update | public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception {
nsdhcpparams updateresource = new nsdhcpparams();
updateresource.dhcpclient = resource.dhcpclient;
updateresource.saveroute = resource.saveroute;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception {
nsdhcpparams updateresource = new nsdhcpparams();
updateresource.dhcpclient = resource.dhcpclient;
updateresource.saveroute = resource.saveroute;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsdhcpparams",
"resource",
")",
"throws",
"Exception",
"{",
"nsdhcpparams",
"updateresource",
"=",
"new",
"nsdhcpparams",
"(",
")",
";",
"updateresource",
".",
"dhcpclient",
"=",
... | Use this API to update nsdhcpparams. | [
"Use",
"this",
"API",
"to",
"update",
"nsdhcpparams",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java#L156-L161 | train | Use this API to update nsdhcpparams. | Create a Java method that does the following: "Use this API to update nsdhcpparams.". | Of course, here is the Java code you requested:
```java
public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception {
nsdhcpparams updateresource = new nsdhcpparams();
updateresource.dhcpclient = resource.dhcpclient;
updateresource.saveroute = resource.saveroute;
return upd... | |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/Driver.java | Driver.tryWithLock | private <T> Optional<T> tryWithLock(long timeout, TimeUnit unit, Supplier<T> task)
{
checkLockNotHeld("Lock can not be reacquired");
boolean acquired = false;
try {
acquired = exclusiveLock.tryLock(timeout, unit);
}
catch (InterruptedException e) {
Th... | java | private <T> Optional<T> tryWithLock(long timeout, TimeUnit unit, Supplier<T> task)
{
checkLockNotHeld("Lock can not be reacquired");
boolean acquired = false;
try {
acquired = exclusiveLock.tryLock(timeout, unit);
}
catch (InterruptedException e) {
Th... | [
"private",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"tryWithLock",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"Supplier",
"<",
"T",
">",
"task",
")",
"{",
"checkLockNotHeld",
"(",
"\"Lock can not be reacquired\"",
")",
";",
"boolean",
"acquired",... | Note: task can not return null | [
"Note",
":",
"task",
"can",
"not",
"return",
"null"
] | 89de5e379d8f85e139d292b0add8c537a2a01a88 | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/Driver.java#L657-L712 | train | Try to acquire a lock on the result of a task. | Create a Java method that does the following: "Try to acquire a lock on the result of a task.". | Of course, here is the Java code you requested:
```java
private <T> Optional<T> tryWithLock(long timeout, TimeUnit unit, Supplier<T> task)
{
checkLockNotHeld("Lock can not be reacquired");
boolean acquired = false;
try {
acquired = exclusiveLock.tryLock(timeout, unit);
... | |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java | Vector2dfx.lengthSquaredProperty | public ReadOnlyDoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector2dfx.this.x.doubleValue() * Vector2dfx.th... | java | public ReadOnlyDoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector2dfx.this.x.doubleValue() * Vector2dfx.th... | [
"public",
"ReadOnlyDoubleProperty",
"lengthSquaredProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"lengthSquareProperty",
"==",
"null",
")",
"{",
"this",
".",
"lengthSquareProperty",
"=",
"new",
"ReadOnlyDoubleWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".... | Replies the property that represents the length of the vector.
@return the length property | [
"Replies",
"the",
"property",
"that",
"represents",
"the",
"length",
"of",
"the",
"vector",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java#L188-L196 | train | Replies the length squared property. | Create a Java method that does the following: "Replies the length squared property.". | Of course, here is the Java code you requested:
```java
public ReadOnlyDoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(... | |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/logger/LoggerFactory.java | LoggerFactory.getLogger | public static Logger getLogger(Class<?> key) {
FailsafeLogger logger = LOGGERS.get(key.getName());
if (logger == null) {
LOGGERS.putIfAbsent(key.getName(), new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
logger = LOGGERS.get(key.getName());
}
return logger;
... | java | public static Logger getLogger(Class<?> key) {
FailsafeLogger logger = LOGGERS.get(key.getName());
if (logger == null) {
LOGGERS.putIfAbsent(key.getName(), new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
logger = LOGGERS.get(key.getName());
}
return logger;
... | [
"public",
"static",
"Logger",
"getLogger",
"(",
"Class",
"<",
"?",
">",
"key",
")",
"{",
"FailsafeLogger",
"logger",
"=",
"LOGGERS",
".",
"get",
"(",
"key",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
"==",
"null",
")",
"{",
"LOGGERS",
... | 获取日志输出器
@param key 分类键
@return 日志输出器, 后验条件: 不返回null. | [
"获取日志输出器"
] | 64d3aa000ff5022be5e94f511b58f405e5f4c8eb | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/logger/LoggerFactory.java#L91-L98 | train | Get a logger from the cache. | Create a Java method that does the following: "Get a logger from the cache.". | Of course, here is the Java code you requested:
```java
public static Logger getLogger(Class<?> key) {
FailsafeLogger logger = LOGGERS.get(key.getName());
if (logger == null) {
LOGGERS.putIfAbsent(key.getName(), new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
logger = LOGGER... | |
jbundle/jbundle | thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java | Application.addTask | public int addTask(Task task, Object remoteTask)
{
if (m_taskMain == null)
{
if (task != null)
if (task.isMainTaskCandidate())
m_taskMain = task;
}
m_mapTasks.put(task, (RemoteTask)remoteTask);
return m_mapTasks.size();
} | java | public int addTask(Task task, Object remoteTask)
{
if (m_taskMain == null)
{
if (task != null)
if (task.isMainTaskCandidate())
m_taskMain = task;
}
m_mapTasks.put(task, (RemoteTask)remoteTask);
return m_mapTasks.size();
} | [
"public",
"int",
"addTask",
"(",
"Task",
"task",
",",
"Object",
"remoteTask",
")",
"{",
"if",
"(",
"m_taskMain",
"==",
"null",
")",
"{",
"if",
"(",
"task",
"!=",
"null",
")",
"if",
"(",
"task",
".",
"isMainTaskCandidate",
"(",
")",
")",
"m_taskMain",
... | Add this session, screen, or task that belongs to this application.
@param objSession Session to remove.
@return Number of remaining sessions still active. | [
"Add",
"this",
"session",
"screen",
"or",
"task",
"that",
"belongs",
"to",
"this",
"application",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java#L284-L294 | train | Add a task to the tc_map. | Create a Java method that does the following: "Add a task to the tc_map.". | Of course, here is the Java code you requested:
```java
public int addTask(Task task, Object remoteTask)
{
if (m_taskMain == null)
{
if (task != null)
if (task.isMainTaskCandidate())
m_taskMain = task;
}
m_mapTasks.put(task, (RemoteTas... | |
knightliao/disconf | disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/DefaultPropertyPlaceholderConfigurer.java | DefaultPropertyPlaceholderConfigurer.getPlaceholder | protected final String getPlaceholder(final String placeholderWithDefault) {
int separatorIdx = placeholderWithDefault.indexOf(defaultSeparator);
if (separatorIdx == -1) {
return placeholderWithDefault;
}
return placeholderWithDefault.substring(0, separatorIdx);
} | java | protected final String getPlaceholder(final String placeholderWithDefault) {
int separatorIdx = placeholderWithDefault.indexOf(defaultSeparator);
if (separatorIdx == -1) {
return placeholderWithDefault;
}
return placeholderWithDefault.substring(0, separatorIdx);
} | [
"protected",
"final",
"String",
"getPlaceholder",
"(",
"final",
"String",
"placeholderWithDefault",
")",
"{",
"int",
"separatorIdx",
"=",
"placeholderWithDefault",
".",
"indexOf",
"(",
"defaultSeparator",
")",
";",
"if",
"(",
"separatorIdx",
"==",
"-",
"1",
")",
... | extract the placeholder name from the complete placeholder string (between prefix and separator,
or complete placeholder if no separator is found).
@param placeholderWithDefault default placeholder
@return the placeholder
@see #setPlaceholderPrefix
@see #setDefaultSeparator
@see #setPlaceholderSuffix | [
"extract",
"the",
"placeholder",
"name",
"from",
"the",
"complete",
"placeholder",
"string",
"(",
"between",
"prefix",
"and",
"separator",
"or",
"complete",
"placeholder",
"if",
"no",
"separator",
"is",
"found",
")",
"."
] | d413cbce9334fe38a5a24982ce4db3a6ed8e98ea | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/DefaultPropertyPlaceholderConfigurer.java#L85-L91 | train | Get the placeholder. | Create a Java method that does the following: "Get the placeholder.". | Of course, here is the Java code you requested:
```java
protected final String getPlaceholder(final String placeholderWithDefault) {
int separatorIdx = placeholderWithDefault.indexOf(defaultSeparator);
if (separatorIdx == -1) {
return placeholderWithDefault;
}
return placeho... | |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_save_config.java | ns_save_config.validate | protected void validate(String operationType) throws Exception
{
super.validate(operationType);
MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress();
ns_ip_address_arr_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
if(ns_ip_address_arr != null)
{
for(int i=0; i<ns_ip_ad... | java | protected void validate(String operationType) throws Exception
{
super.validate(operationType);
MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress();
ns_ip_address_arr_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
if(ns_ip_address_arr != null)
{
for(int i=0; i<ns_ip_ad... | [
"protected",
"void",
"validate",
"(",
"String",
"operationType",
")",
"throws",
"Exception",
"{",
"super",
".",
"validate",
"(",
"operationType",
")",
";",
"MPSIPAddress",
"ns_ip_address_arr_validator",
"=",
"new",
"MPSIPAddress",
"(",
")",
";",
"ns_ip_address_arr_v... | <pre>
Performs generic data validation for the operation to be performed
</pre> | [
"<pre",
">",
"Performs",
"generic",
"data",
"validation",
"for",
"the",
"operation",
"to",
"be",
"performed",
"<",
"/",
"pre",
">"
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_save_config.java#L166-L180 | train | Validates the
operation. | Create a Java method that does the following: "Validates the
operation.". | Of course, here is the Java code you requested:
```java
protected void validate(String operationType) throws Exception
{
super.validate(operationType);
MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress();
ns_ip_address_arr_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
if(ns... | |
janus-project/guava.janusproject.io | guava/src/com/google/common/base/Defaults.java | Defaults.defaultValue | @Nullable
public static <T> T defaultValue(Class<T> type) {
// Primitives.wrap(type).cast(...) would avoid the warning, but we can't use that from here
@SuppressWarnings("unchecked") // the put method enforces this key-value relationship
T t = (T) DEFAULTS.get(checkNotNull(type));
return t;
} | java | @Nullable
public static <T> T defaultValue(Class<T> type) {
// Primitives.wrap(type).cast(...) would avoid the warning, but we can't use that from here
@SuppressWarnings("unchecked") // the put method enforces this key-value relationship
T t = (T) DEFAULTS.get(checkNotNull(type));
return t;
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"defaultValue",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"// Primitives.wrap(type).cast(...) would avoid the warning, but we can't use that from here",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"//... | Returns the default value of {@code type} as defined by JLS --- {@code 0} for numbers, {@code
false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and
{@code void}, null is returned. | [
"Returns",
"the",
"default",
"value",
"of",
"{"
] | 1c48fb672c9fdfddf276970570f703fa1115f588 | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/base/Defaults.java#L61-L67 | train | Returns the default value for the given type. | Create a Java method that does the following: "Returns the default value for the given type.". | Of course, here is the Java code you requested:
```java
@Nullable
public static <T> T defaultValue(Class<T> type) {
// Primitives.wrap(type).cast(...) would avoid the warning, but we can't use that from here
@SuppressWarnings("unchecked") // the put method enforces this key-value relationship
T t = (T) D... | |
bramp/ffmpeg-cli-wrapper | src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java | AbstractFFmpegStreamBuilder.setDuration | public T setDuration(long duration, TimeUnit units) {
checkNotNull(units);
this.duration = units.toMillis(duration);
return getThis();
} | java | public T setDuration(long duration, TimeUnit units) {
checkNotNull(units);
this.duration = units.toMillis(duration);
return getThis();
} | [
"public",
"T",
"setDuration",
"(",
"long",
"duration",
",",
"TimeUnit",
"units",
")",
"{",
"checkNotNull",
"(",
"units",
")",
";",
"this",
".",
"duration",
"=",
"units",
".",
"toMillis",
"(",
"duration",
")",
";",
"return",
"getThis",
"(",
")",
";",
"}... | Stop writing the output after duration is reached.
@param duration The duration
@param units The units the duration is in
@return this | [
"Stop",
"writing",
"the",
"output",
"after",
"duration",
"is",
"reached",
"."
] | 3819b155edf9132acc75bb6af66dcef1b98c64b2 | https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java#L447-L453 | train | Sets the duration of the sequence. | Create a Java method that does the following: "Sets the duration of the sequence.". | Of course, here is the Java code you requested:
```java
public T setDuration(long duration, TimeUnit units) {
checkNotNull(units);
this.duration = units.toMillis(duration);
return getThis();
}
```
Hope this helps! | |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/model/buffered/XAbstractAttributeMapBufferedImpl.java | XAbstractAttributeMapBufferedImpl.keySet | public synchronized Set<String> keySet() {
if(size == 0) {
return new HashSet<String>(0);
} else {
try {
XAttributeMap map = deserialize();
return map.keySet();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
} | java | public synchronized Set<String> keySet() {
if(size == 0) {
return new HashSet<String>(0);
} else {
try {
XAttributeMap map = deserialize();
return map.keySet();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
} | [
"public",
"synchronized",
"Set",
"<",
"String",
">",
"keySet",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"new",
"HashSet",
"<",
"String",
">",
"(",
"0",
")",
";",
"}",
"else",
"{",
"try",
"{",
"XAttributeMap",
"map",
"=",
"... | /* (non-Javadoc)
@see java.util.Map#keySet() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | e791cb07a6e62ecf837d760d58a25f32fbf6bbca | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/model/buffered/XAbstractAttributeMapBufferedImpl.java#L243-L255 | train | Returns a set of all the attribute names in this attribute map. | Create a Java method that does the following: "Returns a set of all the attribute names in this attribute map.". | Of course, here is the Java code you requested:
```java
public synchronized Set<String> keySet() {
if(size == 0) {
return new HashSet<String>(0);
} else {
try {
XAttributeMap map = deserialize();
return map.keySet();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
`... | |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java | CountMin4.spread | int spread(int x) {
x = ((x >>> 16) ^ x) * 0x45d9f3b;
x = ((x >>> 16) ^ x) * 0x45d9f3b;
return (x >>> 16) ^ x;
} | java | int spread(int x) {
x = ((x >>> 16) ^ x) * 0x45d9f3b;
x = ((x >>> 16) ^ x) * 0x45d9f3b;
return (x >>> 16) ^ x;
} | [
"int",
"spread",
"(",
"int",
"x",
")",
"{",
"x",
"=",
"(",
"(",
"x",
">>>",
"16",
")",
"^",
"x",
")",
"*",
"0x45d9f3b",
";",
"x",
"=",
"(",
"(",
"x",
">>>",
"16",
")",
"^",
"x",
")",
"*",
"0x45d9f3b",
";",
"return",
"(",
"x",
">>>",
"16",... | Applies a supplemental hash function to a given hashCode, which defends against poor quality
hash functions. | [
"Applies",
"a",
"supplemental",
"hash",
"function",
"to",
"a",
"given",
"hashCode",
"which",
"defends",
"against",
"poor",
"quality",
"hash",
"functions",
"."
] | 4cf6d6e6a18ea2e8088f166261e5949343b0f2eb | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java#L195-L199 | train | Spread a single word. | Create a Java method that does the following: "Spread a single word.". | Of course, here is the Java code you requested:
```java
int spread(int x) {
x = ((x >>> 16) ^ x) * 0x45d9f3b;
x = ((x >>> 16) ^ x) * 0x45d9f3b;
return (x >>> 16) ^ x;
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java | H2StreamProcessor.completeConnectionPreface | protected void completeConnectionPreface() throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completeConnectionPreface entry: about to send preface SETTINGS frame");
}
FrameSettings settings;
// send out a settings frame ... | java | protected void completeConnectionPreface() throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completeConnectionPreface entry: about to send preface SETTINGS frame");
}
FrameSettings settings;
// send out a settings frame ... | [
"protected",
"void",
"completeConnectionPreface",
"(",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"comp... | Complete the connection preface. At this point, we should have received the client connection preface string.
Now we need to make sure that the client sent a settings frame along with the preface, update our settings,
and send an empty settings frame in response to the client preface.
@throws Http2Exception | [
"Complete",
"the",
"connection",
"preface",
".",
"At",
"this",
"point",
"we",
"should",
"have",
"received",
"the",
"client",
"connection",
"preface",
"string",
".",
"Now",
"we",
"need",
"to",
"make",
"sure",
"that",
"the",
"client",
"sent",
"a",
"settings",
... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L161-L181 | train | Complete the preface of the connection. | Create a Java method that does the following: "Complete the preface of the connection.". | Of course, here is the Java code you requested:
```java
protected void completeConnectionPreface() throws Http2Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "completeConnectionPreface entry: about to send preface SETTINGS frame");
}
Fram... | |
mlhartme/mork | src/main/java/net/oneandone/mork/classfile/MethodRef.java | MethodRef.argSize | public int argSize() {
int result;
int i;
result = 0;
for (i = 0; i < argumentTypes.length; i++) {
result += argumentTypes[i].operandSize();
}
return result;
} | java | public int argSize() {
int result;
int i;
result = 0;
for (i = 0; i < argumentTypes.length; i++) {
result += argumentTypes[i].operandSize();
}
return result;
} | [
"public",
"int",
"argSize",
"(",
")",
"{",
"int",
"result",
";",
"int",
"i",
";",
"result",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"argumentTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"+=",
"argumentTypes",
"[",
... | -- | [
"--"
] | a069b087750c4133bfeebaf1f599c3bc96762113 | https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/MethodRef.java#L182-L191 | train | Get the number of arguments in this class. | Create a Java method that does the following: "Get the number of arguments in this class.". | Of course, here is the Java code you requested:
```java
public int argSize() {
int result;
int i;
result = 0;
for (i = 0; i < argumentTypes.length; i++) {
result += argumentTypes[i].operandSize();
}
return result;
}
```
Hope this helps! | |
craftercms/commons | entitlements/src/main/java/org/craftercms/commons/entitlements/validator/impl/DefaultDbIntegrityValidatorImpl.java | DefaultDbIntegrityValidatorImpl.store | @Override
public void store(final Connection connection) throws SQLException {
try(PreparedStatement statement = connection.prepareStatement(query)) {
ResultSet result = statement.executeQuery();
if (result.next()) {
long value = result.getLong(1);
try... | java | @Override
public void store(final Connection connection) throws SQLException {
try(PreparedStatement statement = connection.prepareStatement(query)) {
ResultSet result = statement.executeQuery();
if (result.next()) {
long value = result.getLong(1);
try... | [
"@",
"Override",
"public",
"void",
"store",
"(",
"final",
"Connection",
"connection",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"PreparedStatement",
"statement",
"=",
"connection",
".",
"prepareStatement",
"(",
"query",
")",
")",
"{",
"ResultSet",
"result"... | {@inheritDoc} | [
"{"
] | 3074fe49e56c2a4aae0832f40b17ae563335dc83 | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/entitlements/src/main/java/org/craftercms/commons/entitlements/validator/impl/DefaultDbIntegrityValidatorImpl.java#L56-L69 | train | Stores the data in the database. | Create a Java method that does the following: "Stores the data in the database.". | Of course, here is the Java code you requested:
```java
@Override
public void store(final Connection connection) throws SQLException {
try(PreparedStatement statement = connection.prepareStatement(query)) {
ResultSet result = statement.executeQuery();
if (result.next()) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.