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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/YearWeek.java | YearWeek.withYear | public YearWeek withYear(int weekBasedYear) {
if (week == 53 && weekRange(weekBasedYear) < 53) {
return YearWeek.of(weekBasedYear, 52);
}
return with(weekBasedYear, week);
} | java | public YearWeek withYear(int weekBasedYear) {
if (week == 53 && weekRange(weekBasedYear) < 53) {
return YearWeek.of(weekBasedYear, 52);
}
return with(weekBasedYear, week);
} | [
"public",
"YearWeek",
"withYear",
"(",
"int",
"weekBasedYear",
")",
"{",
"if",
"(",
"week",
"==",
"53",
"&&",
"weekRange",
"(",
"weekBasedYear",
")",
"<",
"53",
")",
"{",
"return",
"YearWeek",
".",
"of",
"(",
"weekBasedYear",
",",
"52",
")",
";",
"}",
... | Returns a copy of this {@code YearWeek} with the week-based-year altered.
<p>
This returns a year-week with the specified week-based-year.
If the week of this instance is 53 and the new year does not have 53 weeks,
the week will be adjusted to be 52.
<p>
This instance is immutable and unaffected by this method call.
@... | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"YearWeek",
"}",
"with",
"the",
"week",
"-",
"based",
"-",
"year",
"altered",
".",
"<p",
">",
"This",
"returns",
"a",
"year",
"-",
"week",
"with",
"the",
"specified",
"week",
"-",
"based",
"-",
"yea... | e94ecd3592ef70e54d6eea21095239ea9ffbab78 | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/YearWeek.java#L498-L503 | train | Gets a copy of this instance with the specified year. | Create a Java method that does the following: "Gets a copy of this instance with the specified year.". | Of course, here is the Java code you requested:
```java
public YearWeek withYear(int weekBasedYear) {
if (week == 53 && weekRange(weekBasedYear) < 53) {
return YearWeek.of(weekBasedYear, 52);
}
return with(weekBasedYear, week);
}
```
Hope this helps! | |
alibaba/otter | shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java | ZkClientx.create | public String create(final String path, Object data, final CreateMode mode) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
RuntimeException... | java | public String create(final String path, Object data, final CreateMode mode) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
RuntimeException... | [
"public",
"String",
"create",
"(",
"final",
"String",
"path",
",",
"Object",
"data",
",",
"final",
"CreateMode",
"mode",
")",
"throws",
"ZkInterruptedException",
",",
"IllegalArgumentException",
",",
"ZkException",
",",
"RuntimeException",
"{",
"if",
"(",
"path",
... | Create a node.
@param path
@param data
@param mode
@return create node's path
@throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted
@throws IllegalArgumentException if called from anything except the ZooKeeper event thread
@throws ZkException if any ZooKeeper exception... | [
"Create",
"a",
"node",
"."
] | c7b5f94a0dd162e01ddffaf3a63cade7d23fca55 | https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java#L396-L411 | train | Create a new file in the cluster. | Create a Java method that does the following: "Create a new file in the cluster.". | Of course, here is the Java code you requested:
```java
public String create(final String path, Object data, final CreateMode mode) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
... | |
kamranzafar/jtar | src/main/java/org/kamranzafar/jtar/TarHeader.java | TarHeader.createHeader | public static TarHeader createHeader(String entryName, long size, long modTime, boolean dir, int permissions) {
String name = entryName;
name = TarUtils.trim(name.replace(File.separatorChar, '/'), '/');
TarHeader header = new TarHeader();
header.linkName = new StringBuffer("");
header.mode = permission... | java | public static TarHeader createHeader(String entryName, long size, long modTime, boolean dir, int permissions) {
String name = entryName;
name = TarUtils.trim(name.replace(File.separatorChar, '/'), '/');
TarHeader header = new TarHeader();
header.linkName = new StringBuffer("");
header.mode = permission... | [
"public",
"static",
"TarHeader",
"createHeader",
"(",
"String",
"entryName",
",",
"long",
"size",
",",
"long",
"modTime",
",",
"boolean",
"dir",
",",
"int",
"permissions",
")",
"{",
"String",
"name",
"=",
"entryName",
";",
"name",
"=",
"TarUtils",
".",
"tr... | Creates a new header for a file/directory entry.
@param entryName
File name
@param size
File size in bytes
@param modTime
Last modification time in numeric Unix time format
@param dir
Is directory | [
"Creates",
"a",
"new",
"header",
"for",
"a",
"file",
"/",
"directory",
"entry",
"."
] | aace0a3c8a6478fd1bac95865c27535e658afb73 | https://github.com/kamranzafar/jtar/blob/aace0a3c8a6478fd1bac95865c27535e658afb73/src/main/java/org/kamranzafar/jtar/TarHeader.java#L205-L236 | train | Creates a new TarHeader object. | Create a Java method that does the following: "Creates a new TarHeader object.". | Of course, here is the Java code you requested:
```java
public static TarHeader createHeader(String entryName, long size, long modTime, boolean dir, int permissions) {
String name = entryName;
name = TarUtils.trim(name.replace(File.separatorChar, '/'), '/');
TarHeader header = new TarHeader();
header.lin... | |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelClientState.java | PaymentChannelClientState.checkNotExpired | public synchronized void checkNotExpired() {
if (Utils.currentTimeSeconds() > getExpiryTime()) {
stateMachine.transition(State.EXPIRED);
disconnectFromChannel();
throw new IllegalStateException("Channel expired");
}
} | java | public synchronized void checkNotExpired() {
if (Utils.currentTimeSeconds() > getExpiryTime()) {
stateMachine.transition(State.EXPIRED);
disconnectFromChannel();
throw new IllegalStateException("Channel expired");
}
} | [
"public",
"synchronized",
"void",
"checkNotExpired",
"(",
")",
"{",
"if",
"(",
"Utils",
".",
"currentTimeSeconds",
"(",
")",
">",
"getExpiryTime",
"(",
")",
")",
"{",
"stateMachine",
".",
"transition",
"(",
"State",
".",
"EXPIRED",
")",
";",
"disconnectFromC... | Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet
storage and throwing an {@link IllegalStateException} if it is. | [
"Checks",
"if",
"the",
"channel",
"is",
"expired",
"setting",
"state",
"to",
"{"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelClientState.java#L259-L265 | train | Check if the channel has expired. | Create a Java method that does the following: "Check if the channel has expired.". | Of course, here is the Java code you requested:
```java
public synchronized void checkNotExpired() {
if (Utils.currentTimeSeconds() > getExpiryTime()) {
stateMachine.transition(State.EXPIRED);
disconnectFromChannel();
throw new IllegalStateException("Channel expired");
... | |
real-logic/aeron | aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java | ChannelUriStringBuilder.initialPosition | public ChannelUriStringBuilder initialPosition(final long position, final int initialTermId, final int termLength)
{
if (position < 0 || 0 != (position & (FRAME_ALIGNMENT - 1)))
{
throw new IllegalArgumentException("invalid position: " + position);
}
final int bitsToShif... | java | public ChannelUriStringBuilder initialPosition(final long position, final int initialTermId, final int termLength)
{
if (position < 0 || 0 != (position & (FRAME_ALIGNMENT - 1)))
{
throw new IllegalArgumentException("invalid position: " + position);
}
final int bitsToShif... | [
"public",
"ChannelUriStringBuilder",
"initialPosition",
"(",
"final",
"long",
"position",
",",
"final",
"int",
"initialTermId",
",",
"final",
"int",
"termLength",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"0",
"!=",
"(",
"position",
"&",
"(",
"FRAME_A... | Initialise a channel for restarting a publication at a given position.
@param position at which the publication should be started.
@param initialTermId what which the stream would start.
@param termLength for the stream.
@return this for a fluent API. | [
"Initialise",
"a",
"channel",
"for",
"restarting",
"a",
"publication",
"at",
"a",
"given",
"position",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java#L730-L745 | test | Sets the initial term id and term length. | Create a Java method that does the following: "Sets the initial term id and term length.". | Of course, here is the Java code you requested:
```java
public ChannelUriStringBuilder initialPosition(final long position, final int initialTermId, final int termLength)
{
if (position < 0 || 0 != (position & (FRAME_ALIGNMENT - 1)))
{
throw new IllegalArgumentException("invalid positio... | |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java | SwingSyncPageWorker.afterPageDisplay | public void afterPageDisplay()
{
SwingWorker<String,String> worker = new SwingWorker<String,String>()
{
public String doInBackground()
{
return null;
}
public void done()
{ // This should always be the awt thread
... | java | public void afterPageDisplay()
{
SwingWorker<String,String> worker = new SwingWorker<String,String>()
{
public String doInBackground()
{
return null;
}
public void done()
{ // This should always be the awt thread
... | [
"public",
"void",
"afterPageDisplay",
"(",
")",
"{",
"SwingWorker",
"<",
"String",
",",
"String",
">",
"worker",
"=",
"new",
"SwingWorker",
"<",
"String",
",",
"String",
">",
"(",
")",
"{",
"public",
"String",
"doInBackground",
"(",
")",
"{",
"return",
"... | Do this code after the page has displayed on the screen.
Override this method. | [
"Do",
"this",
"code",
"after",
"the",
"page",
"has",
"displayed",
"on",
"the",
"screen",
".",
"Override",
"this",
"method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java#L128-L157 | train | This method is called after the page display. | Create a Java method that does the following: "This method is called after the page display.". | Of course, here is the Java code you requested:
```java
public void afterPageDisplay()
{
SwingWorker<String,String> worker = new SwingWorker<String,String>()
{
public String doInBackground()
{
return null;
}
public void done()
... | |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/HttpHeaderInjector.java | HttpHeaderInjector.addHttpHeaderToResponseStream | public void addHttpHeaderToResponseStream(final HttpServletResponse servletResponse,
final UriInfo uriInfo,
final FedoraResource resource) {
getUriAwareHttpHeaderFactories().forEach((bean, factory) -> {
LOGG... | java | public void addHttpHeaderToResponseStream(final HttpServletResponse servletResponse,
final UriInfo uriInfo,
final FedoraResource resource) {
getUriAwareHttpHeaderFactories().forEach((bean, factory) -> {
LOGG... | [
"public",
"void",
"addHttpHeaderToResponseStream",
"(",
"final",
"HttpServletResponse",
"servletResponse",
",",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"FedoraResource",
"resource",
")",
"{",
"getUriAwareHttpHeaderFactories",
"(",
")",
".",
"forEach",
"(",
"(",
"... | Add additional Http Headers
@param servletResponse the response
@param uriInfo the URI context
@param resource the resource | [
"Add",
"additional",
"Http",
"Headers"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/HttpHeaderInjector.java#L66-L78 | train | Add HTTP headers to response stream. | Create a Java method that does the following: "Add HTTP headers to response stream.". | Of course, here is the Java code you requested:
```java
public void addHttpHeaderToResponseStream(final HttpServletResponse servletResponse,
final UriInfo uriInfo,
final FedoraResource resource) {
getUriAwareHttpHeader... | |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.getKeysForKeyNameAsync | public Observable<SharedAccessSignatureAuthorizationRuleInner> getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) {
return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1<ServiceResponse<SharedAccessSignatureAuthorizationRuleIn... | java | public Observable<SharedAccessSignatureAuthorizationRuleInner> getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) {
return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1<ServiceResponse<SharedAccessSignatureAuthorizationRuleIn... | [
"public",
"Observable",
"<",
"SharedAccessSignatureAuthorizationRuleInner",
">",
"getKeysForKeyNameAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"keyName",
")",
"{",
"return",
"getKeysForKeyNameWithServiceResponseAsync",
"(",
"resou... | Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
@param resourceGroupName ... | [
"Get",
"a",
"shared",
"access",
"policy",
"by",
"name",
"from",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub... | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2999-L3006 | train | Gets the keys for a given key name. | Create a Java method that does the following: "Gets the keys for a given key name.". | Of course, here is the Java code you requested:
```java
public Observable<SharedAccessSignatureAuthorizationRuleInner> getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) {
return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1... | |
febit/wit | wit-core/src/main/java/org/febit/wit_shaded/asm/ByteBuffer.java | ByteBuffer.put | ByteBuffer put(final ByteBuffer buffer) {
int len = buffer.length;
ensure(length + len);
System.arraycopy(buffer.data, 0, data, length, len);
length += len;
return this;
} | java | ByteBuffer put(final ByteBuffer buffer) {
int len = buffer.length;
ensure(length + len);
System.arraycopy(buffer.data, 0, data, length, len);
length += len;
return this;
} | [
"ByteBuffer",
"put",
"(",
"final",
"ByteBuffer",
"buffer",
")",
"{",
"int",
"len",
"=",
"buffer",
".",
"length",
";",
"ensure",
"(",
"length",
"+",
"len",
")",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
".",
"data",
",",
"0",
",",
"data",
",",
... | } | [
"}"
] | 89ee29efbc5633b79c30c3c7b953c9f4130575af | https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ByteBuffer.java#L136-L142 | train | Puts the contents of the specified buffer into this buffer. | Create a Java method that does the following: "Puts the contents of the specified buffer into this buffer.". | Of course, here is the Java code you requested:
```java
ByteBuffer put(final ByteBuffer buffer) {
int len = buffer.length;
ensure(length + len);
System.arraycopy(buffer.data, 0, data, length, len);
length += len;
return this;
}
```
Hope this helps! | |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/longlong/Roaring64NavigableMap.java | Roaring64NavigableMap.or | public void or(final Roaring64NavigableMap x2) {
boolean firstBucket = true;
for (Entry<Integer, BitmapDataProvider> e2 : x2.highToBitmap.entrySet()) {
// Keep object to prevent auto-boxing
Integer high = e2.getKey();
BitmapDataProvider lowBitmap1 = this.highToBitmap.get(high);
Bitmap... | java | public void or(final Roaring64NavigableMap x2) {
boolean firstBucket = true;
for (Entry<Integer, BitmapDataProvider> e2 : x2.highToBitmap.entrySet()) {
// Keep object to prevent auto-boxing
Integer high = e2.getKey();
BitmapDataProvider lowBitmap1 = this.highToBitmap.get(high);
Bitmap... | [
"public",
"void",
"or",
"(",
"final",
"Roaring64NavigableMap",
"x2",
")",
"{",
"boolean",
"firstBucket",
"=",
"true",
";",
"for",
"(",
"Entry",
"<",
"Integer",
",",
"BitmapDataProvider",
">",
"e2",
":",
"x2",
".",
"highToBitmap",
".",
"entrySet",
"(",
")",... | In-place bitwise OR (union) operation. The current bitmap is modified.
@param x2 other bitmap | [
"In",
"-",
"place",
"bitwise",
"OR",
"(",
"union",
")",
"operation",
".",
"The",
"current",
"bitmap",
"is",
"modified",
"."
] | b26fd0a1330fd4d2877f4d74feb69ceb812e9efa | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/longlong/Roaring64NavigableMap.java#L719-L768 | train | OR this map with another map. | Create a Java method that does the following: "OR this map with another map.". | Of course, here is the Java code you requested:
```java
public void or(final Roaring64NavigableMap x2) {
boolean firstBucket = true;
for (Entry<Integer, BitmapDataProvider> e2 : x2.highToBitmap.entrySet()) {
// Keep object to prevent auto-boxing
Integer high = e2.getKey();
BitmapDataProvide... | |
OpenEstate/OpenEstate-IO | OpenImmo/src/main/jaxb/org/openestate/io/openimmo/xml/Unterkellert.java | Unterkellert.setKeller | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public void setKeller(Unterkellert.Keller value) {
this.keller = value;
} | java | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public void setKeller(Unterkellert.Keller value) {
this.keller = value;
} | [
"@",
"Generated",
"(",
"value",
"=",
"\"com.sun.tools.xjc.Driver\"",
",",
"date",
"=",
"\"2018-10-12T02:54:50+02:00\"",
",",
"comments",
"=",
"\"JAXB RI v2.2.11\"",
")",
"public",
"void",
"setKeller",
"(",
"Unterkellert",
".",
"Keller",
"value",
")",
"{",
"this",
... | Sets the value of the keller property.
@param value
allowed object is
{@link Unterkellert.Keller } | [
"Sets",
"the",
"value",
"of",
"the",
"keller",
"property",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/OpenImmo/src/main/jaxb/org/openestate/io/openimmo/xml/Unterkellert.java#L63-L66 | test | Sets the value of the keller property. | Create a Java method that does the following: "Sets the value of the keller property.". | Of course, here is the Java code you requested:
```java
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public void setKeller(Unterkellert.Keller value) {
this.keller = value;
}
```
Hope this helps! | |
esmasui/AndroidJUnit4 | android-junit4/src/main/java/android/os/PerformanceCollector.java | PerformanceCollector.endPerformanceSnapshot | private void endPerformanceSnapshot() {
// Stop the timing. This must be done first before any other counting is
// stopped.
mSnapshotCpuTime = Process.getElapsedCpuTime() - mSnapshotCpuTime;
mSnapshotExecTime = SystemClock.uptimeMillis() - mSnapshotExecTime;
stopAllocCounting()... | java | private void endPerformanceSnapshot() {
// Stop the timing. This must be done first before any other counting is
// stopped.
mSnapshotCpuTime = Process.getElapsedCpuTime() - mSnapshotCpuTime;
mSnapshotExecTime = SystemClock.uptimeMillis() - mSnapshotExecTime;
stopAllocCounting()... | [
"private",
"void",
"endPerformanceSnapshot",
"(",
")",
"{",
"// Stop the timing. This must be done first before any other counting is",
"// stopped.",
"mSnapshotCpuTime",
"=",
"Process",
".",
"getElapsedCpuTime",
"(",
")",
"-",
"mSnapshotCpuTime",
";",
"mSnapshotExecTime",
"=",... | /*
Stops tracking memory usage, binder transactions, and real & cpu timing.
Stores collected data as type long into Bundle object for reporting. | [
"/",
"*",
"Stops",
"tracking",
"memory",
"usage",
"binder",
"transactions",
"and",
"real",
"&",
"cpu",
"timing",
".",
"Stores",
"collected",
"data",
"as",
"type",
"long",
"into",
"Bundle",
"object",
"for",
"reporting",
"."
] | 173b050663844f81ca9da6c9076dd13e1bde6a75 | https://github.com/esmasui/AndroidJUnit4/blob/173b050663844f81ca9da6c9076dd13e1bde6a75/android-junit4/src/main/java/android/os/PerformanceCollector.java#L480-L533 | train | End the performance snapshot of the current audit log. | Create a Java method that does the following: "End the performance snapshot of the current audit log.". | Of course, here is the Java code you requested:
```java
private void endPerformanceSnapshot() {
// Stop the timing. This must be done first before any other counting is
// stopped.
mSnapshotCpuTime = Process.getElapsedCpuTime() - mSnapshotCpuTime;
mSnapshotExecTime = SystemClock.uptimeM... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/OutboundChain.java | OutboundChain.verifyChainCoherency | public static void verifyChainCoherency(ChainData chainData) throws IncoherentChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "verifyChainCoherency");
}
ChannelData[] channelDataArray = chainData.getChannelList();
// Verify the... | java | public static void verifyChainCoherency(ChainData chainData) throws IncoherentChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "verifyChainCoherency");
}
ChannelData[] channelDataArray = chainData.getChannelList();
// Verify the... | [
"public",
"static",
"void",
"verifyChainCoherency",
"(",
"ChainData",
"chainData",
")",
"throws",
"IncoherentChainException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
"."... | This method analyzes the interfaces between the input array of
inbound channels. If the interfaces between them match, implying they
have the ability to form a chain, the method returns without exception.
Otherwise, an IncoherentChainException is thrown describing the channels
that were incoherent.
@param chainData
@t... | [
"This",
"method",
"analyzes",
"the",
"interfaces",
"between",
"the",
"input",
"array",
"of",
"inbound",
"channels",
".",
"If",
"the",
"interfaces",
"between",
"them",
"match",
"implying",
"they",
"have",
"the",
"ability",
"to",
"form",
"a",
"chain",
"the",
"... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/OutboundChain.java#L146-L211 | train | Verify that the chain coherency is valid. | Create a Java method that does the following: "Verify that the chain coherency is valid.". | Of course, here is the Java code you requested:
```java
public static void verifyChainCoherency(ChainData chainData) throws IncoherentChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "verifyChainCoherency");
}
ChannelData[] channelData... | |
twilio/twilio-java | src/main/java/com/twilio/rest/studio/v1/flow/EngagementReader.java | EngagementReader.nextPage | @Override
public Page<Engagement> nextPage(final Page<Engagement> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.STUDIO.toString(),
client.getRegi... | java | @Override
public Page<Engagement> nextPage(final Page<Engagement> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.STUDIO.toString(),
client.getRegi... | [
"@",
"Override",
"public",
"Page",
"<",
"Engagement",
">",
"nextPage",
"(",
"final",
"Page",
"<",
"Engagement",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
"... | Retrieve the next page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Next Page | [
"Retrieve",
"the",
"next",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | 0318974c0a6a152994af167d430255684d5e9b9f | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/studio/v1/flow/EngagementReader.java#L90-L101 | train | This method is used to retrieve the next page of a CDNA language. | Create a Java method that does the following: "This method is used to retrieve the next page of a CDNA language.". | Of course, here is the Java code you requested:
```java
@Override
public Page<Engagement> nextPage(final Page<Engagement> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
... | |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.encodeBytesToBytes | @Nonnull
@ReturnsMutableCopy
public static byte [] encodeBytesToBytes (@Nonnull final byte [] source)
{
byte [] encoded;
try
{
encoded = encodeBytesToBytes (source, 0, source.length, NO_OPTIONS);
}
catch (final IOException ex)
{
throw new IllegalStateException ("IOExceptions on... | java | @Nonnull
@ReturnsMutableCopy
public static byte [] encodeBytesToBytes (@Nonnull final byte [] source)
{
byte [] encoded;
try
{
encoded = encodeBytesToBytes (source, 0, source.length, NO_OPTIONS);
}
catch (final IOException ex)
{
throw new IllegalStateException ("IOExceptions on... | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"byte",
"[",
"]",
"encodeBytesToBytes",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"source",
")",
"{",
"byte",
"[",
"]",
"encoded",
";",
"try",
"{",
"encoded",
"=",
"encodeBytesToBytes",
"... | Similar to {@link #encodeBytes(byte[])} but returns a byte array instead of
instantiating a String. This is more efficient if you're working with I/O
streams and have large data sets to encode.
@param source
The data to convert
@return The Base64-encoded data as a byte[] (of ASCII characters)
@throws NullPointerExcept... | [
"Similar",
"to",
"{",
"@link",
"#encodeBytes",
"(",
"byte",
"[]",
")",
"}",
"but",
"returns",
"a",
"byte",
"array",
"instead",
"of",
"instantiating",
"a",
"String",
".",
"This",
"is",
"more",
"efficient",
"if",
"you",
"re",
"working",
"with",
"I",
"/",
... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L1810-L1824 | train | Encode bytes to bytes. | Create a Java method that does the following: "Encode bytes to bytes.". | Of course, here is the Java code you requested:
```java
@Nonnull
@ReturnsMutableCopy
public static byte [] encodeBytesToBytes (@Nonnull final byte [] source)
{
byte [] encoded;
try
{
encoded = encodeBytesToBytes (source, 0, source.length, NO_OPTIONS);
}
catch (final IOException ex)
... | |
RestComm/jain-slee.sip | examples/sip-jdbc-registrar/sbb/src/main/java/org/mobicents/slee/example/sjr/data/jdbc/DataSourceChildSbb.java | DataSourceChildSbb.onJdbcTaskExecutionThrowableEvent | public void onJdbcTaskExecutionThrowableEvent(
JdbcTaskExecutionThrowableEvent event, ActivityContextInterface aci) {
if (tracer.isWarningEnabled()) {
tracer.warning(
"Received a JdbcTaskExecutionThrowableEvent, as result of executed task "
+ event.getTask(), event.getThrowable());
}
// end jdbc... | java | public void onJdbcTaskExecutionThrowableEvent(
JdbcTaskExecutionThrowableEvent event, ActivityContextInterface aci) {
if (tracer.isWarningEnabled()) {
tracer.warning(
"Received a JdbcTaskExecutionThrowableEvent, as result of executed task "
+ event.getTask(), event.getThrowable());
}
// end jdbc... | [
"public",
"void",
"onJdbcTaskExecutionThrowableEvent",
"(",
"JdbcTaskExecutionThrowableEvent",
"event",
",",
"ActivityContextInterface",
"aci",
")",
"{",
"if",
"(",
"tracer",
".",
"isWarningEnabled",
"(",
")",
")",
"{",
"tracer",
".",
"warning",
"(",
"\"Received a Jdb... | Event handler for {@link JdbcTaskExecutionThrowableEvent}.
@param event
@param aci | [
"Event",
"handler",
"for",
"{",
"@link",
"JdbcTaskExecutionThrowableEvent",
"}",
"."
] | 2c173af0a760cb0ea13fe0ffa58c0f82b14731f9 | https://github.com/RestComm/jain-slee.sip/blob/2c173af0a760cb0ea13fe0ffa58c0f82b14731f9/examples/sip-jdbc-registrar/sbb/src/main/java/org/mobicents/slee/example/sjr/data/jdbc/DataSourceChildSbb.java#L138-L154 | train | Called by the application to handle a JdbcTaskExecutionThrowableEvent. | Create a Java method that does the following: "Called by the application to handle a JdbcTaskExecutionThrowableEvent.". | Of course, here is the Java code you requested:
```java
public void onJdbcTaskExecutionThrowableEvent(
JdbcTaskExecutionThrowableEvent event, ActivityContextInterface aci) {
if (tracer.isWarningEnabled()) {
tracer.warning(
"Received a JdbcTaskExecutionThrowableEvent, as result of executed task "
+ ... | |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.getParamDouble | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new Runt... | java | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new Runt... | [
"private",
"double",
"getParamDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"values",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
... | Returns the double, or the default is absent. Throws if the double is specified but invalid. | [
"Returns",
"the",
"double",
"or",
"the",
"default",
"is",
"absent",
".",
"Throws",
"if",
"the",
"double",
"is",
"specified",
"but",
"invalid",
"."
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L117-L127 | train | Get the parameter double. | Create a Java method that does the following: "Get the parameter double.". | Of course, here is the Java code you requested:
```java
private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} cat... | |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java | RuleDefinitionFileConstant.getSQLStatementRuleDefinitionFileName | public static String getSQLStatementRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), SQL_STATEMENT_RULE_DEFINITION_FILE_NAME);
} | java | public static String getSQLStatementRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), SQL_STATEMENT_RULE_DEFINITION_FILE_NAME);
} | [
"public",
"static",
"String",
"getSQLStatementRuleDefinitionFileName",
"(",
"final",
"String",
"rootDir",
",",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"'",
"'",
")",
".",
"join",
"(",
"rootDir",
",",
"databaseType",... | Get SQL statement rule definition file name.
@param rootDir root dir
@param databaseType database type
@return SQL statement rule definition file name | [
"Get",
"SQL",
"statement",
"rule",
"definition",
"file",
"name",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java#L54-L56 | train | Gets the SQL statement rule definition file name. | Create a Java method that does the following: "Gets the SQL statement rule definition file name.". | Of course, here is the Java code you requested:
```java
public static String getSQLStatementRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), SQL_STATEMENT_RULE_DEFINITION_FILE_NAME);
}
```
Hope this helps... | |
virgo47/javasimon | examples/src/main/java/org/javasimon/examples/SamplingExample.java | SamplingExample.main | public static void main(String[] args) {
// Starts the sampler
Sampler sampler = new Sampler();
sampler.setDaemon(true);
sampler.start();
// Starts the measuring
while (true) {
try (Split ignored = SimonManager.getStopwatch("sampled-stopwatch").start()) {
ExampleUtils.waitRandomlySquared(50);
}
... | java | public static void main(String[] args) {
// Starts the sampler
Sampler sampler = new Sampler();
sampler.setDaemon(true);
sampler.start();
// Starts the measuring
while (true) {
try (Split ignored = SimonManager.getStopwatch("sampled-stopwatch").start()) {
ExampleUtils.waitRandomlySquared(50);
}
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// Starts the sampler",
"Sampler",
"sampler",
"=",
"new",
"Sampler",
"(",
")",
";",
"sampler",
".",
"setDaemon",
"(",
"true",
")",
";",
"sampler",
".",
"start",
"(",
")",
"... | Entry point of the demo application.
@param args command line arguments | [
"Entry",
"point",
"of",
"the",
"demo",
"application",
"."
] | 17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/SamplingExample.java#L24-L36 | train | Main method of the sample. | Create a Java method that does the following: "Main method of the sample.". | Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
// Starts the sampler
Sampler sampler = new Sampler();
sampler.setDaemon(true);
sampler.start();
// Starts the measuring
while (true) {
try (Split ignored = SimonManager.getStopwatch("sampled-stopwatch").st... | |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/FieldInitializerUtil.java | FieldInitializerUtil.getSelectedResource | @SuppressWarnings("static-method")
public IJavaElement getSelectedResource(IStructuredSelection selection) {
IJavaElement elem = null;
if (selection != null && !selection.isEmpty()) {
final Object object = selection.getFirstElement();
if (object instanceof IAdaptable) {
final IAdaptable adaptable = (IAda... | java | @SuppressWarnings("static-method")
public IJavaElement getSelectedResource(IStructuredSelection selection) {
IJavaElement elem = null;
if (selection != null && !selection.isEmpty()) {
final Object object = selection.getFirstElement();
if (object instanceof IAdaptable) {
final IAdaptable adaptable = (IAda... | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"IJavaElement",
"getSelectedResource",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"IJavaElement",
"elem",
"=",
"null",
";",
"if",
"(",
"selection",
"!=",
"null",
"&&",
"!",
"selection",
"."... | Replies the Java element that corresponds to the given selection.
@param selection the current selection.
@return the Java element. | [
"Replies",
"the",
"Java",
"element",
"that",
"corresponds",
"to",
"the",
"given",
"selection",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/FieldInitializerUtil.java#L56-L92 | train | Replies the selected resource. | Create a Java method that does the following: "Replies the selected resource.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("static-method")
public IJavaElement getSelectedResource(IStructuredSelection selection) {
IJavaElement elem = null;
if (selection != null && !selection.isEmpty()) {
final Object object = selection.getFirstElement();
if (object instan... | |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/datetimepicker/client/ui/base/DateTimePickerBase.java | DateTimePickerBase.setFormat | @Override
public void setFormat(final String format) {
this.format = format;
// Get the old value
final Date oldValue = getValue();
// Make the new DateTimeFormat
setDateTimeFormat(format);
if (oldValue != null) {
setValue(oldValue);
}
} | java | @Override
public void setFormat(final String format) {
this.format = format;
// Get the old value
final Date oldValue = getValue();
// Make the new DateTimeFormat
setDateTimeFormat(format);
if (oldValue != null) {
setValue(oldValue);
}
} | [
"@",
"Override",
"public",
"void",
"setFormat",
"(",
"final",
"String",
"format",
")",
"{",
"this",
".",
"format",
"=",
"format",
";",
"// Get the old value",
"final",
"Date",
"oldValue",
"=",
"getValue",
"(",
")",
";",
"// Make the new DateTimeFormat",
"setDate... | {@inheritDoc} | [
"{"
] | 8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94 | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/datetimepicker/client/ui/base/DateTimePickerBase.java#L586-L599 | train | Sets the format of the calendar. | Create a Java method that does the following: "Sets the format of the calendar.". | Of course, here is the Java code you requested:
```java
@Override
public void setFormat(final String format) {
this.format = format;
// Get the old value
final Date oldValue = getValue();
// Make the new DateTimeFormat
setDateTimeFormat(format);
if (oldValue != nu... | |
DDTH/ddth-kafka | src/main/java/com/github/ddth/kafka/KafkaClient.java | KafkaClient.sendMessageAsync | public Future<KafkaMessage> sendMessageAsync(ProducerType type, KafkaMessage message) {
String key = message.key();
ProducerRecord<String, byte[]> record = StringUtils.isEmpty(key)
? new ProducerRecord<>(message.topic(), message.content())
: new ProducerRecord<>(message.t... | java | public Future<KafkaMessage> sendMessageAsync(ProducerType type, KafkaMessage message) {
String key = message.key();
ProducerRecord<String, byte[]> record = StringUtils.isEmpty(key)
? new ProducerRecord<>(message.topic(), message.content())
: new ProducerRecord<>(message.t... | [
"public",
"Future",
"<",
"KafkaMessage",
">",
"sendMessageAsync",
"(",
"ProducerType",
"type",
",",
"KafkaMessage",
"message",
")",
"{",
"String",
"key",
"=",
"message",
".",
"key",
"(",
")",
";",
"ProducerRecord",
"<",
"String",
",",
"byte",
"[",
"]",
">"... | Sends a message asynchronously, specifying {@link ProducerType}.
@param type
@param message
@return a copy of message filled with partition number and offset | [
"Sends",
"a",
"message",
"asynchronously",
"specifying",
"{",
"@link",
"ProducerType",
"}",
"."
] | aaeb8536e28a109ac0b69022f0ea4bbf5696b76f | https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L726-L748 | train | Send message async. | Create a Java method that does the following: "Send message async.". | Of course, here is the Java code you requested:
```java
public Future<KafkaMessage> sendMessageAsync(ProducerType type, KafkaMessage message) {
String key = message.key();
ProducerRecord<String, byte[]> record = StringUtils.isEmpty(key)
? new ProducerRecord<>(message.topic(), message.co... | |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/util/TimerUtil.java | TimerUtil.createTimerEntityForTimerEventDefinition | public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEventDefinition timerEventDefinition, boolean isInterruptingTimer,
ExecutionEntity executionEntity, String jobHandlerType, String jobHandlerConfig) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngin... | java | public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEventDefinition timerEventDefinition, boolean isInterruptingTimer,
ExecutionEntity executionEntity, String jobHandlerType, String jobHandlerConfig) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngin... | [
"public",
"static",
"TimerJobEntity",
"createTimerEntityForTimerEventDefinition",
"(",
"TimerEventDefinition",
"timerEventDefinition",
",",
"boolean",
"isInterruptingTimer",
",",
"ExecutionEntity",
"executionEntity",
",",
"String",
"jobHandlerType",
",",
"String",
"jobHandlerConf... | The event definition on which the timer is based.
Takes in an optional execution, if missing the {@link NoExecutionVariableScope} will be used (eg Timer start event) | [
"The",
"event",
"definition",
"on",
"which",
"the",
"timer",
"is",
"based",
"."
] | 82e2b2cd2083b2f734ca0efc7815389c0f2517d9 | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/TimerUtil.java#L36-L154 | train | Create a TimerJobEntity for a TimerEventDefinition | Create a Java method that does the following: "Create a TimerJobEntity for a TimerEventDefinition". | Of course, here is the Java code you requested:
```java
public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEventDefinition timerEventDefinition, boolean isInterruptingTimer,
ExecutionEntity executionEntity, String jobHandlerType, String jobHandlerConfig) {
ProcessEngineConfiguration... | |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm21/EntityImpl.java | EntityImpl.getAllPrimaryKeyJoinColumn | public List<PrimaryKeyJoinColumn<Entity<T>>> getAllPrimaryKeyJoinColumn()
{
List<PrimaryKeyJoinColumn<Entity<T>>> list = new ArrayList<PrimaryKeyJoinColumn<Entity<T>>>();
List<Node> nodeList = childNode.get("primary-key-join-column");
for(Node node: nodeList)
{
PrimaryKeyJoinColumn<E... | java | public List<PrimaryKeyJoinColumn<Entity<T>>> getAllPrimaryKeyJoinColumn()
{
List<PrimaryKeyJoinColumn<Entity<T>>> list = new ArrayList<PrimaryKeyJoinColumn<Entity<T>>>();
List<Node> nodeList = childNode.get("primary-key-join-column");
for(Node node: nodeList)
{
PrimaryKeyJoinColumn<E... | [
"public",
"List",
"<",
"PrimaryKeyJoinColumn",
"<",
"Entity",
"<",
"T",
">",
">",
">",
"getAllPrimaryKeyJoinColumn",
"(",
")",
"{",
"List",
"<",
"PrimaryKeyJoinColumn",
"<",
"Entity",
"<",
"T",
">>>",
"list",
"=",
"new",
"ArrayList",
"<",
"PrimaryKeyJoinColumn... | Returns all <code>primary-key-join-column</code> elements
@return list of <code>primary-key-join-column</code> | [
"Returns",
"all",
"<code",
">",
"primary",
"-",
"key",
"-",
"join",
"-",
"column<",
"/",
"code",
">",
"elements"
] | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm21/EntityImpl.java#L226-L236 | train | Get all Primary Key Join Column | Create a Java method that does the following: "Get all Primary Key Join Column". | Of course, here is the Java code you requested:
```java
public List<PrimaryKeyJoinColumn<Entity<T>>> getAllPrimaryKeyJoinColumn()
{
List<PrimaryKeyJoinColumn<Entity<T>>> list = new ArrayList<PrimaryKeyJoinColumn<Entity<T>>>();
List<Node> nodeList = childNode.get("primary-key-join-column");
for(Nod... | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java | ClassLoaderUtil.getOrCreate | public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className) {
if (instance != null) {
return instance;
} else if (className != null) {
try {
return ClassLoaderUtil.newInstance(classLoader, className);
} catch (Exception e) {
... | java | public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className) {
if (instance != null) {
return instance;
} else if (className != null) {
try {
return ClassLoaderUtil.newInstance(classLoader, className);
} catch (Exception e) {
... | [
"public",
"static",
"<",
"T",
">",
"T",
"getOrCreate",
"(",
"T",
"instance",
",",
"ClassLoader",
"classLoader",
",",
"String",
"className",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"return",
"instance",
";",
"}",
"else",
"if",
"(",
"cla... | Returns the {@code instance}, if not null, or constructs a new instance of the class using
{@link #newInstance(ClassLoader, String)}.
@param instance the instance of the class, can be null
@param classLoader the classloader used for class instantiation
@param className the name of the class being constructed. If ... | [
"Returns",
"the",
"{",
"@code",
"instance",
"}",
"if",
"not",
"null",
"or",
"constructs",
"a",
"new",
"instance",
"of",
"the",
"class",
"using",
"{",
"@link",
"#newInstance",
"(",
"ClassLoader",
"String",
")",
"}",
"."
] | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java#L89-L101 | train | Gets the instance of the class with the specified name. | Create a Java method that does the following: "Gets the instance of the class with the specified name.". | Of course, here is the Java code you requested:
```java
public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className) {
if (instance != null) {
return instance;
} else if (className != null) {
try {
return ClassLoaderUtil.newInstance(clas... | |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.exclusiveBetween | @SuppressWarnings("boxing")
public static void exclusiveBetween(final long start, final long end, final long value) {
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_EXCLUSIVE_BET... | java | @SuppressWarnings("boxing")
public static void exclusiveBetween(final long start, final long end, final long value) {
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_EXCLUSIVE_BET... | [
"@",
"SuppressWarnings",
"(",
"\"boxing\"",
")",
"public",
"static",
"void",
"exclusiveBetween",
"(",
"final",
"long",
"start",
",",
"final",
"long",
"end",
",",
"final",
"long",
"value",
")",
"{",
"// TODO when breaking BC, consider returning value",
"if",
"(",
"... | Validate that the specified primitive value falls between the two
exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0, 2, 1);</pre>
@param start the exclusive start value
@param end the exclusive end value
@param value the value to validate
@throws IllegalArgumentException i... | [
"Validate",
"that",
"the",
"specified",
"primitive",
"value",
"falls",
"between",
"the",
"two",
"exclusive",
"values",
"specified",
";",
"otherwise",
"throws",
"an",
"exception",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1172-L1178 | train | Validate that the value is between the two exclusive values. | Create a Java method that does the following: "Validate that the value is between the two exclusive values.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("boxing")
public static void exclusiveBetween(final long start, final long end, final long value) {
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumen... | |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java | TempByteHolder.getString | public String getString(String character_encoding) throws java.io.UnsupportedEncodingException {
if (_file_mode) throw new IllegalStateException("data too large");
return new String(_memory_buffer,0,_write_pos,character_encoding);
} | java | public String getString(String character_encoding) throws java.io.UnsupportedEncodingException {
if (_file_mode) throw new IllegalStateException("data too large");
return new String(_memory_buffer,0,_write_pos,character_encoding);
} | [
"public",
"String",
"getString",
"(",
"String",
"character_encoding",
")",
"throws",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"{",
"if",
"(",
"_file_mode",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"data too large\"",
")",
";",
"return",
... | Returns buffered data as String using given character encoding.
@param character_encoding Name of character encoding to use for
converting bytes to String.
@return Buffered data as String.
@throws IllegalStateException when data is too large to be read this way.
@throws java.io.UnsupportedEncodingException when this en... | [
"Returns",
"buffered",
"data",
"as",
"String",
"using",
"given",
"character",
"encoding",
"."
] | a9252e62246ac33d55d51b993ba1159404e7d389 | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java#L242-L245 | train | Returns the contents of the file as a String. | Create a Java method that does the following: "Returns the contents of the file as a String.". | Of course, here is the Java code you requested:
```java
public String getString(String character_encoding) throws java.io.UnsupportedEncodingException {
if (_file_mode) throw new IllegalStateException("data too large");
return new String(_memory_buffer,0,_write_pos,character_encoding);
}
```
Hope ... | |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/model/ListDomainsResult.java | ListDomainsResult.setDomainNames | public void setDomainNames(java.util.Collection<String> domainNames) {
if (domainNames == null) {
this.domainNames = null;
return;
}
this.domainNames = new com.amazonaws.internal.SdkInternalList<String>(domainNames);
} | java | public void setDomainNames(java.util.Collection<String> domainNames) {
if (domainNames == null) {
this.domainNames = null;
return;
}
this.domainNames = new com.amazonaws.internal.SdkInternalList<String>(domainNames);
} | [
"public",
"void",
"setDomainNames",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"String",
">",
"domainNames",
")",
"{",
"if",
"(",
"domainNames",
"==",
"null",
")",
"{",
"this",
".",
"domainNames",
"=",
"null",
";",
"return",
";",
"}",
"this",
".... | A list of domain names that match the expression.
@param domainNames
A list of domain names that match the expression. | [
"A",
"list",
"of",
"domain",
"names",
"that",
"match",
"the",
"expression",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/model/ListDomainsResult.java#L50-L57 | train | Sets the value of the domainNames property. | Create a Java method that does the following: "Sets the value of the domainNames property.". | Of course, here is the Java code you requested:
```java
public void setDomainNames(java.util.Collection<String> domainNames) {
if (domainNames == null) {
this.domainNames = null;
return;
}
this.domainNames = new com.amazonaws.internal.SdkInternalList<String>(domainNames... | |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.createFailure | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
} | java | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
">",
"SuccessWithValue",
"<",
"DATATYPE",
">",
"createFailure",
"(",
"@",
"Nullable",
"final",
"DATATYPE",
"aValue",
")",
"{",
"return",
"new",
"SuccessWithValue",
"<>",
"(",
"ESuccess",
".",
"FAILURE",
",",... | Create a new failure object with the given value.
@param <DATATYPE>
The data type that is wrapped together with the success indicator
@param aValue
The value to be used. May be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"failure",
"object",
"with",
"the",
"given",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L200-L204 | train | Create a new failure with the passed value. | Create a Java method that does the following: "Create a new failure with the passed value.". | Of course, here is the Java code you requested:
```java
@Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
}
```
Hope this helps! | |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/XmlUtils.java | XmlUtils.getDomFromString | public static Document getDomFromString( String str )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
try {
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse( new InputSource( new ... | java | public static Document getDomFromString( String str )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
try {
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse( new InputSource( new ... | [
"public",
"static",
"Document",
"getDomFromString",
"(",
"String",
"str",
")",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"try",
"{",
"Do... | Parses a string and build a DOM
@return DOM | [
"Parses",
"a",
"string",
"and",
"build",
"a",
"DOM"
] | 20691e52e144014f99ca75cb7dedc7ba0c18586c | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/XmlUtils.java#L159-L170 | train | Get the DOM from the XML response. | Create a Java method that does the following: "Get the DOM from the XML response.". | Of course, here is the Java code you requested:
```java
public static Document getDomFromString( String str )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
try {
DocumentBuilder builder = factory.newDocumentBuilder()... | |
YahooArchive/samoa | samoa-s4/src/main/java/com/yahoo/labs/samoa/topology/impl/S4DoTask.java | S4DoTask.createPE | @Override
public <T extends ProcessingElement> T createPE(Class<T> type) {
return super.createPE(type);
} | java | @Override
public <T extends ProcessingElement> T createPE(Class<T> type) {
return super.createPE(type);
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"ProcessingElement",
">",
"T",
"createPE",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"super",
".",
"createPE",
"(",
"type",
")",
";",
"}"
] | /*
(non-Javadoc)
@see org.apache.s4.core.App#createPE(java.lang.Class) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-s4/src/main/java/com/yahoo/labs/samoa/topology/impl/S4DoTask.java#L209-L212 | train | Create a processing element of the given type. | Create a Java method that does the following: "Create a processing element of the given type.". | Of course, here is the Java code you requested:
```java
@Override
public <T extends ProcessingElement> T createPE(Class<T> type) {
return super.createPE(type);
}
```
Hope this helps! | |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/DigitalRadial.java | DigitalRadial.setValue | @Override
public void setValue(double value) {
super.setValue(value);
// Set active leds relating to the new value
calcNoOfActiveLed();
if (isValueCoupled()) {
setLcdValue(value);
}
repaint(getInnerBounds());
} | java | @Override
public void setValue(double value) {
super.setValue(value);
// Set active leds relating to the new value
calcNoOfActiveLed();
if (isValueCoupled()) {
setLcdValue(value);
}
repaint(getInnerBounds());
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"double",
"value",
")",
"{",
"super",
".",
"setValue",
"(",
"value",
")",
";",
"// Set active leds relating to the new value",
"calcNoOfActiveLed",
"(",
")",
";",
"if",
"(",
"isValueCoupled",
"(",
")",
")",
"... | <editor-fold defaultstate="collapsed" desc="Getters and Setters"> | [
"<editor",
"-",
"fold",
"defaultstate",
"=",
"collapsed",
"desc",
"=",
"Getters",
"and",
"Setters",
">"
] | c2f7b45a477757ef21bbb6a1174ddedb2250ae57 | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/DigitalRadial.java#L323-L334 | train | Sets the value of the CRAS language. | Create a Java method that does the following: "Sets the value of the CRAS language.". | Of course, here is the Java code you requested:
```java
@Override
public void setValue(double value) {
super.setValue(value);
// Set active leds relating to the new value
calcNoOfActiveLed();
if (isValueCoupled()) {
setLcdValue(value);
}
repaint(getInne... | |
vkostyukov/la4j | src/main/java/org/la4j/matrix/dense/Basic1DMatrix.java | Basic1DMatrix.from2DArray | public static Basic1DMatrix from2DArray(double[][] array) {
int rows = array.length;
int columns = array[0].length;
double[] array1D = new double[rows * columns];
int offset = 0;
for (int i = 0; i < rows; i++) {
System.arraycopy(array[i], 0, array1D, offset, columns)... | java | public static Basic1DMatrix from2DArray(double[][] array) {
int rows = array.length;
int columns = array[0].length;
double[] array1D = new double[rows * columns];
int offset = 0;
for (int i = 0; i < rows; i++) {
System.arraycopy(array[i], 0, array1D, offset, columns)... | [
"public",
"static",
"Basic1DMatrix",
"from2DArray",
"(",
"double",
"[",
"]",
"[",
"]",
"array",
")",
"{",
"int",
"rows",
"=",
"array",
".",
"length",
";",
"int",
"columns",
"=",
"array",
"[",
"0",
"]",
".",
"length",
";",
"double",
"[",
"]",
"array1D... | Creates a {@link Basic1DMatrix} of the given 2D {@code array} with
copying the underlying array. | [
"Creates",
"a",
"{"
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/dense/Basic1DMatrix.java#L146-L158 | train | Create a Basic1DMatrix from 2D double array. | Create a Java method that does the following: "Create a Basic1DMatrix from 2D double array.". | Of course, here is the Java code you requested:
```java
public static Basic1DMatrix from2DArray(double[][] array) {
int rows = array.length;
int columns = array[0].length;
double[] array1D = new double[rows * columns];
int offset = 0;
for (int i = 0; i < rows; i++) {
... | |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.sequenceMethod | private void sequenceMethod(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, String apiName, String groupName) {
pendingSequenceMethods.put(className, classWriter -> createSequence(classWriter, xsdElements, className, interfaceIndex, apiName, groupName));
} | java | private void sequenceMethod(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, String apiName, String groupName) {
pendingSequenceMethods.put(className, classWriter -> createSequence(classWriter, xsdElements, className, interfaceIndex, apiName, groupName));
} | [
"private",
"void",
"sequenceMethod",
"(",
"Stream",
"<",
"XsdAbstractElement",
">",
"xsdElements",
",",
"String",
"className",
",",
"int",
"interfaceIndex",
",",
"String",
"apiName",
",",
"String",
"groupName",
")",
"{",
"pendingSequenceMethods",
".",
"put",
"(",
... | Postpones the sequence method creation due to solution design.
@param xsdElements A {@link Stream} of {@link XsdElement}, ordered, that represent the sequence.
@param className The className of the element which contains this sequence.
@param interfaceIndex The current interfaceIndex that serves as a base to distinguis... | [
"Postpones",
"the",
"sequence",
"method",
"creation",
"due",
"to",
"solution",
"design",
"."
] | ccb78f9dd4b957ad5ac1ca349eaf24338c421e94 | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L370-L372 | train | Create a sequence method. | Create a Java method that does the following: "Create a sequence method.". | Of course, here is the Java code you requested:
```java
private void sequenceMethod(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, String apiName, String groupName) {
pendingSequenceMethods.put(className, classWriter -> createSequence(classWriter, xsdElements, className, interfac... | |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/io/TileReader.java | TileReader.readFormatTiles | private static int readFormatTiles(GeoPackage geoPackage, String tileTable,
String imageFormat, TileFormatType tileType, boolean rawImage,
TileDirectory tileDirectory) throws IOException, SQLException {
int created = 0;
// Find the bounding box that includes all the zoom levels
BoundingBox webMercatorBoun... | java | private static int readFormatTiles(GeoPackage geoPackage, String tileTable,
String imageFormat, TileFormatType tileType, boolean rawImage,
TileDirectory tileDirectory) throws IOException, SQLException {
int created = 0;
// Find the bounding box that includes all the zoom levels
BoundingBox webMercatorBoun... | [
"private",
"static",
"int",
"readFormatTiles",
"(",
"GeoPackage",
"geoPackage",
",",
"String",
"tileTable",
",",
"String",
"imageFormat",
",",
"TileFormatType",
"tileType",
",",
"boolean",
"rawImage",
",",
"TileDirectory",
"tileDirectory",
")",
"throws",
"IOException"... | Read formatted tiles into a GeoPackage
@param geoPackage
@param tileTable
@param imageFormat
@param tileType
@param rawImage
@param tileDirectory
@return
@throws IOException
@throws SQLException | [
"Read",
"formatted",
"tiles",
"into",
"a",
"GeoPackage"
] | 889bffb5d18330a3f4bd89443acf7959ebe3a376 | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/io/TileReader.java#L511-L837 | train | Read the tiles from the tile directory. | Create a Java method that does the following: "Read the tiles from the tile directory.". | Of course, here is the Java code you requested:
```java
private static int readFormatTiles(GeoPackage geoPackage, String tileTable,
String imageFormat, TileFormatType tileType, boolean rawImage,
TileDirectory tileDirectory) throws IOException, SQLException {
int created = 0;
// Find the bounding box that i... | |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java | KeyManagementServiceClient.getKeyRing | public final KeyRing getKeyRing(String name) {
GetKeyRingRequest request = GetKeyRingRequest.newBuilder().setName(name).build();
return getKeyRing(request);
} | java | public final KeyRing getKeyRing(String name) {
GetKeyRingRequest request = GetKeyRingRequest.newBuilder().setName(name).build();
return getKeyRing(request);
} | [
"public",
"final",
"KeyRing",
"getKeyRing",
"(",
"String",
"name",
")",
"{",
"GetKeyRingRequest",
"request",
"=",
"GetKeyRingRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"getKeyRing",
"(",
... | Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].
<p>Sample code:
<pre><code>
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
KeyRing response = keyManagementServiceClient... | [
"Returns",
"metadata",
"for",
"a",
"given",
"[",
"KeyRing",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
".",
"KeyRing",
"]",
"."
] | d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L614-L618 | train | Gets a KeyRing by name. | Create a Java method that does the following: "Gets a KeyRing by name.". | Of course, here is the Java code you requested:
```java
public final KeyRing getKeyRing(String name) {
GetKeyRingRequest request = GetKeyRingRequest.newBuilder().setName(name).build();
return getKeyRing(request);
}
```
Hope this helps! | |
attribyte/wpdb | src/main/java/org/attribyte/wp/model/User.java | User.withMetadata | public User withMetadata(final List<Meta> metadata) {
return new User(id, username, displayName, slug, email, createTimestamp, url, metadata);
} | java | public User withMetadata(final List<Meta> metadata) {
return new User(id, username, displayName, slug, email, createTimestamp, url, metadata);
} | [
"public",
"User",
"withMetadata",
"(",
"final",
"List",
"<",
"Meta",
">",
"metadata",
")",
"{",
"return",
"new",
"User",
"(",
"id",
",",
"username",
",",
"displayName",
",",
"slug",
",",
"email",
",",
"createTimestamp",
",",
"url",
",",
"metadata",
")",
... | Creates a user with added metadata.
@param metadata The metadata.
@return The user with metadata added. | [
"Creates",
"a",
"user",
"with",
"added",
"metadata",
"."
] | b9adf6131dfb67899ebff770c9bfeb001cc42f30 | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/User.java#L147-L149 | train | Create a new user with the specified metadata. | Create a Java method that does the following: "Create a new user with the specified metadata.". | Of course, here is the Java code you requested:
```java
public User withMetadata(final List<Meta> metadata) {
return new User(id, username, displayName, slug, email, createTimestamp, url, metadata);
}
```
Hope this helps! | |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | BaseXMLBuilder.attributeImpl | protected void attributeImpl(String name, String value) {
if (! (this.xmlNode instanceof Element)) {
throw new RuntimeException(
"Cannot add an attribute to non-Element underlying node: "
+ this.xmlNode);
}
((Element) xmlNode).setAttribute(name, value)... | java | protected void attributeImpl(String name, String value) {
if (! (this.xmlNode instanceof Element)) {
throw new RuntimeException(
"Cannot add an attribute to non-Element underlying node: "
+ this.xmlNode);
}
((Element) xmlNode).setAttribute(name, value)... | [
"protected",
"void",
"attributeImpl",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"xmlNode",
"instanceof",
"Element",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Cannot add an attribute to non-Element... | Add a named attribute value to the element for this builder node.
@param name
the attribute's name.
@param value
the attribute's value. | [
"Add",
"a",
"named",
"attribute",
"value",
"to",
"the",
"element",
"for",
"this",
"builder",
"node",
"."
] | 7c224b8e8ed79808509322cb141dab5a88dd3cec | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L806-L813 | train | Add an attribute to the XML Node. | Create a Java method that does the following: "Add an attribute to the XML Node.". | Of course, here is the Java code you requested:
```java
protected void attributeImpl(String name, String value) {
if (! (this.xmlNode instanceof Element)) {
throw new RuntimeException(
"Cannot add an attribute to non-Element underlying node: "
+ this.xmlNode);
... | |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbservice.java | gslbservice.unset | public static base_responses unset(nitro_service client, gslbservice resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbservice unsetresources[] = new gslbservice[resources.length];
for (int i=0;i<resources.length;i++){
unsetr... | java | public static base_responses unset(nitro_service client, gslbservice resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbservice unsetresources[] = new gslbservice[resources.length];
for (int i=0;i<resources.length;i++){
unsetr... | [
"public",
"static",
"base_responses",
"unset",
"(",
"nitro_service",
"client",
",",
"gslbservice",
"resources",
"[",
"]",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
... | Use this API to unset the properties of gslbservice resources.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"gslbservice",
"resources",
".",
"Properties",
"that",
"need",
"to",
"be",
"unset",
"are",
"specified",
"in",
"args",
"array",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbservice.java#L1086-L1097 | train | Use this API to unset the properties of gslbservice resources. Properties that need to be unset are specified in args array. | Create a Java method that does the following: "Use this API to unset the properties of gslbservice resources. Properties that need to be unset are specified in args array.". | Of course, here is the Java code you requested:
```java
public static base_responses unset(nitro_service client, gslbservice resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbservice unsetresources[] = new gslbservice[resources.len... | |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClob.java | JDBCClob.getSubString | public String getSubString(long pos,
final int length) throws SQLException {
final String ldata = data;
checkValid(ldata);
final int dlen = ldata.length();
if (pos < MIN_POS || pos > dlen) {
Util.outOfRangeArgument("pos: " + pos);
}
... | java | public String getSubString(long pos,
final int length) throws SQLException {
final String ldata = data;
checkValid(ldata);
final int dlen = ldata.length();
if (pos < MIN_POS || pos > dlen) {
Util.outOfRangeArgument("pos: " + pos);
}
... | [
"public",
"String",
"getSubString",
"(",
"long",
"pos",
",",
"final",
"int",
"length",
")",
"throws",
"SQLException",
"{",
"final",
"String",
"ldata",
"=",
"data",
";",
"checkValid",
"(",
"ldata",
")",
";",
"final",
"int",
"dlen",
"=",
"ldata",
".",
"len... | Retrieves a copy of the specified substring
in the <code>CLOB</code> value
designated by this <code>Clob</code> object.
The substring begins at position
<code>pos</code> and has up to <code>length</code> consecutive
characters.
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h... | [
"Retrieves",
"a",
"copy",
"of",
"the",
"specified",
"substring",
"in",
"the",
"<code",
">",
"CLOB<",
"/",
"code",
">",
"value",
"designated",
"by",
"this",
"<code",
">",
"Clob<",
"/",
"code",
">",
"object",
".",
"The",
"substring",
"begins",
"at",
"posit... | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClob.java#L189-L209 | train | Get a substring of the data in the specified position. | Create a Java method that does the following: "Get a substring of the data in the specified position.". | Of course, here is the Java code you requested:
```java
public String getSubString(long pos,
final int length) throws SQLException {
final String ldata = data;
checkValid(ldata);
final int dlen = ldata.length();
if (pos < MIN_POS || pos > dlen) {
... | |
youseries/urule | urule-console/src/main/java/com/bstek/urule/console/repository/database/DbPersistenceManager.java | DbPersistenceManager.existsReferencesTo | public synchronized boolean existsReferencesTo(NodeId targetId) throws ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
ResultSet rs = null;
try {
rs = conHelper.exec(nodeReferenceSelectSQL, getKey(targetId), false, 0... | java | public synchronized boolean existsReferencesTo(NodeId targetId) throws ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
ResultSet rs = null;
try {
rs = conHelper.exec(nodeReferenceSelectSQL, getKey(targetId), false, 0... | [
"public",
"synchronized",
"boolean",
"existsReferencesTo",
"(",
"NodeId",
"targetId",
")",
"throws",
"ItemStateException",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"not initialized\"",
")",
";",
"}",
"ResultSet",
... | {@inheritDoc} | [
"{"
] | 3fa0eb4439e97aa292e744bcbd88a9faa36661d8 | https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-console/src/main/java/com/bstek/urule/console/repository/database/DbPersistenceManager.java#L1056-L1075 | train | Checks if a node reference exists to the target node id. | Create a Java method that does the following: "Checks if a node reference exists to the target node id.". | Of course, here is the Java code you requested:
```java
public synchronized boolean existsReferencesTo(NodeId targetId) throws ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
ResultSet rs = null;
try {
rs = conHelpe... | |
zaproxy/zaproxy | src/org/parosproxy/paros/extension/filter/ExtensionFilter.java | ExtensionFilter.destroy | @Override
public void destroy() {
if (timerFilterThread != null) {
timerFilterThread.setStopped();
timerFilterThread = null;
}
Filter filter = null;
for (int i=0; i<filterFactory.getAllFilter().size(); i++) {
// ZAP: Removed unnecessary c... | java | @Override
public void destroy() {
if (timerFilterThread != null) {
timerFilterThread.setStopped();
timerFilterThread = null;
}
Filter filter = null;
for (int i=0; i<filterFactory.getAllFilter().size(); i++) {
// ZAP: Removed unnecessary c... | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"timerFilterThread",
"!=",
"null",
")",
"{",
"timerFilterThread",
".",
"setStopped",
"(",
")",
";",
"timerFilterThread",
"=",
"null",
";",
"}",
"Filter",
"filter",
"=",
"null",
";",
... | Destroy every filter during extension destroy. | [
"Destroy",
"every",
"filter",
"during",
"extension",
"destroy",
"."
] | 0cbe5121f2ae1ecca222513d182759210c569bec | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/filter/ExtensionFilter.java#L247-L264 | train | Destroy the related records. | Create a Java method that does the following: "Destroy the related records.". | Of course, here is the Java code you requested:
```java
@Override
public void destroy() {
if (timerFilterThread != null) {
timerFilterThread.setStopped();
timerFilterThread = null;
}
Filter filter = null;
for (int i=0; i<filterFactory.getAllFilter().... | |
morimekta/providence | providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/program/extras/HazelcastPortableProgramFormatter.java | HazelcastPortableProgramFormatter.appendPopulateMethod | private void appendPopulateMethod(List<CStructDescriptor> messages) {
writer.formatln("public static final %s populateConfig(%s %s, int %s) {",
Config.class.getName(),
Config.class.getName(),
CONFIG,
PORTABLE_VERSION... | java | private void appendPopulateMethod(List<CStructDescriptor> messages) {
writer.formatln("public static final %s populateConfig(%s %s, int %s) {",
Config.class.getName(),
Config.class.getName(),
CONFIG,
PORTABLE_VERSION... | [
"private",
"void",
"appendPopulateMethod",
"(",
"List",
"<",
"CStructDescriptor",
">",
"messages",
")",
"{",
"writer",
".",
"formatln",
"(",
"\"public static final %s populateConfig(%s %s, int %s) {\"",
",",
"Config",
".",
"class",
".",
"getName",
"(",
")",
",",
"Co... | Method to append populate methods for the Hazelcast Config.
@param messages List with CStructDescriptor to iterate through.
<pre>
{@code
public static final com.hazelcast.config.Config populateConfig(com.hazelcast.config.Config config) {
PortableFactoryImpl instance = new PortableFactoryImpl();
config.getSerialization... | [
"Method",
"to",
"append",
"populate",
"methods",
"for",
"the",
"Hazelcast",
"Config",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/program/extras/HazelcastPortableProgramFormatter.java#L205-L232 | train | Append populate method. | Create a Java method that does the following: "Append populate method.". | Of course, here is the Java code you requested:
```java
private void appendPopulateMethod(List<CStructDescriptor> messages) {
writer.formatln("public static final %s populateConfig(%s %s, int %s) {",
Config.class.getName(),
Config.class.getName(),
... | |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/NarAssemblyMojo.java | NarAssemblyMojo.narExecute | @Override
public final void narExecute() throws MojoExecutionException, MojoFailureException {
// download the dependencies if needed in local maven repository.
List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries);
downloadAttachedNars(attachedNarArtifacts);
// Warning,... | java | @Override
public final void narExecute() throws MojoExecutionException, MojoFailureException {
// download the dependencies if needed in local maven repository.
List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries);
downloadAttachedNars(attachedNarArtifacts);
// Warning,... | [
"@",
"Override",
"public",
"final",
"void",
"narExecute",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"// download the dependencies if needed in local maven repository.",
"List",
"<",
"AttachedNarArtifact",
">",
"attachedNarArtifacts",
"=",
... | Copies the unpacked nar libraries and files into the projects target area | [
"Copies",
"the",
"unpacked",
"nar",
"libraries",
"and",
"files",
"into",
"the",
"projects",
"target",
"area"
] | 3c622e2024296b4203431bbae3bde290a01dac00 | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/NarAssemblyMojo.java#L56-L104 | train | Execute the nar command. | Create a Java method that does the following: "Execute the nar command.". | Of course, here is the Java code you requested:
```java
@Override
public final void narExecute() throws MojoExecutionException, MojoFailureException {
// download the dependencies if needed in local maven repository.
List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries);
dow... | |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java | AbstractGauge.setAutoResetToZero | public void setAutoResetToZero(final boolean AUTO_RESET_TO_ZERO) {
model.setAutoResetToZero(AUTO_RESET_TO_ZERO);
if (model.isAutoResetToZero()) {
setThresholdVisible(false);
setLedVisible(false);
}
} | java | public void setAutoResetToZero(final boolean AUTO_RESET_TO_ZERO) {
model.setAutoResetToZero(AUTO_RESET_TO_ZERO);
if (model.isAutoResetToZero()) {
setThresholdVisible(false);
setLedVisible(false);
}
} | [
"public",
"void",
"setAutoResetToZero",
"(",
"final",
"boolean",
"AUTO_RESET_TO_ZERO",
")",
"{",
"model",
".",
"setAutoResetToZero",
"(",
"AUTO_RESET_TO_ZERO",
")",
";",
"if",
"(",
"model",
".",
"isAutoResetToZero",
"(",
")",
")",
"{",
"setThresholdVisible",
"(",
... | Enables/disables the mode where the gauge
will return to zero after a value was set.
Means if you set a value the pointer will
move to this value and after it reached the
given value it will return back to zero.
@param AUTO_RESET_TO_ZERO | [
"Enables",
"/",
"disables",
"the",
"mode",
"where",
"the",
"gauge",
"will",
"return",
"to",
"zero",
"after",
"a",
"value",
"was",
"set",
".",
"Means",
"if",
"you",
"set",
"a",
"value",
"the",
"pointer",
"will",
"move",
"to",
"this",
"value",
"and",
"af... | c2f7b45a477757ef21bbb6a1174ddedb2250ae57 | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java#L406-L413 | train | Sets the AutoResetToZero property. | Create a Java method that does the following: "Sets the AutoResetToZero property.". | Of course, here is the Java code you requested:
```java
public void setAutoResetToZero(final boolean AUTO_RESET_TO_ZERO) {
model.setAutoResetToZero(AUTO_RESET_TO_ZERO);
if (model.isAutoResetToZero()) {
setThresholdVisible(false);
setLedVisible(false);
}
}
```
Hope ... | |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java | AbstractInterfaceConfig.getMethodConfigValue | public Object getMethodConfigValue(String methodName, String configKey) {
if (configValueCache == null) {
return null;
}
String key = buildmkey(methodName, configKey);
return configValueCache.get(key);
} | java | public Object getMethodConfigValue(String methodName, String configKey) {
if (configValueCache == null) {
return null;
}
String key = buildmkey(methodName, configKey);
return configValueCache.get(key);
} | [
"public",
"Object",
"getMethodConfigValue",
"(",
"String",
"methodName",
",",
"String",
"configKey",
")",
"{",
"if",
"(",
"configValueCache",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"key",
"=",
"buildmkey",
"(",
"methodName",
",",
"conf... | 得到方法级配置,找不到则返回null
@param methodName 方法名
@param configKey 配置key,例如参数
@return 配置值 method config value | [
"得到方法级配置,找不到则返回null"
] | a31406410291e56696185a29c3ba4bd1f54488fd | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java#L958-L964 | train | Gets the value of a method configuration property. | Create a Java method that does the following: "Gets the value of a method configuration property.". | Of course, here is the Java code you requested:
```java
public Object getMethodConfigValue(String methodName, String configKey) {
if (configValueCache == null) {
return null;
}
String key = buildmkey(methodName, configKey);
return configValueCache.get(key);
}
```
Hope t... | |
jpelzer/pelzer-util | src/main/java/com/pelzer/util/StringMan.java | StringMan.getNullAsValue | public static String getNullAsValue(String input, String value) {
return (input == null) ? value : input;
} | java | public static String getNullAsValue(String input, String value) {
return (input == null) ? value : input;
} | [
"public",
"static",
"String",
"getNullAsValue",
"(",
"String",
"input",
",",
"String",
"value",
")",
"{",
"return",
"(",
"input",
"==",
"null",
")",
"?",
"value",
":",
"input",
";",
"}"
] | Returns the specified string value if input is null, otherwise returns the original input
string untouched.
@param input
String to be evaluated
@param value
String to substitute if input is null | [
"Returns",
"the",
"specified",
"string",
"value",
"if",
"input",
"is",
"null",
"otherwise",
"returns",
"the",
"original",
"input",
"string",
"untouched",
"."
] | ec14f2573fd977d1442dba5d1507a264f5ea9aa6 | https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/StringMan.java#L51-L53 | train | Returns the input string as a value if it is null. | Create a Java method that does the following: "Returns the input string as a value if it is null.". | Of course, here is the Java code you requested:
```java
public static String getNullAsValue(String input, String value) {
return (input == null) ? value : input;
}
```
Hope this helps! | |
Manabu-GT/EtsyBlur | sample/src/main/java/com/ms/square/android/etsyblurdemo/ui/fragment/NavigationDrawerFragment.java | NavigationDrawerFragment.setUp | public void setUp(int fragmentId, final DrawerLayout drawerLayout) {
fragmentContainerView = getActivity().findViewById(fragmentId);
this.drawerLayout = drawerLayout;
// Set the custom scrim color (the overlay color) for the etsy like effect
drawerLayout.setScrimColor(ContextCompat.getC... | java | public void setUp(int fragmentId, final DrawerLayout drawerLayout) {
fragmentContainerView = getActivity().findViewById(fragmentId);
this.drawerLayout = drawerLayout;
// Set the custom scrim color (the overlay color) for the etsy like effect
drawerLayout.setScrimColor(ContextCompat.getC... | [
"public",
"void",
"setUp",
"(",
"int",
"fragmentId",
",",
"final",
"DrawerLayout",
"drawerLayout",
")",
"{",
"fragmentContainerView",
"=",
"getActivity",
"(",
")",
".",
"findViewById",
"(",
"fragmentId",
")",
";",
"this",
".",
"drawerLayout",
"=",
"drawerLayout"... | Users of this fragment must call this method to set up the navigation drawer interactions.
@param fragmentId The android:id of this fragment in its activity's layout.
@param drawerLayout The DrawerLayout containing this fragment's UI. | [
"Users",
"of",
"this",
"fragment",
"must",
"call",
"this",
"method",
"to",
"set",
"up",
"the",
"navigation",
"drawer",
"interactions",
"."
] | b51c9e80e823fce3590cc061e79e267388b4d8e0 | https://github.com/Manabu-GT/EtsyBlur/blob/b51c9e80e823fce3590cc061e79e267388b4d8e0/sample/src/main/java/com/ms/square/android/etsyblurdemo/ui/fragment/NavigationDrawerFragment.java#L124-L198 | train | Set up the action bar drawer. | Create a Java method that does the following: "Set up the action bar drawer.". | Of course, here is the Java code you requested:
```java
public void setUp(int fragmentId, final DrawerLayout drawerLayout) {
fragmentContainerView = getActivity().findViewById(fragmentId);
this.drawerLayout = drawerLayout;
// Set the custom scrim color (the overlay color) for the etsy like eff... | |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeRouteTablesRequest.java | DescribeRouteTablesRequest.getRouteTableIds | public java.util.List<String> getRouteTableIds() {
if (routeTableIds == null) {
routeTableIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return routeTableIds;
} | java | public java.util.List<String> getRouteTableIds() {
if (routeTableIds == null) {
routeTableIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return routeTableIds;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"getRouteTableIds",
"(",
")",
"{",
"if",
"(",
"routeTableIds",
"==",
"null",
")",
"{",
"routeTableIds",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"St... | <p>
One or more route table IDs.
</p>
<p>
Default: Describes all your route tables.
</p>
@return One or more route table IDs.</p>
<p>
Default: Describes all your route tables. | [
"<p",
">",
"One",
"or",
"more",
"route",
"table",
"IDs",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Default",
":",
"Describes",
"all",
"your",
"route",
"tables",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeRouteTablesRequest.java#L1236-L1241 | train | Gets the value of the routeTableIds property. | Create a Java method that does the following: "Gets the value of the routeTableIds property.". | Of course, here is the Java code you requested:
```java
public java.util.List<String> getRouteTableIds() {
if (routeTableIds == null) {
routeTableIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return routeTableIds;
}
```
Hope this helps! | |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Polygon.java | Polygon.isLinearRing | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | java | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | [
"private",
"static",
"boolean",
"isLinearRing",
"(",
"LineString",
"lineString",
")",
"{",
"if",
"(",
"lineString",
".",
"coordinates",
"(",
")",
".",
"size",
"(",
")",
"<",
"4",
")",
"{",
"throw",
"new",
"GeoJsonException",
"(",
"\"LinearRings need to be made... | Checks to ensure that the LineStrings defining the polygon correctly and adhering to the linear
ring rules.
@param lineString {@link LineString} the polygon geometry
@return true if number of coordinates are 4 or more, and first and last coordinates
are identical, else false
@throws GeoJsonException if number of coord... | [
"Checks",
"to",
"ensure",
"that",
"the",
"LineStrings",
"defining",
"the",
"polygon",
"correctly",
"and",
"adhering",
"to",
"the",
"linear",
"ring",
"rules",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Polygon.java#L385-L394 | train | Checks if the LineString is a LinearRing. | Create a Java method that does the following: "Checks if the LineString is a LinearRing.". | Of course, here is the Java code you requested:
```java
private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
... | |
nyla-solutions/gedi-geode | gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/operations/stats/GfStatsReader.java | GfStatsReader.main | public static void main(String[] args)
{
File archiveFile, csvFile;
if(args.length < 1)
{
System.err.println("Usage: java "+GfStatsReader.class.getName()+" archiveFile [csvFile [statName ]*]");
return;
}
try
{
archiveFile = Paths.get(args[0]).toFile();
if(archiveFile.isDirectory())
... | java | public static void main(String[] args)
{
File archiveFile, csvFile;
if(args.length < 1)
{
System.err.println("Usage: java "+GfStatsReader.class.getName()+" archiveFile [csvFile [statName ]*]");
return;
}
try
{
archiveFile = Paths.get(args[0]).toFile();
if(archiveFile.isDirectory())
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"File",
"archiveFile",
",",
"csvFile",
";",
"if",
"(",
"args",
".",
"length",
"<",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Usage: java \"",
"+",
"GfSt... | Main method to extract GF Stats to file
@param args archiveFile csvFile [statName ]* | [
"Main",
"method",
"to",
"extract",
"GF",
"Stats",
"to",
"file"
] | 3dd71d6e66e941ce350b306b70677ee95a7d9eee | https://github.com/nyla-solutions/gedi-geode/blob/3dd71d6e66e941ce350b306b70677ee95a7d9eee/gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/operations/stats/GfStatsReader.java#L969-L1021 | test | Main method to run the CVTS stats reader. | Create a Java method that does the following: "Main method to run the CVTS stats reader.". | Of course, here is the Java code you requested:
```java
public static void main(String[] args)
{
File archiveFile, csvFile;
if(args.length < 1)
{
System.err.println("Usage: java "+GfStatsReader.class.getName()+" archiveFile [csvFile [statName ]*]");
return;
}
try
{
archiveFile = Paths.get(args... | |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201805/BuyerRfp.java | BuyerRfp.getAdExchangeEnvironment | public com.google.api.ads.admanager.axis.v201805.AdExchangeEnvironment getAdExchangeEnvironment() {
return adExchangeEnvironment;
} | java | public com.google.api.ads.admanager.axis.v201805.AdExchangeEnvironment getAdExchangeEnvironment() {
return adExchangeEnvironment;
} | [
"public",
"com",
".",
"google",
".",
"api",
".",
"ads",
".",
"admanager",
".",
"axis",
".",
"v201805",
".",
"AdExchangeEnvironment",
"getAdExchangeEnvironment",
"(",
")",
"{",
"return",
"adExchangeEnvironment",
";",
"}"
] | Gets the adExchangeEnvironment value for this BuyerRfp.
@return adExchangeEnvironment * Identifies the format of the inventory or "channel" through
which the ad serves. Environments
currently supported include {@link AdExchangeEnvironment#DISPLAY},
{@link AdExchangeEnvironment#VIDEO}, and {@link AdExchangeEnvironmen... | [
"Gets",
"the",
"adExchangeEnvironment",
"value",
"for",
"this",
"BuyerRfp",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201805/BuyerRfp.java#L530-L532 | train | Gets the adExchangeEnvironment value for this BaseAdUnit. | Create a Java method that does the following: "Gets the adExchangeEnvironment value for this BaseAdUnit.". | Of course, here is the Java code you requested:
```java
public com.google.api.ads.admanager.axis.v201805.AdExchangeEnvironment getAdExchangeEnvironment() {
return adExchangeEnvironment;
}
```
Hope this helps! | |
Netflix/astyanax | astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java | ThriftKeyspaceImpl.toThriftKeyspaceDefinition | private ThriftKeyspaceDefinitionImpl toThriftKeyspaceDefinition(final Map<String, Object> options) {
ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(op... | java | private ThriftKeyspaceDefinitionImpl toThriftKeyspaceDefinition(final Map<String, Object> options) {
ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(op... | [
"private",
"ThriftKeyspaceDefinitionImpl",
"toThriftKeyspaceDefinition",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"ThriftKeyspaceDefinitionImpl",
"def",
"=",
"new",
"ThriftKeyspaceDefinitionImpl",
"(",
")",
";",
"Map",
"<",
"String"... | Convert a Map of options to an internal thrift keyspace definition
@param options | [
"Convert",
"a",
"Map",
"of",
"options",
"to",
"an",
"internal",
"thrift",
"keyspace",
"definition"
] | bcc3fd26e2dda05a923751aa32b139f6209fecdf | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java#L800-L819 | train | Converts the options to a ThriftKeyspaceDefinition object. | Create a Java method that does the following: "Converts the options to a ThriftKeyspaceDefinition object.". | Of course, here is the Java code you requested:
```java
private ThriftKeyspaceDefinitionImpl toThriftKeyspaceDefinition(final Map<String, Object> options) {
ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
i... | |
jenkinsci/jenkins | core/src/main/java/hudson/ProxyConfiguration.java | ProxyConfiguration.getNoProxyHostPatterns | public static List<Pattern> getNoProxyHostPatterns(String noProxyHost) {
if (noProxyHost==null) return Collections.emptyList();
List<Pattern> r = Lists.newArrayList();
for (String s : noProxyHost.split("[ \t\n,|]+")) {
if (s.length()==0) continue;
r.add(Pattern.compile... | java | public static List<Pattern> getNoProxyHostPatterns(String noProxyHost) {
if (noProxyHost==null) return Collections.emptyList();
List<Pattern> r = Lists.newArrayList();
for (String s : noProxyHost.split("[ \t\n,|]+")) {
if (s.length()==0) continue;
r.add(Pattern.compile... | [
"public",
"static",
"List",
"<",
"Pattern",
">",
"getNoProxyHostPatterns",
"(",
"String",
"noProxyHost",
")",
"{",
"if",
"(",
"noProxyHost",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"List",
"<",
"Pattern",
">",
"r",
"=",... | Returns the list of properly formatted no proxy host names. | [
"Returns",
"the",
"list",
"of",
"properly",
"formatted",
"no",
"proxy",
"host",
"names",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/ProxyConfiguration.java#L187-L196 | train | Get no proxy host patterns. | Create a Java method that does the following: "Get no proxy host patterns.". | Of course, here is the Java code you requested:
```java
public static List<Pattern> getNoProxyHostPatterns(String noProxyHost) {
if (noProxyHost==null) return Collections.emptyList();
List<Pattern> r = Lists.newArrayList();
for (String s : noProxyHost.split("[ \t\n,|]+")) {
if (s.... | |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/profile/definition/ProfileDefinition.java | ProfileDefinition.primary | protected void primary(final String name, final AttributeConverter<? extends Object> converter) {
primaries.add(name);
converters.put(name, converter);
} | java | protected void primary(final String name, final AttributeConverter<? extends Object> converter) {
primaries.add(name);
converters.put(name, converter);
} | [
"protected",
"void",
"primary",
"(",
"final",
"String",
"name",
",",
"final",
"AttributeConverter",
"<",
"?",
"extends",
"Object",
">",
"converter",
")",
"{",
"primaries",
".",
"add",
"(",
"name",
")",
";",
"converters",
".",
"put",
"(",
"name",
",",
"co... | Add an attribute as a primary one and its converter.
@param name name of the attribute
@param converter converter | [
"Add",
"an",
"attribute",
"as",
"a",
"primary",
"one",
"and",
"its",
"converter",
"."
] | d9cd029f8783792b31dd48bf1e32f80628f2c4a3 | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/profile/definition/ProfileDefinition.java#L116-L119 | train | Add a primary class. | Create a Java method that does the following: "Add a primary class.". | Of course, here is the Java code you requested:
```java
protected void primary(final String name, final AttributeConverter<? extends Object> converter) {
primaries.add(name);
converters.put(name, converter);
}
```
Hope this helps! | |
inversoft/restify | src/main/java/com/inversoft/net/ssl/SSLTools.java | SSLTools.getSSLSocketFactory | public static SSLSocketFactory getSSLSocketFactory(String certificateString) throws CertificateException,
KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException {
byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END);
X509Certific... | java | public static SSLSocketFactory getSSLSocketFactory(String certificateString) throws CertificateException,
KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException {
byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END);
X509Certific... | [
"public",
"static",
"SSLSocketFactory",
"getSSLSocketFactory",
"(",
"String",
"certificateString",
")",
"throws",
"CertificateException",
",",
"KeyStoreException",
",",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"UnrecoverableKeyException",
",",
"KeyManagementExceptio... | This creates an in-memory keystore containing the certificate and initializes the SSLContext with the the trust
material it contains.
<p>
With HttpsURLConnection con, set the connection to use the SSLSocketFactory before {@code con.connect()}: {@code
con.setSSLSocketFactory(sslSocketFactory)}
@param certificateString ... | [
"This",
"creates",
"an",
"in",
"-",
"memory",
"keystore",
"containing",
"the",
"certificate",
"and",
"initializes",
"the",
"SSLContext",
"with",
"the",
"the",
"trust",
"material",
"it",
"contains",
".",
"<p",
">",
"With",
"HttpsURLConnection",
"con",
"set",
"t... | f2426d9082e00a9d958af28f78ccda61802c6700 | https://github.com/inversoft/restify/blob/f2426d9082e00a9d958af28f78ccda61802c6700/src/main/java/com/inversoft/net/ssl/SSLTools.java#L154-L171 | train | Get an SSLSocketFactory from a PEM formatted certificate string. | Create a Java method that does the following: "Get an SSLSocketFactory from a PEM formatted certificate string.". | Of course, here is the Java code you requested:
```java
public static SSLSocketFactory getSSLSocketFactory(String certificateString) throws CertificateException,
KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException {
byte[] certBytes = parseDERFromPEM(ce... | |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/modes/CBCBlockCipher.java | CBCBlockCipher.decrypt | public byte[] decrypt(byte[] iv, byte[] data) throws IntegrityException {
if (data.length % blockSize != 0) {
throw new IntegrityException("Incorrect data size");
}
if (iv.length != blockSize) {
throw new IntegrityException("Incorrect iv size");
}
byte[] ... | java | public byte[] decrypt(byte[] iv, byte[] data) throws IntegrityException {
if (data.length % blockSize != 0) {
throw new IntegrityException("Incorrect data size");
}
if (iv.length != blockSize) {
throw new IntegrityException("Incorrect iv size");
}
byte[] ... | [
"public",
"byte",
"[",
"]",
"decrypt",
"(",
"byte",
"[",
"]",
"iv",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IntegrityException",
"{",
"if",
"(",
"data",
".",
"length",
"%",
"blockSize",
"!=",
"0",
")",
"{",
"throw",
"new",
"IntegrityException",
... | Decrypting data
@param iv initialization vector
@param data data for decryption
@return decrypted data | [
"Decrypting",
"data"
] | 5123c1584757c6eeea0ed2a0e7e043629871a0c6 | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/modes/CBCBlockCipher.java#L60-L71 | train | Decrypt a byte array using the specified iv. | Create a Java method that does the following: "Decrypt a byte array using the specified iv.". | Of course, here is the Java code you requested:
```java
public byte[] decrypt(byte[] iv, byte[] data) throws IntegrityException {
if (data.length % blockSize != 0) {
throw new IntegrityException("Incorrect data size");
}
if (iv.length != blockSize) {
throw new IntegrityE... | |
aws/aws-sdk-java | aws-java-sdk-appsync/src/main/java/com/amazonaws/services/appsync/AWSAppSyncClient.java | AWSAppSyncClient.deleteGraphqlApi | @Override
public DeleteGraphqlApiResult deleteGraphqlApi(DeleteGraphqlApiRequest request) {
request = beforeClientExecution(request);
return executeDeleteGraphqlApi(request);
} | java | @Override
public DeleteGraphqlApiResult deleteGraphqlApi(DeleteGraphqlApiRequest request) {
request = beforeClientExecution(request);
return executeDeleteGraphqlApi(request);
} | [
"@",
"Override",
"public",
"DeleteGraphqlApiResult",
"deleteGraphqlApi",
"(",
"DeleteGraphqlApiRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeDeleteGraphqlApi",
"(",
"request",
")",
";",
"}"
] | <p>
Deletes a <code>GraphqlApi</code> object.
</p>
@param deleteGraphqlApiRequest
@return Result of the DeleteGraphqlApi operation returned by the service.
@throws BadRequestException
The request is not well formed. For example, a value is invalid or a required field is missing. Check the
field values, and then try ag... | [
"<p",
">",
"Deletes",
"a",
"<code",
">",
"GraphqlApi<",
"/",
"code",
">",
"object",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-appsync/src/main/java/com/amazonaws/services/appsync/AWSAppSyncClient.java#L752-L756 | train | Deletes an API from an existing SQL Database. | Create a Java method that does the following: "Deletes an API from an existing SQL Database.". | Of course, here is the Java code you requested:
```java
@Override
public DeleteGraphqlApiResult deleteGraphqlApi(DeleteGraphqlApiRequest request) {
request = beforeClientExecution(request);
return executeDeleteGraphqlApi(request);
}
```
Hope this helps! | |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jobXML10/ChunkImpl.java | ChunkImpl.getOrCreateCheckpointAlgorithm | public CheckpointAlgorithm<Chunk<T>> getOrCreateCheckpointAlgorithm()
{
Node node = childNode.getOrCreate("checkpoint-algorithm");
CheckpointAlgorithm<Chunk<T>> checkpointAlgorithm = new CheckpointAlgorithmImpl<Chunk<T>>(this, "checkpoint-algorithm", childNode, node);
return checkpointAlgorithm;
... | java | public CheckpointAlgorithm<Chunk<T>> getOrCreateCheckpointAlgorithm()
{
Node node = childNode.getOrCreate("checkpoint-algorithm");
CheckpointAlgorithm<Chunk<T>> checkpointAlgorithm = new CheckpointAlgorithmImpl<Chunk<T>>(this, "checkpoint-algorithm", childNode, node);
return checkpointAlgorithm;
... | [
"public",
"CheckpointAlgorithm",
"<",
"Chunk",
"<",
"T",
">",
">",
"getOrCreateCheckpointAlgorithm",
"(",
")",
"{",
"Node",
"node",
"=",
"childNode",
".",
"getOrCreate",
"(",
"\"checkpoint-algorithm\"",
")",
";",
"CheckpointAlgorithm",
"<",
"Chunk",
"<",
"T",
">... | If not already created, a new <code>checkpoint-algorithm</code> element with the given value will be created.
Otherwise, the existing <code>checkpoint-algorithm</code> element will be returned.
@return a new or existing instance of <code>CheckpointAlgorithm<Chunk<T>></code> | [
"If",
"not",
"already",
"created",
"a",
"new",
"<code",
">",
"checkpoint",
"-",
"algorithm<",
"/",
"code",
">",
"element",
"with",
"the",
"given",
"value",
"will",
"be",
"created",
".",
"Otherwise",
"the",
"existing",
"<code",
">",
"checkpoint",
"-",
"algo... | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jobXML10/ChunkImpl.java#L141-L146 | train | Get the checkpoint algorithm. | Create a Java method that does the following: "Get the checkpoint algorithm.". | Of course, here is the Java code you requested:
```java
public CheckpointAlgorithm<Chunk<T>> getOrCreateCheckpointAlgorithm()
{
Node node = childNode.getOrCreate("checkpoint-algorithm");
CheckpointAlgorithm<Chunk<T>> checkpointAlgorithm = new CheckpointAlgorithmImpl<Chunk<T>>(this, "checkpoint-algorithm... | |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHErrorResources.java | XPATHErrorResources.getContents | public Object[][] getContents()
{
return new Object[][]{
{ "ERROR0000" , "{0}" },
{ ER_CURRENT_NOT_ALLOWED_IN_MATCH, "The current() function is not allowed in a match pattern!" },
{ ER_CURRENT_TAKES_NO_ARGS, "The current() function does not accept arguments!" },
{ ER_DOCUMENT_REPLACED,
"document... | java | public Object[][] getContents()
{
return new Object[][]{
{ "ERROR0000" , "{0}" },
{ ER_CURRENT_NOT_ALLOWED_IN_MATCH, "The current() function is not allowed in a match pattern!" },
{ ER_CURRENT_TAKES_NO_ARGS, "The current() function does not accept arguments!" },
{ ER_DOCUMENT_REPLACED,
"document... | [
"public",
"Object",
"[",
"]",
"[",
"]",
"getContents",
"(",
")",
"{",
"return",
"new",
"Object",
"[",
"]",
"[",
"]",
"{",
"{",
"\"ERROR0000\"",
",",
"\"{0}\"",
"}",
",",
"{",
"ER_CURRENT_NOT_ALLOWED_IN_MATCH",
",",
"\"The current() function is not allowed in a m... | Get the association list.
@return The association list. | [
"Get",
"the",
"association",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHErrorResources.java#L366-L902 | train | Gets the contents of the CID_NON_MATCH_SPECIFICATION specification. | Create a Java method that does the following: "Gets the contents of the CID_NON_MATCH_SPECIFICATION specification.". | Of course, here is the Java code you requested:
```java
public Object[][] getContents()
{
return new Object[][]{
{ "ERROR0000" , "{0}" },
{ ER_CURRENT_NOT_ALLOWED_IN_MATCH, "The current() function is not allowed in a match pattern!" },
{ ER_CURRENT_TAKES_NO_ARGS, "The current() function does not accept ... | |
Unidata/thredds | legacy/src/main/java/thredds/util/DodsURLExtractor.java | DodsURLExtractor.getTextContent | public String getTextContent(String url) throws IOException {
if (debug) System.out.println(" URL.getTextContent=" + url);
baseURL = new URL(url);
InputStream in = baseURL.openStream();
InputStreamReader r = new InputStreamReader(filterTag(in), CDM.UTF8);
HTMLEditorKit.ParserCallback callback = new... | java | public String getTextContent(String url) throws IOException {
if (debug) System.out.println(" URL.getTextContent=" + url);
baseURL = new URL(url);
InputStream in = baseURL.openStream();
InputStreamReader r = new InputStreamReader(filterTag(in), CDM.UTF8);
HTMLEditorKit.ParserCallback callback = new... | [
"public",
"String",
"getTextContent",
"(",
"String",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"debug",
")",
"System",
".",
"out",
".",
"println",
"(",
"\" URL.getTextContent=\"",
"+",
"url",
")",
";",
"baseURL",
"=",
"new",
"URL",
"(",
"url",
... | Extract text content from the given URL and return in String | [
"Extract",
"text",
"content",
"from",
"the",
"given",
"URL",
"and",
"return",
"in",
"String"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/util/DodsURLExtractor.java#L66-L80 | test | Get the text content of the specified URL. | Create a Java method that does the following: "Get the text content of the specified URL.". | Of course, here is the Java code you requested:
```java
public String getTextContent(String url) throws IOException {
if (debug) System.out.println(" URL.getTextContent=" + url);
baseURL = new URL(url);
InputStream in = baseURL.openStream();
InputStreamReader r = new InputStreamReader(filterTag(in), C... | |
google/guava | android/guava/src/com/google/common/math/PairedStats.java | PairedStats.toByteArray | public byte[] toByteArray() {
ByteBuffer buffer = ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN);
xStats.writeTo(buffer);
yStats.writeTo(buffer);
buffer.putDouble(sumOfProductsOfDeltas);
return buffer.array();
} | java | public byte[] toByteArray() {
ByteBuffer buffer = ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN);
xStats.writeTo(buffer);
yStats.writeTo(buffer);
buffer.putDouble(sumOfProductsOfDeltas);
return buffer.array();
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"BYTES",
")",
".",
"order",
"(",
"ByteOrder",
".",
"LITTLE_ENDIAN",
")",
";",
"xStats",
".",
"writeTo",
"(",
"buffer",
")",
";",
... | Gets a byte array representation of this instance.
<p><b>Note:</b> No guarantees are made regarding stability of the representation between
versions. | [
"Gets",
"a",
"byte",
"array",
"representation",
"of",
"this",
"instance",
"."
] | 7155d12b70a2406fa84d94d4b8b3bc108e89abfd | https://github.com/google/guava/blob/7155d12b70a2406fa84d94d4b8b3bc108e89abfd/android/guava/src/com/google/common/math/PairedStats.java#L289-L295 | valid | Returns the bytes of the CID SEGMENT. | Create a Java method that does the following: "Returns the bytes of the CID SEGMENT.". | Of course, here is the Java code you requested:
```java
public byte[] toByteArray() {
ByteBuffer buffer = ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN);
xStats.writeTo(buffer);
yStats.writeTo(buffer);
buffer.putDouble(sumOfProductsOfDeltas);
return buffer.array();
}
```
Hope this hel... | |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.callMethod | @Override
public <R, T extends Object> R callMethod(final String methodName, final T argument) throws CouldNotPerformException, InterruptedException {
return callMethod(methodName, argument, -1);
} | java | @Override
public <R, T extends Object> R callMethod(final String methodName, final T argument) throws CouldNotPerformException, InterruptedException {
return callMethod(methodName, argument, -1);
} | [
"@",
"Override",
"public",
"<",
"R",
",",
"T",
"extends",
"Object",
">",
"R",
"callMethod",
"(",
"final",
"String",
"methodName",
",",
"final",
"T",
"argument",
")",
"throws",
"CouldNotPerformException",
",",
"InterruptedException",
"{",
"return",
"callMethod",
... | {@inheritDoc}
@throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc}
@throws java.lang.InterruptedException {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | 662e98c3a853085e475be54c3be3deb72193c72d | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L740-L743 | train | This method is used to call a method on the class. | Create a Java method that does the following: "This method is used to call a method on the class.". | Of course, here is the Java code you requested:
```java
@Override
public <R, T extends Object> R callMethod(final String methodName, final T argument) throws CouldNotPerformException, InterruptedException {
return callMethod(methodName, argument, -1);
}
```
Hope this helps! | |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/core/template/context/SimpleContext.java | SimpleContext.addValue | public final SimpleContext addValue(String variable, Object value) {
variables.put(variable, value);
return this;
} | java | public final SimpleContext addValue(String variable, Object value) {
variables.put(variable, value);
return this;
} | [
"public",
"final",
"SimpleContext",
"addValue",
"(",
"String",
"variable",
",",
"Object",
"value",
")",
"{",
"variables",
".",
"put",
"(",
"variable",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a new variable entry.
@param variable
the name of the variable
@param value
the value of the variable
@return the context for fluent use | [
"Add",
"a",
"new",
"variable",
"entry",
"."
] | e273b845604add74b5a25dfd931cb3c166b1008f | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/template/context/SimpleContext.java#L56-L59 | train | Add a value to the context. | Create a Java method that does the following: "Add a value to the context.". | Of course, here is the Java code you requested:
```java
public final SimpleContext addValue(String variable, Object value) {
variables.put(variable, value);
return this;
}
```
Hope this helps! | |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/finder/RootFinder.java | RootFinder.insert | @Override
public void insert(final FinderObject owner, final FinderObject gob) {
final Root root = (Root) owner;
root.extraInsert(gob);
} | java | @Override
public void insert(final FinderObject owner, final FinderObject gob) {
final Root root = (Root) owner;
root.extraInsert(gob);
} | [
"@",
"Override",
"public",
"void",
"insert",
"(",
"final",
"FinderObject",
"owner",
",",
"final",
"FinderObject",
"gob",
")",
"{",
"final",
"Root",
"root",
"=",
"(",
"Root",
")",
"owner",
";",
"root",
".",
"extraInsert",
"(",
"gob",
")",
";",
"}"
] | {@inheritDoc} | [
"{"
] | e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1 | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/finder/RootFinder.java#L40-L44 | train | Insert a CID into the root. | Create a Java method that does the following: "Insert a CID into the root.". | Of course, here is the Java code you requested:
```java
@Override
public void insert(final FinderObject owner, final FinderObject gob) {
final Root root = (Root) owner;
root.extraInsert(gob);
}
```
Hope this helps! | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/EIMImpl.java | EIMImpl.eGet | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.EIM__IDO_NAME:
return getIdoName();
case AfplibPackage.EIM__TRIPLETS:
return getTriplets();
}
return super.eGet(featureID, resolve, coreType);
} | java | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.EIM__IDO_NAME:
return getIdoName();
case AfplibPackage.EIM__TRIPLETS:
return getTriplets();
}
return super.eGet(featureID, resolve, coreType);
} | [
"@",
"Override",
"public",
"Object",
"eGet",
"(",
"int",
"featureID",
",",
"boolean",
"resolve",
",",
"boolean",
"coreType",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"AfplibPackage",
".",
"EIM__IDO_NAME",
":",
"return",
"getIdoName",
"(",
")",... | <!-- 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/EIMImpl.java#L143-L152 | train | Override eGet to return the value of the featureID. | Create a Java method that does the following: "Override eGet to return the value of the featureID.". | Of course, here is the Java code you requested:
```java
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.EIM__IDO_NAME:
return getIdoName();
case AfplibPackage.EIM__TRIPLETS:
return getTriplets();
}
return super.eGet(featureID... | |
tvesalainen/util | util/src/main/java/org/vesalainen/util/CmdArgs.java | CmdArgs.addOption | public final <T> void addOption(String name, String description, String exclusiveGroup, T defValue)
{
Option opt = new Option(name, description, exclusiveGroup, defValue);
Option old = map.put(name, opt);
if (old != null)
{
throw new IllegalArgumentException(name+" ... | java | public final <T> void addOption(String name, String description, String exclusiveGroup, T defValue)
{
Option opt = new Option(name, description, exclusiveGroup, defValue);
Option old = map.put(name, opt);
if (old != null)
{
throw new IllegalArgumentException(name+" ... | [
"public",
"final",
"<",
"T",
">",
"void",
"addOption",
"(",
"String",
"name",
",",
"String",
"description",
",",
"String",
"exclusiveGroup",
",",
"T",
"defValue",
")",
"{",
"Option",
"opt",
"=",
"new",
"Option",
"(",
"name",
",",
"description",
",",
"exc... | Add an option
@param <T>
@param name Option name Option name without
@param description Option description
@param exclusiveGroup A group of options. Only options of a single group
are accepted.
@param defValue Option default value | [
"Add",
"an",
"option"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L384-L396 | train | Adds an option to the command line. | Create a Java method that does the following: "Adds an option to the command line.". | Of course, here is the Java code you requested:
```java
public final <T> void addOption(String name, String description, String exclusiveGroup, T defValue)
{
Option opt = new Option(name, description, exclusiveGroup, defValue);
Option old = map.put(name, opt);
if (old != null)
... | |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.runTasks | @GuardedBy("evictionLock")
void runTasks(Task[] tasks, int maxTaskIndex) {
for (int i = 0; i <= maxTaskIndex; i++) {
runTasksInChain(tasks[i]);
}
} | java | @GuardedBy("evictionLock")
void runTasks(Task[] tasks, int maxTaskIndex) {
for (int i = 0; i <= maxTaskIndex; i++) {
runTasksInChain(tasks[i]);
}
} | [
"@",
"GuardedBy",
"(",
"\"evictionLock\"",
")",
"void",
"runTasks",
"(",
"Task",
"[",
"]",
"tasks",
",",
"int",
"maxTaskIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"maxTaskIndex",
";",
"i",
"++",
")",
"{",
"runTasksInChain",
"... | Runs the pending page replacement policy operations.
@param tasks the ordered array of the pending operations
@param maxTaskIndex the maximum index of the array | [
"Runs",
"the",
"pending",
"page",
"replacement",
"policy",
"operations",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L527-L532 | train | Run the tasks in the chain of tasks. | Create a Java method that does the following: "Run the tasks in the chain of tasks.". | Of course, here is the Java code you requested:
```java
@GuardedBy("evictionLock")
void runTasks(Task[] tasks, int maxTaskIndex) {
for (int i = 0; i <= maxTaskIndex; i++) {
runTasksInChain(tasks[i]);
}
}
```
Hope this helps! | |
undertow-io/undertow | core/src/main/java/io/undertow/util/QueryParameterUtils.java | QueryParameterUtils.parseQueryString | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
} | java | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
} | [
"@",
"Deprecated",
"public",
"static",
"Map",
"<",
"String",
",",
"Deque",
"<",
"String",
">",
">",
"parseQueryString",
"(",
"final",
"String",
"newQueryString",
")",
"{",
"return",
"parseQueryString",
"(",
"newQueryString",
",",
"null",
")",
";",
"}"
] | Parses a query string into a map
@param newQueryString The query string
@return The map of key value parameters | [
"Parses",
"a",
"query",
"string",
"into",
"a",
"map"
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/QueryParameterUtils.java#L77-L80 | train | Parse a query string into a map of key - value pairs. | Create a Java method that does the following: "Parse a query string into a map of key - value pairs.". | Of course, here is the Java code you requested:
```java
@Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
}
```
Hope this helps! | |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.encode | private String encode(final String value, final Charset charset) {
if (StringUtils.isBlank(value)) {
return "";
}
try {
return URLEncoder.encode(value, charset.name());
} catch (UnsupportedEncodingException e) {
return value;
}
} | java | private String encode(final String value, final Charset charset) {
if (StringUtils.isBlank(value)) {
return "";
}
try {
return URLEncoder.encode(value, charset.name());
} catch (UnsupportedEncodingException e) {
return value;
}
} | [
"private",
"String",
"encode",
"(",
"final",
"String",
"value",
",",
"final",
"Charset",
"charset",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"try",
"{",
"return",
"URLEncoder",
".",
"e... | Encode query parameter.
@param value the parameter value
@param charset the charset
@return the encoded parameter value | [
"Encode",
"query",
"parameter",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L491-L501 | train | Encode a string. | Create a Java method that does the following: "Encode a string.". | Of course, here is the Java code you requested:
```java
private String encode(final String value, final Charset charset) {
if (StringUtils.isBlank(value)) {
return "";
}
try {
return URLEncoder.encode(value, charset.name());
} catch (UnsupportedEncodingException e) {
return value;
... | |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.filter | public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
return MapUtil.filter(map, editor);
} | java | public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
return MapUtil.filter(map, editor);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"filter",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Editor",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"editor",
")",
"{",
"return",
"MapUtil",
".",
"fil... | 过滤<br>
过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:
<pre>
1、过滤出需要的对象,如果返回null表示这个元素对象抛弃
2、修改元素对象,返回集合中为修改后的对象
</pre>
@param <K> Key类型
@param <V> Value类型
@param map Map
@param editor 编辑器接口
@return 过滤后的Map
@see MapUtil#filter(Map, Editor) | [
"过滤<br",
">",
"过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1268-L1270 | train | Filter the given map by applying the given editor to each entry in the map. | Create a Java method that does the following: "Filter the given map by applying the given editor to each entry in the map.". | Of course, here is the Java code you requested:
```java
public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
return MapUtil.filter(map, editor);
}
```
Hope this helps! | |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/PersistentLongFile.java | PersistentLongFile.writeFile | public static void writeFile(File file, long val) throws IOException {
AtomicFileOutputStream fos = new AtomicFileOutputStream(file);
try {
fos.write(String.valueOf(val).getBytes(Charsets.UTF_8));
fos.write('\n');
fos.close();
fos = null;
} finally {
if (fos != null) {
... | java | public static void writeFile(File file, long val) throws IOException {
AtomicFileOutputStream fos = new AtomicFileOutputStream(file);
try {
fos.write(String.valueOf(val).getBytes(Charsets.UTF_8));
fos.write('\n');
fos.close();
fos = null;
} finally {
if (fos != null) {
... | [
"public",
"static",
"void",
"writeFile",
"(",
"File",
"file",
",",
"long",
"val",
")",
"throws",
"IOException",
"{",
"AtomicFileOutputStream",
"fos",
"=",
"new",
"AtomicFileOutputStream",
"(",
"file",
")",
";",
"try",
"{",
"fos",
".",
"write",
"(",
"String",... | Atomically write the given value to the given file, including fsyncing.
@param file destination file
@param val value to write
@throws IOException if the file cannot be written | [
"Atomically",
"write",
"the",
"given",
"value",
"to",
"the",
"given",
"file",
"including",
"fsyncing",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/PersistentLongFile.java#L77-L89 | train | Write a long to a file. | Create a Java method that does the following: "Write a long to a file.". | Of course, here is the Java code you requested:
```java
public static void writeFile(File file, long val) throws IOException {
AtomicFileOutputStream fos = new AtomicFileOutputStream(file);
try {
fos.write(String.valueOf(val).getBytes(Charsets.UTF_8));
fos.write('\n');
fos.close();
fos ... | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java | LocalMapStatsProvider.finalizeFreshIndexStats | private static void finalizeFreshIndexStats(Map<String, OnDemandIndexStats> freshStats) {
if (freshStats == null) {
return;
}
for (OnDemandIndexStats freshIndexStats : freshStats.values()) {
long totalHitCount = freshIndexStats.getTotalHitCount();
if (totalHi... | java | private static void finalizeFreshIndexStats(Map<String, OnDemandIndexStats> freshStats) {
if (freshStats == null) {
return;
}
for (OnDemandIndexStats freshIndexStats : freshStats.values()) {
long totalHitCount = freshIndexStats.getTotalHitCount();
if (totalHi... | [
"private",
"static",
"void",
"finalizeFreshIndexStats",
"(",
"Map",
"<",
"String",
",",
"OnDemandIndexStats",
">",
"freshStats",
")",
"{",
"if",
"(",
"freshStats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"OnDemandIndexStats",
"freshIndexStats",
... | Finalizes the aggregation of the freshly obtained on-demand index
statistics by computing the final average values which are accumulated
as total sums in {@link #aggregateFreshIndexStats}.
@param freshStats the fresh stats to finalize, can be {@code null} if no
stats was produced during the aggregation. | [
"Finalizes",
"the",
"aggregation",
"of",
"the",
"freshly",
"obtained",
"on",
"-",
"demand",
"index",
"statistics",
"by",
"computing",
"the",
"final",
"average",
"values",
"which",
"are",
"accumulated",
"as",
"total",
"sums",
"in",
"{",
"@link",
"#aggregateFreshI... | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java#L413-L427 | train | Finalize the fresh index stats. | Create a Java method that does the following: "Finalize the fresh index stats.". | Of course, here is the Java code you requested:
```java
private static void finalizeFreshIndexStats(Map<String, OnDemandIndexStats> freshStats) {
if (freshStats == null) {
return;
}
for (OnDemandIndexStats freshIndexStats : freshStats.values()) {
long totalHitCount = fr... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Implement an algorithm to reverse a string in Java without using any built-in string manipulation methods or additional data structures. The algorithm should have a time complexity of O(n) and a space complexity of O(1). | Here is the Java implementation of the algorithm to reverse a string without using any built-in string manipulation methods or additional data structures:
```java
public class ReverseString {
public static void main(String[] args) {
String str = "Hello, World!";
String reversed = reverseString(str)... | |||||||
belaban/JGroups | src/org/jgroups/util/RingBuffer.java | RingBuffer.drainTo | public int drainTo(T[] c) {
int num=Math.min(count, c.length); // count may increase in the mean time, but that's ok
if(num == 0)
return num;
int read_index=ri; // no lock as we're the only reader
for(int i=0; i < num; i++) {
int real_index=realIndex(read_index +i... | java | public int drainTo(T[] c) {
int num=Math.min(count, c.length); // count may increase in the mean time, but that's ok
if(num == 0)
return num;
int read_index=ri; // no lock as we're the only reader
for(int i=0; i < num; i++) {
int real_index=realIndex(read_index +i... | [
"public",
"int",
"drainTo",
"(",
"T",
"[",
"]",
"c",
")",
"{",
"int",
"num",
"=",
"Math",
".",
"min",
"(",
"count",
",",
"c",
".",
"length",
")",
";",
"// count may increase in the mean time, but that's ok",
"if",
"(",
"num",
"==",
"0",
")",
"return",
... | Removes messages and adds them to c.
@param c The array to add messages to.
@return The number of messages removed and added to c. This is min(count, c.length). If no messages are present,
this method returns immediately | [
"Removes",
"messages",
"and",
"adds",
"them",
"to",
"c",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBuffer.java#L214-L226 | train | Drains the buffer to the specified array. | Create a Java method that does the following: "Drains the buffer to the specified array.". | Of course, here is the Java code you requested:
```java
public int drainTo(T[] c) {
int num=Math.min(count, c.length); // count may increase in the mean time, but that's ok
if(num == 0)
return num;
int read_index=ri; // no lock as we're the only reader
for(int i=0; i < num; ... | |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/JavaTypeUtil.java | JavaTypeUtil.isBasic | public static boolean isBasic(Class<?> clazz) throws NullPointerException {
Assert.notNull(clazz, "clazz不能为null");
return Boolean.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz)
|| Byte.class.isAssignableFrom(clazz) || Short.class.isAssignableFrom(clazz)
... | java | public static boolean isBasic(Class<?> clazz) throws NullPointerException {
Assert.notNull(clazz, "clazz不能为null");
return Boolean.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz)
|| Byte.class.isAssignableFrom(clazz) || Short.class.isAssignableFrom(clazz)
... | [
"public",
"static",
"boolean",
"isBasic",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"NullPointerException",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"clazz不能为null\");",
"",
"",
"return",
"Boolean",
".",
"class",
".",
"isAssignableFrom",
... | 判断Class对象是否为八大基本类型的封装类型
@param clazz Class对象,不能为null
@return 如果是基本类型则返回<code>true</code>
@throws NullPointerException 当传入Class对象为null时抛出该异常 | [
"判断Class对象是否为八大基本类型的封装类型"
] | 45e1b2dc4d736956674fc4dcbe6cf84eaee69278 | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/JavaTypeUtil.java#L217-L223 | train | Check if the class is a basic class. | Create a Java method that does the following: "Check if the class is a basic class.". | Of course, here is the Java code you requested:
```java
public static boolean isBasic(Class<?> clazz) throws NullPointerException {
Assert.notNull(clazz, "clazz不能为null");
return Boolean.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz)
|| Byte.class.isAssignableFro... | |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201902/ReportQuery.java | ReportQuery.setDimensions | public void setDimensions(com.google.api.ads.admanager.axis.v201902.Dimension[] dimensions) {
this.dimensions = dimensions;
} | java | public void setDimensions(com.google.api.ads.admanager.axis.v201902.Dimension[] dimensions) {
this.dimensions = dimensions;
} | [
"public",
"void",
"setDimensions",
"(",
"com",
".",
"google",
".",
"api",
".",
"ads",
".",
"admanager",
".",
"axis",
".",
"v201902",
".",
"Dimension",
"[",
"]",
"dimensions",
")",
"{",
"this",
".",
"dimensions",
"=",
"dimensions",
";",
"}"
] | Sets the dimensions value for this ReportQuery.
@param dimensions * The list of break-down types being requested in the report.
The generated report will contain the dimensions in the same order
as requested.
This field is required. | [
"Sets",
"the",
"dimensions",
"value",
"for",
"this",
"ReportQuery",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201902/ReportQuery.java#L293-L295 | train | Sets the dimensions value for this CDN. | Create a Java method that does the following: "Sets the dimensions value for this CDN.". | Of course, here is the Java code you requested:
```java
public void setDimensions(com.google.api.ads.admanager.axis.v201902.Dimension[] dimensions) {
this.dimensions = dimensions;
}
```
Hope this helps! | |
roboconf/roboconf-platform | core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java | DockerUtils.findDefaultImageVersion | public static String findDefaultImageVersion( String rawVersion ) {
String rbcfVersion = rawVersion;
if( rbcfVersion == null
|| rbcfVersion.toLowerCase().endsWith( "snapshot" ))
rbcfVersion = LATEST;
return rbcfVersion;
} | java | public static String findDefaultImageVersion( String rawVersion ) {
String rbcfVersion = rawVersion;
if( rbcfVersion == null
|| rbcfVersion.toLowerCase().endsWith( "snapshot" ))
rbcfVersion = LATEST;
return rbcfVersion;
} | [
"public",
"static",
"String",
"findDefaultImageVersion",
"(",
"String",
"rawVersion",
")",
"{",
"String",
"rbcfVersion",
"=",
"rawVersion",
";",
"if",
"(",
"rbcfVersion",
"==",
"null",
"||",
"rbcfVersion",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\... | Finds the version of the default Docker image.
@param rawVersion the raw version (e.g. ManifestUtils.findBundleVersion())
@return {@value #LATEST} if the raw version is null or a snapshot, a specific version otherwise | [
"Finds",
"the",
"version",
"of",
"the",
"default",
"Docker",
"image",
"."
] | add54eead479effb138d0ff53a2d637902b82702 | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L393-L401 | train | Find the default image version for the given raw version. | Create a Java method that does the following: "Find the default image version for the given raw version.". | Of course, here is the Java code you requested:
```java
public static String findDefaultImageVersion( String rawVersion ) {
String rbcfVersion = rawVersion;
if( rbcfVersion == null
|| rbcfVersion.toLowerCase().endsWith( "snapshot" ))
rbcfVersion = LATEST;
return rbcfVersion;
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ContextServiceImpl.java | ContextServiceImpl.unsetBaseInstance | protected void unsetBaseInstance(ServiceReference<ContextService> ref) {
lock.writeLock().lock();
try {
threadContextConfigurations = null;
} finally {
lock.writeLock().unlock();
}
} | java | protected void unsetBaseInstance(ServiceReference<ContextService> ref) {
lock.writeLock().lock();
try {
threadContextConfigurations = null;
} finally {
lock.writeLock().unlock();
}
} | [
"protected",
"void",
"unsetBaseInstance",
"(",
"ServiceReference",
"<",
"ContextService",
">",
"ref",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"threadContextConfigurations",
"=",
"null",
";",
"}",
"finally",
"{",
... | Declarative Services method for unsetting the service reference to the base contextService instance.
@param ref reference to the service | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"service",
"reference",
"to",
"the",
"base",
"contextService",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ContextServiceImpl.java#L671-L678 | train | Unset the base instance. | Create a Java method that does the following: "Unset the base instance.". | Of course, here is the Java code you requested:
```java
protected void unsetBaseInstance(ServiceReference<ContextService> ref) {
lock.writeLock().lock();
try {
threadContextConfigurations = null;
} finally {
lock.writeLock().unlock();
}
}
```
Hope this helps... | |
vinaysshenoy/mugen | sample/src/main/java/com/mugen/sample/ReposFragment.java | ReposFragment.getPerPage | private int getPerPage(Context context) {
//fixed item size in recyclerview. Adding 3 enables recyclerview scrolling.
return (context.getResources().getDisplayMetrics().heightPixels
/ context.getResources().getDimensionPixelSize(R.dimen.repo_item_height)) + 3;
} | java | private int getPerPage(Context context) {
//fixed item size in recyclerview. Adding 3 enables recyclerview scrolling.
return (context.getResources().getDisplayMetrics().heightPixels
/ context.getResources().getDimensionPixelSize(R.dimen.repo_item_height)) + 3;
} | [
"private",
"int",
"getPerPage",
"(",
"Context",
"context",
")",
"{",
"//fixed item size in recyclerview. Adding 3 enables recyclerview scrolling.",
"return",
"(",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
".",
"heightPixels",
"/",
"co... | Get items to load per page onScroll.
@param context {@link Context}
@return int of num of items that can be loaded onto the screen with scroll enabled | [
"Get",
"items",
"to",
"load",
"per",
"page",
"onScroll",
"."
] | 2ace4312c940fed6b82d221a6a7fbd8681e91e9e | https://github.com/vinaysshenoy/mugen/blob/2ace4312c940fed6b82d221a6a7fbd8681e91e9e/sample/src/main/java/com/mugen/sample/ReposFragment.java#L93-L97 | train | Gets the per page of the page. | Create a Java method that does the following: "Gets the per page of the page.". | Of course, here is the Java code you requested:
```java
private int getPerPage(Context context) {
//fixed item size in recyclerview. Adding 3 enables recyclerview scrolling.
return (context.getResources().getDisplayMetrics().heightPixels
/ context.getResources().getDimensionPixelSize(R.... | |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/RemoteService.java | RemoteService.call | public static Response call(String server, String service, DataObject data, String... params) {
return call(server, service, false, data, params);
} | java | public static Response call(String server, String service, DataObject data, String... params) {
return call(server, service, false, data, params);
} | [
"public",
"static",
"Response",
"call",
"(",
"String",
"server",
",",
"String",
"service",
",",
"DataObject",
"data",
",",
"String",
"...",
"params",
")",
"{",
"return",
"call",
"(",
"server",
",",
"service",
",",
"false",
",",
"data",
",",
"params",
")"... | Calls a remote service with non-static member values in the given DataObject as arguments. | [
"Calls",
"a",
"remote",
"service",
"with",
"non",
"-",
"static",
"member",
"values",
"in",
"the",
"given",
"DataObject",
"as",
"arguments",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/RemoteService.java#L79-L81 | train | Call a service with the specified parameters. | Create a Java method that does the following: "Call a service with the specified parameters.". | Of course, here is the Java code you requested:
```java
public static Response call(String server, String service, DataObject data, String... params) {
return call(server, service, false, data, params);
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java | ConfigurationsInner.listByServerAsync | public Observable<List<ConfigurationInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ConfigurationInner>>, List<ConfigurationInner>>() {
@Override
public ... | java | public Observable<List<ConfigurationInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ConfigurationInner>>, List<ConfigurationInner>>() {
@Override
public ... | [
"public",
"Observable",
"<",
"List",
"<",
"ConfigurationInner",
">",
">",
"listByServerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
... | List all the configurations in a given server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the valida... | [
"List",
"all",
"the",
"configurations",
"in",
"a",
"given",
"server",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java#L390-L397 | train | Gets a list of CDNA configuration. | Create a Java method that does the following: "Gets a list of CDNA configuration.". | Of course, here is the Java code you requested:
```java
public Observable<List<ConfigurationInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ConfigurationInner>>, List<Configura... | |
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixtree/SuffixTree.java | SuffixTree.insert | void insert(Suffix<I, S> suffix) {
if (activePoint.isNode()) {
Node<I, S> node = activePoint.getNode();
node.insert(suffix, activePoint);
} else if (activePoint.isEdge()) {
Edge<I, S> edge = activePoint.getEdge();
edge.insert(suffix, activePoint);
... | java | void insert(Suffix<I, S> suffix) {
if (activePoint.isNode()) {
Node<I, S> node = activePoint.getNode();
node.insert(suffix, activePoint);
} else if (activePoint.isEdge()) {
Edge<I, S> edge = activePoint.getEdge();
edge.insert(suffix, activePoint);
... | [
"void",
"insert",
"(",
"Suffix",
"<",
"I",
",",
"S",
">",
"suffix",
")",
"{",
"if",
"(",
"activePoint",
".",
"isNode",
"(",
")",
")",
"{",
"Node",
"<",
"I",
",",
"S",
">",
"node",
"=",
"activePoint",
".",
"getNode",
"(",
")",
";",
"node",
".",
... | Inserts the given suffix into this tree.
@param suffix The suffix to insert. | [
"Inserts",
"the",
"given",
"suffix",
"into",
"this",
"tree",
"."
] | 76dd1fcc36047bc66a87d31142e72e98b5347821 | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixtree/SuffixTree.java#L77-L85 | train | Insert a suffix into the image. | Create a Java method that does the following: "Insert a suffix into the image.". | Of course, here is the Java code you requested:
```java
void insert(Suffix<I, S> suffix) {
if (activePoint.isNode()) {
Node<I, S> node = activePoint.getNode();
node.insert(suffix, activePoint);
} else if (activePoint.isEdge()) {
Edge<I, S> edge = activePoint.getEdge(... | |
aws/aws-sdk-java | aws-java-sdk-elasticache/src/main/java/com/amazonaws/services/elasticache/AmazonElastiCacheClient.java | AmazonElastiCacheClient.modifyCacheCluster | @Override
public CacheCluster modifyCacheCluster(ModifyCacheClusterRequest request) {
request = beforeClientExecution(request);
return executeModifyCacheCluster(request);
} | java | @Override
public CacheCluster modifyCacheCluster(ModifyCacheClusterRequest request) {
request = beforeClientExecution(request);
return executeModifyCacheCluster(request);
} | [
"@",
"Override",
"public",
"CacheCluster",
"modifyCacheCluster",
"(",
"ModifyCacheClusterRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeModifyCacheCluster",
"(",
"request",
")",
";",
"}"
] | <p>
Modifies the settings for a cluster. You can use this operation to change one or more cluster configuration
parameters by specifying the parameters and the new values.
</p>
@param modifyCacheClusterRequest
Represents the input of a <code>ModifyCacheCluster</code> operation.
@return Result of the ModifyCacheCluster... | [
"<p",
">",
"Modifies",
"the",
"settings",
"for",
"a",
"cluster",
".",
"You",
"can",
"use",
"this",
"operation",
"to",
"change",
"one",
"or",
"more",
"cluster",
"configuration",
"parameters",
"by",
"specifying",
"the",
"parameters",
"and",
"the",
"new",
"valu... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticache/src/main/java/com/amazonaws/services/elasticache/AmazonElastiCacheClient.java#L2709-L2713 | train | Modify an existing cache cluster. | Create a Java method that does the following: "Modify an existing cache cluster.". | Of course, here is the Java code you requested:
```java
@Override
public CacheCluster modifyCacheCluster(ModifyCacheClusterRequest request) {
request = beforeClientExecution(request);
return executeModifyCacheCluster(request);
}
```
Hope this helps! | |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java | AbstractManagerFactoryBuilder.withManagedEntityClasses | public T withManagedEntityClasses(List<Class<?>> entityClasses) {
configMap.put(MANAGED_ENTITIES, entityClasses);
return getThis();
} | java | public T withManagedEntityClasses(List<Class<?>> entityClasses) {
configMap.put(MANAGED_ENTITIES, entityClasses);
return getThis();
} | [
"public",
"T",
"withManagedEntityClasses",
"(",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"entityClasses",
")",
"{",
"configMap",
".",
"put",
"(",
"MANAGED_ENTITIES",
",",
"entityClasses",
")",
";",
"return",
"getThis",
"(",
")",
";",
"}"
] | Define a list of entities to be managed by <strong>Achilles</strong>.
Specifically, schema validation will be performed at bootstrap for those entities
@param entityClasses entities to be managed by <strong>Achilles</strong>
@return ManagerFactoryBuilder | [
"Define",
"a",
"list",
"of",
"entities",
"to",
"be",
"managed",
"by",
"<strong",
">",
"Achilles<",
"/",
"strong",
">",
".",
"Specifically",
"schema",
"validation",
"will",
"be",
"performed",
"at",
"bootstrap",
"for",
"those",
"entities"
] | 8281c33100e72c993e570592ae1a5306afac6813 | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java#L434-L437 | train | Sets the managed entity classes. | Create a Java method that does the following: "Sets the managed entity classes.". | Of course, here is the Java code you requested:
```java
public T withManagedEntityClasses(List<Class<?>> entityClasses) {
configMap.put(MANAGED_ENTITIES, entityClasses);
return getThis();
}
```
Hope this helps! | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Create a Java program to sort an array of objects using the Gnome Sort technique. The Gnome Sort algorithm is similar to the Selection Sort algorithm, but instead of finding the minimum element and swapping it with the first unsorted element, it finds the first unsorted element and swaps it with the previous element un... | Here is a Java program that implements the Gnome Sort algorithm to sort an array of objects:
```java
import java.util.Comparator;
public class GnomeSort<T> {
public void gnomeSort(T[] arr, Comparator<? super T> c) {
int index = 0;
while (index < arr.length) {
if (index == 0 ||... | |||||||
playn/playn | scene/src/playn/scene/Layer.java | Layer.close | @Override public void close() {
if (parent != null) parent.remove(this);
setState(State.DISPOSED);
setBatch(null);
} | java | @Override public void close() {
if (parent != null) parent.remove(this);
setState(State.DISPOSED);
setBatch(null);
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"parent",
".",
"remove",
"(",
"this",
")",
";",
"setState",
"(",
"State",
".",
"DISPOSED",
")",
";",
"setBatch",
"(",
"null",
")",
";",
"}"
] | Disposes this layer, removing it from its parent layer. Any resources associated with this
layer are freed, and it cannot be reused after being disposed. Disposing a layer that has
children will dispose them as well. | [
"Disposes",
"this",
"layer",
"removing",
"it",
"from",
"its",
"parent",
"layer",
".",
"Any",
"resources",
"associated",
"with",
"this",
"layer",
"are",
"freed",
"and",
"it",
"cannot",
"be",
"reused",
"after",
"being",
"disposed",
".",
"Disposing",
"a",
"laye... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/Layer.java#L262-L266 | train | Close the block. | Create a Java method that does the following: "Close the block.". | Of course, here is the Java code you requested:
```java
@Override public void close() {
if (parent != null) parent.remove(this);
setState(State.DISPOSED);
setBatch(null);
}
```
Hope this helps! | |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.cloneOf | public ITestCaseGenerator cloneOf()
{
TupleGenerator other = new TupleGenerator();
other.setRandomSeed( getRandomSeed());
other.setDefaultTupleSize( getDefaultTupleSize());
other.setCombiners( getCombiners().stream().map( TupleCombiner::cloneOf).collect( toList()));
return other;
} | java | public ITestCaseGenerator cloneOf()
{
TupleGenerator other = new TupleGenerator();
other.setRandomSeed( getRandomSeed());
other.setDefaultTupleSize( getDefaultTupleSize());
other.setCombiners( getCombiners().stream().map( TupleCombiner::cloneOf).collect( toList()));
return other;
} | [
"public",
"ITestCaseGenerator",
"cloneOf",
"(",
")",
"{",
"TupleGenerator",
"other",
"=",
"new",
"TupleGenerator",
"(",
")",
";",
"other",
".",
"setRandomSeed",
"(",
"getRandomSeed",
"(",
")",
")",
";",
"other",
".",
"setDefaultTupleSize",
"(",
"getDefaultTupleS... | Returns a copy of this object. | [
"Returns",
"a",
"copy",
"of",
"this",
"object",
"."
] | 21e15cf107fa149620c40f4bda1829c1224fcfb1 | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L823-L830 | train | Creates a clone of this generator. | Create a Java method that does the following: "Creates a clone of this generator.". | Of course, here is the Java code you requested:
```java
public ITestCaseGenerator cloneOf()
{
TupleGenerator other = new TupleGenerator();
other.setRandomSeed( getRandomSeed());
other.setDefaultTupleSize( getDefaultTupleSize());
other.setCombiners( getCombiners().stream().map( TupleCombiner::cloneO... | |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.getPathOrder | public List<Integer> getPathOrder(int profileId) {
ArrayList<Integer> pathOrder = new ArrayList<Integer>();
PreparedStatement queryStatement = null;
ResultSet results = null;
try (Connection sqlConnection = sqlService.getConnection()) {
queryStatement = sqlConnection.prepare... | java | public List<Integer> getPathOrder(int profileId) {
ArrayList<Integer> pathOrder = new ArrayList<Integer>();
PreparedStatement queryStatement = null;
ResultSet results = null;
try (Connection sqlConnection = sqlService.getConnection()) {
queryStatement = sqlConnection.prepare... | [
"public",
"List",
"<",
"Integer",
">",
"getPathOrder",
"(",
"int",
"profileId",
")",
"{",
"ArrayList",
"<",
"Integer",
">",
"pathOrder",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"PreparedStatement",
"queryStatement",
"=",
"null",
";",
"... | Return collection of path Ids in priority order
@param profileId ID of profile
@return collection of path Ids in priority order | [
"Return",
"collection",
"of",
"path",
"Ids",
"in",
"priority",
"order"
] | 3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1 | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L227-L262 | train | Get the path order for a profile | Create a Java method that does the following: "Get the path order for a profile". | Of course, here is the Java code you requested:
```java
public List<Integer> getPathOrder(int profileId) {
ArrayList<Integer> pathOrder = new ArrayList<Integer>();
PreparedStatement queryStatement = null;
ResultSet results = null;
try (Connection sqlConnection = sqlService.getConnectio... | |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java | JcrManagedConnection.openSession | private JcrSession openSession() throws ResourceException {
try {
Repository repo = mcf.getRepository();
Session s = repo.login(cri.getCredentials(), cri.getWorkspace());
return (JcrSession) s;
} catch (RepositoryException e) {
throw new ResourceException(... | java | private JcrSession openSession() throws ResourceException {
try {
Repository repo = mcf.getRepository();
Session s = repo.login(cri.getCredentials(), cri.getWorkspace());
return (JcrSession) s;
} catch (RepositoryException e) {
throw new ResourceException(... | [
"private",
"JcrSession",
"openSession",
"(",
")",
"throws",
"ResourceException",
"{",
"try",
"{",
"Repository",
"repo",
"=",
"mcf",
".",
"getRepository",
"(",
")",
";",
"Session",
"s",
"=",
"repo",
".",
"login",
"(",
"cri",
".",
"getCredentials",
"(",
")",... | Create a new session.
@return new JCR session handle object.
@throws ResourceException if there is an error opening the session | [
"Create",
"a",
"new",
"session",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java#L126-L134 | train | Create a session. | Create a Java method that does the following: "Create a session.". | Of course, here is the Java code you requested:
```java
private JcrSession openSession() throws ResourceException {
try {
Repository repo = mcf.getRepository();
Session s = repo.login(cri.getCredentials(), cri.getWorkspace());
return (JcrSession) s;
} catch (Reposito... | |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroEntityComposer.java | AvroEntityComposer.buildAvroRecordBuilderFactory | @SuppressWarnings({ "unchecked", "rawtypes" })
private AvroRecordBuilderFactory<E> buildAvroRecordBuilderFactory(
Schema schema) {
if (specific) {
Class<E> specificClass;
String className = schema.getFullName();
try {
specificClass = (Class<E>) Class.forName(className);
} cat... | java | @SuppressWarnings({ "unchecked", "rawtypes" })
private AvroRecordBuilderFactory<E> buildAvroRecordBuilderFactory(
Schema schema) {
if (specific) {
Class<E> specificClass;
String className = schema.getFullName();
try {
specificClass = (Class<E>) Class.forName(className);
} cat... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"private",
"AvroRecordBuilderFactory",
"<",
"E",
">",
"buildAvroRecordBuilderFactory",
"(",
"Schema",
"schema",
")",
"{",
"if",
"(",
"specific",
")",
"{",
"Class",
"<",
"E",
">"... | Build the appropriate AvroRecordBuilderFactory for this instance. Avro has
many different record types, of which we support two: Specific and Generic.
@param schema
The Avro schema needed to construct the AvroRecordBuilderFactory.
@return The constructed AvroRecordBuilderFactory. | [
"Build",
"the",
"appropriate",
"AvroRecordBuilderFactory",
"for",
"this",
"instance",
".",
"Avro",
"has",
"many",
"different",
"record",
"types",
"of",
"which",
"we",
"support",
"two",
":",
"Specific",
"and",
"Generic",
"."
] | 72bfb4b1a881af85808cd7f14bc3e15160a1e811 | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroEntityComposer.java#L219-L236 | train | Build AvroRecordBuilderFactory. | Create a Java method that does the following: "Build AvroRecordBuilderFactory.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "unchecked", "rawtypes" })
private AvroRecordBuilderFactory<E> buildAvroRecordBuilderFactory(
Schema schema) {
if (specific) {
Class<E> specificClass;
String className = schema.getFullName();
try {
specifi... | |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UIInput.java | UIInput.validateValue | protected void validateValue(FacesContext context, Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (n... | java | protected void validateValue(FacesContext context, Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (n... | [
"protected",
"void",
"validateValue",
"(",
"FacesContext",
"context",
",",
"Object",
"newValue",
")",
"{",
"// If our value is valid, enforce the required property if present",
"if",
"(",
"isValid",
"(",
")",
"&&",
"isRequired",
"(",
")",
"&&",
"isEmpty",
"(",
"newVal... | <p><span class="changed_modified_2_0">Set</span> the "valid"
property according to the below algorithm.</p>
<ul>
<li>
<p>If the <code>valid</code> property on this component is
still <code>true</code>, and the <code>required</code> property
is also <code>true</code>, ensure that the local value is not
empty (where "... | [
"<p",
">",
"<span",
"class",
"=",
"changed_modified_2_0",
">",
"Set<",
"/",
"span",
">",
"the",
"valid",
"property",
"according",
"to",
"the",
"below",
"algorithm",
".",
"<",
"/",
"p",
">"
] | cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3 | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIInput.java#L1139-L1198 | train | Validate the value of the component. | Create a Java method that does the following: "Validate the value of the component.". | Of course, here is the Java code you requested:
```java
protected void validateValue(FacesContext context, Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
String requiredMessageStr = getRequiredMessa... | |
rupertlssmith/lojix | lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/builtins/Call.java | Call.compileBodyCall | public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
boolean isLastBody, boolean chainRule, int permVarsRemaining)
{
// Used to build up the results in.
SizeableLinkedList<WAMInstruction> instructions = new SizeableLinkedList<WAMInstruction>();
... | java | public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
boolean isLastBody, boolean chainRule, int permVarsRemaining)
{
// Used to build up the results in.
SizeableLinkedList<WAMInstruction> instructions = new SizeableLinkedList<WAMInstruction>();
... | [
"public",
"SizeableLinkedList",
"<",
"WAMInstruction",
">",
"compileBodyCall",
"(",
"Functor",
"expression",
",",
"boolean",
"isFirstBody",
",",
"boolean",
"isLastBody",
",",
"boolean",
"chainRule",
",",
"int",
"permVarsRemaining",
")",
"{",
"// Used to build up the res... | {@inheritDoc} | [
"{"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/builtins/Call.java#L57-L85 | test | Compile a body call instruction. | Create a Java method that does the following: "Compile a body call instruction.". | Of course, here is the Java code you requested:
```java
public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
boolean isLastBody, boolean chainRule, int permVarsRemaining)
{
// Used to build up the results in.
SizeableLinkedList<WAMInstruction> i... | |
dickschoeller/gedbrowser | gedbrowser-renderer/src/main/java/org/schoellerfamily/gedbrowser/renderer/MultimediaListItemRenderer.java | MultimediaListItemRenderer.renderListItemContents | private void renderListItemContents(final StringBuilder builder) {
final Multimedia multimedia = multimediaRenderer.getGedObject();
builder.append("<span class=\"label\">");
builder.append(GedRenderer.escapeString(multimedia));
builder.append(":</span> ");
final MultimediaVisito... | java | private void renderListItemContents(final StringBuilder builder) {
final Multimedia multimedia = multimediaRenderer.getGedObject();
builder.append("<span class=\"label\">");
builder.append(GedRenderer.escapeString(multimedia));
builder.append(":</span> ");
final MultimediaVisito... | [
"private",
"void",
"renderListItemContents",
"(",
"final",
"StringBuilder",
"builder",
")",
"{",
"final",
"Multimedia",
"multimedia",
"=",
"multimediaRenderer",
".",
"getGedObject",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<span class=\\\"label\\\">\"",
")",
... | Render the inner part of this thing in a list item. Will never
have an <li> tag.
@param builder the string builder that we will be appending to. | [
"Render",
"the",
"inner",
"part",
"of",
"this",
"thing",
"in",
"a",
"list",
"item",
".",
"Will",
"never",
"have",
"an",
"<",
";",
"li>",
";",
"tag",
"."
] | e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1 | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-renderer/src/main/java/org/schoellerfamily/gedbrowser/renderer/MultimediaListItemRenderer.java#L57-L81 | train | Render the list item contents. | Create a Java method that does the following: "Render the list item contents.". | Of course, here is the Java code you requested:
```java
private void renderListItemContents(final StringBuilder builder) {
final Multimedia multimedia = multimediaRenderer.getGedObject();
builder.append("<span class=\"label\">");
builder.append(GedRenderer.escapeString(multimedia));
bui... | |
square/wire | wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/SyntaxReader.java | SyntaxReader.readComment | private String readComment() {
if (pos == data.length || data[pos] != '/') throw new AssertionError();
pos++;
int commentType = pos < data.length ? data[pos++] : -1;
if (commentType == '*') {
StringBuilder result = new StringBuilder();
boolean startOfLine = true;
for (; pos + 1 < data... | java | private String readComment() {
if (pos == data.length || data[pos] != '/') throw new AssertionError();
pos++;
int commentType = pos < data.length ? data[pos++] : -1;
if (commentType == '*') {
StringBuilder result = new StringBuilder();
boolean startOfLine = true;
for (; pos + 1 < data... | [
"private",
"String",
"readComment",
"(",
")",
"{",
"if",
"(",
"pos",
"==",
"data",
".",
"length",
"||",
"data",
"[",
"pos",
"]",
"!=",
"'",
"'",
")",
"throw",
"new",
"AssertionError",
"(",
")",
";",
"pos",
"++",
";",
"int",
"commentType",
"=",
"pos... | Reads a comment and returns its body. | [
"Reads",
"a",
"comment",
"and",
"returns",
"its",
"body",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/SyntaxReader.java#L246-L293 | train | Read a comment from the input. | Create a Java method that does the following: "Read a comment from the input.". | Of course, here is the Java code you requested:
```java
private String readComment() {
if (pos == data.length || data[pos] != '/') throw new AssertionError();
pos++;
int commentType = pos < data.length ? data[pos++] : -1;
if (commentType == '*') {
StringBuilder result = new StringBuilder();
... | |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.filterTaskPlanWithStores | public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
List<StoreDefinition> storeDefs) {
List<RebalanceTaskInfo> plans = Lists.newArrayList();
List<String> storeNames = StoreDefinitionUt... | java | public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
List<StoreDefinition> storeDefs) {
List<RebalanceTaskInfo> plans = Lists.newArrayList();
List<String> storeNames = StoreDefinitionUt... | [
"public",
"static",
"List",
"<",
"RebalanceTaskInfo",
">",
"filterTaskPlanWithStores",
"(",
"List",
"<",
"RebalanceTaskInfo",
">",
"existingPlanList",
",",
"List",
"<",
"StoreDefinition",
">",
"storeDefs",
")",
"{",
"List",
"<",
"RebalanceTaskInfo",
">",
"plans",
... | Given a list of partition plans and a set of stores, copies the store
names to every individual plan and creates a new list
@param existingPlanList Existing partition plan list
@param storeDefs List of store names we are rebalancing
@return List of updated partition plan | [
"Given",
"a",
"list",
"of",
"partition",
"plans",
"and",
"a",
"set",
"of",
"stores",
"copies",
"the",
"store",
"names",
"to",
"every",
"individual",
"plan",
"and",
"creates",
"a",
"new",
"list"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L649-L669 | train | Filter the list of plan with stores | Create a Java method that does the following: "Filter the list of plan with stores". | Of course, here is the Java code you requested:
```java
public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
List<StoreDefinition> storeDefs) {
List<RebalanceTaskInfo> plans = Lists.newArrayLi... | |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/spring/ApplicationContextProvider.java | ApplicationContextProvider.registerBeanIntoApplicationContext | public static <T> T registerBeanIntoApplicationContext(final ConfigurableApplicationContext applicationContext,
final Class<T> beanClazz, final String beanId) {
val beanFactory = applicationContext.getBeanFactory();
val provider = beanFactory.cr... | java | public static <T> T registerBeanIntoApplicationContext(final ConfigurableApplicationContext applicationContext,
final Class<T> beanClazz, final String beanId) {
val beanFactory = applicationContext.getBeanFactory();
val provider = beanFactory.cr... | [
"public",
"static",
"<",
"T",
">",
"T",
"registerBeanIntoApplicationContext",
"(",
"final",
"ConfigurableApplicationContext",
"applicationContext",
",",
"final",
"Class",
"<",
"T",
">",
"beanClazz",
",",
"final",
"String",
"beanId",
")",
"{",
"val",
"beanFactory",
... | Register bean into application context.
@param <T> the type parameter
@param applicationContext the application context
@param beanClazz the bean clazz
@param beanId the bean id
@return the type registered | [
"Register",
"bean",
"into",
"application",
"context",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/spring/ApplicationContextProvider.java#L54-L62 | train | Register bean into application context. | Create a Java method that does the following: "Register bean into application context.". | Of course, here is the Java code you requested:
```java
public static <T> T registerBeanIntoApplicationContext(final ConfigurableApplicationContext applicationContext,
final Class<T> beanClazz, final String beanId) {
val beanFactory = applicationContex... | |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.isStale | static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
if (userDevice.equals(subject)) {
return false;
}
if (lastReceipt == null) {
return false;
}
long maxAgeMillis = MILLIS_PER_HOUR * maxAgeHours;
... | java | static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
if (userDevice.equals(subject)) {
return false;
}
if (lastReceipt == null) {
return false;
}
long maxAgeMillis = MILLIS_PER_HOUR * maxAgeHours;
... | [
"static",
"boolean",
"isStale",
"(",
"OmemoDevice",
"userDevice",
",",
"OmemoDevice",
"subject",
",",
"Date",
"lastReceipt",
",",
"int",
"maxAgeHours",
")",
"{",
"if",
"(",
"userDevice",
".",
"equals",
"(",
"subject",
")",
")",
"{",
"return",
"false",
";",
... | Determine, whether another one of *our* devices is stale or not.
@param userDevice our omemoDevice
@param subject another one of our devices
@param lastReceipt date of last received message from that device
@param maxAgeHours threshold
@return staleness | [
"Determine",
"whether",
"another",
"one",
"of",
"*",
"our",
"*",
"devices",
"is",
"stale",
"or",
"not",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L993-L1006 | train | Checks if the last receipt is stale. | Create a Java method that does the following: "Checks if the last receipt is stale.". | Of course, here is the Java code you requested:
```java
static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
if (userDevice.equals(subject)) {
return false;
}
if (lastReceipt == null) {
return false;
}
... | |
mongodb/mongo-java-driver | bson/src/main/org/bson/BasicBSONObject.java | BasicBSONObject.getInt | public int getInt(final String key) {
Object o = get(key);
if (o == null) {
throw new NullPointerException("no value for: " + key);
}
return toInt(o);
} | java | public int getInt(final String key) {
Object o = get(key);
if (o == null) {
throw new NullPointerException("no value for: " + key);
}
return toInt(o);
} | [
"public",
"int",
"getInt",
"(",
"final",
"String",
"key",
")",
"{",
"Object",
"o",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"no value for: \"",
"+",
"key",
")",
";",
"}",... | Returns the value of a field as an {@code int}.
@param key the field to look for
@return the field value (or default) | [
"Returns",
"the",
"value",
"of",
"a",
"field",
"as",
"an",
"{",
"@code",
"int",
"}",
"."
] | a92d47e2e9f2fca55d09229a0a2e2cdc714db085 | https://github.com/mongodb/mongo-java-driver/blob/a92d47e2e9f2fca55d09229a0a2e2cdc714db085/bson/src/main/org/bson/BasicBSONObject.java#L126-L133 | valid | Gets the value of the attribute as an int. | Create a Java method that does the following: "Gets the value of the attribute as an int.". | Of course, here is the Java code you requested:
```java
public int getInt(final String key) {
Object o = get(key);
if (o == null) {
throw new NullPointerException("no value for: " + key);
}
return toInt(o);
}
```
Hope this helps! | |
AlejandroRivera/embedded-rabbitmq | src/main/java/io/arivera/oss/embedded/rabbitmq/apache/commons/io/FileUtils.java | FileUtils.copyInputStreamToFile | public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
try {
FileOutputStream output = openOutputStream(destination);
try {
copy(source, output);
output.close(); // don't swallow close Exception if copy completes normally
} finally {
... | java | public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
try {
FileOutputStream output = openOutputStream(destination);
try {
copy(source, output);
output.close(); // don't swallow close Exception if copy completes normally
} finally {
... | [
"public",
"static",
"void",
"copyInputStreamToFile",
"(",
"InputStream",
"source",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileOutputStream",
"output",
"=",
"openOutputStream",
"(",
"destination",
")",
";",
"try",
"{",
"copy",
... | Copies bytes from an {@link InputStream} <code>source</code> to a file
<code>destination</code>. The directories up to <code>destination</code>
will be created if they don't already exist. <code>destination</code>
will be overwritten if it already exists.
@param source the <code>InputStream</code> to copy bytes f... | [
"Copies",
"bytes",
"from",
"an",
"{",
"@link",
"InputStream",
"}",
"<code",
">",
"source<",
"/",
"code",
">",
"to",
"a",
"file",
"<code",
">",
"destination<",
"/",
"code",
">",
".",
"The",
"directories",
"up",
"to",
"<code",
">",
"destination<",
"/",
"... | b9dc6e0a1b7eabf16bf5a573d0d6bf4d536f0a46 | https://github.com/AlejandroRivera/embedded-rabbitmq/blob/b9dc6e0a1b7eabf16bf5a573d0d6bf4d536f0a46/src/main/java/io/arivera/oss/embedded/rabbitmq/apache/commons/io/FileUtils.java#L130-L142 | test | Copy an input stream to a file. | Create a Java method that does the following: "Copy an input stream to a file.". | Of course, here is the Java code you requested:
```java
public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
try {
FileOutputStream output = openOutputStream(destination);
try {
copy(source, output);
output.close(); // don't swallow close E... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.