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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/types/StorageSize.java | StorageSize.getAmount | @Deprecated
public BigInteger getAmount()
{
// We try to cache the amount field in _amount since it is likely going to be accessed frequently
if (this._amount == null)
{
this._amount = getUnit().convert(getBits(), StorageUnit.BITS);
}
return this._amount;
} | java | @Deprecated
public BigInteger getAmount()
{
// We try to cache the amount field in _amount since it is likely going to be accessed frequently
if (this._amount == null)
{
this._amount = getUnit().convert(getBits(), StorageUnit.BITS);
}
return this._amount;
} | [
"@",
"Deprecated",
"public",
"BigInteger",
"getAmount",
"(",
")",
"{",
"// We try to cache the amount field in _amount since it is likely going to be accessed frequently",
"if",
"(",
"this",
".",
"_amount",
"==",
"null",
")",
"{",
"this",
".",
"_amount",
"=",
"getUnit",
... | Converts the size of this StorageSize to another unit, rounding the result to an integer<br />
Uses the default representation unit for this type<br />
This method may result in the loss of information (due to rounding). If precision is required then getDecimalAmount()
should be used<br />
@return the size (as an inte... | [
"Converts",
"the",
"size",
"of",
"this",
"StorageSize",
"to",
"another",
"unit",
"rounding",
"the",
"result",
"to",
"an",
"integer<br",
"/",
">",
"Uses",
"the",
"default",
"representation",
"unit",
"for",
"this",
"type<br",
"/",
">",
"This",
"method",
"may",... | d4025d2f881bc0542b1e004c5f65a1ccaf895836 | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/StorageSize.java#L203-L213 | train | Returns the amount of this account. | Create a Java method that does the following: "Returns the amount of this account.". | Of course, here is the Java code you requested:
```java
@Deprecated
public BigInteger getAmount()
{
// We try to cache the amount field in _amount since it is likely going to be accessed frequently
if (this._amount == null)
{
this._amount = getUnit().convert(getBits(), StorageUnit.BITS);
}
return this.... | |
tzaeschke/zoodb | src/org/zoodb/internal/util/BucketTreeStack.java | BucketTreeStack.add | public boolean add(E e) {
ensureCapacity(size + 1); // Increments modCount!!
addElement(bucket, bucketDepth, size++, e);
return true;
} | java | public boolean add(E e) {
ensureCapacity(size + 1); // Increments modCount!!
addElement(bucket, bucketDepth, size++, e);
return true;
} | [
"public",
"boolean",
"add",
"(",
"E",
"e",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"1",
")",
";",
"// Increments modCount!!",
"addElement",
"(",
"bucket",
",",
"bucketDepth",
",",
"size",
"++",
",",
"e",
")",
";",
"return",
"true",
";",
"}"
] | Appends the specified element to the end of this list.
@param e element to be appended to this list
@return <tt>true</tt> (as specified by {@link Collection#add}) | [
"Appends",
"the",
"specified",
"element",
"to",
"the",
"end",
"of",
"this",
"list",
"."
] | 058d0ff161a8ee9d53244c433aca97ee9c654410 | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/BucketTreeStack.java#L179-L183 | train | Adds the specified element to the end of the list. | Create a Java method that does the following: "Adds the specified element to the end of the list.". | Of course, here is the Java code you requested:
```java
public boolean add(E e) {
ensureCapacity(size + 1); // Increments modCount!!
addElement(bucket, bucketDepth, size++, e);
return true;
}
```
Hope this helps! | |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/adt/Try.java | Try.withResources | public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources(
CheckedSupplier<? extends Exception, ? extends A> aSupplier,
CheckedFn1<? extends Exception, ? super A, ? extends B> bFn,
CheckedFn1<? extends Exception, ? su... | java | public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources(
CheckedSupplier<? extends Exception, ? extends A> aSupplier,
CheckedFn1<? extends Exception, ? super A, ? extends B> bFn,
CheckedFn1<? extends Exception, ? su... | [
"public",
"static",
"<",
"A",
"extends",
"AutoCloseable",
",",
"B",
"extends",
"AutoCloseable",
",",
"C",
"extends",
"AutoCloseable",
",",
"D",
">",
"Try",
"<",
"Exception",
",",
"D",
">",
"withResources",
"(",
"CheckedSupplier",
"<",
"?",
"extends",
"Except... | Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1, CheckedFn1) withResources} that
cascades
two dependent resource creations via nested calls.
@param aSupplier the first resource supplier
@param bFn the second resource function
@param cFn the final resource function
@param fn ... | [
"Convenience",
"overload",
"of",
"{",
"@link",
"Try#withResources",
"(",
"CheckedSupplier",
"CheckedFn1",
"CheckedFn1",
")",
"withResources",
"}",
"that",
"cascades",
"two",
"dependent",
"resource",
"creations",
"via",
"nested",
"calls",
"."
] | b643ba836c5916d1d8193822e5efb4e7b40c489a | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L364-L370 | train | Returns a Try that wraps the supplied resources. | Create a Java method that does the following: "Returns a Try that wraps the supplied resources.". | Of course, here is the Java code you requested:
```java
public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources(
CheckedSupplier<? extends Exception, ? extends A> aSupplier,
CheckedFn1<? extends Exception, ? super A, ? extends... | |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java | TCPMemcachedNodeImpl.copyInputQueue | public final void copyInputQueue() {
Collection<Operation> tmp = new ArrayList<Operation>();
// don't drain more than we have space to place
inputQueue.drainTo(tmp, writeQ.remainingCapacity());
writeQ.addAll(tmp);
} | java | public final void copyInputQueue() {
Collection<Operation> tmp = new ArrayList<Operation>();
// don't drain more than we have space to place
inputQueue.drainTo(tmp, writeQ.remainingCapacity());
writeQ.addAll(tmp);
} | [
"public",
"final",
"void",
"copyInputQueue",
"(",
")",
"{",
"Collection",
"<",
"Operation",
">",
"tmp",
"=",
"new",
"ArrayList",
"<",
"Operation",
">",
"(",
")",
";",
"// don't drain more than we have space to place",
"inputQueue",
".",
"drainTo",
"(",
"tmp",
",... | /*
(non-Javadoc)
@see net.spy.memcached.MemcachedNode#copyInputQueue() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java#L114-L120 | train | Copy the input queue to the output queue. | Create a Java method that does the following: "Copy the input queue to the output queue.". | Of course, here is the Java code you requested:
```java
public final void copyInputQueue() {
Collection<Operation> tmp = new ArrayList<Operation>();
// don't drain more than we have space to place
inputQueue.drainTo(tmp, writeQ.remainingCapacity());
writeQ.addAll(tmp);
}
```
Hope this helps! | |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java | WDataTable.getCurrentPageEndRow | private int getCurrentPageEndRow() {
TableDataModel model = getDataModel();
int rowsPerPage = getRowsPerPage();
int endRow = model.getRowCount() - 1;
if (getPaginationMode() != PaginationMode.NONE) {
if (model instanceof TreeTableDataModel) {
// For tree tables, pagination only occurs on first-level nod... | java | private int getCurrentPageEndRow() {
TableDataModel model = getDataModel();
int rowsPerPage = getRowsPerPage();
int endRow = model.getRowCount() - 1;
if (getPaginationMode() != PaginationMode.NONE) {
if (model instanceof TreeTableDataModel) {
// For tree tables, pagination only occurs on first-level nod... | [
"private",
"int",
"getCurrentPageEndRow",
"(",
")",
"{",
"TableDataModel",
"model",
"=",
"getDataModel",
"(",
")",
";",
"int",
"rowsPerPage",
"=",
"getRowsPerPage",
"(",
")",
";",
"int",
"endRow",
"=",
"model",
".",
"getRowCount",
"(",
")",
"-",
"1",
";",
... | Retrieves the ending row index for the current page. Will always return the row count minus 1 for tables which
are not paginated.
@return the starting row index for the current page. | [
"Retrieves",
"the",
"ending",
"row",
"index",
"for",
"the",
"current",
"page",
".",
"Will",
"always",
"return",
"the",
"row",
"count",
"minus",
"1",
"for",
"tables",
"which",
"are",
"not",
"paginated",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java#L1171-L1195 | train | Get the end row of the table. | Create a Java method that does the following: "Get the end row of the table.". | Of course, here is the Java code you requested:
```java
private int getCurrentPageEndRow() {
TableDataModel model = getDataModel();
int rowsPerPage = getRowsPerPage();
int endRow = model.getRowCount() - 1;
if (getPaginationMode() != PaginationMode.NONE) {
if (model instanceof TreeTableDataModel) {
// F... | |
xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.isValidCompressedBuffer | public static boolean isValidCompressedBuffer(long inputAddr, long offset, long length)
throws IOException
{
return impl.isValidCompressedBuffer(inputAddr, offset, length);
} | java | public static boolean isValidCompressedBuffer(long inputAddr, long offset, long length)
throws IOException
{
return impl.isValidCompressedBuffer(inputAddr, offset, length);
} | [
"public",
"static",
"boolean",
"isValidCompressedBuffer",
"(",
"long",
"inputAddr",
",",
"long",
"offset",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"return",
"impl",
".",
"isValidCompressedBuffer",
"(",
"inputAddr",
",",
"offset",
",",
"length",
... | Returns true iff the contents of compressed buffer [offset,
offset+length) can be uncompressed successfully. Does not return the
uncompressed data. Takes time proportional to the input length, but is
usually at least a factor of four faster than actual decompression. | [
"Returns",
"true",
"iff",
"the",
"contents",
"of",
"compressed",
"buffer",
"[",
"offset",
"offset",
"+",
"length",
")",
"can",
"be",
"uncompressed",
"successfully",
".",
"Does",
"not",
"return",
"the",
"uncompressed",
"data",
".",
"Takes",
"time",
"proportiona... | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L361-L365 | train | This method checks if the input is a compressed buffer of a CIS file. | Create a Java method that does the following: "This method checks if the input is a compressed buffer of a CIS file.". | Of course, here is the Java code you requested:
```java
public static boolean isValidCompressedBuffer(long inputAddr, long offset, long length)
throws IOException
{
return impl.isValidCompressedBuffer(inputAddr, offset, length);
}
```
Hope this helps! | |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/impl/YamlLenientConstructor.java | YamlLenientConstructor.getConstructor | @Override
protected Construct getConstructor(Node node) {
Construct construct = super.getConstructor(node);
logger.trace("getting constructor for node {} Tag {} = {}", new Object[] {node, node.getTag(), construct});
if(construct instanceof ConstructYamlObject && !tagsDefined.contains(node.getTag())) {
... | java | @Override
protected Construct getConstructor(Node node) {
Construct construct = super.getConstructor(node);
logger.trace("getting constructor for node {} Tag {} = {}", new Object[] {node, node.getTag(), construct});
if(construct instanceof ConstructYamlObject && !tagsDefined.contains(node.getTag())) {
... | [
"@",
"Override",
"protected",
"Construct",
"getConstructor",
"(",
"Node",
"node",
")",
"{",
"Construct",
"construct",
"=",
"super",
".",
"getConstructor",
"(",
"node",
")",
";",
"logger",
".",
"trace",
"(",
"\"getting constructor for node {} Tag {} = {}\"",
",",
"... | Overridden to fetch constructor even if tag is not mapped. | [
"Overridden",
"to",
"fetch",
"constructor",
"even",
"if",
"tag",
"is",
"not",
"mapped",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/impl/YamlLenientConstructor.java#L68-L93 | train | Override the constructor method. | Create a Java method that does the following: "Override the constructor method.". | Of course, here is the Java code you requested:
```java
@Override
protected Construct getConstructor(Node node) {
Construct construct = super.getConstructor(node);
logger.trace("getting constructor for node {} Tag {} = {}", new Object[] {node, node.getTag(), construct});
if(construct instanceof Construct... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.metadata.context/src/com/ibm/ws/javaee/metadata/context/internal/JEEMetadataContextImpl.java | JEEMetadataContextImpl.readObject | private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
GetField fields = in.readFields();
beginDefaultContext = fields.get(BEGIN_DEFAULT, true);
// Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadContext
... | java | private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
GetField fields = in.readFields();
beginDefaultContext = fields.get(BEGIN_DEFAULT, true);
// Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadContext
... | [
"private",
"void",
"readObject",
"(",
"java",
".",
"io",
".",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"GetField",
"fields",
"=",
"in",
".",
"readFields",
"(",
")",
";",
"beginDefaultContext",
"=",
"fields",
... | Reads and deserializes from the input stream.
@param in The object input stream from which to deserialize.
@throws IOException
@throws ClassNotFoundException | [
"Reads",
"and",
"deserializes",
"from",
"the",
"input",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.metadata.context/src/com/ibm/ws/javaee/metadata/context/internal/JEEMetadataContextImpl.java#L160-L166 | train | Read the object from an input stream. | Create a Java method that does the following: "Read the object from an input stream.". | Of course, here is the Java code you requested:
```java
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
GetField fields = in.readFields();
beginDefaultContext = fields.get(BEGIN_DEFAULT, true);
// Note that further processing is required in JE... | |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.renderMenuItems | @SuppressWarnings("SameParameterValue")
public synchronized List<Message> renderMenuItems(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot,
CdjStatus.TrackType trackType, Message availableResponse)
throws IOException {
final ... | java | @SuppressWarnings("SameParameterValue")
public synchronized List<Message> renderMenuItems(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot,
CdjStatus.TrackType trackType, Message availableResponse)
throws IOException {
final ... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"synchronized",
"List",
"<",
"Message",
">",
"renderMenuItems",
"(",
"Message",
".",
"MenuIdentifier",
"targetMenu",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"CdjStatus",
".",
"Trac... | Gather up all the responses that are available for a menu request. Will involve multiple requests if
the number of responses available is larger than our maximum batch size (see {@link #getMenuBatchSize()}.
@param targetMenu the destination for the response to this query
@param slot the media library of interest for t... | [
"Gather",
"up",
"all",
"the",
"responses",
"that",
"are",
"available",
"for",
"a",
"menu",
"request",
".",
"Will",
"involve",
"multiple",
"requests",
"if",
"the",
"number",
"of",
"responses",
"available",
"is",
"larger",
"than",
"our",
"maximum",
"batch",
"s... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L510-L519 | train | Render the menu items. | Create a Java method that does the following: "Render the menu items.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("SameParameterValue")
public synchronized List<Message> renderMenuItems(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot,
CdjStatus.TrackType trackType, Message available... | |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/query/expr/NumberPath.java | NumberPath.lt | public Expression<Float> lt(float value) {
String valueString = "'" + value + "'";
return new Expression<Float>(this, Operation.lt, valueString);
} | java | public Expression<Float> lt(float value) {
String valueString = "'" + value + "'";
return new Expression<Float>(this, Operation.lt, valueString);
} | [
"public",
"Expression",
"<",
"Float",
">",
"lt",
"(",
"float",
"value",
")",
"{",
"String",
"valueString",
"=",
"\"'\"",
"+",
"value",
"+",
"\"'\"",
";",
"return",
"new",
"Expression",
"<",
"Float",
">",
"(",
"this",
",",
"Operation",
".",
"lt",
",",
... | Method to construct the less than expression for float
@param value the float
@return Expression | [
"Method",
"to",
"construct",
"the",
"less",
"than",
"expression",
"for",
"float"
] | 59f988d0776d46620d0b34711c411b2b5b1da06b | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/query/expr/NumberPath.java#L221-L224 | train | Method to construct the less than expression for float | Create a Java method that does the following: "Method to construct the less than expression for float". | Of course, here is the Java code you requested:
```java
public Expression<Float> lt(float value) {
String valueString = "'" + value + "'";
return new Expression<Float>(this, Operation.lt, valueString);
}
```
Hope this helps! | |
jeroenvanmaanen/bridge-pattern | src/main/java/org/leialearns/bridge/FactoryAccessor.java | FactoryAccessor.set | public void set(BridgeFactory factory) {
if (factory.getNearType() != nearType) {
throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
}
factorySetting.set(factory);
} | java | public void set(BridgeFactory factory) {
if (factory.getNearType() != nearType) {
throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
}
factorySetting.set(factory);
} | [
"public",
"void",
"set",
"(",
"BridgeFactory",
"factory",
")",
"{",
"if",
"(",
"factory",
".",
"getNearType",
"(",
")",
"!=",
"nearType",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Type mismatch: \"",
"+",
"nearType",
"+",
"\": \"",
"+",
"... | Sets the bridge factory to use with this accessor. The near type of the given bridge factory has to match
the near type of this bridge accessor.
@param factory The bridge factory to set | [
"Sets",
"the",
"bridge",
"factory",
"to",
"use",
"with",
"this",
"accessor",
".",
"The",
"near",
"type",
"of",
"the",
"given",
"bridge",
"factory",
"has",
"to",
"match",
"the",
"near",
"type",
"of",
"this",
"bridge",
"accessor",
"."
] | 55bd2de8cff800a1a97e26e97d3600e6dfb00b59 | https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/FactoryAccessor.java#L33-L38 | train | Sets the bridge factory. | Create a Java method that does the following: "Sets the bridge factory.". | Of course, here is the Java code you requested:
```java
public void set(BridgeFactory factory) {
if (factory.getNearType() != nearType) {
throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
}
factorySetting.set(factory);
}
```
Hope t... | |
aws/aws-sdk-java | aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesisanalytics/model/ApplicationUpdate.java | ApplicationUpdate.withInputUpdates | public ApplicationUpdate withInputUpdates(InputUpdate... inputUpdates) {
if (this.inputUpdates == null) {
setInputUpdates(new java.util.ArrayList<InputUpdate>(inputUpdates.length));
}
for (InputUpdate ele : inputUpdates) {
this.inputUpdates.add(ele);
}
ret... | java | public ApplicationUpdate withInputUpdates(InputUpdate... inputUpdates) {
if (this.inputUpdates == null) {
setInputUpdates(new java.util.ArrayList<InputUpdate>(inputUpdates.length));
}
for (InputUpdate ele : inputUpdates) {
this.inputUpdates.add(ele);
}
ret... | [
"public",
"ApplicationUpdate",
"withInputUpdates",
"(",
"InputUpdate",
"...",
"inputUpdates",
")",
"{",
"if",
"(",
"this",
".",
"inputUpdates",
"==",
"null",
")",
"{",
"setInputUpdates",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"InputUpdate",
">... | <p>
Describes application input configuration updates.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setInputUpdates(java.util.Collection)} or {@link #withInputUpdates(java.util.Collection)} if you want to
override the existing values.
</p>
@param inputUpdates
Describe... | [
"<p",
">",
"Describes",
"application",
"input",
"configuration",
"updates",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"method",
"appends",
"the",
"values",
"to",
"the",
"existing",
"list",
"(",
"if",
"any... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesisanalytics/model/ApplicationUpdate.java#L107-L115 | train | A list of InputUpdates that you want to update. | Create a Java method that does the following: "A list of InputUpdates that you want to update.". | Of course, here is the Java code you requested:
```java
public ApplicationUpdate withInputUpdates(InputUpdate... inputUpdates) {
if (this.inputUpdates == null) {
setInputUpdates(new java.util.ArrayList<InputUpdate>(inputUpdates.length));
}
for (InputUpdate ele : inputUpdates) {
... | |
aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.of | public static <T> Future<T> of(final Supplier<T> s, final Executor ex) {
return Future.of(CompletableFuture.supplyAsync(s, ex));
} | java | public static <T> Future<T> of(final Supplier<T> s, final Executor ex) {
return Future.of(CompletableFuture.supplyAsync(s, ex));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"of",
"(",
"final",
"Supplier",
"<",
"T",
">",
"s",
",",
"final",
"Executor",
"ex",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"CompletableFuture",
".",
"supplyAsync",
"(",
"s",
",",
"e... | Create a Future object that asyncrhonously populates using the provided
Executor and Supplier
@param s
Supplier to asynchronously populate results from
@param ex
Executro to asynchronously populate results with
@return Future asynchronously populated from the Supplier | [
"Create",
"a",
"Future",
"object",
"that",
"asyncrhonously",
"populates",
"using",
"the",
"provided",
"Executor",
"and",
"Supplier"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1217-L1219 | train | Create a new Future from a Supplier and an Executor. | Create a Java method that does the following: "Create a new Future from a Supplier and an Executor.". | Of course, here is the Java code you requested:
```java
public static <T> Future<T> of(final Supplier<T> s, final Executor ex) {
return Future.of(CompletableFuture.supplyAsync(s, ex));
}
```
Hope this helps! | |
PinaeOS/nala | src/main/java/org/pinae/nala/xb/marshal/XmlMarshaller.java | XmlMarshaller.buildXMLNodeByString | private StringBuffer buildXMLNodeByString(NodeConfig config, int deep) {
StringBuffer xmlBuffer = new StringBuffer();
String tagName = config.getName();
if (isLowCase == true) {
tagName = StringUtils.lowerCase(config.getName());
}
List<Namespace> namespaces = config.getNamespace();
if (namespaces != nu... | java | private StringBuffer buildXMLNodeByString(NodeConfig config, int deep) {
StringBuffer xmlBuffer = new StringBuffer();
String tagName = config.getName();
if (isLowCase == true) {
tagName = StringUtils.lowerCase(config.getName());
}
List<Namespace> namespaces = config.getNamespace();
if (namespaces != nu... | [
"private",
"StringBuffer",
"buildXMLNodeByString",
"(",
"NodeConfig",
"config",
",",
"int",
"deep",
")",
"{",
"StringBuffer",
"xmlBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"tagName",
"=",
"config",
".",
"getName",
"(",
")",
";",
"if",
"("... | /*
根据结构体, 构建XML内容 | [
"/",
"*",
"根据结构体",
"构建XML内容"
] | 2047ade4af197cec938278d300d111ea94af6fbf | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/marshal/XmlMarshaller.java#L213-L331 | train | Build XML node by string. | Create a Java method that does the following: "Build XML node by string.". | Of course, here is the Java code you requested:
```java
private StringBuffer buildXMLNodeByString(NodeConfig config, int deep) {
StringBuffer xmlBuffer = new StringBuffer();
String tagName = config.getName();
if (isLowCase == true) {
tagName = StringUtils.lowerCase(config.getName());
}
List<Namespace> n... | |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java | DocletInvoker.fileToURL | private static URL fileToURL(Path file) {
Path p;
try {
p = file.toRealPath();
} catch (IOException e) {
p = file.toAbsolutePath();
}
try {
return p.normalize().toUri().toURL();
} catch (MalformedURLException e) {
return nul... | java | private static URL fileToURL(Path file) {
Path p;
try {
p = file.toRealPath();
} catch (IOException e) {
p = file.toAbsolutePath();
}
try {
return p.normalize().toUri().toURL();
} catch (MalformedURLException e) {
return nul... | [
"private",
"static",
"URL",
"fileToURL",
"(",
"Path",
"file",
")",
"{",
"Path",
"p",
";",
"try",
"{",
"p",
"=",
"file",
".",
"toRealPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"p",
"=",
"file",
".",
"toAbsolutePath",
"(",... | Returns the directory or JAR file URL corresponding to the specified local file name.
@param file the Path object
@return the resulting directory or JAR file URL, or null if unknown | [
"Returns",
"the",
"directory",
"or",
"JAR",
"file",
"URL",
"corresponding",
"to",
"the",
"specified",
"local",
"file",
"name",
"."
] | a53d069bbdb2c60232ed3811c19b65e41c3e60e0 | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L424-L436 | train | Get the URL of a file. | Create a Java method that does the following: "Get the URL of a file.". | Of course, here is the Java code you requested:
```java
private static URL fileToURL(Path file) {
Path p;
try {
p = file.toRealPath();
} catch (IOException e) {
p = file.toAbsolutePath();
}
try {
return p.normalize().toUri().toURL();
}... | |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/ObjIteratorEx.java | ObjIteratorEx.of | public static <T> ObjIteratorEx<T> of(final Supplier<? extends Iterator<? extends T>> iteratorSupplier) {
N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");
return new ObjIteratorEx<T>() {
private Iterator<? extends T> iter = null;
private ObjIteratorEx<? extends T> i... | java | public static <T> ObjIteratorEx<T> of(final Supplier<? extends Iterator<? extends T>> iteratorSupplier) {
N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");
return new ObjIteratorEx<T>() {
private Iterator<? extends T> iter = null;
private ObjIteratorEx<? extends T> i... | [
"public",
"static",
"<",
"T",
">",
"ObjIteratorEx",
"<",
"T",
">",
"of",
"(",
"final",
"Supplier",
"<",
"?",
"extends",
"Iterator",
"<",
"?",
"extends",
"T",
">",
">",
"iteratorSupplier",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"iteratorSupplier",
",... | Lazy evaluation.
@param iteratorSupplier
@return | [
"Lazy",
"evaluation",
"."
] | 544b7720175d15e9329f83dd22a8cc5fa4515e12 | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/ObjIteratorEx.java#L188-L261 | train | Creates an object of class ObjIteratorEx from the specified Supplier. | Create a Java method that does the following: "Creates an object of class ObjIteratorEx from the specified Supplier.". | Of course, here is the Java code you requested:
```java
public static <T> ObjIteratorEx<T> of(final Supplier<? extends Iterator<? extends T>> iteratorSupplier) {
N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");
return new ObjIteratorEx<T>() {
private Iterator<? extends T> iter ... | |
threerings/nenya | core/src/main/java/com/threerings/media/MediaPanel.java | MediaPanel.addObscurerDirtyRegions | protected void addObscurerDirtyRegions (boolean changedOnly)
{
if (_obscurerList != null) {
for (Obscurer obscurer : _obscurerList) {
Rectangle obscured = obscurer.getObscured(changedOnly);
if (obscured != null) {
Point pt = new Point(obscured.... | java | protected void addObscurerDirtyRegions (boolean changedOnly)
{
if (_obscurerList != null) {
for (Obscurer obscurer : _obscurerList) {
Rectangle obscured = obscurer.getObscured(changedOnly);
if (obscured != null) {
Point pt = new Point(obscured.... | [
"protected",
"void",
"addObscurerDirtyRegions",
"(",
"boolean",
"changedOnly",
")",
"{",
"if",
"(",
"_obscurerList",
"!=",
"null",
")",
"{",
"for",
"(",
"Obscurer",
"obscurer",
":",
"_obscurerList",
")",
"{",
"Rectangle",
"obscured",
"=",
"obscurer",
".",
"get... | Add dirty regions for all our obscurers. | [
"Add",
"dirty",
"regions",
"for",
"all",
"our",
"obscurers",
"."
] | 3165a012fd859009db3367f87bd2a5b820cc760a | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MediaPanel.java#L385-L398 | train | Add the dirty regions of the obscurer list. | Create a Java method that does the following: "Add the dirty regions of the obscurer list.". | Of course, here is the Java code you requested:
```java
protected void addObscurerDirtyRegions (boolean changedOnly)
{
if (_obscurerList != null) {
for (Obscurer obscurer : _obscurerList) {
Rectangle obscured = obscurer.getObscured(changedOnly);
if (obscured != n... | |
nguillaumin/slick2d-maven | slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java | ParticleEditor.saveSystem | public void saveSystem() {
int resp = chooser.showSaveDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (!file.getName().endsWith(".xml")) {
file = new File(file.getAbsolutePath()+".xml");
}
try {
ParticleIO.saveConfiguredSystem(file,... | java | public void saveSystem() {
int resp = chooser.showSaveDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (!file.getName().endsWith(".xml")) {
file = new File(file.getAbsolutePath()+".xml");
}
try {
ParticleIO.saveConfiguredSystem(file,... | [
"public",
"void",
"saveSystem",
"(",
")",
"{",
"int",
"resp",
"=",
"chooser",
".",
"showSaveDialog",
"(",
"this",
")",
";",
"if",
"(",
"resp",
"==",
"JFileChooser",
".",
"APPROVE_OPTION",
")",
"{",
"File",
"file",
"=",
"chooser",
".",
"getSelectedFile",
... | Save a complete particle system XML description | [
"Save",
"a",
"complete",
"particle",
"system",
"XML",
"description"
] | 8251f88a0ed6a70e726d2468842455cd1f80893f | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L579-L594 | train | Saves the system configuration. | Create a Java method that does the following: "Saves the system configuration.". | Of course, here is the Java code you requested:
```java
public void saveSystem() {
int resp = chooser.showSaveDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (!file.getName().endsWith(".xml")) {
file = new File(file.getAbsolutePath()+".xml");
}
... | |
javagl/Common | src/main/java/de/javagl/common/iteration/Iterables.java | Iterables.toList | public static <T> List<T> toList(Iterable<T> iterable)
{
Objects.requireNonNull(iterable, "The iterable is null");
return Iterables.toCollection(iterable, new ArrayList<T>());
} | java | public static <T> List<T> toList(Iterable<T> iterable)
{
Objects.requireNonNull(iterable, "The iterable is null");
return Iterables.toCollection(iterable, new ArrayList<T>());
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"toList",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"iterable",
",",
"\"The iterable is null\"",
")",
";",
"return",
"Iterables",
".",
"toCollectio... | Drains all elements that are provided by the iterator of
the given iterable into a list
@param <T> The element type
@param iterable The iterable
@return The list | [
"Drains",
"all",
"elements",
"that",
"are",
"provided",
"by",
"the",
"iterator",
"of",
"the",
"given",
"iterable",
"into",
"a",
"list"
] | 5a4876b48c3a2dc61d21324733cf37512d721c33 | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/iteration/Iterables.java#L56-L60 | train | Converts the given iterable to a list of objects. | Create a Java method that does the following: "Converts the given iterable to a list of objects.". | Of course, here is the Java code you requested:
```java
public static <T> List<T> toList(Iterable<T> iterable)
{
Objects.requireNonNull(iterable, "The iterable is null");
return Iterables.toCollection(iterable, new ArrayList<T>());
}
```
Hope this helps! | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/SystemViewStreamExporter.java | SystemViewStreamExporter.leaving | @Override
protected void leaving(NodeData node, int level) throws RepositoryException
{
try
{
if (exportChildVersionHistory && node.getPrimaryTypeName().equals(Constants.NT_VERSIONEDCHILD))
{
try
{
PropertyData childVersionHistory =
... | java | @Override
protected void leaving(NodeData node, int level) throws RepositoryException
{
try
{
if (exportChildVersionHistory && node.getPrimaryTypeName().equals(Constants.NT_VERSIONEDCHILD))
{
try
{
PropertyData childVersionHistory =
... | [
"@",
"Override",
"protected",
"void",
"leaving",
"(",
"NodeData",
"node",
",",
"int",
"level",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"if",
"(",
"exportChildVersionHistory",
"&&",
"node",
".",
"getPrimaryTypeName",
"(",
")",
".",
"equals",
"(",... | /*
(non-Javadoc)
@see
org.exoplatform.services.jcr.dataflow.ItemDataTraversingVisitor#leaving(org.exoplatform.services
.jcr.datamodel.NodeData, int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/SystemViewStreamExporter.java#L154-L200 | train | Override the leaving method to export the versioned child version history. | Create a Java method that does the following: "Override the leaving method to export the versioned child version history.". | Of course, here is the Java code you requested:
```java
@Override
protected void leaving(NodeData node, int level) throws RepositoryException
{
try
{
if (exportChildVersionHistory && node.getPrimaryTypeName().equals(Constants.NT_VERSIONEDCHILD))
{
try
{
... | |
huahin/huahin-unit | src/main/java/org/huahinframework/unit/FilterDriver.java | FilterDriver.setSimpleJoin | protected void setSimpleJoin(String[] masterLabels, String[] masterColumn, String[] dataColumn,
String masterSeparator, boolean regex, List<String> masterData)
throws DataFormatException {
if (masterColumn.length != dataColumn.length) {
... | java | protected void setSimpleJoin(String[] masterLabels, String[] masterColumn, String[] dataColumn,
String masterSeparator, boolean regex, List<String> masterData)
throws DataFormatException {
if (masterColumn.length != dataColumn.length) {
... | [
"protected",
"void",
"setSimpleJoin",
"(",
"String",
"[",
"]",
"masterLabels",
",",
"String",
"[",
"]",
"masterColumn",
",",
"String",
"[",
"]",
"dataColumn",
",",
"String",
"masterSeparator",
",",
"boolean",
"regex",
",",
"List",
"<",
"String",
">",
"master... | Easily supports the Join. To use the setSimpleJoin,
you must be a size master data appear in the memory of the task.
@param masterLabels label of master data
@param masterColumn master column
@param dataColumn data column
@param masterSeparator separator
@param regex master join is regex
@param masterData master data
@... | [
"Easily",
"supports",
"the",
"Join",
".",
"To",
"use",
"the",
"setSimpleJoin",
"you",
"must",
"be",
"a",
"size",
"master",
"data",
"appear",
"in",
"the",
"memory",
"of",
"the",
"task",
"."
] | 7993d390eff8dba4510a3a1e6a3c8bef95697316 | https://github.com/huahin/huahin-unit/blob/7993d390eff8dba4510a3a1e6a3c8bef95697316/src/main/java/org/huahinframework/unit/FilterDriver.java#L441-L455 | train | Set the Simple Join configuration. | Create a Java method that does the following: "Set the Simple Join configuration.". | Of course, here is the Java code you requested:
```java
protected void setSimpleJoin(String[] masterLabels, String[] masterColumn, String[] dataColumn,
String masterSeparator, boolean regex, List<String> masterData)
throws DataFormatException {
... | |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.putBinds | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | java | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | [
"private",
"void",
"putBinds",
"(",
")",
"throws",
"BindException",
"{",
"createStageIfNeeded",
"(",
")",
";",
"String",
"putStatement",
"=",
"getPutStmt",
"(",
"bindDir",
".",
"toString",
"(",
")",
",",
"stagePath",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Upload binds from local file to stage
@throws BindException if uploading the binds fails | [
"Upload",
"binds",
"from",
"local",
"file",
"to",
"stage"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L424-L457 | train | Put the files to stage. | Create a Java method that does the following: "Put the files to stage.". | Of course, here is the Java code you requested:
```java
private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatemen... | |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.timesPlusTimes | public static double[] timesPlusTimes(final double[] v1, final double s1, final double[] v2, final double s2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] * s1 + v2[i] * s2;
}
ret... | java | public static double[] timesPlusTimes(final double[] v1, final double s1, final double[] v2, final double s2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] * s1 + v2[i] * s2;
}
ret... | [
"public",
"static",
"double",
"[",
"]",
"timesPlusTimes",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"s1",
",",
"final",
"double",
"[",
"]",
"v2",
",",
"final",
"double",
"s2",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"v2",... | Computes component-wise v1 * s1 + v2 * s2.
@param v1 first vector
@param s1 the scalar for v1
@param v2 second vector
@param s2 the scalar for v2
@return the result of v1 * s1 + v2 * s2 | [
"Computes",
"component",
"-",
"wise",
"v1",
"*",
"s1",
"+",
"v2",
"*",
"s2",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L190-L197 | train | Computes the times plus times of two vectors. | Create a Java method that does the following: "Computes the times plus times of two vectors.". | Of course, here is the Java code you requested:
```java
public static double[] timesPlusTimes(final double[] v1, final double s1, final double[] v2, final double s2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {... | |
whitesource/fs-agent | src/main/java/org/whitesource/agent/FileSystemScanner.java | FileSystemScanner.createResolversIncludesPattern | private String[] createResolversIncludesPattern(Collection<AbstractDependencyResolver> dependencyResolvers) {
Collection<String> resultIncludes = new ArrayList<>();
// TODO - check if can be done with lambda
for (AbstractDependencyResolver dependencyResolver : dependencyResolvers) {
... | java | private String[] createResolversIncludesPattern(Collection<AbstractDependencyResolver> dependencyResolvers) {
Collection<String> resultIncludes = new ArrayList<>();
// TODO - check if can be done with lambda
for (AbstractDependencyResolver dependencyResolver : dependencyResolvers) {
... | [
"private",
"String",
"[",
"]",
"createResolversIncludesPattern",
"(",
"Collection",
"<",
"AbstractDependencyResolver",
">",
"dependencyResolvers",
")",
"{",
"Collection",
"<",
"String",
">",
"resultIncludes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// TODO - ... | /* --- Private methods --- | [
"/",
"*",
"---",
"Private",
"methods",
"---"
] | d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1 | https://github.com/whitesource/fs-agent/blob/d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1/src/main/java/org/whitesource/agent/FileSystemScanner.java#L470-L483 | train | Create the includes pattern for the given collection of dependency resolvers. | Create a Java method that does the following: "Create the includes pattern for the given collection of dependency resolvers.". | Of course, here is the Java code you requested:
```java
private String[] createResolversIncludesPattern(Collection<AbstractDependencyResolver> dependencyResolvers) {
Collection<String> resultIncludes = new ArrayList<>();
// TODO - check if can be done with lambda
for (AbstractDependencyResolver... | |
thorntail/thorntail | fractions/topology-webapp/src/main/java/org/wildfly/swarm/topology/webapp/runtime/TopologySSEServlet.java | TopologySSEServlet.formatMaybeIpv6 | private String formatMaybeIpv6(String address) {
String openBracket = "[";
String closeBracket = "]";
if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) {
return openBracket + address + closeBracket;
}
return address;
... | java | private String formatMaybeIpv6(String address) {
String openBracket = "[";
String closeBracket = "]";
if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) {
return openBracket + address + closeBracket;
}
return address;
... | [
"private",
"String",
"formatMaybeIpv6",
"(",
"String",
"address",
")",
"{",
"String",
"openBracket",
"=",
"\"[\"",
";",
"String",
"closeBracket",
"=",
"\"]\"",
";",
"if",
"(",
"address",
".",
"contains",
"(",
"\":\"",
")",
"&&",
"!",
"address",
".",
"start... | This isn't very precise; org.jboss.as.network.NetworkUtils has better implementation, but that's in a private module. | [
"This",
"isn",
"t",
"very",
"precise",
";",
"org",
".",
"jboss",
".",
"as",
".",
"network",
".",
"NetworkUtils",
"has",
"better",
"implementation",
"but",
"that",
"s",
"in",
"a",
"private",
"module",
"."
] | 4a391b68ffae98c6e66d30a3bfb99dadc9509f14 | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/topology-webapp/src/main/java/org/wildfly/swarm/topology/webapp/runtime/TopologySSEServlet.java#L168-L177 | train | Format the address if it is an IPv6 address. | Create a Java method that does the following: "Format the address if it is an IPv6 address.". | Of course, here is the Java code you requested:
```java
private String formatMaybeIpv6(String address) {
String openBracket = "[";
String closeBracket = "]";
if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) {
return openBracket + add... | |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.contains | public static <T> boolean contains(T[] array, T value) {
return indexOf(array, value) > INDEX_NOT_FOUND;
} | java | public static <T> boolean contains(T[] array, T value) {
return indexOf(array, value) > INDEX_NOT_FOUND;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"contains",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"value",
")",
"{",
"return",
"indexOf",
"(",
"array",
",",
"value",
")",
">",
"INDEX_NOT_FOUND",
";",
"}"
] | 数组中是否包含元素
@param <T> 数组元素类型
@param array 数组
@param value 被检查的元素
@return 是否包含 | [
"数组中是否包含元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L956-L958 | train | Returns true if the array contains the given value. | Create a Java method that does the following: "Returns true if the array contains the given value.". | Of course, here is the Java code you requested:
```java
public static <T> boolean contains(T[] array, T value) {
return indexOf(array, value) > INDEX_NOT_FOUND;
}
```
Hope this helps! | |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java | MtoNCollectionPrefetcher.buildPrefetchQuery | protected Query buildPrefetchQuery(Collection ids)
{
CollectionDescriptor cds = getCollectionDescriptor();
String[] indFkCols = getFksToThisClass();
String[] indItemFkCols = getFksToItemClass();
FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();
... | java | protected Query buildPrefetchQuery(Collection ids)
{
CollectionDescriptor cds = getCollectionDescriptor();
String[] indFkCols = getFksToThisClass();
String[] indItemFkCols = getFksToItemClass();
FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();
... | [
"protected",
"Query",
"buildPrefetchQuery",
"(",
"Collection",
"ids",
")",
"{",
"CollectionDescriptor",
"cds",
"=",
"getCollectionDescriptor",
"(",
")",
";",
"String",
"[",
"]",
"indFkCols",
"=",
"getFksToThisClass",
"(",
")",
";",
"String",
"[",
"]",
"indItemFk... | Build the prefetch query for a M-N relationship, The query looks like the following sample :
<br>
<pre>
crit = new Criteria();
crit.addIn("PERSON_PROJECT.PROJECT_ID", ids);
crit.addEqualToField("id","PERSON_PROJECT.PERSON_ID");
qry = new QueryByMtoNCriteria(Person.class, "PERSON_PROJECT", crit, true);
</pre>
@param id... | [
"Build",
"the",
"prefetch",
"query",
"for",
"a",
"M",
"-",
"N",
"relationship",
"The",
"query",
"looks",
"like",
"the",
"following",
"sample",
":",
"<br",
">",
"<pre",
">",
"crit",
"=",
"new",
"Criteria",
"()",
";",
"crit",
".",
"addIn",
"(",
"PERSON_P... | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java#L111-L130 | train | Build a Query object for a
request. | Create a Java method that does the following: "Build a Query object for a
request.". | Of course, here is the Java code you requested:
```java
protected Query buildPrefetchQuery(Collection ids)
{
CollectionDescriptor cds = getCollectionDescriptor();
String[] indFkCols = getFksToThisClass();
String[] indItemFkCols = getFksToItemClass();
FieldDescriptor[] itemPkFie... | |
facebook/fresco | fbcore/src/main/java/com/facebook/datasource/DataSources.java | DataSources.waitForFinalResult | @Nullable
public static <T> T waitForFinalResult(DataSource<T> dataSource) throws Throwable {
final CountDownLatch latch = new CountDownLatch(1);
final ValueHolder<T> resultHolder = new ValueHolder<>();
final ValueHolder<Throwable> pendingException = new ValueHolder<>();
dataSource.subscribe(
... | java | @Nullable
public static <T> T waitForFinalResult(DataSource<T> dataSource) throws Throwable {
final CountDownLatch latch = new CountDownLatch(1);
final ValueHolder<T> resultHolder = new ValueHolder<>();
final ValueHolder<Throwable> pendingException = new ValueHolder<>();
dataSource.subscribe(
... | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"waitForFinalResult",
"(",
"DataSource",
"<",
"T",
">",
"dataSource",
")",
"throws",
"Throwable",
"{",
"final",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"final",
"... | This methods blocks the calling thread until the {@link DataSource} has a final result, has
been cancelled or has failed.
@param dataSource The {@link DataSource} to wait for. The caller MUST close the data source
after this method returned!
@param <T> The type parameter for the {@link DataSource}
@return The final r... | [
"This",
"methods",
"blocks",
"the",
"calling",
"thread",
"until",
"the",
"{",
"@link",
"DataSource",
"}",
"has",
"a",
"final",
"result",
"has",
"been",
"cancelled",
"or",
"has",
"failed",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/datasource/DataSources.java#L57-L117 | train | Waits for the final result of a data source to be available. | Create a Java method that does the following: "Waits for the final result of a data source to be available.". | Of course, here is the Java code you requested:
```java
@Nullable
public static <T> T waitForFinalResult(DataSource<T> dataSource) throws Throwable {
final CountDownLatch latch = new CountDownLatch(1);
final ValueHolder<T> resultHolder = new ValueHolder<>();
final ValueHolder<Throwable> pendingException ... | |
cketti/EmailIntentBuilder | library/src/main/java/de/cketti/mailto/EmailIntentBuilder.java | EmailIntentBuilder.start | public boolean start() {
Intent emailIntent = build();
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
return false;
}
return true;
} | java | public boolean start() {
Intent emailIntent = build();
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
return false;
}
return true;
} | [
"public",
"boolean",
"start",
"(",
")",
"{",
"Intent",
"emailIntent",
"=",
"build",
"(",
")",
";",
"try",
"{",
"startActivity",
"(",
"emailIntent",
")",
";",
"}",
"catch",
"(",
"ActivityNotFoundException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"ret... | Launch the email intent.
@return {@code false} if no activity to handle the email intent could be found; {@code true} otherwise | [
"Launch",
"the",
"email",
"intent",
"."
] | 81660eebd415a1a8f16824cba2d37f019034223e | https://github.com/cketti/EmailIntentBuilder/blob/81660eebd415a1a8f16824cba2d37f019034223e/library/src/main/java/de/cketti/mailto/EmailIntentBuilder.java#L220-L229 | train | Start the application. | Create a Java method that does the following: "Start the application.". | Of course, here is the Java code you requested:
```java
public boolean start() {
Intent emailIntent = build();
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
return false;
}
return true;
}
```
Hope this helps! | |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/command/SetReplicationCommand.java | SetReplicationCommand.setReplication | private void setReplication(AlluxioURI path, Integer replicationMax, Integer replicationMin,
boolean recursive) throws AlluxioException, IOException {
SetAttributePOptions.Builder optionsBuilder =
SetAttributePOptions.newBuilder().setRecursive(recursive);
String message = "Changed the replication ... | java | private void setReplication(AlluxioURI path, Integer replicationMax, Integer replicationMin,
boolean recursive) throws AlluxioException, IOException {
SetAttributePOptions.Builder optionsBuilder =
SetAttributePOptions.newBuilder().setRecursive(recursive);
String message = "Changed the replication ... | [
"private",
"void",
"setReplication",
"(",
"AlluxioURI",
"path",
",",
"Integer",
"replicationMax",
",",
"Integer",
"replicationMin",
",",
"boolean",
"recursive",
")",
"throws",
"AlluxioException",
",",
"IOException",
"{",
"SetAttributePOptions",
".",
"Builder",
"option... | Changes the replication level of directory or file with the path specified in args.
@param path The {@link AlluxioURI} path as the input of the command
@param replicationMax the max replicas, null if not to set
@param replicationMin the min replicas, null if not to set
@param recursive Whether change the permission re... | [
"Changes",
"the",
"replication",
"level",
"of",
"directory",
"or",
"file",
"with",
"the",
"path",
"specified",
"in",
"args",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/SetReplicationCommand.java#L80-L95 | train | Sets the replication level of a file. | Create a Java method that does the following: "Sets the replication level of a file.". | Of course, here is the Java code you requested:
```java
private void setReplication(AlluxioURI path, Integer replicationMax, Integer replicationMin,
boolean recursive) throws AlluxioException, IOException {
SetAttributePOptions.Builder optionsBuilder =
SetAttributePOptions.newBuilder().setRecursive(r... | |
jMetal/jMetal | jmetal-exec/src/main/java/org/uma/jmetal/runner/singleobjective/DifferentialEvolutionRunner.java | DifferentialEvolutionRunner.main | public static void main(String[] args) throws Exception {
DoubleProblem problem;
Algorithm<DoubleSolution> algorithm;
DifferentialEvolutionSelection selection;
DifferentialEvolutionCrossover crossover;
SolutionListEvaluator<DoubleSolution> evaluator ;
problem = new Sphere(20) ;
int number... | java | public static void main(String[] args) throws Exception {
DoubleProblem problem;
Algorithm<DoubleSolution> algorithm;
DifferentialEvolutionSelection selection;
DifferentialEvolutionCrossover crossover;
SolutionListEvaluator<DoubleSolution> evaluator ;
problem = new Sphere(20) ;
int number... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"DoubleProblem",
"problem",
";",
"Algorithm",
"<",
"DoubleSolution",
">",
"algorithm",
";",
"DifferentialEvolutionSelection",
"selection",
";",
"DifferentialEvoluti... | Usage: java org.uma.jmetal.runner.singleobjective.DifferentialEvolutionRunner [cores] | [
"Usage",
":",
"java",
"org",
".",
"uma",
".",
"jmetal",
".",
"runner",
".",
"singleobjective",
".",
"DifferentialEvolutionRunner",
"[",
"cores",
"]"
] | bc981e6aede275d26c5216c9a01227d9675b0cf7 | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/runner/singleobjective/DifferentialEvolutionRunner.java#L33-L88 | train | Main method for the Differential Evolution | Create a Java method that does the following: "Main method for the Differential Evolution". | Of course, here is the Java code you requested:
```java
public static void main(String[] args) throws Exception {
DoubleProblem problem;
Algorithm<DoubleSolution> algorithm;
DifferentialEvolutionSelection selection;
DifferentialEvolutionCrossover crossover;
SolutionListEvaluator<DoubleSolution> ev... | |
molgenis/molgenis | molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java | ExcelSheetWriter.add | @Override
public void add(Entity entity) {
if (entity == null) throw new IllegalArgumentException("Entity cannot be null");
if (cachedAttributes == null)
throw new MolgenisDataException(
"The attribute names are not defined, call writeAttributeNames first");
int i = 0;
Row poiRow = sh... | java | @Override
public void add(Entity entity) {
if (entity == null) throw new IllegalArgumentException("Entity cannot be null");
if (cachedAttributes == null)
throw new MolgenisDataException(
"The attribute names are not defined, call writeAttributeNames first");
int i = 0;
Row poiRow = sh... | [
"@",
"Override",
"public",
"void",
"add",
"(",
"Entity",
"entity",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Entity cannot be null\"",
")",
";",
"if",
"(",
"cachedAttributes",
"==",
"null",
")",
"th... | Add a new row to the sheet | [
"Add",
"a",
"new",
"row",
"to",
"the",
"sheet"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java#L44-L59 | train | Add an entity to the sheet. | Create a Java method that does the following: "Add an entity to the sheet.". | Of course, here is the Java code you requested:
```java
@Override
public void add(Entity entity) {
if (entity == null) throw new IllegalArgumentException("Entity cannot be null");
if (cachedAttributes == null)
throw new MolgenisDataException(
"The attribute names are not defined, call writeAt... | |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/Stopwatch.java | Stopwatch.getSeconds | public String getSeconds() {
if (myTimerIsRunning) {
throw new IllegalStateException(LOGGER.getI18n(MessageCodes.UTIL_042));
}
final StringBuilder result = new StringBuilder();
final long timeGap = myStop - myStart;
return result.append(timeGap / 1000).append(" secs... | java | public String getSeconds() {
if (myTimerIsRunning) {
throw new IllegalStateException(LOGGER.getI18n(MessageCodes.UTIL_042));
}
final StringBuilder result = new StringBuilder();
final long timeGap = myStop - myStart;
return result.append(timeGap / 1000).append(" secs... | [
"public",
"String",
"getSeconds",
"(",
")",
"{",
"if",
"(",
"myTimerIsRunning",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"LOGGER",
".",
"getI18n",
"(",
"MessageCodes",
".",
"UTIL_042",
")",
")",
";",
"}",
"final",
"StringBuilder",
"result",
"=... | Express the "reading" on the stopwatch in seconds.
@return Time elapsed in stopwatch in seconds
@throws IllegalStateException if the Stopwatch has never been used, or if the stopwatch is still running. | [
"Express",
"the",
"reading",
"on",
"the",
"stopwatch",
"in",
"seconds",
"."
] | 54e822ae4c11b3d74793fd82a1a535ffafffaf45 | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/Stopwatch.java#L83-L92 | train | Get the seconds. | Create a Java method that does the following: "Get the seconds.". | Of course, here is the Java code you requested:
```java
public String getSeconds() {
if (myTimerIsRunning) {
throw new IllegalStateException(LOGGER.getI18n(MessageCodes.UTIL_042));
}
final StringBuilder result = new StringBuilder();
final long timeGap = myStop - myStart;
... | |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskTracker.java | TaskTracker.getAveReduceSlotRefillMsecs | int getAveReduceSlotRefillMsecs() {
synchronized (reduceSlotRefillMsecsQueue) {
if (reduceSlotRefillMsecsQueue.isEmpty()) {
return -1;
}
int totalReduceSlotRefillMsecs = 0;
for (int refillMsecs : reduceSlotRefillMsecsQueue) {
totalReduceSlotRefillMsecs += refillMsecs;
... | java | int getAveReduceSlotRefillMsecs() {
synchronized (reduceSlotRefillMsecsQueue) {
if (reduceSlotRefillMsecsQueue.isEmpty()) {
return -1;
}
int totalReduceSlotRefillMsecs = 0;
for (int refillMsecs : reduceSlotRefillMsecsQueue) {
totalReduceSlotRefillMsecs += refillMsecs;
... | [
"int",
"getAveReduceSlotRefillMsecs",
"(",
")",
"{",
"synchronized",
"(",
"reduceSlotRefillMsecsQueue",
")",
"{",
"if",
"(",
"reduceSlotRefillMsecsQueue",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"totalReduceSlotRefillMsecs",
"=",
... | Get the average time in milliseconds to refill a free reduce slot. This
average is calculated on a rotating buffer.
@return Average time in milliseconds to refill a free reduce slot. Return -1
if the value is not valid (hasn't actually refilled anything) | [
"Get",
"the",
"average",
"time",
"in",
"milliseconds",
"to",
"refill",
"a",
"free",
"reduce",
"slot",
".",
"This",
"average",
"is",
"calculated",
"on",
"a",
"rotating",
"buffer",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTracker.java#L4329-L4341 | train | Get the average time in milliseconds that the reduce slot refills. | Create a Java method that does the following: "Get the average time in milliseconds that the reduce slot refills.". | Of course, here is the Java code you requested:
```java
int getAveReduceSlotRefillMsecs() {
synchronized (reduceSlotRefillMsecsQueue) {
if (reduceSlotRefillMsecsQueue.isEmpty()) {
return -1;
}
int totalReduceSlotRefillMsecs = 0;
for (int refillMsecs : reduceSlotRefillMsecsQueue) {
... | |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java | RemoteConnectionImpl.setTransactionIsolation | @Override
public void setTransactionIsolation(int level) throws RemoteException {
if (getAutoCommit() != false)
throw new RemoteException(
"the auto-commit mode need to be set to false before changing the isolation level");
if (this.isolationLevel == level)
return;
tx.commit();
this.isolatio... | java | @Override
public void setTransactionIsolation(int level) throws RemoteException {
if (getAutoCommit() != false)
throw new RemoteException(
"the auto-commit mode need to be set to false before changing the isolation level");
if (this.isolationLevel == level)
return;
tx.commit();
this.isolatio... | [
"@",
"Override",
"public",
"void",
"setTransactionIsolation",
"(",
"int",
"level",
")",
"throws",
"RemoteException",
"{",
"if",
"(",
"getAutoCommit",
"(",
")",
"!=",
"false",
")",
"throw",
"new",
"RemoteException",
"(",
"\"the auto-commit mode need to be set to false ... | Attempts to change the transaction isolation level for this connection.
This method will commit current transaction and start a new transaction.
Currently, the only supported isolation levels are
{@link Connection#TRANSACTION_SERIALIZABLE} and
{@link Connection#TRANSACTION_REPEATABLE_READ}. The auto-commit mode must
be... | [
"Attempts",
"to",
"change",
"the",
"transaction",
"isolation",
"level",
"for",
"this",
"connection",
".",
"This",
"method",
"will",
"commit",
"current",
"transaction",
"and",
"start",
"a",
"new",
"transaction",
".",
"Currently",
"the",
"only",
"supported",
"isol... | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java#L112-L126 | train | Sets the isolation level of the transaction. | Create a Java method that does the following: "Sets the isolation level of the transaction.". | Of course, here is the Java code you requested:
```java
@Override
public void setTransactionIsolation(int level) throws RemoteException {
if (getAutoCommit() != false)
throw new RemoteException(
"the auto-commit mode need to be set to false before changing the isolation level");
if (this.isolationLev... | |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java | SoyExpression.asBoxedList | public static Expression asBoxedList(List<SoyExpression> items) {
List<Expression> childExprs = new ArrayList<>(items.size());
for (SoyExpression child : items) {
childExprs.add(child.box());
}
return BytecodeUtils.asList(childExprs);
} | java | public static Expression asBoxedList(List<SoyExpression> items) {
List<Expression> childExprs = new ArrayList<>(items.size());
for (SoyExpression child : items) {
childExprs.add(child.box());
}
return BytecodeUtils.asList(childExprs);
} | [
"public",
"static",
"Expression",
"asBoxedList",
"(",
"List",
"<",
"SoyExpression",
">",
"items",
")",
"{",
"List",
"<",
"Expression",
">",
"childExprs",
"=",
"new",
"ArrayList",
"<>",
"(",
"items",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"SoyExpres... | Returns an Expression that evaluates to a list containing all the items as boxed soy values. | [
"Returns",
"an",
"Expression",
"that",
"evaluates",
"to",
"a",
"list",
"containing",
"all",
"the",
"items",
"as",
"boxed",
"soy",
"values",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java#L99-L105 | train | Returns a list of boxed elements of a list of SoyExpressions. | Create a Java method that does the following: "Returns a list of boxed elements of a list of SoyExpressions.". | Of course, here is the Java code you requested:
```java
public static Expression asBoxedList(List<SoyExpression> items) {
List<Expression> childExprs = new ArrayList<>(items.size());
for (SoyExpression child : items) {
childExprs.add(child.box());
}
return BytecodeUtils.asList(childExprs);
}
``... | |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/summarize/aggregation/ShortSummaryAggregator.java | ShortSummaryAggregator.max | public static Short max(Short a, Short b) {
return a >= b ? a : b;
} | java | public static Short max(Short a, Short b) {
return a >= b ? a : b;
} | [
"public",
"static",
"Short",
"max",
"(",
"Short",
"a",
",",
"Short",
"b",
")",
"{",
"return",
"a",
">=",
"b",
"?",
"a",
":",
"b",
";",
"}"
] | Like Math.max() except for shorts. | [
"Like",
"Math",
".",
"max",
"()",
"except",
"for",
"shorts",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/summarize/aggregation/ShortSummaryAggregator.java#L41-L43 | train | Get the max value of two shorts. | Create a Java method that does the following: "Get the max value of two shorts.". | Of course, here is the Java code you requested:
```java
public static Short max(Short a, Short b) {
return a >= b ? a : b;
}
```
Hope this helps! | |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java | EnterClickAdapter.bind | public static HandlerRegistration bind (HasKeyDownHandlers target, ClickHandler onEnter)
{
return target.addKeyDownHandler(new EnterClickAdapter(onEnter));
} | java | public static HandlerRegistration bind (HasKeyDownHandlers target, ClickHandler onEnter)
{
return target.addKeyDownHandler(new EnterClickAdapter(onEnter));
} | [
"public",
"static",
"HandlerRegistration",
"bind",
"(",
"HasKeyDownHandlers",
"target",
",",
"ClickHandler",
"onEnter",
")",
"{",
"return",
"target",
".",
"addKeyDownHandler",
"(",
"new",
"EnterClickAdapter",
"(",
"onEnter",
")",
")",
";",
"}"
] | Binds a listener to the supplied target text box that triggers the supplied click handler
when enter is pressed on the text box. | [
"Binds",
"a",
"listener",
"to",
"the",
"supplied",
"target",
"text",
"box",
"that",
"triggers",
"the",
"supplied",
"click",
"handler",
"when",
"enter",
"is",
"pressed",
"on",
"the",
"text",
"box",
"."
] | 31b31a23b667f2a9c683160d77646db259f2aae5 | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/EnterClickAdapter.java#L41-L44 | train | Binds a key down handler to a hasKeyDownHandlers target. | Create a Java method that does the following: "Binds a key down handler to a hasKeyDownHandlers target.". | Of course, here is the Java code you requested:
```java
public static HandlerRegistration bind (HasKeyDownHandlers target, ClickHandler onEnter)
{
return target.addKeyDownHandler(new EnterClickAdapter(onEnter));
}
```
Hope this helps! | |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fn.java | Fn.indexed | @Deprecated
static <U, T> BiPredicate<U, T> indexed(final IndexedBiPredicate<U, T> predicate) {
return BiPredicates.indexed(predicate);
} | java | @Deprecated
static <U, T> BiPredicate<U, T> indexed(final IndexedBiPredicate<U, T> predicate) {
return BiPredicates.indexed(predicate);
} | [
"@",
"Deprecated",
"static",
"<",
"U",
",",
"T",
">",
"BiPredicate",
"<",
"U",
",",
"T",
">",
"indexed",
"(",
"final",
"IndexedBiPredicate",
"<",
"U",
",",
"T",
">",
"predicate",
")",
"{",
"return",
"BiPredicates",
".",
"indexed",
"(",
"predicate",
")"... | Returns a stateful <code>BiPredicate</code> which should not be used in parallel stream.
@param predicate
@return
@deprecated replaced by {@code BiPredicates#indexed(IndexedBiPredicate)}. | [
"Returns",
"a",
"stateful",
"<code",
">",
"BiPredicate<",
"/",
"code",
">",
"which",
"should",
"not",
"be",
"used",
"in",
"parallel",
"stream",
"."
] | 544b7720175d15e9329f83dd22a8cc5fa4515e12 | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fn.java#L2050-L2053 | train | Creates a binary predicate that only accepts tokens that are not part of an indexed sequence. | Create a Java method that does the following: "Creates a binary predicate that only accepts tokens that are not part of an indexed sequence.". | Of course, here is the Java code you requested:
```java
@Deprecated
static <U, T> BiPredicate<U, T> indexed(final IndexedBiPredicate<U, T> predicate) {
return BiPredicates.indexed(predicate);
}
```
Hope this helps! | |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java | PdfCopyFieldsImp.isVisited | protected boolean isVisited(PRIndirectReference ref) {
IntHashtable refs = (IntHashtable)visited.get(ref.getReader());
if (refs != null)
return refs.containsKey(ref.getNumber());
else
return false;
} | java | protected boolean isVisited(PRIndirectReference ref) {
IntHashtable refs = (IntHashtable)visited.get(ref.getReader());
if (refs != null)
return refs.containsKey(ref.getNumber());
else
return false;
} | [
"protected",
"boolean",
"isVisited",
"(",
"PRIndirectReference",
"ref",
")",
"{",
"IntHashtable",
"refs",
"=",
"(",
"IntHashtable",
")",
"visited",
".",
"get",
"(",
"ref",
".",
"getReader",
"(",
")",
")",
";",
"if",
"(",
"refs",
"!=",
"null",
")",
"retur... | Checks if a reference has already been "visited" in the copy process.
@param ref the reference that needs to be checked
@return true if the reference was already visited | [
"Checks",
"if",
"a",
"reference",
"has",
"already",
"been",
"visited",
"in",
"the",
"copy",
"process",
"."
] | 438fc1899367fd13dfdfa8dfdca9a3c1a7783b84 | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java#L589-L595 | train | Check if the reference has already been visited. | Create a Java method that does the following: "Check if the reference has already been visited.". | Of course, here is the Java code you requested:
```java
protected boolean isVisited(PRIndirectReference ref) {
IntHashtable refs = (IntHashtable)visited.get(ref.getReader());
if (refs != null)
return refs.containsKey(ref.getNumber());
else
return false;
}
```
Hope this he... | |
VoltDB/voltdb | src/frontend/org/voltdb/largequery/LargeBlockManager.java | LargeBlockManager.releaseAllBlocks | private void releaseAllBlocks() throws IOException {
synchronized (m_accessLock) {
Set<Map.Entry<BlockId, Path>> entries = m_blockPathMap.entrySet();
while (! entries.isEmpty()) {
Map.Entry<BlockId, Path> entry = entries.iterator().next();
Files.delete(ent... | java | private void releaseAllBlocks() throws IOException {
synchronized (m_accessLock) {
Set<Map.Entry<BlockId, Path>> entries = m_blockPathMap.entrySet();
while (! entries.isEmpty()) {
Map.Entry<BlockId, Path> entry = entries.iterator().next();
Files.delete(ent... | [
"private",
"void",
"releaseAllBlocks",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"m_accessLock",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"BlockId",
",",
"Path",
">",
">",
"entries",
"=",
"m_blockPathMap",
".",
"entrySet",
"(",
")... | Release all the blocks that are on disk, and delete them from the
map that tracks them.
@throws IOException | [
"Release",
"all",
"the",
"blocks",
"that",
"are",
"on",
"disk",
"and",
"delete",
"them",
"from",
"the",
"map",
"that",
"tracks",
"them",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/largequery/LargeBlockManager.java#L240-L250 | train | Release all blocks. | Create a Java method that does the following: "Release all blocks.". | Of course, here is the Java code you requested:
```java
private void releaseAllBlocks() throws IOException {
synchronized (m_accessLock) {
Set<Map.Entry<BlockId, Path>> entries = m_blockPathMap.entrySet();
while (! entries.isEmpty()) {
Map.Entry<BlockId, Path> entry = en... | |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCStatementBase.java | JDBCStatementBase.closeResultData | void closeResultData() throws SQLException {
if (currentResultSet != null) {
currentResultSet.close();
}
if (generatedResultSet != null) {
generatedResultSet.close();
}
generatedResultSet = null;
generatedResult = null;
resultIn ... | java | void closeResultData() throws SQLException {
if (currentResultSet != null) {
currentResultSet.close();
}
if (generatedResultSet != null) {
generatedResultSet.close();
}
generatedResultSet = null;
generatedResult = null;
resultIn ... | [
"void",
"closeResultData",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"currentResultSet",
"!=",
"null",
")",
"{",
"currentResultSet",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"generatedResultSet",
"!=",
"null",
")",
"{",
"generatedResultSet",
".... | See comment for getMoreResults. | [
"See",
"comment",
"for",
"getMoreResults",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCStatementBase.java#L259-L271 | train | Close the result set. | Create a Java method that does the following: "Close the result set.". | Of course, here is the Java code you requested:
```java
void closeResultData() throws SQLException {
if (currentResultSet != null) {
currentResultSet.close();
}
if (generatedResultSet != null) {
generatedResultSet.close();
}
generatedResultSet = null;
... | |
aws/aws-sdk-java | aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/StartBackupJobRequest.java | StartBackupJobRequest.withRecoveryPointTags | public StartBackupJobRequest withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
} | java | public StartBackupJobRequest withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
} | [
"public",
"StartBackupJobRequest",
"withRecoveryPointTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"recoveryPointTags",
")",
"{",
"setRecoveryPointTags",
"(",
"recoveryPointTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a
key-value pair.
</p>
@param recoveryPointTags
To help organize your resources, you can assign your own metadata to the resources that you create. Each
tag is a key-value pair.
@return Returns a referen... | [
"<p",
">",
"To",
"help",
"organize",
"your",
"resources",
"you",
"can",
"assign",
"your",
"own",
"metadata",
"to",
"the",
"resources",
"that",
"you",
"create",
".",
"Each",
"tag",
"is",
"a",
"key",
"-",
"value",
"pair",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/StartBackupJobRequest.java#L497-L500 | train | Sets the tags associated with the backup job. | Create a Java method that does the following: "Sets the tags associated with the backup job.". | Of course, here is the Java code you requested:
```java
public StartBackupJobRequest withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-efs/src/main/java/com/amazonaws/services/elasticfilesystem/model/transform/DescribeTagsRequestMarshaller.java | DescribeTagsRequestMarshaller.marshall | public void marshall(DescribeTagsRequest describeTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeTagsRequest.ge... | java | public void marshall(DescribeTagsRequest describeTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeTagsRequest.ge... | [
"public",
"void",
"marshall",
"(",
"DescribeTagsRequest",
"describeTagsRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"describeTagsRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to m... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-efs/src/main/java/com/amazonaws/services/elasticfilesystem/model/transform/DescribeTagsRequestMarshaller.java#L46-L59 | train | marshalls the given request to the JSON object. | Create a Java method that does the following: "marshalls the given request to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(DescribeTagsRequest describeTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
... | |
windy1/google-places-api-java | src/main/java/se/walkercrou/places/Place.java | Place.parseDetails | public static Place parseDetails(GooglePlaces client, String rawJson) {
JSONObject json = new JSONObject(rawJson);
JSONObject result = json.getJSONObject(OBJECT_RESULT);
// easy stuff
String name = result.getString(STRING_NAME);
String id = result.getString(STRING_PLACE_ID);
... | java | public static Place parseDetails(GooglePlaces client, String rawJson) {
JSONObject json = new JSONObject(rawJson);
JSONObject result = json.getJSONObject(OBJECT_RESULT);
// easy stuff
String name = result.getString(STRING_NAME);
String id = result.getString(STRING_PLACE_ID);
... | [
"public",
"static",
"Place",
"parseDetails",
"(",
"GooglePlaces",
"client",
",",
"String",
"rawJson",
")",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
"rawJson",
")",
";",
"JSONObject",
"result",
"=",
"json",
".",
"getJSONObject",
"(",
"OBJECT_RE... | Parses a detailed Place object.
@param client api client
@param rawJson json to parse
@return a detailed place | [
"Parses",
"a",
"detailed",
"Place",
"object",
"."
] | a5f2a18a7d1ca03fc0480637eae255fe92fc8b86 | https://github.com/windy1/google-places-api-java/blob/a5f2a18a7d1ca03fc0480637eae255fe92fc8b86/src/main/java/se/walkercrou/places/Place.java#L56-L225 | train | Parses the details of a GooglePlaces API response. | Create a Java method that does the following: "Parses the details of a GooglePlaces API response.". | Of course, here is the Java code you requested:
```java
public static Place parseDetails(GooglePlaces client, String rawJson) {
JSONObject json = new JSONObject(rawJson);
JSONObject result = json.getJSONObject(OBJECT_RESULT);
// easy stuff
String name = result.getString(STRING_NAME);
... | |
phax/ph-css | ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java | CascadingStyleSheet.addImportRule | @Nonnull
public CascadingStyleSheet addImportRule (@Nonnull final CSSImportRule aImportRule)
{
ValueEnforcer.notNull (aImportRule, "ImportRule");
m_aImportRules.add (aImportRule);
return this;
} | java | @Nonnull
public CascadingStyleSheet addImportRule (@Nonnull final CSSImportRule aImportRule)
{
ValueEnforcer.notNull (aImportRule, "ImportRule");
m_aImportRules.add (aImportRule);
return this;
} | [
"@",
"Nonnull",
"public",
"CascadingStyleSheet",
"addImportRule",
"(",
"@",
"Nonnull",
"final",
"CSSImportRule",
"aImportRule",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aImportRule",
",",
"\"ImportRule\"",
")",
";",
"m_aImportRules",
".",
"add",
"(",
"aImp... | Add a new <code>@import</code> rule at the end of the <code>@import</code>
rule list.
@param aImportRule
The import rule to add. May not be <code>null</code>.
@return this | [
"Add",
"a",
"new",
"<code",
">",
"@import<",
"/",
"code",
">",
"rule",
"at",
"the",
"end",
"of",
"the",
"<code",
">",
"@import<",
"/",
"code",
">",
"rule",
"list",
"."
] | c9da5bb4decc681de6e27ce31712aad4c00adafa | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java#L93-L100 | train | Add an import rule to the stylesheet. | Create a Java method that does the following: "Add an import rule to the stylesheet.". | Of course, here is the Java code you requested:
```java
@Nonnull
public CascadingStyleSheet addImportRule (@Nonnull final CSSImportRule aImportRule)
{
ValueEnforcer.notNull (aImportRule, "ImportRule");
m_aImportRules.add (aImportRule);
return this;
}
```
Hope this helps! | |
Comcast/jrugged | jrugged-aspects/src/main/java/org/fishwife/jrugged/aspects/RetryableAspect.java | RetryableAspect.call | @Around("@annotation(retryableAnnotation)")
public Object call(final ProceedingJoinPoint pjp, Retryable retryableAnnotation) throws Throwable {
final int maxTries = retryableAnnotation.maxTries();
final int retryDelayMillies = retryableAnnotation.retryDelayMillis();
final Class<? extends Thr... | java | @Around("@annotation(retryableAnnotation)")
public Object call(final ProceedingJoinPoint pjp, Retryable retryableAnnotation) throws Throwable {
final int maxTries = retryableAnnotation.maxTries();
final int retryDelayMillies = retryableAnnotation.retryDelayMillis();
final Class<? extends Thr... | [
"@",
"Around",
"(",
"\"@annotation(retryableAnnotation)\"",
")",
"public",
"Object",
"call",
"(",
"final",
"ProceedingJoinPoint",
"pjp",
",",
"Retryable",
"retryableAnnotation",
")",
"throws",
"Throwable",
"{",
"final",
"int",
"maxTries",
"=",
"retryableAnnotation",
"... | Runs a method call with retries.
@param pjp a {@link ProceedingJoinPoint} representing an annotated
method call.
@param retryableAnnotation the {@link org.fishwife.jrugged.aspects.Retryable}
annotation that wrapped the method.
@throws Throwable if the method invocation itself throws one during execution.
@return The re... | [
"Runs",
"a",
"method",
"call",
"with",
"retries",
"."
] | b6a5147c68ee733faf5616d49800abcbba67afe9 | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-aspects/src/main/java/org/fishwife/jrugged/aspects/RetryableAspect.java#L49-L86 | train | Around to call a method on a single object. | Create a Java method that does the following: "Around to call a method on a single object.". | Of course, here is the Java code you requested:
```java
@Around("@annotation(retryableAnnotation)")
public Object call(final ProceedingJoinPoint pjp, Retryable retryableAnnotation) throws Throwable {
final int maxTries = retryableAnnotation.maxTries();
final int retryDelayMillies = retryableAnnotat... | |
pressgang-ccms/PressGangCCMSRESTv1Common | src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java | RESTBaseCollectionV1.ignoreDuplicatedChangeItemRequests | protected void ignoreDuplicatedChangeItemRequests() {
if (getItems() != null) {
final List<V> items = new ArrayList<V>(getItems());
// on the second loop, remove any items that are marked for both add and remove is separate items
for (int i = 0; i < items.size(); ++i) {
... | java | protected void ignoreDuplicatedChangeItemRequests() {
if (getItems() != null) {
final List<V> items = new ArrayList<V>(getItems());
// on the second loop, remove any items that are marked for both add and remove is separate items
for (int i = 0; i < items.size(); ++i) {
... | [
"protected",
"void",
"ignoreDuplicatedChangeItemRequests",
"(",
")",
"{",
"if",
"(",
"getItems",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"V",
">",
"items",
"=",
"new",
"ArrayList",
"<",
"V",
">",
"(",
"getItems",
"(",
")",
")",
";",
"... | This method will clear out any child items that are marked for both add and remove, or duplicated add and remove
requests. Override this method to deal with collections where the children are not uniquely identified by only their id.
<p/>
This shouldn't occur when using the REST API through Java but may occur if a requ... | [
"This",
"method",
"will",
"clear",
"out",
"any",
"child",
"items",
"that",
"are",
"marked",
"for",
"both",
"add",
"and",
"remove",
"or",
"duplicated",
"add",
"and",
"remove",
"requests",
".",
"Override",
"this",
"method",
"to",
"deal",
"with",
"collections",... | 0641d21b127297b47035f3b8e55fba81251b419c | https://github.com/pressgang-ccms/PressGangCCMSRESTv1Common/blob/0641d21b127297b47035f3b8e55fba81251b419c/src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java#L219-L257 | train | This method is called to ignore duplicate change item requests. | Create a Java method that does the following: "This method is called to ignore duplicate change item requests.". | Of course, here is the Java code you requested:
```java
protected void ignoreDuplicatedChangeItemRequests() {
if (getItems() != null) {
final List<V> items = new ArrayList<V>(getItems());
// on the second loop, remove any items that are marked for both add and remove is separate items
... | |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/ReflectUtil.java | ReflectUtil.getFieldValue | public static <T extends Object> T getFieldValue(Object obj, String fieldName) {
Assert.notNull(obj, "obj不能为空");
Assert.notNull(fieldName, "fieldName不能为空");
Field field;
if (obj instanceof Class) {
field = getField((Class) obj, fieldName);
} else {
field ... | java | public static <T extends Object> T getFieldValue(Object obj, String fieldName) {
Assert.notNull(obj, "obj不能为空");
Assert.notNull(fieldName, "fieldName不能为空");
Field field;
if (obj instanceof Class) {
field = getField((Class) obj, fieldName);
} else {
field ... | [
"public",
"static",
"<",
"T",
"extends",
"Object",
">",
"T",
"getFieldValue",
"(",
"Object",
"obj",
",",
"String",
"fieldName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"obj",
",",
"\"obj不能为空\");",
"",
"",
"Assert",
".",
"notNull",
"(",
"fieldName",
",",... | 获取指定对象中指定字段名对应的字段的值
@param obj 对象,如果要获取的字段是静态字段那么需要传入Class
@param fieldName 字段名
@param <T> 字段类型
@return 指定对象中指定字段名对应字段的值 | [
"获取指定对象中指定字段名对应的字段的值"
] | 45e1b2dc4d736956674fc4dcbe6cf84eaee69278 | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ReflectUtil.java#L302-L314 | train | Gets the value of the field with the specified name from the specified object. | Create a Java method that does the following: "Gets the value of the field with the specified name from the specified object.". | Of course, here is the Java code you requested:
```java
public static <T extends Object> T getFieldValue(Object obj, String fieldName) {
Assert.notNull(obj, "obj不能为空");
Assert.notNull(fieldName, "fieldName不能为空");
Field field;
if (obj instanceof Class) {
field = getField((Cl... | |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.notifications_sendEmailPlain | public String notifications_sendEmailPlain(Collection<Integer> recipientIds, CharSequence subject, CharSequence text)
throws FacebookException, IOException {
return notifications_sendEmail(recipientIds, subject, /*fbml*/null, text);
} | java | public String notifications_sendEmailPlain(Collection<Integer> recipientIds, CharSequence subject, CharSequence text)
throws FacebookException, IOException {
return notifications_sendEmail(recipientIds, subject, /*fbml*/null, text);
} | [
"public",
"String",
"notifications_sendEmailPlain",
"(",
"Collection",
"<",
"Integer",
">",
"recipientIds",
",",
"CharSequence",
"subject",
",",
"CharSequence",
"text",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"notifications_sendEmail",
"("... | Sends a notification email to the specified users, who must have added your application.
You can send five (5) emails to a user per day. Requires a session key for desktop applications, which may only
send email to the person whose session it is. This method does not require a session for Web applications.
@param reci... | [
"Sends",
"a",
"notification",
"email",
"to",
"the",
"specified",
"users",
"who",
"must",
"have",
"added",
"your",
"application",
".",
"You",
"can",
"send",
"five",
"(",
"5",
")",
"emails",
"to",
"a",
"user",
"per",
"day",
".",
"Requires",
"a",
"session",... | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1252-L1255 | train | Sends a plain email to a list of recipient ids. | Create a Java method that does the following: "Sends a plain email to a list of recipient ids.". | Of course, here is the Java code you requested:
```java
public String notifications_sendEmailPlain(Collection<Integer> recipientIds, CharSequence subject, CharSequence text)
throws FacebookException, IOException {
return notifications_sendEmail(recipientIds, subject, /*fbml*/null, text);
}
```
Hope this hel... | |
alkacon/opencms-core | src/org/opencms/ui/report/CmsStreamReportWidget.java | CmsStreamReportWidget.writeToDelegate | private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | java | private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | [
"private",
"void",
"writeToDelegate",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"m_delegateStream",
"!=",
"null",
")",
"{",
"try",
"{",
"m_delegateStream",
".",
"write",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
... | Writes data to delegate stream if it has been set.
@param data the data to write | [
"Writes",
"data",
"to",
"delegate",
"stream",
"if",
"it",
"has",
"been",
"set",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/report/CmsStreamReportWidget.java#L183-L192 | train | Write the bytes to the delegate stream. | Create a Java method that does the following: "Write the bytes to the delegate stream.". | Of course, here is the Java code you requested:
```java
private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}... | |
aws/aws-sdk-java | aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/transform/AddInstanceFleetRequestMarshaller.java | AddInstanceFleetRequestMarshaller.marshall | public void marshall(AddInstanceFleetRequest addInstanceFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (addInstanceFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addInstanc... | java | public void marshall(AddInstanceFleetRequest addInstanceFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (addInstanceFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addInstanc... | [
"public",
"void",
"marshall",
"(",
"AddInstanceFleetRequest",
"addInstanceFleetRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"addInstanceFleetRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/transform/AddInstanceFleetRequestMarshaller.java#L44-L56 | train | marshalls the given addInstanceFleetRequest to the given protocolMarshaller. | Create a Java method that does the following: "marshalls the given addInstanceFleetRequest to the given protocolMarshaller.". | Of course, here is the Java code you requested:
```java
public void marshall(AddInstanceFleetRequest addInstanceFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (addInstanceFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
... | |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/util/FastList.java | FastList.remove | @Override
public boolean remove(Object element)
{
for (int index = size - 1; index >= 0; index--) {
if (element == elementData[index]) {
final int numMoved = size - index - 1;
if (numMoved > 0) {
System.arraycopy(elementData, index + 1, elementData, index, num... | java | @Override
public boolean remove(Object element)
{
for (int index = size - 1; index >= 0; index--) {
if (element == elementData[index]) {
final int numMoved = size - index - 1;
if (numMoved > 0) {
System.arraycopy(elementData, index + 1, elementData, index, num... | [
"@",
"Override",
"public",
"boolean",
"remove",
"(",
"Object",
"element",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"size",
"-",
"1",
";",
"index",
">=",
"0",
";",
"index",
"--",
")",
"{",
"if",
"(",
"element",
"==",
"elementData",
"[",
"index",
"... | This remove method is most efficient when the element being removed
is the last element. Equality is identity based, not equals() based.
Only the first matching element is removed.
@param element the element to remove | [
"This",
"remove",
"method",
"is",
"most",
"efficient",
"when",
"the",
"element",
"being",
"removed",
"is",
"the",
"last",
"element",
".",
"Equality",
"is",
"identity",
"based",
"not",
"equals",
"()",
"based",
".",
"Only",
"the",
"first",
"matching",
"element... | c509ec1a3f1e19769ee69323972f339cf098ff4b | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/FastList.java#L127-L142 | train | Remove a single element from the list. | Create a Java method that does the following: "Remove a single element from the list.". | Of course, here is the Java code you requested:
```java
@Override
public boolean remove(Object element)
{
for (int index = size - 1; index >= 0; index--) {
if (element == elementData[index]) {
final int numMoved = size - index - 1;
if (numMoved > 0) {
System.... | |
aws/aws-sdk-java | aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/transform/JobFlowInstancesConfigMarshaller.java | JobFlowInstancesConfigMarshaller.marshall | public void marshall(JobFlowInstancesConfig jobFlowInstancesConfig, ProtocolMarshaller protocolMarshaller) {
if (jobFlowInstancesConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobFlowInstan... | java | public void marshall(JobFlowInstancesConfig jobFlowInstancesConfig, ProtocolMarshaller protocolMarshaller) {
if (jobFlowInstancesConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobFlowInstan... | [
"public",
"void",
"marshall",
"(",
"JobFlowInstancesConfig",
"jobFlowInstancesConfig",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"jobFlowInstancesConfig",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument pa... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/transform/JobFlowInstancesConfigMarshaller.java#L75-L102 | train | marshalls the given jobFlowInstancesConfig to the JSON object. | Create a Java method that does the following: "marshalls the given jobFlowInstancesConfig to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(JobFlowInstancesConfig jobFlowInstancesConfig, ProtocolMarshaller protocolMarshaller) {
if (jobFlowInstancesConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
tr... | |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobProcessDetails.java | JobProcessDetails.withProcessingTargets | public JobProcessDetails withProcessingTargets(String... processingTargets) {
if (this.processingTargets == null) {
setProcessingTargets(new java.util.ArrayList<String>(processingTargets.length));
}
for (String ele : processingTargets) {
this.processingTargets.add(ele);
... | java | public JobProcessDetails withProcessingTargets(String... processingTargets) {
if (this.processingTargets == null) {
setProcessingTargets(new java.util.ArrayList<String>(processingTargets.length));
}
for (String ele : processingTargets) {
this.processingTargets.add(ele);
... | [
"public",
"JobProcessDetails",
"withProcessingTargets",
"(",
"String",
"...",
"processingTargets",
")",
"{",
"if",
"(",
"this",
".",
"processingTargets",
"==",
"null",
")",
"{",
"setProcessingTargets",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"Str... | <p>
The target devices to which the job execution is being rolled out. This value will be null after the job
execution has finished rolling out to all the target devices.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setProcessingTargets(java.util.Collection)} or {@link... | [
"<p",
">",
"The",
"target",
"devices",
"to",
"which",
"the",
"job",
"execution",
"is",
"being",
"rolled",
"out",
".",
"This",
"value",
"will",
"be",
"null",
"after",
"the",
"job",
"execution",
"has",
"finished",
"rolling",
"out",
"to",
"all",
"the",
"tar... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobProcessDetails.java#L136-L144 | train | A list of string IDs to process for the job. | Create a Java method that does the following: "A list of string IDs to process for the job.". | Of course, here is the Java code you requested:
```java
public JobProcessDetails withProcessingTargets(String... processingTargets) {
if (this.processingTargets == null) {
setProcessingTargets(new java.util.ArrayList<String>(processingTargets.length));
}
for (String ele : processing... | |
konvergeio/cofoja | src/main/java/com/google/java/contract/core/util/Elements.java | Elements.findEnclosingElement | @Requires({
"element != null",
"clazz != null",
"kinds != null"
})
@SuppressWarnings("unchecked")
public static <T extends ElementModel> T findEnclosingElement(
ElementModel element, Class<T> clazz, ElementKind... kinds) {
List<ElementKind> list = Arrays.asList(kinds);
for (;;) {
e... | java | @Requires({
"element != null",
"clazz != null",
"kinds != null"
})
@SuppressWarnings("unchecked")
public static <T extends ElementModel> T findEnclosingElement(
ElementModel element, Class<T> clazz, ElementKind... kinds) {
List<ElementKind> list = Arrays.asList(kinds);
for (;;) {
e... | [
"@",
"Requires",
"(",
"{",
"\"element != null\"",
",",
"\"clazz != null\"",
",",
"\"kinds != null\"",
"}",
")",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"ElementModel",
">",
"T",
"findEnclosingElement",
"(",
"Ele... | Returns the closest enclosing element of the specified kind. | [
"Returns",
"the",
"closest",
"enclosing",
"element",
"of",
"the",
"specified",
"kind",
"."
] | 6ded58fa05eb5bf85f16353c8dd4c70bee59121a | https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/util/Elements.java#L85-L104 | train | Find the enclosing element of the given type. | Create a Java method that does the following: "Find the enclosing element of the given type.". | Of course, here is the Java code you requested:
```java
@Requires({
"element != null",
"clazz != null",
"kinds != null"
})
@SuppressWarnings("unchecked")
public static <T extends ElementModel> T findEnclosingElement(
ElementModel element, Class<T> clazz, ElementKind... kinds) {
List<Element... | |
algolia/algoliasearch-client-android | algoliasearch/src/main/java/com/algolia/search/saas/helpers/BrowseIterator.java | BrowseIterator.start | public void start() {
if (started) {
throw new IllegalStateException();
}
started = true;
request = index.browseAsync(query, requestOptions, completionHandler);
} | java | public void start() {
if (started) {
throw new IllegalStateException();
}
started = true;
request = index.browseAsync(query, requestOptions, completionHandler);
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"started",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"started",
"=",
"true",
";",
"request",
"=",
"index",
".",
"browseAsync",
"(",
"query",
",",
"requestOptions",
",",
"... | Start the iteration. | [
"Start",
"the",
"iteration",
"."
] | 3293ba6e6116a4f6c1face2cc606bc047d6d4a3c | https://github.com/algolia/algoliasearch-client-android/blob/3293ba6e6116a4f6c1face2cc606bc047d6d4a3c/algoliasearch/src/main/java/com/algolia/search/saas/helpers/BrowseIterator.java#L117-L123 | test | Starts the application. | Create a Java method that does the following: "Starts the application.". | Of course, here is the Java code you requested:
```java
public void start() {
if (started) {
throw new IllegalStateException();
}
started = true;
request = index.browseAsync(query, requestOptions, completionHandler);
}
```
Hope this helps! | |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java | FunctionalType.consumer | public static FunctionalType consumer(TypeMirror type) {
checkArgument(!type.getKind().isPrimitive(), "Unexpected primitive type %s", type);
return new FunctionalType(
QualifiedName.of(Consumer.class).withParameters(type),
"accept",
ImmutableList.of(type),
null);
} | java | public static FunctionalType consumer(TypeMirror type) {
checkArgument(!type.getKind().isPrimitive(), "Unexpected primitive type %s", type);
return new FunctionalType(
QualifiedName.of(Consumer.class).withParameters(type),
"accept",
ImmutableList.of(type),
null);
} | [
"public",
"static",
"FunctionalType",
"consumer",
"(",
"TypeMirror",
"type",
")",
"{",
"checkArgument",
"(",
"!",
"type",
".",
"getKind",
"(",
")",
".",
"isPrimitive",
"(",
")",
",",
"\"Unexpected primitive type %s\"",
",",
"type",
")",
";",
"return",
"new",
... | Returns {@code Consumer<type>}.
@throws IllegalArgumentException if {@code type} is primitive | [
"Returns",
"{",
"@code",
"Consumer<type",
">",
"}",
"."
] | d5a222f90648aece135da4b971c55a60afe8649c | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java#L49-L56 | train | Creates a functional type that accepts a single value from a consumer type. | Create a Java method that does the following: "Creates a functional type that accepts a single value from a consumer type.". | Of course, here is the Java code you requested:
```java
public static FunctionalType consumer(TypeMirror type) {
checkArgument(!type.getKind().isPrimitive(), "Unexpected primitive type %s", type);
return new FunctionalType(
QualifiedName.of(Consumer.class).withParameters(type),
"accept",
... | |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotateRoot | public static void annotateRoot(String longName, long longValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(longName, longValue);
}
} | java | public static void annotateRoot(String longName, long longValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(longName, longValue);
}
} | [
"public",
"static",
"void",
"annotateRoot",
"(",
"String",
"longName",
",",
"long",
"longValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"... | Annotate a long value at the root Tracy frame | [
"Annotate",
"a",
"long",
"value",
"at",
"the",
"root",
"Tracy",
"frame"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L195-L200 | train | This method is used to annotate a Tracy class with a long value. | Create a Java method that does the following: "This method is used to annotate a Tracy class with a long value.". | Of course, here is the Java code you requested:
```java
public static void annotateRoot(String longName, long longValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(longName, longValue);
}
}
```
Hope this helps! | |
app55/app55-java | src/support/java/com/googlecode/openbeans/UtilCollectionsPersistenceDelegate.java | UtilCollectionsPersistenceDelegate.mutatesTo | protected boolean mutatesTo(Object o1, Object o2)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
if (o1 instanceof Collection<?>)
{
Collection<?> c1 = (Collection<?>) o1;
Collection<?> c2 = (Collection<?>) o2;
return c1.size() == c2.size() && c1.containsAll(c2);
}
i... | java | protected boolean mutatesTo(Object o1, Object o2)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
if (o1 instanceof Collection<?>)
{
Collection<?> c1 = (Collection<?>) o1;
Collection<?> c2 = (Collection<?>) o2;
return c1.size() == c2.size() && c1.containsAll(c2);
}
i... | [
"protected",
"boolean",
"mutatesTo",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"if",
"(",
"BeansUtils",
".",
"declaredEquals",
"(",
"o1",
".",
"getClass",
"(",
")",
")",
")",
"{",
"return",
"o1",
".",
"equals",
"(",
"o2",
")",
";",
"}",
"... | $NON-NLS-1$ | [
"$NON",
"-",
"NLS",
"-",
"1$"
] | 73e51d0f3141a859dfbd37ca9becef98477e553e | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/UtilCollectionsPersistenceDelegate.java#L48-L67 | train | Checks if the two objects are mutating. | Create a Java method that does the following: "Checks if the two objects are mutating.". | Of course, here is the Java code you requested:
```java
protected boolean mutatesTo(Object o1, Object o2)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
if (o1 instanceof Collection<?>)
{
Collection<?> c1 = (Collection<?>) o1;
Collection<?> c2 = (Collection<?>) o2;
ret... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java method to check if a numerical value is within a specified range and return the number of times the value appears in the range.
Signature:
```java
public static int countValuesInRange(int[] nums, int startRange, int endRange)
```
Input:
- An array of integers `nums` (1 <= nums.length <= 10^6) where each ... | To solve this problem, we can iterate through the `nums` array and check if each element falls within the specified range. If it does, we increment a counter variable. Finally, we return the value of the counter.
Here is the implementation of the `countValuesInRange` method:
```java
public static int countValuesInRan... | |||||||
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/PortletTypeImpl.java | PortletTypeImpl.getOrCreatePortletInfo | public PortletInfoType<PortletType<T>> getOrCreatePortletInfo()
{
Node node = childNode.getOrCreate("portlet-info");
PortletInfoType<PortletType<T>> portletInfo = new PortletInfoTypeImpl<PortletType<T>>(this, "portlet-info", childNode, node);
return portletInfo;
} | java | public PortletInfoType<PortletType<T>> getOrCreatePortletInfo()
{
Node node = childNode.getOrCreate("portlet-info");
PortletInfoType<PortletType<T>> portletInfo = new PortletInfoTypeImpl<PortletType<T>>(this, "portlet-info", childNode, node);
return portletInfo;
} | [
"public",
"PortletInfoType",
"<",
"PortletType",
"<",
"T",
">",
">",
"getOrCreatePortletInfo",
"(",
")",
"{",
"Node",
"node",
"=",
"childNode",
".",
"getOrCreate",
"(",
"\"portlet-info\"",
")",
";",
"PortletInfoType",
"<",
"PortletType",
"<",
"T",
">",
">",
... | If not already created, a new <code>portlet-info</code> element with the given value will be created.
Otherwise, the existing <code>portlet-info</code> element will be returned.
@return a new or existing instance of <code>PortletInfoType<PortletType<T>></code> | [
"If",
"not",
"already",
"created",
"a",
"new",
"<code",
">",
"portlet",
"-",
"info<",
"/",
"code",
">",
"element",
"with",
"the",
"given",
"value",
"will",
"be",
"created",
".",
"Otherwise",
"the",
"existing",
"<code",
">",
"portlet",
"-",
"info<",
"/",
... | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/PortletTypeImpl.java#L504-L509 | train | Get the existing PortletInfoType object. | Create a Java method that does the following: "Get the existing PortletInfoType object.". | Of course, here is the Java code you requested:
```java
public PortletInfoType<PortletType<T>> getOrCreatePortletInfo()
{
Node node = childNode.getOrCreate("portlet-info");
PortletInfoType<PortletType<T>> portletInfo = new PortletInfoTypeImpl<PortletType<T>>(this, "portlet-info", childNode, node);
... | |
actframework/actframework | src/main/java/act/conf/Config.java | Config.get | public <T> T get(String key) {
if (key.startsWith(PREFIX)) {
key = key.substring(PREFIX_LEN);
}
ConfigKey rk = keyOf(key);
if (null != rk) {
return get(rk, null);
} else {
return AppConfigKey.helper.getConfiguration(key, null, raw);
}
... | java | public <T> T get(String key) {
if (key.startsWith(PREFIX)) {
key = key.substring(PREFIX_LEN);
}
ConfigKey rk = keyOf(key);
if (null != rk) {
return get(rk, null);
} else {
return AppConfigKey.helper.getConfiguration(key, null, raw);
}
... | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"PREFIX",
")",
")",
"{",
"key",
"=",
"key",
".",
"substring",
"(",
"PREFIX_LEN",
")",
";",
"}",
"ConfigKey",
"rk",
"=",
"keyOf",
"(",
... | Look up configuration by a <code>String<code/> key. If the String key
can be converted into {@link AppConfigKey rythm configuration key}, then
it is converted and call to {@link #get(ConfigKey, Object)} method. Otherwise
the original configuration map is used to fetch the value from the string key
@param key
@param <T... | [
"Look",
"up",
"configuration",
"by",
"a",
"<code",
">",
"String<code",
"/",
">",
"key",
".",
"If",
"the",
"String",
"key",
"can",
"be",
"converted",
"into",
"{",
"@link",
"AppConfigKey",
"rythm",
"configuration",
"key",
"}",
"then",
"it",
"is",
"converted"... | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/conf/Config.java#L166-L176 | train | Get a value from the Config. | Create a Java method that does the following: "Get a value from the Config.". | Of course, here is the Java code you requested:
```java
public <T> T get(String key) {
if (key.startsWith(PREFIX)) {
key = key.substring(PREFIX_LEN);
}
ConfigKey rk = keyOf(key);
if (null != rk) {
return get(rk, null);
} else {
return AppConfi... | |
roboconf/roboconf-platform | core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java | AgentUtils.injectConfigurations | public static void injectConfigurations(
String karafEtc,
String applicationName,
String scopedInstancePath,
String domain,
String ipAddress ) {
File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR );
if( injectionDir.isDirectory()) {
for( File source : Utils.listAllFiles( injectionDir, "... | java | public static void injectConfigurations(
String karafEtc,
String applicationName,
String scopedInstancePath,
String domain,
String ipAddress ) {
File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR );
if( injectionDir.isDirectory()) {
for( File source : Utils.listAllFiles( injectionDir, "... | [
"public",
"static",
"void",
"injectConfigurations",
"(",
"String",
"karafEtc",
",",
"String",
"applicationName",
",",
"String",
"scopedInstancePath",
",",
"String",
"domain",
",",
"String",
"ipAddress",
")",
"{",
"File",
"injectionDir",
"=",
"new",
"File",
"(",
... | Generates configuration files from templates.
@param karafEtc Karaf's etc directory
@param applicationName the application name
@param scopedInstancePath the scoped instance path
@param domain the domain
@param ipAddress the IP address | [
"Generates",
"configuration",
"files",
"from",
"templates",
"."
] | add54eead479effb138d0ff53a2d637902b82702 | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L272-L303 | train | Injects the configuration files from the karafEtc directory into the karafEtc directory. | Create a Java method that does the following: "Injects the configuration files from the karafEtc directory into the karafEtc directory.". | Of course, here is the Java code you requested:
```java
public static void injectConfigurations(
String karafEtc,
String applicationName,
String scopedInstancePath,
String domain,
String ipAddress ) {
File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR );
if( injectionDir.isDirectory()) {
... | |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/Toolbar.java | Toolbar.addGroup | public Toolbar addGroup(ToolbarButton... buttons) {
groups.add(SummernoteOptions.newToolbarGroup(GROUP_PREFIX + GROUP_INDEX++, buttons));
return this;
} | java | public Toolbar addGroup(ToolbarButton... buttons) {
groups.add(SummernoteOptions.newToolbarGroup(GROUP_PREFIX + GROUP_INDEX++, buttons));
return this;
} | [
"public",
"Toolbar",
"addGroup",
"(",
"ToolbarButton",
"...",
"buttons",
")",
"{",
"groups",
".",
"add",
"(",
"SummernoteOptions",
".",
"newToolbarGroup",
"(",
"GROUP_PREFIX",
"+",
"GROUP_INDEX",
"++",
",",
"buttons",
")",
")",
";",
"return",
"this",
";",
"}... | Add a new toolbar group with the specified buttons.
@param buttons the toolbar buttons to be added
@return {@link Toolbar} | [
"Add",
"a",
"new",
"toolbar",
"group",
"with",
"the",
"specified",
"buttons",
"."
] | 8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94 | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/Toolbar.java#L47-L50 | train | Add a new toolbar group to the toolbar. | Create a Java method that does the following: "Add a new toolbar group to the toolbar.". | Of course, here is the Java code you requested:
```java
public Toolbar addGroup(ToolbarButton... buttons) {
groups.add(SummernoteOptions.newToolbarGroup(GROUP_PREFIX + GROUP_INDEX++, buttons));
return this;
}
```
Hope this helps! | |
jenkinsci/jenkins | core/src/main/java/hudson/model/Fingerprint.java | Fingerprint.getJobs | public @Nonnull List<String> getJobs() {
List<String> r = new ArrayList<>();
r.addAll(usages.keySet());
Collections.sort(r);
return r;
} | java | public @Nonnull List<String> getJobs() {
List<String> r = new ArrayList<>();
r.addAll(usages.keySet());
Collections.sort(r);
return r;
} | [
"public",
"@",
"Nonnull",
"List",
"<",
"String",
">",
"getJobs",
"(",
")",
"{",
"List",
"<",
"String",
">",
"r",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"r",
".",
"addAll",
"(",
"usages",
".",
"keySet",
"(",
")",
")",
";",
"Collections",
".... | Gets the sorted list of job names where this jar is used. | [
"Gets",
"the",
"sorted",
"list",
"of",
"job",
"names",
"where",
"this",
"jar",
"is",
"used",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Fingerprint.java#L969-L974 | train | Get a list of all the jobs in this project. | Create a Java method that does the following: "Get a list of all the jobs in this project.". | Of course, here is the Java code you requested:
```java
public @Nonnull List<String> getJobs() {
List<String> r = new ArrayList<>();
r.addAll(usages.keySet());
Collections.sort(r);
return r;
}
```
Hope this helps! | |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/charges/MMFF94PartialCharges.java | MMFF94PartialCharges.assignMMFF94PartialCharges | public IAtomContainer assignMMFF94PartialCharges(IAtomContainer ac) throws CDKException {
if (!mmff.assignAtomTypes(ac))
throw new CDKException("Molecule had an atom of unknown MMFF type");
mmff.partialCharges(ac);
mmff.clearProps(ac);
for (IAtom atom : ac.atoms())
... | java | public IAtomContainer assignMMFF94PartialCharges(IAtomContainer ac) throws CDKException {
if (!mmff.assignAtomTypes(ac))
throw new CDKException("Molecule had an atom of unknown MMFF type");
mmff.partialCharges(ac);
mmff.clearProps(ac);
for (IAtom atom : ac.atoms())
... | [
"public",
"IAtomContainer",
"assignMMFF94PartialCharges",
"(",
"IAtomContainer",
"ac",
")",
"throws",
"CDKException",
"{",
"if",
"(",
"!",
"mmff",
".",
"assignAtomTypes",
"(",
"ac",
")",
")",
"throw",
"new",
"CDKException",
"(",
"\"Molecule had an atom of unknown MMFF... | Main method which assigns MMFF94 partial charges
@param ac AtomContainer
@return AtomContainer with MMFF94 partial charges as atom properties | [
"Main",
"method",
"which",
"assigns",
"MMFF94",
"partial",
"charges"
] | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/charges/MMFF94PartialCharges.java#L73-L81 | train | Assigns the partial charges of the MMFF94 molecule to the molecule. | Create a Java method that does the following: "Assigns the partial charges of the MMFF94 molecule to the molecule.". | Of course, here is the Java code you requested:
```java
public IAtomContainer assignMMFF94PartialCharges(IAtomContainer ac) throws CDKException {
if (!mmff.assignAtomTypes(ac))
throw new CDKException("Molecule had an atom of unknown MMFF type");
mmff.partialCharges(ac);
mmff.clearPr... | |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/Symbol.java | Symbol.invoke | public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
}
Method method = (Method)value;
Object ret;
... | java | public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
}
Method method = (Method)value;
Object ret;
... | [
"public",
"Object",
"invoke",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"value",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"ISymbol",
")",
"{",
"return",
"(",
"(",
"Symbol",
")",
"value",
")",
".",
"invoke",
"(",
... | Invokes function. | [
"Invokes",
"function",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/Symbol.java#L259-L282 | train | Invoke the method of the target object. | Create a Java method that does the following: "Invoke the method of the target object.". | Of course, here is the Java code you requested:
```java
public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
... | |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.getSubsitemapType | @SuppressWarnings("deprecation")
private int getSubsitemapType() throws CmsRpcException {
try {
return OpenCms.getResourceManager().getResourceType(
CmsResourceTypeFolderSubSitemap.TYPE_SUBSITEMAP).getTypeId();
} catch (CmsLoaderException e) {
error(e);
... | java | @SuppressWarnings("deprecation")
private int getSubsitemapType() throws CmsRpcException {
try {
return OpenCms.getResourceManager().getResourceType(
CmsResourceTypeFolderSubSitemap.TYPE_SUBSITEMAP).getTypeId();
} catch (CmsLoaderException e) {
error(e);
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"int",
"getSubsitemapType",
"(",
")",
"throws",
"CmsRpcException",
"{",
"try",
"{",
"return",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"CmsResourceTypeFolderSubSitemap... | Gets the default type id for subsitemap folders.<p>
@return the default type id for subsitemap folders
@throws CmsRpcException in case of an error | [
"Gets",
"the",
"default",
"type",
"id",
"for",
"subsitemap",
"folders",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2664-L2674 | train | Returns the subsitemap type. | Create a Java method that does the following: "Returns the subsitemap type.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("deprecation")
private int getSubsitemapType() throws CmsRpcException {
try {
return OpenCms.getResourceManager().getResourceType(
CmsResourceTypeFolderSubSitemap.TYPE_SUBSITEMAP).getTypeId();
} c... | |
dottydingo/hyperion | client/src/main/java/com/dottydingo/hyperion/client/builder/RequestBuilder.java | RequestBuilder.setParameter | public RequestBuilder<T,ID> setParameter(String name,String value)
{
parameters.set(name, value);
return this;
} | java | public RequestBuilder<T,ID> setParameter(String name,String value)
{
parameters.set(name, value);
return this;
} | [
"public",
"RequestBuilder",
"<",
"T",
",",
"ID",
">",
"setParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"parameters",
".",
"set",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Set a parameter on the request. Replaces any existing values for the name.
@param name The name of the parameter
@param value The value
@return The request builder | [
"Set",
"a",
"parameter",
"on",
"the",
"request",
".",
"Replaces",
"any",
"existing",
"values",
"for",
"the",
"name",
"."
] | c4d119c90024a88c0335d7d318e9ccdb70149764 | https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/client/src/main/java/com/dottydingo/hyperion/client/builder/RequestBuilder.java#L56-L60 | train | Sets a parameter to the request. | Create a Java method that does the following: "Sets a parameter to the request.". | Of course, here is the Java code you requested:
```java
public RequestBuilder<T,ID> setParameter(String name,String value)
{
parameters.set(name, value);
return this;
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdateAsync | public ServiceFuture<FirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters, final ServiceCallback<FirewallRuleInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync... | java | public ServiceFuture<FirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters, final ServiceCallback<FirewallRuleInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync... | [
"public",
"ServiceFuture",
"<",
"FirewallRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"firewallRuleName",
",",
"CreateOrUpdateFirewallRuleParameters",
"parameters",
",",
"final",
"ServiceCallback",
... | Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param firewallRuleName The name of the firew... | [
"Creates",
"or",
"updates",
"the",
"specified",
"firewall",
"rule",
".",
"During",
"update",
"the",
"firewall",
"rule",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"firewall",
"rule",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L243-L245 | train | Creates or updates a CDN image image. | Create a Java method that does the following: "Creates or updates a CDN image image.". | Of course, here is the Java code you requested:
```java
public ServiceFuture<FirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters, final ServiceCallback<FirewallRuleInner> serviceCallback) {
return ServiceF... | |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerSocketChannelConfig.java | EpollServerSocketChannelConfig.setIpTransparent | public EpollServerSocketChannelConfig setIpTransparent(boolean transparent) {
try {
((EpollServerSocketChannel) channel).socket.setIpTransparent(transparent);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollServerSocketChannelConfig setIpTransparent(boolean transparent) {
try {
((EpollServerSocketChannel) channel).socket.setIpTransparent(transparent);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollServerSocketChannelConfig",
"setIpTransparent",
"(",
"boolean",
"transparent",
")",
"{",
"try",
"{",
"(",
"(",
"EpollServerSocketChannel",
")",
"channel",
")",
".",
"socket",
".",
"setIpTransparent",
"(",
"transparent",
")",
";",
"return",
"this",
... | If {@code true} is used <a href="http://man7.org/linux/man-pages/man7/ip.7.html">IP_TRANSPARENT</a> is enabled,
{@code false} for disable it. Default is disabled. | [
"If",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerSocketChannelConfig.java#L257-L264 | train | Sets the transparent mode of the socket. | Create a Java method that does the following: "Sets the transparent mode of the socket.". | Of course, here is the Java code you requested:
```java
public EpollServerSocketChannelConfig setIpTransparent(boolean transparent) {
try {
((EpollServerSocketChannel) channel).socket.setIpTransparent(transparent);
return this;
} catch (IOException e) {
throw new Cha... | |
aws/aws-sdk-java | aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/transform/GetLoggerDefinitionRequestMarshaller.java | GetLoggerDefinitionRequestMarshaller.marshall | public void marshall(GetLoggerDefinitionRequest getLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (getLoggerDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(g... | java | public void marshall(GetLoggerDefinitionRequest getLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (getLoggerDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(g... | [
"public",
"void",
"marshall",
"(",
"GetLoggerDefinitionRequest",
"getLoggerDefinitionRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"getLoggerDefinitionRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/transform/GetLoggerDefinitionRequestMarshaller.java#L42-L53 | train | Gets the given parameter object. | Create a Java method that does the following: "Gets the given parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(GetLoggerDefinitionRequest getLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (getLoggerDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}... | |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/state/StateMachineDefinition.java | StateMachineDefinition.getTransitions | public Set<T> getTransitions(S state) {
getStateId(state);
return validTransitions.get(state);
} | java | public Set<T> getTransitions(S state) {
getStateId(state);
return validTransitions.get(state);
} | [
"public",
"Set",
"<",
"T",
">",
"getTransitions",
"(",
"S",
"state",
")",
"{",
"getStateId",
"(",
"state",
")",
";",
"return",
"validTransitions",
".",
"get",
"(",
"state",
")",
";",
"}"
] | Get all transitions valid for specified state
@param state the state
@return all transitions valid for the state | [
"Get",
"all",
"transitions",
"valid",
"for",
"specified",
"state"
] | bceed441595c5e5195a7418795f03b69fa7b61e4 | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/state/StateMachineDefinition.java#L131-L134 | train | Returns the set of transitions for the given state. | Create a Java method that does the following: "Returns the set of transitions for the given state.". | Of course, here is the Java code you requested:
```java
public Set<T> getTransitions(S state) {
getStateId(state);
return validTransitions.get(state);
}
```
Hope this helps! | |
juebanlin/util4j | util4j/src/main/java/net/jueb/util4j/hotSwap/classFactory/old/v0/AbstractLibScriptFactory.java | AbstractLibScriptFactory.loadAllClass | protected Set<Class<?>> loadAllClass(File jarFile, ScriptClassLoader loader) throws Exception {
Set<Class<?>> clzzs = new HashSet<Class<?>>();
JarFile jf = new JarFile(jarFile);
try {
loader.addURL(jarFile.toURI().toURL());// 添加文件到加载器
Enumeration<JarEntry> it = jf.entries();
while (it.hasMoreElements()) ... | java | protected Set<Class<?>> loadAllClass(File jarFile, ScriptClassLoader loader) throws Exception {
Set<Class<?>> clzzs = new HashSet<Class<?>>();
JarFile jf = new JarFile(jarFile);
try {
loader.addURL(jarFile.toURI().toURL());// 添加文件到加载器
Enumeration<JarEntry> it = jf.entries();
while (it.hasMoreElements()) ... | [
"protected",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"loadAllClass",
"(",
"File",
"jarFile",
",",
"ScriptClassLoader",
"loader",
")",
"throws",
"Exception",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"clzzs",
"=",
"new",
"HashSet",
"<",
"Class",
"<... | 加载jar的所有类
@param jarFiles
@param loader
@return
@throws ClassNotFoundException
@throws IOException | [
"加载jar的所有类"
] | c404b2dbdedf7a8890533b351257fa8af4f1439f | https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/hotSwap/classFactory/old/v0/AbstractLibScriptFactory.java#L262-L279 | train | Load all classes from a jar file. | Create a Java method that does the following: "Load all classes from a jar file.". | Of course, here is the Java code you requested:
```java
protected Set<Class<?>> loadAllClass(File jarFile, ScriptClassLoader loader) throws Exception {
Set<Class<?>> clzzs = new HashSet<Class<?>>();
JarFile jf = new JarFile(jarFile);
try {
loader.addURL(jarFile.toURI().toURL());// 添加文件到加载器
Enumeration<JarE... | |
logic-ng/LogicNG | src/main/java/org/logicng/predicates/DNFPredicate.java | DNFPredicate.isDNFClause | private boolean isDNFClause(final Formula formula) {
switch (formula.type()) {
case TRUE:
case FALSE:
case LITERAL:
return true;
case IMPL:
case EQUIV:
case PBC:
case NOT:
case OR:
return false;
case AND:
for (final Formula op : formula)
... | java | private boolean isDNFClause(final Formula formula) {
switch (formula.type()) {
case TRUE:
case FALSE:
case LITERAL:
return true;
case IMPL:
case EQUIV:
case PBC:
case NOT:
case OR:
return false;
case AND:
for (final Formula op : formula)
... | [
"private",
"boolean",
"isDNFClause",
"(",
"final",
"Formula",
"formula",
")",
"{",
"switch",
"(",
"formula",
".",
"type",
"(",
")",
")",
"{",
"case",
"TRUE",
":",
"case",
"FALSE",
":",
"case",
"LITERAL",
":",
"return",
"true",
";",
"case",
"IMPL",
":",... | Returns {@code true} if the given formula is a DNF minterm, {@code false} otherwise.
@param formula the formula
@return {@code true} if the given formula is a DNF minterm | [
"Returns",
"{"
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/predicates/DNFPredicate.java#L82-L102 | train | Checks if the given formula is a DNF clause. | Create a Java method that does the following: "Checks if the given formula is a DNF clause.". | Of course, here is the Java code you requested:
```java
private boolean isDNFClause(final Formula formula) {
switch (formula.type()) {
case TRUE:
case FALSE:
case LITERAL:
return true;
case IMPL:
case EQUIV:
case PBC:
case NOT:
case OR:
return false;
... | |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.requestData | @Override
public Future<M> requestData() {
logger.debug(this + " requestData...");
try {
validateInitialization();
synchronized (syncMonitor) {
// Check if sync is in process.
if (syncFuture != null && !syncFuture.isDone()) {
... | java | @Override
public Future<M> requestData() {
logger.debug(this + " requestData...");
try {
validateInitialization();
synchronized (syncMonitor) {
// Check if sync is in process.
if (syncFuture != null && !syncFuture.isDone()) {
... | [
"@",
"Override",
"public",
"Future",
"<",
"M",
">",
"requestData",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"this",
"+",
"\" requestData...\"",
")",
";",
"try",
"{",
"validateInitialization",
"(",
")",
";",
"synchronized",
"(",
"syncMonitor",
")",
"{",
... | {@inheritDoc}
@return {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | 662e98c3a853085e475be54c3be3deb72193c72d | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L944-L974 | train | This method is called by the server to request the data from the server. | Create a Java method that does the following: "This method is called by the server to request the data from the server.". | Of course, here is the Java code you requested:
```java
@Override
public Future<M> requestData() {
logger.debug(this + " requestData...");
try {
validateInitialization();
synchronized (syncMonitor) {
// Check if sync is in process.
if (syncFu... | |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobInProgress.java | JobInProgress.completedTask | public synchronized boolean completedTask(TaskInProgress tip,
TaskStatus status)
{
TaskAttemptID taskid = status.getTaskID();
int oldNumAttempts = tip.getActiveTasks().size();
final JobTrackerInstrumentation metrics = jobtracker.getInstrumentation();
// Met... | java | public synchronized boolean completedTask(TaskInProgress tip,
TaskStatus status)
{
TaskAttemptID taskid = status.getTaskID();
int oldNumAttempts = tip.getActiveTasks().size();
final JobTrackerInstrumentation metrics = jobtracker.getInstrumentation();
// Met... | [
"public",
"synchronized",
"boolean",
"completedTask",
"(",
"TaskInProgress",
"tip",
",",
"TaskStatus",
"status",
")",
"{",
"TaskAttemptID",
"taskid",
"=",
"status",
".",
"getTaskID",
"(",
")",
";",
"int",
"oldNumAttempts",
"=",
"tip",
".",
"getActiveTasks",
"(",... | A taskid assigned to this JobInProgress has reported in successfully. | [
"A",
"taskid",
"assigned",
"to",
"this",
"JobInProgress",
"has",
"reported",
"in",
"successfully",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobInProgress.java#L2703-L2870 | train | This method is called by the TaskTracker when a task is completed. | Create a Java method that does the following: "This method is called by the TaskTracker when a task is completed.". | Of course, here is the Java code you requested:
```java
public synchronized boolean completedTask(TaskInProgress tip,
TaskStatus status)
{
TaskAttemptID taskid = status.getTaskID();
int oldNumAttempts = tip.getActiveTasks().size();
final JobTrackerInstrumentati... | |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/model/term/impl/AbstractFunctionalTermImpl.java | AbstractFunctionalTermImpl.containsTerm | @Override
public boolean containsTerm(Term t) {
List<Term> terms = getTerms();
for (int i = 0; i < terms.size(); i++) {
Term t2 = terms.get(i);
if (t2.equals(t))
return true;
}
return false;
} | java | @Override
public boolean containsTerm(Term t) {
List<Term> terms = getTerms();
for (int i = 0; i < terms.size(); i++) {
Term t2 = terms.get(i);
if (t2.equals(t))
return true;
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"containsTerm",
"(",
"Term",
"t",
")",
"{",
"List",
"<",
"Term",
">",
"terms",
"=",
"getTerms",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"terms",
".",
"size",
"(",
")",
";",
"i",
"++"... | Check whether the function contains a particular term argument or not.
@param t the term in question.
@return true if the function contains the term, or false otherwise. | [
"Check",
"whether",
"the",
"function",
"contains",
"a",
"particular",
"term",
"argument",
"or",
"not",
"."
] | ddf78b26981b6129ee9a1a59310016830f5352e4 | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/model/term/impl/AbstractFunctionalTermImpl.java#L83-L92 | train | Override this method to check if a term is in the list of terms. | Create a Java method that does the following: "Override this method to check if a term is in the list of terms.". | Of course, here is the Java code you requested:
```java
@Override
public boolean containsTerm(Term t) {
List<Term> terms = getTerms();
for (int i = 0; i < terms.size(); i++) {
Term t2 = terms.get(i);
if (t2.equals(t))
return true;
}
return fal... | |
alkacon/opencms-core | src/org/opencms/ui/editors/A_CmsFrameEditor.java | A_CmsFrameEditor.tryUnlock | private void tryUnlock() {
if (m_resource != null) {
try {
A_CmsUI.getCmsObject().unlockResource(m_resource);
} catch (CmsException e) {
LOG.debug("Unlocking resource " + m_resource.getRootPath() + " failed", e);
}
}
} | java | private void tryUnlock() {
if (m_resource != null) {
try {
A_CmsUI.getCmsObject().unlockResource(m_resource);
} catch (CmsException e) {
LOG.debug("Unlocking resource " + m_resource.getRootPath() + " failed", e);
}
}
} | [
"private",
"void",
"tryUnlock",
"(",
")",
"{",
"if",
"(",
"m_resource",
"!=",
"null",
")",
"{",
"try",
"{",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
".",
"unlockResource",
"(",
"m_resource",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
... | Tries to unlock the current resource.<p> | [
"Tries",
"to",
"unlock",
"the",
"current",
"resource",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/A_CmsFrameEditor.java#L179-L188 | train | Try to unlock the resource. | Create a Java method that does the following: "Try to unlock the resource.". | Of course, here is the Java code you requested:
```java
private void tryUnlock() {
if (m_resource != null) {
try {
A_CmsUI.getCmsObject().unlockResource(m_resource);
} catch (CmsException e) {
LOG.debug("Unlocking resource " + m_resource.getRootPath() + ... | |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java | ExtensionsInner.beginCreateAsync | public ServiceFuture<Void> beginCreateAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameter... | java | public ServiceFuture<Void> beginCreateAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameter... | [
"public",
"ServiceFuture",
"<",
"Void",
">",
"beginCreateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"extensionName",
",",
"ExtensionInner",
"parameters",
",",
"final",
"ServiceCallback",
"<",
"Void",
">",
"serviceCallback"... | Creates an HDInsight cluster extension.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param extensionName The name of the cluster extension.
@param parameters The cluster extensions create request.
@param serviceCallback the async ServiceCallback to handle succes... | [
"Creates",
"an",
"HDInsight",
"cluster",
"extension",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L620-L622 | train | Creates an extension. Creates an extension. | Create a Java method that does the following: "Creates an extension. Creates an extension.". | Of course, here is the Java code you requested:
```java
public ServiceFuture<Void> beginCreateAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Create a Java class called 'Rectangle' that has the following properties and methods:
Properties:
- length (integer)
- width (integer)
Methods:
1. `calculateArea()`: This method should return the area of the rectangle.
2. `calculatePerimeter()`: This method should return the perimeter of the rectangle.
3. `isSquare()... | Here is the corrected code for the `Rectangle` class with the `resize(int factor)` method implemented correctly:
```java
public class Rectangle {
private int length;
private int width;
public Rectangle(int length, int width) {
if (length < 1 || length > 100 || width < 1 || width > 100) {
... | |||||||
alkacon/opencms-core | src/org/opencms/util/CmsPathMap.java | CmsPathMap.add | public void add(String path, V value) {
m_tree.setValue(splitPath(path), value);
} | java | public void add(String path, V value) {
m_tree.setValue(splitPath(path), value);
} | [
"public",
"void",
"add",
"(",
"String",
"path",
",",
"V",
"value",
")",
"{",
"m_tree",
".",
"setValue",
"(",
"splitPath",
"(",
"path",
")",
",",
"value",
")",
";",
"}"
] | Adds an element for the given path, overwriting the previous element for that path if there is one.<p>
@param path the path
@param value the element to add | [
"Adds",
"an",
"element",
"for",
"the",
"given",
"path",
"overwriting",
"the",
"previous",
"element",
"for",
"that",
"path",
"if",
"there",
"is",
"one",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsPathMap.java#L49-L52 | train | Add a value to the cache. | Create a Java method that does the following: "Add a value to the cache.". | Of course, here is the Java code you requested:
```java
public void add(String path, V value) {
m_tree.setValue(splitPath(path), value);
}
```
Hope this helps! | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/DoublePipeline.java | DoublePipeline.limit | @Override
public final DoubleStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeDouble(this, (long) 0, maxSize);
} | java | @Override
public final DoubleStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeDouble(this, (long) 0, maxSize);
} | [
"@",
"Override",
"public",
"final",
"DoubleStream",
"limit",
"(",
"long",
"maxSize",
")",
"{",
"if",
"(",
"maxSize",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"Long",
".",
"toString",
"(",
"maxSize",
")",
")",
";",
"return",
"SliceOps... | Stateful intermediate ops from DoubleStream | [
"Stateful",
"intermediate",
"ops",
"from",
"DoubleStream"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/DoublePipeline.java#L336-L341 | train | Returns a stream of doubles that contains only the specified number of elements. | Create a Java method that does the following: "Returns a stream of doubles that contains only the specified number of elements.". | Of course, here is the Java code you requested:
```java
@Override
public final DoubleStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeDouble(this, (long) 0, maxSize);
}
```
Hope this helps! | |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Conversion.java | Conversion.hexDigitToInt | public static int hexDigitToInt(final char hexDigit) {
final int digit = Character.digit(hexDigit, 16);
if (digit < 0) {
throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit");
}
return digit;
} | java | public static int hexDigitToInt(final char hexDigit) {
final int digit = Character.digit(hexDigit, 16);
if (digit < 0) {
throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit");
}
return digit;
} | [
"public",
"static",
"int",
"hexDigitToInt",
"(",
"final",
"char",
"hexDigit",
")",
"{",
"final",
"int",
"digit",
"=",
"Character",
".",
"digit",
"(",
"hexDigit",
",",
"16",
")",
";",
"if",
"(",
"digit",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgum... | <p>
Converts a hexadecimal digit into an int using the default (Lsb0) bit ordering.
</p>
<p>
'1' is converted to 1
</p>
@param hexDigit the hexadecimal digit to convert
@return an int equals to {@code hexDigit}
@throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit | [
"<p",
">",
"Converts",
"a",
"hexadecimal",
"digit",
"into",
"an",
"int",
"using",
"the",
"default",
"(",
"Lsb0",
")",
"bit",
"ordering",
".",
"<",
"/",
"p",
">",
"<p",
">",
"1",
"is",
"converted",
"to",
"1",
"<",
"/",
"p",
">"
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Conversion.java#L82-L88 | train | Convert a hexadecimal digit to an int. | Create a Java method that does the following: "Convert a hexadecimal digit to an int.". | Of course, here is the Java code you requested:
```java
public static int hexDigitToInt(final char hexDigit) {
final int digit = Character.digit(hexDigit, 16);
if (digit < 0) {
throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit");
}
... | |
blackdoor/blackdoor | src/main/java/black/door/crypto/HistoricSHE.java | HistoricSHE.init | public void init(byte[] IV, byte[] key){
if(IV.length != blockSize || key.length != blockSize)
throw new RuntimeException("key and IV need to be same as block size (" + blockSize + ")."); //TODO subclass exception
this.key = key;
this.IV = IV;
prehash = Misc.cleanXOR(IV, key);
cfg = true;
blockNo = 0;
... | java | public void init(byte[] IV, byte[] key){
if(IV.length != blockSize || key.length != blockSize)
throw new RuntimeException("key and IV need to be same as block size (" + blockSize + ")."); //TODO subclass exception
this.key = key;
this.IV = IV;
prehash = Misc.cleanXOR(IV, key);
cfg = true;
blockNo = 0;
... | [
"public",
"void",
"init",
"(",
"byte",
"[",
"]",
"IV",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"if",
"(",
"IV",
".",
"length",
"!=",
"blockSize",
"||",
"key",
".",
"length",
"!=",
"blockSize",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"key and ... | Initializes the cipher with key and IV
@param IV A 256 bit initialization vector to use for the cipher.
@param key A 256 bit key to encrypt with. | [
"Initializes",
"the",
"cipher",
"with",
"key",
"and",
"IV"
] | 060c7a71dfafb85e10e8717736e6d3160262e96b | https://github.com/blackdoor/blackdoor/blob/060c7a71dfafb85e10e8717736e6d3160262e96b/src/main/java/black/door/crypto/HistoricSHE.java#L92-L102 | train | Initializes the exception with the given IV and key. | Create a Java method that does the following: "Initializes the exception with the given IV and key.". | Of course, here is the Java code you requested:
```java
public void init(byte[] IV, byte[] key){
if(IV.length != blockSize || key.length != blockSize)
throw new RuntimeException("key and IV need to be same as block size (" + blockSize + ")."); //TODO subclass exception
this.key = key;
this.IV = IV;
prehash ... | |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java | OCommandExecutorSQLMoveVertex.execute | public Object execute(final Map<Object, Object> iArgs) {
ODatabaseDocumentInternal db = getDatabase();
db.begin();
if (className == null && clusterName == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
OModifiableBoolean shutdownGra... | java | public Object execute(final Map<Object, Object> iArgs) {
ODatabaseDocumentInternal db = getDatabase();
db.begin();
if (className == null && clusterName == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
OModifiableBoolean shutdownGra... | [
"public",
"Object",
"execute",
"(",
"final",
"Map",
"<",
"Object",
",",
"Object",
">",
"iArgs",
")",
"{",
"ODatabaseDocumentInternal",
"db",
"=",
"getDatabase",
"(",
")",
";",
"db",
".",
"begin",
"(",
")",
";",
"if",
"(",
"className",
"==",
"null",
"&&... | Executes the command and return the ODocument object created. | [
"Executes",
"the",
"command",
"and",
"return",
"the",
"ODocument",
"object",
"created",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java#L122-L184 | test | Execute the CRIT CLEANUP | Create a Java method that does the following: "Execute the CRIT CLEANUP". | Of course, here is the Java code you requested:
```java
public Object execute(final Map<Object, Object> iArgs) {
ODatabaseDocumentInternal db = getDatabase();
db.begin();
if (className == null && clusterName == null)
throw new OCommandExecutionException("Cannot execute the command because it has n... | |
liferay/com-liferay-commerce | commerce-tax-api/src/main/java/com/liferay/commerce/tax/service/persistence/CommerceTaxMethodUtil.java | CommerceTaxMethodUtil.fetchByGroupId_Last | public static CommerceTaxMethod fetchByGroupId_Last(long groupId,
OrderByComparator<CommerceTaxMethod> orderByComparator) {
return getPersistence().fetchByGroupId_Last(groupId, orderByComparator);
} | java | public static CommerceTaxMethod fetchByGroupId_Last(long groupId,
OrderByComparator<CommerceTaxMethod> orderByComparator) {
return getPersistence().fetchByGroupId_Last(groupId, orderByComparator);
} | [
"public",
"static",
"CommerceTaxMethod",
"fetchByGroupId_Last",
"(",
"long",
"groupId",
",",
"OrderByComparator",
"<",
"CommerceTaxMethod",
">",
"orderByComparator",
")",
"{",
"return",
"getPersistence",
"(",
")",
".",
"fetchByGroupId_Last",
"(",
"groupId",
",",
"orde... | Returns the last commerce tax method in the ordered set where groupId = ?.
@param groupId the group ID
@param orderByComparator the comparator to order the set by (optionally <code>null</code>)
@return the last matching commerce tax method, or <code>null</code> if a matching commerce tax method could not be found | [
"Returns",
"the",
"last",
"commerce",
"tax",
"method",
"in",
"the",
"ordered",
"set",
"where",
"groupId",
"=",
"?",
";",
"."
] | 9e54362d7f59531fc684016ba49ee7cdc3a2f22b | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-api/src/main/java/com/liferay/commerce/tax/service/persistence/CommerceTaxMethodUtil.java#L232-L235 | train | Returns the last commerce tax method in the ordered set where groupId = ? ;. | Create a Java method that does the following: "Returns the last commerce tax method in the ordered set where groupId = ? ;.". | Of course, here is the Java code you requested:
```java
public static CommerceTaxMethod fetchByGroupId_Last(long groupId,
OrderByComparator<CommerceTaxMethod> orderByComparator) {
return getPersistence().fetchByGroupId_Last(groupId, orderByComparator);
}
```
Hope this helps! | |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.iconOffsetXDp | @NonNull
public IconicsDrawable iconOffsetXDp(@Dimension(unit = DP) int sizeDp) {
return iconOffsetXPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable iconOffsetXDp(@Dimension(unit = DP) int sizeDp) {
return iconOffsetXPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"iconOffsetXDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"iconOffsetXPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";",
"}"
] | set the icon offset for X as dp
@return The current IconicsDrawable for chaining. | [
"set",
"the",
"icon",
"offset",
"for",
"X",
"as",
"dp"
] | 0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8 | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L525-L528 | train | Iconics drawable offset from dp to x px | Create a Java method that does the following: "Iconics drawable offset from dp to x px". | Of course, here is the Java code you requested:
```java
@NonNull
public IconicsDrawable iconOffsetXDp(@Dimension(unit = DP) int sizeDp) {
return iconOffsetXPx(Utils.convertDpToPx(mContext, sizeDp));
}
```
Hope this helps! | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.offerBackup | public void offerBackup(Data data, long itemId) {
QueueItem item = new QueueItem(this, itemId, null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
getBackupMap().put(itemId, item);
} | java | public void offerBackup(Data data, long itemId) {
QueueItem item = new QueueItem(this, itemId, null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
getBackupMap().put(itemId, item);
} | [
"public",
"void",
"offerBackup",
"(",
"Data",
"data",
",",
"long",
"itemId",
")",
"{",
"QueueItem",
"item",
"=",
"new",
"QueueItem",
"(",
"this",
",",
"itemId",
",",
"null",
")",
";",
"if",
"(",
"!",
"store",
".",
"isEnabled",
"(",
")",
"||",
"store"... | Offers the item to the backup map. If the memory limit
has been achieved the item data will not be kept in-memory.
Executed on the backup replica
@param data the item data
@param itemId the item ID as determined by the primary replica | [
"Offers",
"the",
"item",
"to",
"the",
"backup",
"map",
".",
"If",
"the",
"memory",
"limit",
"has",
"been",
"achieved",
"the",
"item",
"data",
"will",
"not",
"be",
"kept",
"in",
"-",
"memory",
".",
"Executed",
"on",
"the",
"backup",
"replica"
] | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L463-L469 | train | Offer a backup of the data to the queue. | Create a Java method that does the following: "Offer a backup of the data to the queue.". | Of course, here is the Java code you requested:
```java
public void offerBackup(Data data, long itemId) {
QueueItem item = new QueueItem(this, itemId, null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
getBackupMap().put(... | |
aws/aws-sdk-java | aws-java-sdk-directory/src/main/java/com/amazonaws/services/directory/model/transform/CreateDirectoryRequestMarshaller.java | CreateDirectoryRequestMarshaller.marshall | public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirecto... | java | public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirecto... | [
"public",
"void",
"marshall",
"(",
"CreateDirectoryRequest",
"createDirectoryRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"createDirectoryRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument pa... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-directory/src/main/java/com/amazonaws/services/directory/model/transform/CreateDirectoryRequestMarshaller.java#L55-L72 | train | Creates the given parameter object. | Create a Java method that does the following: "Creates the given parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
tr... | |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java | NumericHistogram.initializeQueue | private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex)
{
checkArgument(nextIndex > 0, "nextIndex must be > 0");
PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex);
Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[... | java | private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex)
{
checkArgument(nextIndex > 0, "nextIndex must be > 0");
PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex);
Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[... | [
"private",
"static",
"PriorityQueue",
"<",
"Entry",
">",
"initializeQueue",
"(",
"double",
"[",
"]",
"values",
",",
"double",
"[",
"]",
"weights",
",",
"int",
"nextIndex",
")",
"{",
"checkArgument",
"(",
"nextIndex",
">",
"0",
",",
"\"nextIndex must be > 0\"",... | Create a priority queue with an entry for each bucket, ordered by the penalty score with respect to the bucket to its right
The inputs must be sorted by "value" in increasing order
The last bucket has a penalty of infinity
Entries are doubly-linked to keep track of the relative position of each bucket | [
"Create",
"a",
"priority",
"queue",
"with",
"an",
"entry",
"for",
"each",
"bucket",
"ordered",
"by",
"the",
"penalty",
"score",
"with",
"respect",
"to",
"the",
"bucket",
"to",
"its",
"right",
"The",
"inputs",
"must",
"be",
"sorted",
"by",
"value",
"in",
... | 89de5e379d8f85e139d292b0add8c537a2a01a88 | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L271-L286 | train | Initializes the priority queue. | Create a Java method that does the following: "Initializes the priority queue.". | Of course, here is the Java code you requested:
```java
private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex)
{
checkArgument(nextIndex > 0, "nextIndex must be > 0");
PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex);
Entry right =... | |
JavaMoney/jsr354-api | src/main/java/javax/money/AbstractContext.java | AbstractContext.getKeys | public Set<String> getKeys(Class<?> type) {
return data.entrySet().stream().filter(val -> type.isAssignableFrom(val.getValue()
.getClass())).map(Map.Entry::getKey).collect(Collectors
.toSet());
} | java | public Set<String> getKeys(Class<?> type) {
return data.entrySet().stream().filter(val -> type.isAssignableFrom(val.getValue()
.getClass())).map(Map.Entry::getKey).collect(Collectors
.toSet());
} | [
"public",
"Set",
"<",
"String",
">",
"getKeys",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"data",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"val",
"->",
"type",
".",
"isAssignableFrom",
"(",
"val",
".",
... | Get the present keys of all entries with a given type, checking hereby if assignable.
@param type The attribute type, not null.
@return all present keys of attributes being assignable to the type, never null. | [
"Get",
"the",
"present",
"keys",
"of",
"all",
"entries",
"with",
"a",
"given",
"type",
"checking",
"hereby",
"if",
"assignable",
"."
] | 49a7ae436eaf45cac1040879185531ef22de5525 | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L63-L67 | train | Get all the keys of the given type. | Create a Java method that does the following: "Get all the keys of the given type.". | Of course, here is the Java code you requested:
```java
public Set<String> getKeys(Class<?> type) {
return data.entrySet().stream().filter(val -> type.isAssignableFrom(val.getValue()
.getClass())).map(Map.Entry::getKey).collect(Collectors
.toSet());
}
```
Hope this helps! | |
pushtorefresh/storio | storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/Changes.java | Changes.newInstance | @NonNull
public static Changes newInstance(@NonNull Set<Uri> affectedUris) {
checkNotNull(affectedUris, "Please specify affected Uris");
return new Changes(affectedUris);
} | java | @NonNull
public static Changes newInstance(@NonNull Set<Uri> affectedUris) {
checkNotNull(affectedUris, "Please specify affected Uris");
return new Changes(affectedUris);
} | [
"@",
"NonNull",
"public",
"static",
"Changes",
"newInstance",
"(",
"@",
"NonNull",
"Set",
"<",
"Uri",
">",
"affectedUris",
")",
"{",
"checkNotNull",
"(",
"affectedUris",
",",
"\"Please specify affected Uris\"",
")",
";",
"return",
"new",
"Changes",
"(",
"affecte... | Creates immutable container of information about one
or more changes in {@link StorIOContentResolver}.
@param affectedUris non-null set of affected Uris.
@return new immutable instance of {@link Changes}. | [
"Creates",
"immutable",
"container",
"of",
"information",
"about",
"one",
"or",
"more",
"changes",
"in",
"{",
"@link",
"StorIOContentResolver",
"}",
"."
] | 58f53d81bcc7b069c8bb271c46a90e37775abe8d | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/Changes.java#L38-L42 | train | Create a new Changes object with the specified set of URIs. | Create a Java method that does the following: "Create a new Changes object with the specified set of URIs.". | Of course, here is the Java code you requested:
```java
@NonNull
public static Changes newInstance(@NonNull Set<Uri> affectedUris) {
checkNotNull(affectedUris, "Please specify affected Uris");
return new Changes(affectedUris);
}
```
Hope this helps! | |
abel533/Mapper | core/src/main/java/tk/mybatis/mapper/util/OGNL.java | OGNL.exampleHasAtLeastOneCriteriaCheck | public static boolean exampleHasAtLeastOneCriteriaCheck(Object parameter) {
if (parameter != null) {
try {
if (parameter instanceof Example) {
List<Example.Criteria> criteriaList = ((Example) parameter).getOredCriteria();
if (criteriaList != nu... | java | public static boolean exampleHasAtLeastOneCriteriaCheck(Object parameter) {
if (parameter != null) {
try {
if (parameter instanceof Example) {
List<Example.Criteria> criteriaList = ((Example) parameter).getOredCriteria();
if (criteriaList != nu... | [
"public",
"static",
"boolean",
"exampleHasAtLeastOneCriteriaCheck",
"(",
"Object",
"parameter",
")",
"{",
"if",
"(",
"parameter",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"parameter",
"instanceof",
"Example",
")",
"{",
"List",
"<",
"Example",
".",
"Cri... | 检查 paremeter 对象中指定的 fields 是否全是 null,如果是则抛出异常
@param parameter
@return | [
"检查",
"paremeter",
"对象中指定的",
"fields",
"是否全是",
"null,如果是则抛出异常"
] | 45c3d716583cba3680e03f1f6790fab5e1f4f668 | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/util/OGNL.java#L113-L133 | train | exampleHasAtLeastOneCriteriaCheck This method checks if the parameter is an example object and if it has at least one criteria. | Create a Java method that does the following: "exampleHasAtLeastOneCriteriaCheck This method checks if the parameter is an example object and if it has at least one criteria.". | Of course, here is the Java code you requested:
```java
public static boolean exampleHasAtLeastOneCriteriaCheck(Object parameter) {
if (parameter != null) {
try {
if (parameter instanceof Example) {
List<Example.Criteria> criteriaList = ((Example) parameter).getO... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java code to create multiple threads, where each thread performs a specific task. Each task should involve multiple steps and require complex logical reasoning. | Here's an example Java code that creates multiple threads, each performing a specific task involving complex logical reasoning:
```java
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MultiThreadedTasks {
public static void main(String[] args) {
// Create ... | |||||||
camunda/camunda-commons | typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java | Variables.fromMap | public static VariableMap fromMap(Map<String, Object> map) {
if(map instanceof VariableMap) {
return (VariableMap) map;
}
else {
return new VariableMapImpl(map);
}
} | java | public static VariableMap fromMap(Map<String, Object> map) {
if(map instanceof VariableMap) {
return (VariableMap) map;
}
else {
return new VariableMapImpl(map);
}
} | [
"public",
"static",
"VariableMap",
"fromMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"if",
"(",
"map",
"instanceof",
"VariableMap",
")",
"{",
"return",
"(",
"VariableMap",
")",
"map",
";",
"}",
"else",
"{",
"return",
"new",
"Va... | If the given map is not a variable map, adds all its entries as untyped
values to a new {@link VariableMap}. If the given map is a {@link VariableMap},
it is returned as is. | [
"If",
"the",
"given",
"map",
"is",
"not",
"a",
"variable",
"map",
"adds",
"all",
"its",
"entries",
"as",
"untyped",
"values",
"to",
"a",
"new",
"{"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java#L148-L155 | train | Create a VariableMap from a Map. | Create a Java method that does the following: "Create a VariableMap from a Map.". | Of course, here is the Java code you requested:
```java
public static VariableMap fromMap(Map<String, Object> map) {
if(map instanceof VariableMap) {
return (VariableMap) map;
}
else {
return new VariableMapImpl(map);
}
}
```
Hope this helps! | |
wildfly/wildfly | jpa/subsystem/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java | PersistenceUnitServiceHandler.setAnnotationIndexes | private static void setAnnotationIndexes(
final PersistenceUnitMetadataHolder puHolder,
DeploymentUnit deploymentUnit ) {
final Map<URL, Index> annotationIndexes = new HashMap<>();
do {
for (ResourceRoot root : DeploymentUtils.allResourceRoots(deploymentUnit)) {
... | java | private static void setAnnotationIndexes(
final PersistenceUnitMetadataHolder puHolder,
DeploymentUnit deploymentUnit ) {
final Map<URL, Index> annotationIndexes = new HashMap<>();
do {
for (ResourceRoot root : DeploymentUtils.allResourceRoots(deploymentUnit)) {
... | [
"private",
"static",
"void",
"setAnnotationIndexes",
"(",
"final",
"PersistenceUnitMetadataHolder",
"puHolder",
",",
"DeploymentUnit",
"deploymentUnit",
")",
"{",
"final",
"Map",
"<",
"URL",
",",
"Index",
">",
"annotationIndexes",
"=",
"new",
"HashMap",
"<>",
"(",
... | Setup the annotation index map
@param puHolder
@param deploymentUnit | [
"Setup",
"the",
"annotation",
"index",
"map"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/jpa/subsystem/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java#L753-L778 | test | Sets the annotation indexes for all persistence units in the deployment. | Create a Java method that does the following: "Sets the annotation indexes for all persistence units in the deployment.". | Of course, here is the Java code you requested:
```java
private static void setAnnotationIndexes(
final PersistenceUnitMetadataHolder puHolder,
DeploymentUnit deploymentUnit ) {
final Map<URL, Index> annotationIndexes = new HashMap<>();
do {
for (ResourceRoot root ... | |
aws/aws-sdk-java | aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFindingFilters.java | AwsSecurityFindingFilters.setGeneratorId | public void setGeneratorId(java.util.Collection<StringFilter> generatorId) {
if (generatorId == null) {
this.generatorId = null;
return;
}
this.generatorId = new java.util.ArrayList<StringFilter>(generatorId);
} | java | public void setGeneratorId(java.util.Collection<StringFilter> generatorId) {
if (generatorId == null) {
this.generatorId = null;
return;
}
this.generatorId = new java.util.ArrayList<StringFilter>(generatorId);
} | [
"public",
"void",
"setGeneratorId",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"StringFilter",
">",
"generatorId",
")",
"{",
"if",
"(",
"generatorId",
"==",
"null",
")",
"{",
"this",
".",
"generatorId",
"=",
"null",
";",
"return",
";",
"}",
"this"... | <p>
This is the identifier for the solution-specific component (a discrete unit of logic) that generated a finding.
In various security findings provider's solutions, this generator can be called a rule, a check, a detector, a
plug-in, etc.
</p>
@param generatorId
This is the identifier for the solution-specific compo... | [
"<p",
">",
"This",
"is",
"the",
"identifier",
"for",
"the",
"solution",
"-",
"specific",
"component",
"(",
"a",
"discrete",
"unit",
"of",
"logic",
")",
"that",
"generated",
"a",
"finding",
".",
"In",
"various",
"security",
"findings",
"provider",
"s",
"sol... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFindingFilters.java#L792-L799 | train | Sets the value generatorId ; | Create a Java method that does the following: "Sets the value generatorId ;". | Of course, here is the Java code you requested:
```java
public void setGeneratorId(java.util.Collection<StringFilter> generatorId) {
if (generatorId == null) {
this.generatorId = null;
return;
}
this.generatorId = new java.util.ArrayList<StringFilter>(generatorId);
... | |
googleads/googleads-java-lib | modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201809/cm/AdGroup.java | AdGroup.getAdGroupAdRotationMode | public com.google.api.ads.adwords.axis.v201809.cm.AdGroupAdRotationMode getAdGroupAdRotationMode() {
return adGroupAdRotationMode;
} | java | public com.google.api.ads.adwords.axis.v201809.cm.AdGroupAdRotationMode getAdGroupAdRotationMode() {
return adGroupAdRotationMode;
} | [
"public",
"com",
".",
"google",
".",
"api",
".",
"ads",
".",
"adwords",
".",
"axis",
".",
"v201809",
".",
"cm",
".",
"AdGroupAdRotationMode",
"getAdGroupAdRotationMode",
"(",
")",
"{",
"return",
"adGroupAdRotationMode",
";",
"}"
] | Gets the adGroupAdRotationMode value for this AdGroup.
@return adGroupAdRotationMode * The ad rotation mode to specify how often the ads in the ad
group will be served relative to
one another. | [
"Gets",
"the",
"adGroupAdRotationMode",
"value",
"for",
"this",
"AdGroup",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201809/cm/AdGroup.java#L708-L710 | train | Gets the adGroupAdRotationMode value for this CMA. | Create a Java method that does the following: "Gets the adGroupAdRotationMode value for this CMA.". | Of course, here is the Java code you requested:
```java
public com.google.api.ads.adwords.axis.v201809.cm.AdGroupAdRotationMode getAdGroupAdRotationMode() {
return adGroupAdRotationMode;
}
```
Hope this helps! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.