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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/property/accessor/CharAccessor.java | CharAccessor.toBytes | @Override
public byte[] toBytes(Object object)
{
if (object == null)
{
return null;
}
Character data = null;
if (object.getClass().isAssignableFrom(String.class))
{
data = ((String) object).charAt(0);
}
else
{
... | java | @Override
public byte[] toBytes(Object object)
{
if (object == null)
{
return null;
}
Character data = null;
if (object.getClass().isAssignableFrom(String.class))
{
data = ((String) object).charAt(0);
}
else
{
... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"toBytes",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Character",
"data",
"=",
"null",
";",
"if",
"(",
"object",
".",
"getClass",
"(",
")... | /*
(non-Javadoc)
@see
com.impetus.kundera.property.PropertyAccessor#toBytes(java.lang.Object) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 268958ab1ec09d14ec4d9184f0c8ded7a9158908 | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/property/accessor/CharAccessor.java#L59-L77 | train | Serialize a single object to a byte array. | Create a Java method that does the following: "Serialize a single object to a byte array.". | Of course, here is the Java code you requested:
```java
@Override
public byte[] toBytes(Object object)
{
if (object == null)
{
return null;
}
Character data = null;
if (object.getClass().isAssignableFrom(String.class))
{
data = ((String) o... | |
icode/ameba | src/main/java/ameba/message/internal/streaming/BlobStreamingProcess.java | BlobStreamingProcess.write | @Override
public void write(Blob entity, OutputStream output, Long pos, Long length) throws IOException {
InputStream in;
try {
in = entity.getBinaryStream(pos, length);
} catch (SQLException e) {
throw new IOException(e);
}
try {
ReaderWri... | java | @Override
public void write(Blob entity, OutputStream output, Long pos, Long length) throws IOException {
InputStream in;
try {
in = entity.getBinaryStream(pos, length);
} catch (SQLException e) {
throw new IOException(e);
}
try {
ReaderWri... | [
"@",
"Override",
"public",
"void",
"write",
"(",
"Blob",
"entity",
",",
"OutputStream",
"output",
",",
"Long",
"pos",
",",
"Long",
"length",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
";",
"try",
"{",
"in",
"=",
"entity",
".",
"getBinaryStream... | {@inheritDoc} | [
"{"
] | 9d4956e935898e41331b2745e400ef869cd265e0 | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/internal/streaming/BlobStreamingProcess.java#L42-L55 | train | Write a blob to an output stream. | Create a Java method that does the following: "Write a blob to an output stream.". | Of course, here is the Java code you requested:
```java
@Override
public void write(Blob entity, OutputStream output, Long pos, Long length) throws IOException {
InputStream in;
try {
in = entity.getBinaryStream(pos, length);
} catch (SQLException e) {
throw new IOEx... | |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java | RefinePolyLineCorner.fit | public boolean fit( List<Point2D_I32> contour , GrowQueue_I32 corners )
{
if( corners.size() < 3 ) {
return false;
}
searchRadius = Math.min(6,Math.max(contour.size()/12,3));
int startCorner,endCorner;
if( looping ) {
startCorner = 0;
endCorner = corners.size;
} else {
// the end point positio... | java | public boolean fit( List<Point2D_I32> contour , GrowQueue_I32 corners )
{
if( corners.size() < 3 ) {
return false;
}
searchRadius = Math.min(6,Math.max(contour.size()/12,3));
int startCorner,endCorner;
if( looping ) {
startCorner = 0;
endCorner = corners.size;
} else {
// the end point positio... | [
"public",
"boolean",
"fit",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"GrowQueue_I32",
"corners",
")",
"{",
"if",
"(",
"corners",
".",
"size",
"(",
")",
"<",
"3",
")",
"{",
"return",
"false",
";",
"}",
"searchRadius",
"=",
"Math",
".",
"m... | Fits a polygon to the contour given an initial set of candidate corners. If not looping the corners
must include the end points still. Minimum of 3 points required. Otherwise there's no corner!.
@param contour Contours around the shape
@param corners (Input) initial set of corners. (output) refined set of corners | [
"Fits",
"a",
"polygon",
"to",
"the",
"contour",
"given",
"an",
"initial",
"set",
"of",
"candidate",
"corners",
".",
"If",
"not",
"looping",
"the",
"corners",
"must",
"include",
"the",
"end",
"points",
"still",
".",
"Minimum",
"of",
"3",
"points",
"required... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java#L92-L125 | train | Fits the contour using the specified corners. | Create a Java method that does the following: "Fits the contour using the specified corners.". | Of course, here is the Java code you requested:
```java
public boolean fit( List<Point2D_I32> contour , GrowQueue_I32 corners )
{
if( corners.size() < 3 ) {
return false;
}
searchRadius = Math.min(6,Math.max(contour.size()/12,3));
int startCorner,endCorner;
if( looping ) {
startCorner = 0;
endCorn... | |
finmath/finmath-lib | src/main/java6/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.blackScholesDigitalOptionValue | public static double blackScholesDigitalOptionValue(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 1.0;
}
else
{
// Calcul... | java | public static double blackScholesDigitalOptionValue(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 1.0;
}
else
{
// Calcul... | [
"public",
"static",
"double",
"blackScholesDigitalOptionValue",
"(",
"double",
"initialStockValue",
",",
"double",
"riskFreeRate",
",",
"double",
"volatility",
",",
"double",
"optionMaturity",
",",
"double",
"optionStrike",
")",
"{",
"if",
"(",
"optionStrike",
"<=",
... | Calculates the Black-Scholes option value of a digital call option.
@param initialStockValue The initial value of the underlying, i.e., the spot.
@param riskFreeRate The risk free rate of the bank account numerarie.
@param volatility The Black-Scholes volatility.
@param optionMaturity The option maturity T.
@param opt... | [
"Calculates",
"the",
"Black",
"-",
"Scholes",
"option",
"value",
"of",
"a",
"digital",
"call",
"option",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L543-L565 | train | Calculates the Black - Scholes digital option value for a single option. | Create a Java method that does the following: "Calculates the Black - Scholes digital option value for a single option.". | Of course, here is the Java code you requested:
```java
public static double blackScholesDigitalOptionValue(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0)
{
// The Black-Scholes model does not consider it b... | |
sebastiangraf/jSCSI | bundles/target/src/main/java/org/jscsi/target/settings/SingleNumericalValue.java | SingleNumericalValue.base64ValueOf | private static final int base64ValueOf (final char c) {
if ('A' <= c && c <= 'Z') return c - 'A';
if ('a' <= c && c <= 'z') return c - 'a' + 26;
if ('0' <= c && c <= '9') return c - '0' + 52;
if (c == '+') return 62;
if (c == '/') return 63;
throw new NumberFormatEx... | java | private static final int base64ValueOf (final char c) {
if ('A' <= c && c <= 'Z') return c - 'A';
if ('a' <= c && c <= 'z') return c - 'a' + 26;
if ('0' <= c && c <= '9') return c - '0' + 52;
if (c == '+') return 62;
if (c == '/') return 63;
throw new NumberFormatEx... | [
"private",
"static",
"final",
"int",
"base64ValueOf",
"(",
"final",
"char",
"c",
")",
"{",
"if",
"(",
"'",
"'",
"<=",
"c",
"&&",
"c",
"<=",
"'",
"'",
")",
"return",
"c",
"-",
"'",
"'",
";",
"if",
"(",
"'",
"'",
"<=",
"c",
"&&",
"c",
"<=",
"... | Returns a character's value in Base64
@param c a character that is assigned a value from 0 to 63 in Base64
@throws NumberFormatException if the parameter is not a Base64 character
@return the character's value in Base64 | [
"Returns",
"a",
"character",
"s",
"value",
"in",
"Base64"
] | 6169bfe73f0b15de7d6485453555389e782ae888 | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/settings/SingleNumericalValue.java#L125-L132 | train | Returns the value of a base64 character. | Create a Java method that does the following: "Returns the value of a base64 character.". | Of course, here is the Java code you requested:
```java
private static final int base64ValueOf (final char c) {
if ('A' <= c && c <= 'Z') return c - 'A';
if ('a' <= c && c <= 'z') return c - 'a' + 26;
if ('0' <= c && c <= '9') return c - '0' + 52;
if (c == '+') return 62;
i... | |
threerings/narya | core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java | ClientDObjectMgr.processMessage | public void processMessage (Message msg)
{
if (_client.getRunQueue().isRunning()) {
// append it to our queue
_actions.append(msg);
// and queue ourselves up to be run
_client.getRunQueue().postRunnable(this);
} else {
log.info("Dropping me... | java | public void processMessage (Message msg)
{
if (_client.getRunQueue().isRunning()) {
// append it to our queue
_actions.append(msg);
// and queue ourselves up to be run
_client.getRunQueue().postRunnable(this);
} else {
log.info("Dropping me... | [
"public",
"void",
"processMessage",
"(",
"Message",
"msg",
")",
"{",
"if",
"(",
"_client",
".",
"getRunQueue",
"(",
")",
".",
"isRunning",
"(",
")",
")",
"{",
"// append it to our queue",
"_actions",
".",
"append",
"(",
"msg",
")",
";",
"// and queue ourselv... | Called by the communicator when a message arrives from the network layer. We queue it up for
processing and request some processing time on the main thread. | [
"Called",
"by",
"the",
"communicator",
"when",
"a",
"message",
"arrives",
"from",
"the",
"network",
"layer",
".",
"We",
"queue",
"it",
"up",
"for",
"processing",
"and",
"request",
"some",
"processing",
"time",
"on",
"the",
"main",
"thread",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java#L168-L178 | train | Process a message. | Create a Java method that does the following: "Process a message.". | Of course, here is the Java code you requested:
```java
public void processMessage (Message msg)
{
if (_client.getRunQueue().isRunning()) {
// append it to our queue
_actions.append(msg);
// and queue ourselves up to be run
_client.getRunQueue().postRunnable(... | |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java | SourceLoader.load | public IResourceIterator load(String archiveName) throws Exception {
File file = new File(archiveName);
if (file.isDirectory()) {
return new DirectoryIterator(file);
}
return iteratorClass.getConstructor(String.class).newInstance(archiveName);
} | java | public IResourceIterator load(String archiveName) throws Exception {
File file = new File(archiveName);
if (file.isDirectory()) {
return new DirectoryIterator(file);
}
return iteratorClass.getConstructor(String.class).newInstance(archiveName);
} | [
"public",
"IResourceIterator",
"load",
"(",
"String",
"archiveName",
")",
"throws",
"Exception",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"archiveName",
")",
";",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"new",
"DirectoryIt... | Returns a resource iterator instance for the given archive name.
@param archiveName Name of the archive file.
@return A resource iterator instance.
@throws Exception Unspecified exception. | [
"Returns",
"a",
"resource",
"iterator",
"instance",
"for",
"the",
"given",
"archive",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java#L113-L121 | train | Load an iterator from the given archive name. | Create a Java method that does the following: "Load an iterator from the given archive name.". | Of course, here is the Java code you requested:
```java
public IResourceIterator load(String archiveName) throws Exception {
File file = new File(archiveName);
if (file.isDirectory()) {
return new DirectoryIterator(file);
}
return iteratorClass.getConstruct... | |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java | VisibleMemberMap.getMemberKey | private Object getMemberKey(ProgramElementDoc doc) {
if (doc.isConstructor()) {
return doc.name() + ((ExecutableMemberDoc)doc).signature();
} else if (doc.isMethod()) {
return getClassMember((MethodDoc) doc);
} else if (doc.isField() || doc.isEnumConstant() || doc.isAnnot... | java | private Object getMemberKey(ProgramElementDoc doc) {
if (doc.isConstructor()) {
return doc.name() + ((ExecutableMemberDoc)doc).signature();
} else if (doc.isMethod()) {
return getClassMember((MethodDoc) doc);
} else if (doc.isField() || doc.isEnumConstant() || doc.isAnnot... | [
"private",
"Object",
"getMemberKey",
"(",
"ProgramElementDoc",
"doc",
")",
"{",
"if",
"(",
"doc",
".",
"isConstructor",
"(",
")",
")",
"{",
"return",
"doc",
".",
"name",
"(",
")",
"+",
"(",
"(",
"ExecutableMemberDoc",
")",
"doc",
")",
".",
"signature",
... | Return the key to the member map for the given member. | [
"Return",
"the",
"key",
"to",
"the",
"member",
"map",
"for",
"the",
"given",
"member",
"."
] | a53d069bbdb2c60232ed3811c19b65e41c3e60e0 | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java#L758-L771 | train | Get the member key. | Create a Java method that does the following: "Get the member key.". | Of course, here is the Java code you requested:
```java
private Object getMemberKey(ProgramElementDoc doc) {
if (doc.isConstructor()) {
return doc.name() + ((ExecutableMemberDoc)doc).signature();
} else if (doc.isMethod()) {
return getClassMember((MethodDoc) doc);
} else... | |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/BuiltInThreadStatesProducer.java | BuiltInThreadStatesProducer.readThreads | private void readThreads(){
long[] ids = threadMxBean.getAllThreadIds();
Map<Thread.State, Long> count = new EnumMap<>(Thread.State.class);
for (int i = 0; i<ids.length; i++){
long id = ids[i];
ThreadInfo info = threadMxBean.getThreadInfo(id);
if (info!=null){
Thread.State state = info.getThreadStat... | java | private void readThreads(){
long[] ids = threadMxBean.getAllThreadIds();
Map<Thread.State, Long> count = new EnumMap<>(Thread.State.class);
for (int i = 0; i<ids.length; i++){
long id = ids[i];
ThreadInfo info = threadMxBean.getThreadInfo(id);
if (info!=null){
Thread.State state = info.getThreadStat... | [
"private",
"void",
"readThreads",
"(",
")",
"{",
"long",
"[",
"]",
"ids",
"=",
"threadMxBean",
".",
"getAllThreadIds",
"(",
")",
";",
"Map",
"<",
"Thread",
".",
"State",
",",
"Long",
">",
"count",
"=",
"new",
"EnumMap",
"<>",
"(",
"Thread",
".",
"Sta... | Reads and updates the thread info. | [
"Reads",
"and",
"updates",
"the",
"thread",
"info",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/BuiltInThreadStatesProducer.java#L72-L99 | train | Read threads. | Create a Java method that does the following: "Read threads.". | Of course, here is the Java code you requested:
```java
private void readThreads(){
long[] ids = threadMxBean.getAllThreadIds();
Map<Thread.State, Long> count = new EnumMap<>(Thread.State.class);
for (int i = 0; i<ids.length; i++){
long id = ids[i];
ThreadInfo info = threadMxBean.getThreadInfo(id);
if ... | |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java | AbstractRenderer.toScreenCoordinates | public Point2d toScreenCoordinates(double modelX, double modelY) {
double[] dest = new double[2];
transform.transform(new double[]{modelX, modelY}, 0, dest, 0, 1);
return new Point2d(dest[0], dest[1]);
} | java | public Point2d toScreenCoordinates(double modelX, double modelY) {
double[] dest = new double[2];
transform.transform(new double[]{modelX, modelY}, 0, dest, 0, 1);
return new Point2d(dest[0], dest[1]);
} | [
"public",
"Point2d",
"toScreenCoordinates",
"(",
"double",
"modelX",
",",
"double",
"modelY",
")",
"{",
"double",
"[",
"]",
"dest",
"=",
"new",
"double",
"[",
"2",
"]",
";",
"transform",
".",
"transform",
"(",
"new",
"double",
"[",
"]",
"{",
"modelX",
... | Convert a point in model space into a point in screen space.
@param modelX the model x-coordinate
@param modelY the model y-coordinate
@return the equivalent point in screen space | [
"Convert",
"a",
"point",
"in",
"model",
"space",
"into",
"a",
"point",
"in",
"screen",
"space",
"."
] | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L180-L184 | train | Converts the given model coordinates to the screen coordinates. | Create a Java method that does the following: "Converts the given model coordinates to the screen coordinates.". | Of course, here is the Java code you requested:
```java
public Point2d toScreenCoordinates(double modelX, double modelY) {
double[] dest = new double[2];
transform.transform(new double[]{modelX, modelY}, 0, dest, 0, 1);
return new Point2d(dest[0], dest[1]);
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.listByResourceGroupAsync | public Observable<Page<StorageAccountInner>> listByResourceGroupAsync(String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<StorageAccountInner>>, Page<StorageAccountInner>>() {
@Override
public Page<StorageAc... | java | public Observable<Page<StorageAccountInner>> listByResourceGroupAsync(String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<StorageAccountInner>>, Page<StorageAccountInner>>() {
@Override
public Page<StorageAc... | [
"public",
"Observable",
"<",
"Page",
"<",
"StorageAccountInner",
">",
">",
"listByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
... | Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@return the observable to the List<StorageAccou... | [
"Lists",
"all",
"the",
"storage",
"accounts",
"available",
"under",
"the",
"given",
"resource",
"group",
".",
"Note",
"that",
"storage",
"keys",
"are",
"not",
"returned",
";",
"use",
"the",
"ListKeys",
"operation",
"for",
"this",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L770-L779 | train | Gets a list of Crafter Sessions. | Create a Java method that does the following: "Gets a list of Crafter Sessions.". | Of course, here is the Java code you requested:
```java
public Observable<Page<StorageAccountInner>> listByResourceGroupAsync(String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<StorageAccountInner>>, Page<StorageAccountInner>>() ... | |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/Util.java | Util.replaceFilePathsWithBytes | public static void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException {
ModelNode requestProps = opDescOutcome.get("result", "request-properties");
for (Property prop : requestProps.asPropertyList()) {
ModelNode typeDesc = prop.getValue().get(... | java | public static void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException {
ModelNode requestProps = opDescOutcome.get("result", "request-properties");
for (Property prop : requestProps.asPropertyList()) {
ModelNode typeDesc = prop.getValue().get(... | [
"public",
"static",
"void",
"replaceFilePathsWithBytes",
"(",
"ModelNode",
"request",
",",
"ModelNode",
"opDescOutcome",
")",
"throws",
"CommandFormatException",
"{",
"ModelNode",
"requestProps",
"=",
"opDescOutcome",
".",
"get",
"(",
"\"result\"",
",",
"\"request-prope... | For any request params that are of type BYTES, replace the file path with the bytes from the file | [
"For",
"any",
"request",
"params",
"that",
"are",
"of",
"type",
"BYTES",
"replace",
"the",
"file",
"path",
"with",
"the",
"bytes",
"from",
"the",
"file"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/Util.java#L1693-L1710 | train | Replace file paths with bytes. | Create a Java method that does the following: "Replace file paths with bytes.". | Of course, here is the Java code you requested:
```java
public static void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException {
ModelNode requestProps = opDescOutcome.get("result", "request-properties");
for (Property prop : requestProps.asPropertyList()... | |
code4everything/util | src/main/java/com/zhazhapan/util/AopLogUtils.java | AopLogUtils.getDescriptionNoThrow | public static String getDescriptionNoThrow(String className, String methodName, Object[] args) {
try {
return getDescription(className, methodName, args);
} catch (ClassNotFoundException e) {
LoggerUtils.error("get description from {}#{} error: {}", className, methodName, e.getMe... | java | public static String getDescriptionNoThrow(String className, String methodName, Object[] args) {
try {
return getDescription(className, methodName, args);
} catch (ClassNotFoundException e) {
LoggerUtils.error("get description from {}#{} error: {}", className, methodName, e.getMe... | [
"public",
"static",
"String",
"getDescriptionNoThrow",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"return",
"getDescription",
"(",
"className",
",",
"methodName",
",",
"args",
")",
";",
"}"... | 获取 {@link AopLog}注解中的描述
@param className 类名:joinPoint#getTarget#getClass#getName
@param methodName 方法名:joinPoint#getSignature#getName
@param args 参数数组:joinPoint#getArgs
@return 描述
@since 1.1.0 | [
"获取",
"{",
"@link",
"AopLog",
"}",
"注解中的描述"
] | 1fc9f0ead1108f4d7208ba7c000df4244f708418 | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/AopLogUtils.java#L52-L59 | train | Get description without throwing exception. | Create a Java method that does the following: "Get description without throwing exception.". | Of course, here is the Java code you requested:
```java
public static String getDescriptionNoThrow(String className, String methodName, Object[] args) {
try {
return getDescription(className, methodName, args);
} catch (ClassNotFoundException e) {
LoggerUtils.error("get descript... | |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201808/AdSenseSettings.java | AdSenseSettings.setAdType | public void setAdType(com.google.api.ads.admanager.axis.v201808.AdSenseSettingsAdType adType) {
this.adType = adType;
} | java | public void setAdType(com.google.api.ads.admanager.axis.v201808.AdSenseSettingsAdType adType) {
this.adType = adType;
} | [
"public",
"void",
"setAdType",
"(",
"com",
".",
"google",
".",
"api",
".",
"ads",
".",
"admanager",
".",
"axis",
".",
"v201808",
".",
"AdSenseSettingsAdType",
"adType",
")",
"{",
"this",
".",
"adType",
"=",
"adType",
";",
"}"
] | Sets the adType value for this AdSenseSettings.
@param adType * Specifies what kind of ad can be served by this {@link AdUnit}
from the
AdSense Content Network. This attribute is optional
and defaults to the ad
unit's parent or ancestor's setting if one has been
set. If no ancestor of
the ad unit has set {@code adTy... | [
"Sets",
"the",
"adType",
"value",
"for",
"this",
"AdSenseSettings",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201808/AdSenseSettings.java#L420-L422 | train | Sets the adType value for this AdsSettings. | Create a Java method that does the following: "Sets the adType value for this AdsSettings.". | Of course, here is the Java code you requested:
```java
public void setAdType(com.google.api.ads.admanager.axis.v201808.AdSenseSettingsAdType adType) {
this.adType = adType;
}
```
Hope this helps! | |
eteration/glassmaker | org.glassmaker.eclipse/org.glassmaker.ui.editor/src/main/java/org/glassmaker/ui/editor/wizards/NewCardFileWizardPage.java | NewCardFileWizardPage.addDefaultExtension | String addDefaultExtension(String filename) {
StringBuffer newFileName = new StringBuffer(filename);
String ext = "card";
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);
return newFileName.toString();
} | java | String addDefaultExtension(String filename) {
StringBuffer newFileName = new StringBuffer(filename);
String ext = "card";
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);
return newFileName.toString();
} | [
"String",
"addDefaultExtension",
"(",
"String",
"filename",
")",
"{",
"StringBuffer",
"newFileName",
"=",
"new",
"StringBuffer",
"(",
"filename",
")",
";",
"String",
"ext",
"=",
"\"card\"",
";",
"newFileName",
".",
"append",
"(",
"\".\"",
")",
";",
"//$NON-NLS... | Adds default extension to the filename
@param filename
@return | [
"Adds",
"default",
"extension",
"to",
"the",
"filename"
] | d7f3d0d5e08376d6262a9e9ba198b14f6eac840c | https://github.com/eteration/glassmaker/blob/d7f3d0d5e08376d6262a9e9ba198b14f6eac840c/org.glassmaker.eclipse/org.glassmaker.ui.editor/src/main/java/org/glassmaker/ui/editor/wizards/NewCardFileWizardPage.java#L199-L208 | valid | Add a default extension to the file name. | Create a Java method that does the following: "Add a default extension to the file name.". | Of course, here is the Java code you requested:
```java
String addDefaultExtension(String filename) {
StringBuffer newFileName = new StringBuffer(filename);
String ext = "card";
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);
return newFileName.toString();
}
```
Hope this helps! | |
GumTreeDiff/gumtree | core/src/main/java/com/github/gumtreediff/io/IndentingXMLStreamWriter.java | IndentingXMLStreamWriter.writeNewLine | protected void writeNewLine(int indentation) throws XMLStreamException {
final int newLineLength = getNewLine().length();
final int prefixLength = newLineLength + (getIndent().length() * indentation);
if (prefixLength > 0) {
if (linePrefix == null) {
linePrefix = (get... | java | protected void writeNewLine(int indentation) throws XMLStreamException {
final int newLineLength = getNewLine().length();
final int prefixLength = newLineLength + (getIndent().length() * indentation);
if (prefixLength > 0) {
if (linePrefix == null) {
linePrefix = (get... | [
"protected",
"void",
"writeNewLine",
"(",
"int",
"indentation",
")",
"throws",
"XMLStreamException",
"{",
"final",
"int",
"newLineLength",
"=",
"getNewLine",
"(",
")",
".",
"length",
"(",
")",
";",
"final",
"int",
"prefixLength",
"=",
"newLineLength",
"+",
"("... | Write a line separator followed by indentation. | [
"Write",
"a",
"line",
"separator",
"followed",
"by",
"indentation",
"."
] | a772d4d652af44bff22c38a234ddffbfbd365a37 | https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/io/IndentingXMLStreamWriter.java#L345-L363 | train | Write a new line of text. | Create a Java method that does the following: "Write a new line of text.". | Of course, here is the Java code you requested:
```java
protected void writeNewLine(int indentation) throws XMLStreamException {
final int newLineLength = getNewLine().length();
final int prefixLength = newLineLength + (getIndent().length() * indentation);
if (prefixLength > 0) {
if... | |
wisdom-framework/wisdom-jdbc | wisdom-jpa-manager/src/main/java/org/wisdom/framework/transaction/impl/XidFactoryImpl.java | XidFactoryImpl.createXid | public Xid createXid() {
byte[] globalId = baseId.clone();
long id;
synchronized (this) {
id = count++;
}
insertLong(id, globalId, 0);
return new XidImpl(globalId);
} | java | public Xid createXid() {
byte[] globalId = baseId.clone();
long id;
synchronized (this) {
id = count++;
}
insertLong(id, globalId, 0);
return new XidImpl(globalId);
} | [
"public",
"Xid",
"createXid",
"(",
")",
"{",
"byte",
"[",
"]",
"globalId",
"=",
"baseId",
".",
"clone",
"(",
")",
";",
"long",
"id",
";",
"synchronized",
"(",
"this",
")",
"{",
"id",
"=",
"count",
"++",
";",
"}",
"insertLong",
"(",
"id",
",",
"gl... | Creates the Xid.
@return the new Xid | [
"Creates",
"the",
"Xid",
"."
] | 931f5acf0b2bcb0a8f3b683d60d326caafd09a72 | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-jpa-manager/src/main/java/org/wisdom/framework/transaction/impl/XidFactoryImpl.java#L54-L62 | train | Create a new Xid object. | Create a Java method that does the following: "Create a new Xid object.". | Of course, here is the Java code you requested:
```java
public Xid createXid() {
byte[] globalId = baseId.clone();
long id;
synchronized (this) {
id = count++;
}
insertLong(id, globalId, 0);
return new XidImpl(globalId);
}
```
Hope this helps! | |
aol/cyclops | cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java | Singles.fromIterable | public static <T> Single<T> fromIterable(Iterable<T> t) {
return Single.fromPublisher(Future.fromIterable(t));
} | java | public static <T> Single<T> fromIterable(Iterable<T> t) {
return Single.fromPublisher(Future.fromIterable(t));
} | [
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"T",
">",
"fromIterable",
"(",
"Iterable",
"<",
"T",
">",
"t",
")",
"{",
"return",
"Single",
".",
"fromPublisher",
"(",
"Future",
".",
"fromIterable",
"(",
"t",
")",
")",
";",
"}"
] | Construct a Single from Iterable by taking the first value from Iterable
@param t Iterable to populate Single from
@return Single containing first element from Iterable (or empty Single) | [
"Construct",
"a",
"Single",
"from",
"Iterable",
"by",
"taking",
"the",
"first",
"value",
"from",
"Iterable"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java#L396-L398 | train | Create Single from Iterable | Create a Java method that does the following: "Create Single from Iterable". | Of course, here is the Java code you requested:
```java
public static <T> Single<T> fromIterable(Iterable<T> t) {
return Single.fromPublisher(Future.fromIterable(t));
}
```
Hope this helps! | |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.getThemeResource | public static int getThemeResource(int themeTag, boolean applyModifier) {
if (themeTag >= _START_RESOURCES_ID) {
return themeTag;
}
themeTag = prepareFlags(themeTag, applyModifier);
if (ThemeManager.sThemeGetters != null) {
int getterResource;
final Th... | java | public static int getThemeResource(int themeTag, boolean applyModifier) {
if (themeTag >= _START_RESOURCES_ID) {
return themeTag;
}
themeTag = prepareFlags(themeTag, applyModifier);
if (ThemeManager.sThemeGetters != null) {
int getterResource;
final Th... | [
"public",
"static",
"int",
"getThemeResource",
"(",
"int",
"themeTag",
",",
"boolean",
"applyModifier",
")",
"{",
"if",
"(",
"themeTag",
">=",
"_START_RESOURCES_ID",
")",
"{",
"return",
"themeTag",
";",
"}",
"themeTag",
"=",
"prepareFlags",
"(",
"themeTag",
",... | Resolve theme resource id by flags | [
"Resolve",
"theme",
"resource",
"id",
"by",
"flags"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L371-L392 | train | Get the theme resource. | Create a Java method that does the following: "Get the theme resource.". | Of course, here is the Java code you requested:
```java
public static int getThemeResource(int themeTag, boolean applyModifier) {
if (themeTag >= _START_RESOURCES_ID) {
return themeTag;
}
themeTag = prepareFlags(themeTag, applyModifier);
if (ThemeManager.sThemeGetters != nul... | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/EvictionConfig.java | EvictionConfig.getEvictionPolicyType | @Deprecated
public EvictionPolicyType getEvictionPolicyType() {
switch (evictionPolicy) {
case LFU:
return EvictionPolicyType.LFU;
case LRU:
return EvictionPolicyType.LRU;
case RANDOM:
return EvictionPolicyType.RANDOM;
... | java | @Deprecated
public EvictionPolicyType getEvictionPolicyType() {
switch (evictionPolicy) {
case LFU:
return EvictionPolicyType.LFU;
case LRU:
return EvictionPolicyType.LRU;
case RANDOM:
return EvictionPolicyType.RANDOM;
... | [
"@",
"Deprecated",
"public",
"EvictionPolicyType",
"getEvictionPolicyType",
"(",
")",
"{",
"switch",
"(",
"evictionPolicy",
")",
"{",
"case",
"LFU",
":",
"return",
"EvictionPolicyType",
".",
"LFU",
";",
"case",
"LRU",
":",
"return",
"EvictionPolicyType",
".",
"L... | Returns the {@link EvictionPolicyType} of this eviction configuration.
@return the {@link EvictionPolicyType} of this eviction configuration
@deprecated since 3.9, please use {@link #getEvictionPolicy()} | [
"Returns",
"the",
"{",
"@link",
"EvictionPolicyType",
"}",
"of",
"this",
"eviction",
"configuration",
"."
] | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/EvictionConfig.java#L248-L262 | train | Get the type of the eviction policy. | Create a Java method that does the following: "Get the type of the eviction policy.". | Of course, here is the Java code you requested:
```java
@Deprecated
public EvictionPolicyType getEvictionPolicyType() {
switch (evictionPolicy) {
case LFU:
return EvictionPolicyType.LFU;
case LRU:
return EvictionPolicyType.LRU;
case RANDOM... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.transaction/src/com/ibm/ws/cdi/transaction/liberty/LibertyTransactionService.java | LibertyTransactionService.isTransactionActive | @Override
public boolean isTransactionActive() {
if (this.getTransactionManager() != null)
try {
if (this.getTransactionManager().getStatus() == Status.STATUS_ACTIVE)
return true;
} catch (SystemException se) {
if (TC.isDebugEnabl... | java | @Override
public boolean isTransactionActive() {
if (this.getTransactionManager() != null)
try {
if (this.getTransactionManager().getStatus() == Status.STATUS_ACTIVE)
return true;
} catch (SystemException se) {
if (TC.isDebugEnabl... | [
"@",
"Override",
"public",
"boolean",
"isTransactionActive",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getTransactionManager",
"(",
")",
"!=",
"null",
")",
"try",
"{",
"if",
"(",
"this",
".",
"getTransactionManager",
"(",
")",
".",
"getStatus",
"(",
")",
"... | /*
(non-Javadoc)
@see org.jboss.weld.transaction.spi.TransactionServices#isTransactionActive() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.transaction/src/com/ibm/ws/cdi/transaction/liberty/LibertyTransactionService.java#L163-L178 | train | This method is called to check if the transaction is active. | Create a Java method that does the following: "This method is called to check if the transaction is active.". | Of course, here is the Java code you requested:
```java
@Override
public boolean isTransactionActive() {
if (this.getTransactionManager() != null)
try {
if (this.getTransactionManager().getStatus() == Status.STATUS_ACTIVE)
return true;
} catch (... | |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getPlainDBObject | private Object getPlainDBObject(ClassDescriptor cld, Identity oid) throws ClassNotPersistenceCapableException
{
Object newObj = null;
// Class is NOT an Interface: it has a directly mapped table and we lookup this table first:
if (!cld.isInterface())
{
// 1. try to retri... | java | private Object getPlainDBObject(ClassDescriptor cld, Identity oid) throws ClassNotPersistenceCapableException
{
Object newObj = null;
// Class is NOT an Interface: it has a directly mapped table and we lookup this table first:
if (!cld.isInterface())
{
// 1. try to retri... | [
"private",
"Object",
"getPlainDBObject",
"(",
"ClassDescriptor",
"cld",
",",
"Identity",
"oid",
")",
"throws",
"ClassNotPersistenceCapableException",
"{",
"Object",
"newObj",
"=",
"null",
";",
"// Class is NOT an Interface: it has a directly mapped table and we lookup this table ... | Retrieve an plain object (without populated references) by it's identity
from the database
@param cld the real {@link org.apache.ojb.broker.metadata.ClassDescriptor} of the object to refresh
@param oid the {@link org.apache.ojb.broker.Identity} of the object
@return A new plain object read from the database or <em>nul... | [
"Retrieve",
"an",
"plain",
"object",
"(",
"without",
"populated",
"references",
")",
"by",
"it",
"s",
"identity",
"from",
"the",
"database"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1536-L1565 | train | Get the plain DB object for the given Identity. | Create a Java method that does the following: "Get the plain DB object for the given Identity.". | Of course, here is the Java code you requested:
```java
private Object getPlainDBObject(ClassDescriptor cld, Identity oid) throws ClassNotPersistenceCapableException
{
Object newObj = null;
// Class is NOT an Interface: it has a directly mapped table and we lookup this table first:
if (!cl... | |
stevespringett/Alpine | alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java | LdapConnectionWrapper.searchForUsername | public List<SearchResult> searchForUsername(final DirContext ctx, final String username) throws NamingException {
LOGGER.debug("Performing a directory search for: " + username);
final String[] attributeFilter = {};
final SearchControls sc = new SearchControls();
sc.setReturningAttributes... | java | public List<SearchResult> searchForUsername(final DirContext ctx, final String username) throws NamingException {
LOGGER.debug("Performing a directory search for: " + username);
final String[] attributeFilter = {};
final SearchControls sc = new SearchControls();
sc.setReturningAttributes... | [
"public",
"List",
"<",
"SearchResult",
">",
"searchForUsername",
"(",
"final",
"DirContext",
"ctx",
",",
"final",
"String",
"username",
")",
"throws",
"NamingException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Performing a directory search for: \"",
"+",
"username",
")... | Performs a search for the specified username. Internally, this method queries on
the attribute defined by {@link Config.AlpineKey#LDAP_ATTRIBUTE_NAME}.
@param ctx the DirContext to use
@param username the username to query on
@return a list of SearchResult objects. If the username is found, the list should typically on... | [
"Performs",
"a",
"search",
"for",
"the",
"specified",
"username",
".",
"Internally",
"this",
"method",
"queries",
"on",
"the",
"attribute",
"defined",
"by",
"{"
] | 6c5ef5e1ba4f38922096f1307d3950c09edb3093 | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L182-L192 | train | Perform a directory search for a username. | Create a Java method that does the following: "Perform a directory search for a username.". | Of course, here is the Java code you requested:
```java
public List<SearchResult> searchForUsername(final DirContext ctx, final String username) throws NamingException {
LOGGER.debug("Performing a directory search for: " + username);
final String[] attributeFilter = {};
final SearchControls sc ... | |
gocd/gocd | base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java | DirectoryScanner.matchPath | protected static boolean matchPath(String pattern, String str,
boolean isCaseSensitive) {
return SelectorUtils.matchPath(pattern, str, isCaseSensitive);
} | java | protected static boolean matchPath(String pattern, String str,
boolean isCaseSensitive) {
return SelectorUtils.matchPath(pattern, str, isCaseSensitive);
} | [
"protected",
"static",
"boolean",
"matchPath",
"(",
"String",
"pattern",
",",
"String",
"str",
",",
"boolean",
"isCaseSensitive",
")",
"{",
"return",
"SelectorUtils",
".",
"matchPath",
"(",
"pattern",
",",
"str",
",",
"isCaseSensitive",
")",
";",
"}"
] | Test whether or not a given path matches a given pattern.
@param pattern The pattern to match against. Must not be
<code>null</code>.
@param str The path to match, as a String. Must not be
<code>null</code>.
@param isCaseSensitive Whether or not matching should be performed
case sensitively.
@return <code>true</c... | [
"Test",
"whether",
"or",
"not",
"a",
"given",
"path",
"matches",
"a",
"given",
"pattern",
"."
] | 59a8480e23d6c06de39127635108dff57603cb71 | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L444-L447 | train | Match path. | Create a Java method that does the following: "Match path.". | Of course, here is the Java code you requested:
```java
protected static boolean matchPath(String pattern, String str,
boolean isCaseSensitive) {
return SelectorUtils.matchPath(pattern, str, isCaseSensitive);
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java | JSONConverter.isSupportedNotificationFilter | public boolean isSupportedNotificationFilter(NotificationFilter filter) {
Class<?> clazz = filter.getClass();
return clazz == AttributeChangeNotificationFilter.class ||
clazz == MBeanServerNotificationFilter.class ||
clazz == NotificationFilterSupport.class;
} | java | public boolean isSupportedNotificationFilter(NotificationFilter filter) {
Class<?> clazz = filter.getClass();
return clazz == AttributeChangeNotificationFilter.class ||
clazz == MBeanServerNotificationFilter.class ||
clazz == NotificationFilterSupport.class;
} | [
"public",
"boolean",
"isSupportedNotificationFilter",
"(",
"NotificationFilter",
"filter",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"filter",
".",
"getClass",
"(",
")",
";",
"return",
"clazz",
"==",
"AttributeChangeNotificationFilter",
".",
"class",
"||",
... | Check if a NotificationFilter is a standard filter that can be
send to a JMX server.
@param filter The filter to check. Can't be null.
@return Whether the filter is a standard one | [
"Check",
"if",
"a",
"NotificationFilter",
"is",
"a",
"standard",
"filter",
"that",
"can",
"be",
"send",
"to",
"a",
"JMX",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1574-L1579 | train | Check if the given NotificationFilter is supported by this MBeanServer. | Create a Java method that does the following: "Check if the given NotificationFilter is supported by this MBeanServer.". | Of course, here is the Java code you requested:
```java
public boolean isSupportedNotificationFilter(NotificationFilter filter) {
Class<?> clazz = filter.getClass();
return clazz == AttributeChangeNotificationFilter.class ||
clazz == MBeanServerNotificationFilter.class ||
... | |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/mojo/RamlCompilerMojo.java | RamlCompilerMojo.controllerParsed | @Override
public void controllerParsed(File source, ControllerModel<Raml> model) throws WatchingException {
Raml raml = new Raml(); //Create a new raml file
raml.setBaseUri(baseUri); //set the base uri
raml.setVersion(project().getVersion());
//Visit the controller model to populate... | java | @Override
public void controllerParsed(File source, ControllerModel<Raml> model) throws WatchingException {
Raml raml = new Raml(); //Create a new raml file
raml.setBaseUri(baseUri); //set the base uri
raml.setVersion(project().getVersion());
//Visit the controller model to populate... | [
"@",
"Override",
"public",
"void",
"controllerParsed",
"(",
"File",
"source",
",",
"ControllerModel",
"<",
"Raml",
">",
"model",
")",
"throws",
"WatchingException",
"{",
"Raml",
"raml",
"=",
"new",
"Raml",
"(",
")",
";",
"//Create a new raml file",
"raml",
"."... | Generate the raml file from a given controller source file.
@param source The controller source file.
@param model The controller model
@throws WatchingException If there is a problem while creating the raml file. | [
"Generate",
"the",
"raml",
"file",
"from",
"a",
"given",
"controller",
"source",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/mojo/RamlCompilerMojo.java#L85-L106 | train | Called when a controller is parsed. | Create a Java method that does the following: "Called when a controller is parsed.". | Of course, here is the Java code you requested:
```java
@Override
public void controllerParsed(File source, ControllerModel<Raml> model) throws WatchingException {
Raml raml = new Raml(); //Create a new raml file
raml.setBaseUri(baseUri); //set the base uri
raml.setVersion(project().getVers... | |
glyptodon/guacamole-client | guacamole-ext/src/main/java/org/apache/guacamole/environment/LocalEnvironment.java | LocalEnvironment.readProtocols | private Map<String, ProtocolInfo> readProtocols() {
// Map of all available protocols
Map<String, ProtocolInfo> protocols = new HashMap<String, ProtocolInfo>();
// Get protcols directory
File protocol_directory = new File(getGuacamoleHome(), "protocols");
// Read protocols fro... | java | private Map<String, ProtocolInfo> readProtocols() {
// Map of all available protocols
Map<String, ProtocolInfo> protocols = new HashMap<String, ProtocolInfo>();
// Get protcols directory
File protocol_directory = new File(getGuacamoleHome(), "protocols");
// Read protocols fro... | [
"private",
"Map",
"<",
"String",
",",
"ProtocolInfo",
">",
"readProtocols",
"(",
")",
"{",
"// Map of all available protocols",
"Map",
"<",
"String",
",",
"ProtocolInfo",
">",
"protocols",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ProtocolInfo",
">",
"(",
")... | Reads through all pre-defined protocols and any protocols within the
"protocols" subdirectory of GUACAMOLE_HOME, returning a map containing
each of these protocols. The key of each entry will be the name of that
protocol, as would be passed to guacd during connection.
@return
A map of all available protocols. | [
"Reads",
"through",
"all",
"pre",
"-",
"defined",
"protocols",
"and",
"any",
"protocols",
"within",
"the",
"protocols",
"subdirectory",
"of",
"GUACAMOLE_HOME",
"returning",
"a",
"map",
"containing",
"each",
"of",
"these",
"protocols",
".",
"The",
"key",
"of",
... | ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9 | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-ext/src/main/java/org/apache/guacamole/environment/LocalEnvironment.java#L240-L320 | train | Read protocols from the Guacamole home directory. | Create a Java method that does the following: "Read protocols from the Guacamole home directory.". | Of course, here is the Java code you requested:
```java
private Map<String, ProtocolInfo> readProtocols() {
// Map of all available protocols
Map<String, ProtocolInfo> protocols = new HashMap<String, ProtocolInfo>();
// Get protcols directory
File protocol_directory = new File(getGuac... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.doShallowCopy | private static void doShallowCopy(Object source, Object target, final Boolean allProperties,
final String... propertyNames) {
Assert.notNull(source, "source");
Assert.notNull(target, "target");
Assert.notNull(allProperties, "allProperties");
Assert.notNull(propertyNames, "pr... | java | private static void doShallowCopy(Object source, Object target, final Boolean allProperties,
final String... propertyNames) {
Assert.notNull(source, "source");
Assert.notNull(target, "target");
Assert.notNull(allProperties, "allProperties");
Assert.notNull(propertyNames, "pr... | [
"private",
"static",
"void",
"doShallowCopy",
"(",
"Object",
"source",
",",
"Object",
"target",
",",
"final",
"Boolean",
"allProperties",
",",
"final",
"String",
"...",
"propertyNames",
")",
"{",
"Assert",
".",
"notNull",
"(",
"source",
",",
"\"source\"",
")",... | Makes a shallow copy of the source object into the target one excluding properties not in
<code>propertyNames</code> unless <code>allProperties</code> is true.
<p>
This method differs from {@link ReflectionUtils#shallowCopyFieldState(Object, Object)} this doesn't require
source and target objects to share the same clas... | [
"Makes",
"a",
"shallow",
"copy",
"of",
"the",
"source",
"object",
"into",
"the",
"target",
"one",
"excluding",
"properties",
"not",
"in",
"<code",
">",
"propertyNames<",
"/",
"code",
">",
"unless",
"<code",
">",
"allProperties<",
"/",
"code",
">",
"is",
"t... | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L283-L316 | train | Copy all the property value from source to target. | Create a Java method that does the following: "Copy all the property value from source to target.". | Of course, here is the Java code you requested:
```java
private static void doShallowCopy(Object source, Object target, final Boolean allProperties,
final String... propertyNames) {
Assert.notNull(source, "source");
Assert.notNull(target, "target");
Assert.notNull(allProperties, "a... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Construct an array in Java containing the first 1000 prime numbers. | Here is a Java code that constructs an array containing the first 1000 prime numbers:
```java
public class PrimeNumberArray {
public static void main(String[] args) {
int[] primeNumbers = new int[1000];
primeNumbers[0] = 2; // 2 is the first prime number
int count = 1;
int number =... | |||||||
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/management/DescriptorTools.java | DescriptorTools.getDescriptorFiles | public static File[] getDescriptorFiles( File definitionDir , final String prefix , final String suffix )
{
return definitionDir.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
publi... | java | public static File[] getDescriptorFiles( File definitionDir , final String prefix , final String suffix )
{
return definitionDir.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
publi... | [
"public",
"static",
"File",
"[",
"]",
"getDescriptorFiles",
"(",
"File",
"definitionDir",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"definitionDir",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(",
")",
"{",
"/*\... | Find all descriptor files with the given prefix in a target folder
@param definitionDir the target folder
@param prefix the descriptor filename prefix
@return an array of descriptor files | [
"Find",
"all",
"descriptor",
"files",
"with",
"the",
"given",
"prefix",
"in",
"a",
"target",
"folder"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/management/DescriptorTools.java#L34-L51 | train | Get the descriptor files. | Create a Java method that does the following: "Get the descriptor files.". | Of course, here is the Java code you requested:
```java
public static File[] getDescriptorFiles( File definitionDir , final String prefix , final String suffix )
{
return definitionDir.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(jav... | |
aws/aws-sdk-java | aws-java-sdk-xray/src/main/java/com/amazonaws/services/xray/model/ErrorRootCauseService.java | ErrorRootCauseService.withEntityPath | public ErrorRootCauseService withEntityPath(ErrorRootCauseEntity... entityPath) {
if (this.entityPath == null) {
setEntityPath(new java.util.ArrayList<ErrorRootCauseEntity>(entityPath.length));
}
for (ErrorRootCauseEntity ele : entityPath) {
this.entityPath.add(ele);
... | java | public ErrorRootCauseService withEntityPath(ErrorRootCauseEntity... entityPath) {
if (this.entityPath == null) {
setEntityPath(new java.util.ArrayList<ErrorRootCauseEntity>(entityPath.length));
}
for (ErrorRootCauseEntity ele : entityPath) {
this.entityPath.add(ele);
... | [
"public",
"ErrorRootCauseService",
"withEntityPath",
"(",
"ErrorRootCauseEntity",
"...",
"entityPath",
")",
"{",
"if",
"(",
"this",
".",
"entityPath",
"==",
"null",
")",
"{",
"setEntityPath",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"ErrorRootCaus... | <p>
The path of root cause entities found on the service.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setEntityPath(java.util.Collection)} or {@link #withEntityPath(java.util.Collection)} if you want to
override the existing values.
</p>
@param entityPath
The path of... | [
"<p",
">",
"The",
"path",
"of",
"root",
"cause",
"entities",
"found",
"on",
"the",
"service",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"method",
"appends",
"the",
"values",
"to",
"the",
"existing",
"... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-xray/src/main/java/com/amazonaws/services/xray/model/ErrorRootCauseService.java#L303-L311 | train | A list of errors that caused this exception. | Create a Java method that does the following: "A list of errors that caused this exception.". | Of course, here is the Java code you requested:
```java
public ErrorRootCauseService withEntityPath(ErrorRootCauseEntity... entityPath) {
if (this.entityPath == null) {
setEntityPath(new java.util.ArrayList<ErrorRootCauseEntity>(entityPath.length));
}
for (ErrorRootCauseEntity ele :... | |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java | ReturnValueIgnored.methodReceiverHasType | private static Matcher<ExpressionTree> methodReceiverHasType(final Set<String> typeSet) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
Type receiverType = ASTHelpers.getReceiverType(expressionTree);
return ty... | java | private static Matcher<ExpressionTree> methodReceiverHasType(final Set<String> typeSet) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
Type receiverType = ASTHelpers.getReceiverType(expressionTree);
return ty... | [
"private",
"static",
"Matcher",
"<",
"ExpressionTree",
">",
"methodReceiverHasType",
"(",
"final",
"Set",
"<",
"String",
">",
"typeSet",
")",
"{",
"return",
"new",
"Matcher",
"<",
"ExpressionTree",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"m... | Matches method calls whose receiver objects are of a type included in the set. | [
"Matches",
"method",
"calls",
"whose",
"receiver",
"objects",
"are",
"of",
"a",
"type",
"included",
"in",
"the",
"set",
"."
] | fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java#L174-L182 | train | Matches an AST node if the receiver of the method is of a type in the given set. | Create a Java method that does the following: "Matches an AST node if the receiver of the method is of a type in the given set.". | Of course, here is the Java code you requested:
```java
private static Matcher<ExpressionTree> methodReceiverHasType(final Set<String> typeSet) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
Type receiverType = ASTH... | |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMFiles.java | JMFiles.readString | public static String readString(String filePath, String charsetName) {
return readString(getPath(filePath), charsetName);
} | java | public static String readString(String filePath, String charsetName) {
return readString(getPath(filePath), charsetName);
} | [
"public",
"static",
"String",
"readString",
"(",
"String",
"filePath",
",",
"String",
"charsetName",
")",
"{",
"return",
"readString",
"(",
"getPath",
"(",
"filePath",
")",
",",
"charsetName",
")",
";",
"}"
] | Read string string.
@param filePath the file path
@param charsetName the charset name
@return the string | [
"Read",
"string",
"string",
"."
] | 9e407b3f28a7990418a1e877229fa8344f4d78a5 | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMFiles.java#L173-L175 | train | read string from file path. | Create a Java method that does the following: "read string from file path.". | Of course, here is the Java code you requested:
```java
public static String readString(String filePath, String charsetName) {
return readString(getPath(filePath), charsetName);
}
```
Hope this helps! | |
rupertlssmith/lojix | lojix/logic/src/main/com/thesett/aima/logic/fol/BasePositionalVisitor.java | BasePositionalVisitor.visit | public void visit(Term term)
{
if (traverser.isEnteringContext())
{
enterTerm(term);
}
else if (traverser.isLeavingContext())
{
leaveTerm(term);
term.setTermTraverser(null);
}
} | java | public void visit(Term term)
{
if (traverser.isEnteringContext())
{
enterTerm(term);
}
else if (traverser.isLeavingContext())
{
leaveTerm(term);
term.setTermTraverser(null);
}
} | [
"public",
"void",
"visit",
"(",
"Term",
"term",
")",
"{",
"if",
"(",
"traverser",
".",
"isEnteringContext",
"(",
")",
")",
"{",
"enterTerm",
"(",
"term",
")",
";",
"}",
"else",
"if",
"(",
"traverser",
".",
"isLeavingContext",
"(",
")",
")",
"{",
"lea... | {@inheritDoc} | [
"{"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/logic/src/main/com/thesett/aima/logic/fol/BasePositionalVisitor.java#L64-L75 | test | Visit a CRASSCTYPE term. | Create a Java method that does the following: "Visit a CRASSCTYPE term.". | Of course, here is the Java code you requested:
```java
public void visit(Term term)
{
if (traverser.isEnteringContext())
{
enterTerm(term);
}
else if (traverser.isLeavingContext())
{
leaveTerm(term);
term.setTermTraverser(null);
}... | |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/GuildAction.java | GuildAction.newRole | @CheckReturnValue
public RoleData newRole()
{
final RoleData role = new RoleData(roles.size());
this.roles.add(role);
return role;
} | java | @CheckReturnValue
public RoleData newRole()
{
final RoleData role = new RoleData(roles.size());
this.roles.add(role);
return role;
} | [
"@",
"CheckReturnValue",
"public",
"RoleData",
"newRole",
"(",
")",
"{",
"final",
"RoleData",
"role",
"=",
"new",
"RoleData",
"(",
"roles",
".",
"size",
"(",
")",
")",
";",
"this",
".",
"roles",
".",
"add",
"(",
"role",
")",
";",
"return",
"role",
";... | Creates and add a new {@link net.dv8tion.jda.core.requests.restaction.GuildAction.RoleData RoleData} object
representing a Role for the resulting Guild.
<p>This can be used in {@link GuildAction.ChannelData#addPermissionOverride(GuildAction.RoleData, long, long) ChannelData.addPermissionOverride(...)}.
<br>You may cha... | [
"Creates",
"and",
"add",
"a",
"new",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"requests",
".",
"restaction",
".",
"GuildAction",
".",
"RoleData",
"RoleData",
"}",
"object",
"representing",
"a",
"Role",
"for",
"the",
"resulting",
... | 8ecbbe354d03f6bf448411bba573d0d4c268b560 | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/GuildAction.java#L330-L336 | train | Create a new role. | Create a Java method that does the following: "Create a new role.". | Of course, here is the Java code you requested:
```java
@CheckReturnValue
public RoleData newRole()
{
final RoleData role = new RoleData(roles.size());
this.roles.add(role);
return role;
}
```
Hope this helps! | |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java | FormSpecParser.fail | public static void fail(String source, int index, String description) {
throw new FormLayoutParseException(message(source, index, description));
} | java | public static void fail(String source, int index, String description) {
throw new FormLayoutParseException(message(source, index, description));
} | [
"public",
"static",
"void",
"fail",
"(",
"String",
"source",
",",
"int",
"index",
",",
"String",
"description",
")",
"{",
"throw",
"new",
"FormLayoutParseException",
"(",
"message",
"(",
"source",
",",
"index",
",",
"description",
")",
")",
";",
"}"
] | Exceptions ************************************************************* | [
"Exceptions",
"*************************************************************"
] | c7df05a5fe382e1e08a6237e9391d8dc5fd48692 | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java#L237-L239 | train | Throw a FormLayoutParseException with a message | Create a Java method that does the following: "Throw a FormLayoutParseException with a message". | Of course, here is the Java code you requested:
```java
public static void fail(String source, int index, String description) {
throw new FormLayoutParseException(message(source, index, description));
}
```
Hope this helps! | |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/java/org/deeplearning4j/ui/standalone/StaticPageUtil.java | StaticPageUtil.renderHTML | public static String renderHTML(Component... components) {
try {
return renderHTMLContent(components);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static String renderHTML(Component... components) {
try {
return renderHTMLContent(components);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"renderHTML",
"(",
"Component",
"...",
"components",
")",
"{",
"try",
"{",
"return",
"renderHTMLContent",
"(",
"components",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
... | Given the specified components, render them to a stand-alone HTML page (which is returned as a String)
@param components Components to render
@return Stand-alone HTML page, as a String | [
"Given",
"the",
"specified",
"components",
"render",
"them",
"to",
"a",
"stand",
"-",
"alone",
"HTML",
"page",
"(",
"which",
"is",
"returned",
"as",
"a",
"String",
")"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/java/org/deeplearning4j/ui/standalone/StaticPageUtil.java#L67-L73 | train | Renders the HTML content of the given components. | Create a Java method that does the following: "Renders the HTML content of the given components.". | Of course, here is the Java code you requested:
```java
public static String renderHTML(Component... components) {
try {
return renderHTMLContent(components);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
```
Hope this helps! | |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java | ModeledUser.isActive | private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
// If end occurs before start, convert to equivalent case where start
// start is before end
if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))
return !isActive(inactiveStart... | java | private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
// If end occurs before start, convert to equivalent case where start
// start is before end
if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))
return !isActive(inactiveStart... | [
"private",
"boolean",
"isActive",
"(",
"Calendar",
"activeStart",
",",
"Calendar",
"inactiveStart",
")",
"{",
"// If end occurs before start, convert to equivalent case where start",
"// start is before end",
"if",
"(",
"inactiveStart",
"!=",
"null",
"&&",
"activeStart",
"!="... | Given a time when a particular state changes from inactive to active,
and a time when a particular state changes from active to inactive,
determines whether that state is currently active.
@param activeStart
The time at which the state changes from inactive to active.
@param inactiveStart
The time at which the state ... | [
"Given",
"a",
"time",
"when",
"a",
"particular",
"state",
"changes",
"from",
"inactive",
"to",
"active",
"and",
"a",
"time",
"when",
"a",
"particular",
"state",
"changes",
"from",
"active",
"to",
"inactive",
"determines",
"whether",
"that",
"state",
"is",
"c... | ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9 | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L676-L690 | train | Check if the calendar is active iff the start is before the end of the calendar. | Create a Java method that does the following: "Check if the calendar is active iff the start is before the end of the calendar.". | Of course, here is the Java code you requested:
```java
private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
// If end occurs before start, convert to equivalent case where start
// start is before end
if (inactiveStart != null && activeStart != null && inactiveStart.before... | |
monitorjbl/json-view | json-view/src/main/java/com/monitorjbl/json/Match.java | Match.exclude | public Match exclude(String... fields) {
if(fields != null) {
excludes.addAll(Arrays.asList(fields));
}
return this;
} | java | public Match exclude(String... fields) {
if(fields != null) {
excludes.addAll(Arrays.asList(fields));
}
return this;
} | [
"public",
"Match",
"exclude",
"(",
"String",
"...",
"fields",
")",
"{",
"if",
"(",
"fields",
"!=",
"null",
")",
"{",
"excludes",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"fields",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Mark fields for exclusion during serialization.
@param fields The fields to exclude
@return Match | [
"Mark",
"fields",
"for",
"exclusion",
"during",
"serialization",
"."
] | c01505ac76e5416abe8af85c5816f60bd5d483ea | https://github.com/monitorjbl/json-view/blob/c01505ac76e5416abe8af85c5816f60bd5d483ea/json-view/src/main/java/com/monitorjbl/json/Match.java#L38-L43 | train | Exclude the specified fields from the result. | Create a Java method that does the following: "Exclude the specified fields from the result.". | Of course, here is the Java code you requested:
```java
public Match exclude(String... fields) {
if(fields != null) {
excludes.addAll(Arrays.asList(fields));
}
return this;
}
```
Hope this helps! | |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java | CmsPositionBean.checkCollision | public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {
// check for non collision is easier
if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
// posA is right of posB
return false;
}
if ((posA.getLeft()... | java | public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {
// check for non collision is easier
if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
// posA is right of posB
return false;
}
if ((posA.getLeft()... | [
"public",
"static",
"boolean",
"checkCollision",
"(",
"CmsPositionBean",
"posA",
",",
"CmsPositionBean",
"posB",
",",
"int",
"margin",
")",
"{",
"// check for non collision is easier",
"if",
"(",
"(",
"posA",
".",
"getLeft",
"(",
")",
"-",
"margin",
")",
">=",
... | Checks whether the two position rectangles collide.<p>
@param posA the first position to check
@param posB the second position to check
@param margin the required margin
@return <code>true</code> if the two position rectangles collide | [
"Checks",
"whether",
"the",
"two",
"position",
"rectangles",
"collide",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L206-L228 | train | Checks if two position rectangles collide. | Create a Java method that does the following: "Checks if two position rectangles collide.". | Of course, here is the Java code you requested:
```java
public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {
// check for non collision is easier
if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
// posA is right of posB
... | |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/stat/BasicFrequencyCounter.java | BasicFrequencyCounter.getTotalCounts | public BigInteger getTotalCounts(){
BigInteger result = BigInteger.ZERO;
for (AtomicLong c: counters.getMap().values()){
result = result.add(BigInteger.valueOf(c.get()));
}
return result;
} | java | public BigInteger getTotalCounts(){
BigInteger result = BigInteger.ZERO;
for (AtomicLong c: counters.getMap().values()){
result = result.add(BigInteger.valueOf(c.get()));
}
return result;
} | [
"public",
"BigInteger",
"getTotalCounts",
"(",
")",
"{",
"BigInteger",
"result",
"=",
"BigInteger",
".",
"ZERO",
";",
"for",
"(",
"AtomicLong",
"c",
":",
"counters",
".",
"getMap",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"result",
"=",
"result",
"... | Get the summary value of all the counts
@return the summary value of all the counts | [
"Get",
"the",
"summary",
"value",
"of",
"all",
"the",
"counts"
] | bceed441595c5e5195a7418795f03b69fa7b61e4 | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/stat/BasicFrequencyCounter.java#L122-L128 | train | Gets the total counts of the data in this object. | Create a Java method that does the following: "Gets the total counts of the data in this object.". | Of course, here is the Java code you requested:
```java
public BigInteger getTotalCounts(){
BigInteger result = BigInteger.ZERO;
for (AtomicLong c: counters.getMap().values()){
result = result.add(BigInteger.valueOf(c.get()));
}
return result;
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java | ManagedClustersInner.listAsync | public Observable<Page<ManagedClusterInner>> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<ManagedClusterInner>>, Page<ManagedClusterInner>>() {
@Override
public Page<ManagedClusterInner> call(ServiceResponse<Page<ManagedClust... | java | public Observable<Page<ManagedClusterInner>> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<ManagedClusterInner>>, Page<ManagedClusterInner>>() {
@Override
public Page<ManagedClusterInner> call(ServiceResponse<Page<ManagedClust... | [
"public",
"Observable",
"<",
"Page",
"<",
"ManagedClusterInner",
">",
">",
"listAsync",
"(",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ManagedClusterInner",
">",
">... | Gets a list of managed clusters in the specified subscription.
Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ManagedClusterInne... | [
"Gets",
"a",
"list",
"of",
"managed",
"clusters",
"in",
"the",
"specified",
"subscription",
".",
"Gets",
"a",
"list",
"of",
"managed",
"clusters",
"in",
"the",
"specified",
"subscription",
".",
"The",
"operation",
"returns",
"properties",
"of",
"each",
"manage... | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L159-L167 | train | List all the managed cluster resources. | Create a Java method that does the following: "List all the managed cluster resources.". | Of course, here is the Java code you requested:
```java
public Observable<Page<ManagedClusterInner>> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<ManagedClusterInner>>, Page<ManagedClusterInner>>() {
@Override
public Page<Ma... | |
j256/simplecsv | src/main/java/com/j256/simplecsv/processor/CsvProcessor.java | CsvProcessor.writeAll | public void writeAll(Writer writer, Collection<T> entities, boolean writeHeader) throws IOException {
checkEntityConfig();
BufferedWriter bufferedWriter = new BufferedWriter(writer);
try {
if (writeHeader) {
writeHeader(bufferedWriter, true);
}
for (T entity : entities) {
writeRow(bufferedWriter,... | java | public void writeAll(Writer writer, Collection<T> entities, boolean writeHeader) throws IOException {
checkEntityConfig();
BufferedWriter bufferedWriter = new BufferedWriter(writer);
try {
if (writeHeader) {
writeHeader(bufferedWriter, true);
}
for (T entity : entities) {
writeRow(bufferedWriter,... | [
"public",
"void",
"writeAll",
"(",
"Writer",
"writer",
",",
"Collection",
"<",
"T",
">",
"entities",
",",
"boolean",
"writeHeader",
")",
"throws",
"IOException",
"{",
"checkEntityConfig",
"(",
")",
";",
"BufferedWriter",
"bufferedWriter",
"=",
"new",
"BufferedWr... | Write a header and then the collection of entities to the writer.
@param writer
Where to write the header and entities. It will be closed before this method returns.
@param entities
Collection of entities to write to the writer.
@param writeHeader
Set to true to write header at the start of the writer.
@throws IOExcep... | [
"Write",
"a",
"header",
"and",
"then",
"the",
"collection",
"of",
"entities",
"to",
"the",
"writer",
"."
] | 964fe53073c43e2a311341e3f8fd2c94372f60cb | https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L426-L439 | train | Write all entities to the writer. | Create a Java method that does the following: "Write all entities to the writer.". | Of course, here is the Java code you requested:
```java
public void writeAll(Writer writer, Collection<T> entities, boolean writeHeader) throws IOException {
checkEntityConfig();
BufferedWriter bufferedWriter = new BufferedWriter(writer);
try {
if (writeHeader) {
writeHeader(bufferedWriter, true);
}
... | |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java | ReconfigureOnChangeFilter.updateMaskIfNecessary | private void updateMaskIfNecessary(long now) {
final long timeElapsedSinceLastMaskUpdateCheck = now - lastMaskCheck;
lastMaskCheck = now;
if (timeElapsedSinceLastMaskUpdateCheck < MASK_INCREASE_THRESHOLD && (mask < MAX_MASK)) {
mask = (mask << 1) | 1;
} else if (timeElapsedSinceLastMaskUpdateChe... | java | private void updateMaskIfNecessary(long now) {
final long timeElapsedSinceLastMaskUpdateCheck = now - lastMaskCheck;
lastMaskCheck = now;
if (timeElapsedSinceLastMaskUpdateCheck < MASK_INCREASE_THRESHOLD && (mask < MAX_MASK)) {
mask = (mask << 1) | 1;
} else if (timeElapsedSinceLastMaskUpdateChe... | [
"private",
"void",
"updateMaskIfNecessary",
"(",
"long",
"now",
")",
"{",
"final",
"long",
"timeElapsedSinceLastMaskUpdateCheck",
"=",
"now",
"-",
"lastMaskCheck",
";",
"lastMaskCheck",
"=",
"now",
";",
"if",
"(",
"timeElapsedSinceLastMaskUpdateCheck",
"<",
"MASK_INCR... | update the mask so as to execute change detection code about once every 100 to 8000 milliseconds. | [
"update",
"the",
"mask",
"so",
"as",
"to",
"execute",
"change",
"detection",
"code",
"about",
"once",
"every",
"100",
"to",
"8000",
"milliseconds",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java#L144-L152 | test | Update the mask if necessary. | Create a Java method that does the following: "Update the mask if necessary.". | Of course, here is the Java code you requested:
```java
private void updateMaskIfNecessary(long now) {
final long timeElapsedSinceLastMaskUpdateCheck = now - lastMaskCheck;
lastMaskCheck = now;
if (timeElapsedSinceLastMaskUpdateCheck < MASK_INCREASE_THRESHOLD && (mask < MAX_MASK)) {
mask = (mask <<... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.getConsumerSetLabel | @Override
public String getConsumerSetLabel()
{
String consumerSetLabel = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerSetLabel");
}
consumerSetLabel = _consumerKey.getConsumerSet().getLabel();
... | java | @Override
public String getConsumerSetLabel()
{
String consumerSetLabel = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerSetLabel");
}
consumerSetLabel = _consumerKey.getConsumerSet().getLabel();
... | [
"@",
"Override",
"public",
"String",
"getConsumerSetLabel",
"(",
")",
"{",
"String",
"consumerSetLabel",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",... | /*
(non-Javadoc)
@see com.ibm.ws.sib.processor.impl.interfaces.LocalConsumerPoint#getConsumerSetLabel() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L4514-L4531 | train | Returns the label of the consumer set. | Create a Java method that does the following: "Returns the label of the consumer set.". | Of course, here is the Java code you requested:
```java
@Override
public String getConsumerSetLabel()
{
String consumerSetLabel = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerSetLabel");
}
consumerSetLa... | |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/longlong/Roaring64NavigableMap.java | Roaring64NavigableMap.unsignedBinarySearch | private static int unsignedBinarySearch(int[] a, int fromIndex, int toIndex, int key,
Comparator<? super Integer> c) {
int low = fromIndex;
int high = toIndex - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
int midVal = a[mid];
int cmp = c.compare(midVal, key);
if (cm... | java | private static int unsignedBinarySearch(int[] a, int fromIndex, int toIndex, int key,
Comparator<? super Integer> c) {
int low = fromIndex;
int high = toIndex - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
int midVal = a[mid];
int cmp = c.compare(midVal, key);
if (cm... | [
"private",
"static",
"int",
"unsignedBinarySearch",
"(",
"int",
"[",
"]",
"a",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
",",
"int",
"key",
",",
"Comparator",
"<",
"?",
"super",
"Integer",
">",
"c",
")",
"{",
"int",
"low",
"=",
"fromIndex",
";",
... | From Arrays.binarySearch (Comparator). Check with org.roaringbitmap.Util.unsignedBinarySearch | [
"From",
"Arrays",
".",
"binarySearch",
"(",
"Comparator",
")",
".",
"Check",
"with",
"org",
".",
"roaringbitmap",
".",
"Util",
".",
"unsignedBinarySearch"
] | b26fd0a1330fd4d2877f4d74feb69ceb812e9efa | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/longlong/Roaring64NavigableMap.java#L620-L638 | train | Internal binary search implementation. | Create a Java method that does the following: "Internal binary search implementation.". | Of course, here is the Java code you requested:
```java
private static int unsignedBinarySearch(int[] a, int fromIndex, int toIndex, int key,
Comparator<? super Integer> c) {
int low = fromIndex;
int high = toIndex - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
int midVal = a[m... | |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/factories/CertFactory.java | CertFactory.newX509CertificateV1 | public static X509Certificate newX509CertificateV1(KeyPair keyPair, X500Name issuer,
BigInteger serial, Date notBefore, Date notAfter, X500Name subject,
String signatureAlgorithm) throws OperatorCreationException, CertificateException
{
X509v1CertificateBuilder certBuilder = new JcaX509v1CertificateBuilder(issue... | java | public static X509Certificate newX509CertificateV1(KeyPair keyPair, X500Name issuer,
BigInteger serial, Date notBefore, Date notAfter, X500Name subject,
String signatureAlgorithm) throws OperatorCreationException, CertificateException
{
X509v1CertificateBuilder certBuilder = new JcaX509v1CertificateBuilder(issue... | [
"public",
"static",
"X509Certificate",
"newX509CertificateV1",
"(",
"KeyPair",
"keyPair",
",",
"X500Name",
"issuer",
",",
"BigInteger",
"serial",
",",
"Date",
"notBefore",
",",
"Date",
"notAfter",
",",
"X500Name",
"subject",
",",
"String",
"signatureAlgorithm",
")",... | Factory method for creating a new {@link X509Certificate} object of the first version of
X.509 from the given parameters.
SecurityProvider is Bouncy Castle.
@param keyPair
the key pair
@param issuer
X500Name representing the issuer of this certificate.
@param serial
the serial number for the certificate.
@param notBe... | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"{",
"@link",
"X509Certificate",
"}",
"object",
"of",
"the",
"first",
"version",
"of",
"X",
".",
"509",
"from",
"the",
"given",
"parameters",
"."
] | 7f51ef5e4457e24de7ff391f10bfc5609e6f1a34 | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/CertFactory.java#L178-L189 | train | Creates a new X509Certificate using the given keyPair. | Create a Java method that does the following: "Creates a new X509Certificate using the given keyPair.". | Of course, here is the Java code you requested:
```java
public static X509Certificate newX509CertificateV1(KeyPair keyPair, X500Name issuer,
BigInteger serial, Date notBefore, Date notAfter, X500Name subject,
String signatureAlgorithm) throws OperatorCreationException, CertificateException
{
X509v1CertificateBu... | |
sahan/ZombieLink | zombielink/src/main/java/com/lonepulse/zombielink/request/UriProcessor.java | UriProcessor.process | @Override
protected HttpRequestBase process(InvocationContext context, HttpRequestBase request) {
try {
Endpoint endpoint = context.getEndpoint().getAnnotation(Endpoint.class);
String path = endpoint.value() + Metadata.findPath(context.getRequest());
List<Entry<PathParam, Object>> pathParams = Meta... | java | @Override
protected HttpRequestBase process(InvocationContext context, HttpRequestBase request) {
try {
Endpoint endpoint = context.getEndpoint().getAnnotation(Endpoint.class);
String path = endpoint.value() + Metadata.findPath(context.getRequest());
List<Entry<PathParam, Object>> pathParams = Meta... | [
"@",
"Override",
"protected",
"HttpRequestBase",
"process",
"(",
"InvocationContext",
"context",
",",
"HttpRequestBase",
"request",
")",
"{",
"try",
"{",
"Endpoint",
"endpoint",
"=",
"context",
".",
"getEndpoint",
"(",
")",
".",
"getAnnotation",
"(",
"Endpoint",
... | <p>Accepts the {@link InvocationContext} along with the {@link HttpRequestBase} and forms
the complete request URI by appending the request subpath to the root path defined on the
endpoint. Any placeholders in the URI are replaced with their matching path parameters found
in the request arguments annotated with @{@link... | [
"<p",
">",
"Accepts",
"the",
"{",
"@link",
"InvocationContext",
"}",
"along",
"with",
"the",
"{",
"@link",
"HttpRequestBase",
"}",
"and",
"forms",
"the",
"complete",
"request",
"URI",
"by",
"appending",
"the",
"request",
"subpath",
"to",
"the",
"root",
"path... | a9971add56d4f6919a4a5e84c78e9220011d8982 | https://github.com/sahan/ZombieLink/blob/a9971add56d4f6919a4a5e84c78e9220011d8982/zombielink/src/main/java/com/lonepulse/zombielink/request/UriProcessor.java#L91-L129 | train | Override process method to handle the request. | Create a Java method that does the following: "Override process method to handle the request.". | Of course, here is the Java code you requested:
```java
@Override
protected HttpRequestBase process(InvocationContext context, HttpRequestBase request) {
try {
Endpoint endpoint = context.getEndpoint().getAnnotation(Endpoint.class);
String path = endpoint.value() + Metadata.findPath(context.getRequest())... | |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.step | public SDVariable step(String name, SDVariable in, double cutoff) {
validateNumerical("step", in);
SDVariable ret = f().step(in, cutoff);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable step(String name, SDVariable in, double cutoff) {
validateNumerical("step", in);
SDVariable ret = f().step(in, cutoff);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"step",
"(",
"String",
"name",
",",
"SDVariable",
"in",
",",
"double",
"cutoff",
")",
"{",
"validateNumerical",
"(",
"\"step\"",
",",
"in",
")",
";",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"step",
"(",
"in",
",",
"cutoff"... | Elementwise step function:<br>
out(x) = 1 if x >= cutoff<br>
out(x) = 0 otherwise<br>
@param name Name of the output variable
@param in Input variable
@param cutoff Cutoff value for step function
@return Output variable | [
"Elementwise",
"step",
"function",
":",
"<br",
">",
"out",
"(",
"x",
")",
"=",
"1",
"if",
"x",
">",
"=",
"cutoff<br",
">",
"out",
"(",
"x",
")",
"=",
"0",
"otherwise<br",
">"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L2247-L2251 | train | Step a single attribute set by a CIDCTYPE operation. | Create a Java method that does the following: "Step a single attribute set by a CIDCTYPE operation.". | Of course, here is the Java code you requested:
```java
public SDVariable step(String name, SDVariable in, double cutoff) {
validateNumerical("step", in);
SDVariable ret = f().step(in, cutoff);
return updateVariableNameAndReference(ret, name);
}
```
Hope this helps! | |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesSharesApi.java | DevicesSharesApi.getSharingForDeviceWithHttpInfo | public ApiResponse<DeviceSharing> getSharingForDeviceWithHttpInfo(String deviceId, String shareId) throws ApiException {
com.squareup.okhttp.Call call = getSharingForDeviceValidateBeforeCall(deviceId, shareId, null, null);
Type localVarReturnType = new TypeToken<DeviceSharing>(){}.getType();
ret... | java | public ApiResponse<DeviceSharing> getSharingForDeviceWithHttpInfo(String deviceId, String shareId) throws ApiException {
com.squareup.okhttp.Call call = getSharingForDeviceValidateBeforeCall(deviceId, shareId, null, null);
Type localVarReturnType = new TypeToken<DeviceSharing>(){}.getType();
ret... | [
"public",
"ApiResponse",
"<",
"DeviceSharing",
">",
"getSharingForDeviceWithHttpInfo",
"(",
"String",
"deviceId",
",",
"String",
"shareId",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"getSharingForDeviceValid... | Get specific share of the given device id
Get specific share of the given device id
@param deviceId Device ID. (required)
@param shareId Share ID. (required)
@return ApiResponse<DeviceSharing>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"specific",
"share",
"of",
"the",
"given",
"device",
"id",
"Get",
"specific",
"share",
"of",
"the",
"given",
"device",
"id"
] | 412f447573e7796ab4f685c0bdd5eb76185a365c | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesSharesApi.java#L531-L535 | train | Get Get CID covering for Device Get CID covering for device | Create a Java method that does the following: "Get Get CID covering for Device Get CID covering for device". | Of course, here is the Java code you requested:
```java
public ApiResponse<DeviceSharing> getSharingForDeviceWithHttpInfo(String deviceId, String shareId) throws ApiException {
com.squareup.okhttp.Call call = getSharingForDeviceValidateBeforeCall(deviceId, shareId, null, null);
Type localVarReturnType ... | |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java | AutoResizeTextView.onLayout | @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (changed || mNeedsResize) {
int widthLimit = (right - left) - getCompoundPaddingLeft() - getCompoundPaddingRight();
int heightLimit = (bottom - top) - getCompoundPaddingBottom() - getCompoundPaddingTop();
resiz... | java | @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (changed || mNeedsResize) {
int widthLimit = (right - left) - getCompoundPaddingLeft() - getCompoundPaddingRight();
int heightLimit = (bottom - top) - getCompoundPaddingBottom() - getCompoundPaddingTop();
resiz... | [
"@",
"Override",
"protected",
"void",
"onLayout",
"(",
"boolean",
"changed",
",",
"int",
"left",
",",
"int",
"top",
",",
"int",
"right",
",",
"int",
"bottom",
")",
"{",
"if",
"(",
"changed",
"||",
"mNeedsResize",
")",
"{",
"int",
"widthLimit",
"=",
"("... | Resize text after measuring | [
"Resize",
"text",
"after",
"measuring"
] | 887c08d7bd5ae6488a90366dfb58f58938861a93 | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java#L212-L220 | train | Override onLayout to adjust the width and height of the image. | Create a Java method that does the following: "Override onLayout to adjust the width and height of the image.". | Of course, here is the Java code you requested:
```java
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (changed || mNeedsResize) {
int widthLimit = (right - left) - getCompoundPaddingLeft() - getCompoundPaddingRight();
int heightLimit = (bottom - top) - getCo... | |
feedzai/fos-weka | src/main/java/com/feedzai/fos/impl/weka/WekaScorer.java | WekaScorer.score | @Override
@NotNull
public List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
checkNotNull(modelIds, "Models to score cannot be null");
checkNotNull(scorable, "Instance cannot be null");
List<double[]> scores = new ArrayList<>(modelIds.size());
tr... | java | @Override
@NotNull
public List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
checkNotNull(modelIds, "Models to score cannot be null");
checkNotNull(scorable, "Instance cannot be null");
List<double[]> scores = new ArrayList<>(modelIds.size());
tr... | [
"@",
"Override",
"@",
"NotNull",
"public",
"List",
"<",
"double",
"[",
"]",
">",
"score",
"(",
"List",
"<",
"UUID",
">",
"modelIds",
",",
"Object",
"[",
"]",
"scorable",
")",
"throws",
"FOSException",
"{",
"checkNotNull",
"(",
"modelIds",
",",
"\"Models ... | Score the <code>scorable</code> for each model ID identified by <code>modelIds</code>.
<p> If multiple models are given as parameters, they will be scored in parallel.
@param modelIds the list of models to score
@param scorable the item to score
@return a List of scores with the same order and the received modelIds
@... | [
"Score",
"the",
"<code",
">",
"scorable<",
"/",
"code",
">",
"for",
"each",
"model",
"ID",
"identified",
"by",
"<code",
">",
"modelIds<",
"/",
"code",
">",
"."
] | 130213aa58dfef770382a59727afb9e5f7bc4a3c | https://github.com/feedzai/fos-weka/blob/130213aa58dfef770382a59727afb9e5f7bc4a3c/src/main/java/com/feedzai/fos/impl/weka/WekaScorer.java#L133-L166 | valid | Score a list of models using the specified instance. | Create a Java method that does the following: "Score a list of models using the specified instance.". | Of course, here is the Java code you requested:
```java
@Override
@NotNull
public List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
checkNotNull(modelIds, "Models to score cannot be null");
checkNotNull(scorable, "Instance cannot be null");
List<double[... | |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/CmsRadioSelectWidget.java | CmsRadioSelectWidget.fireChangeEvent | public void fireChangeEvent() {
String result = "";
// check if there is a radio button selected.
if (m_group.getSelectedButton() != null) {
// set the name of the selected radio button.
result = m_group.getSelectedButton().getName();
}
ValueCha... | java | public void fireChangeEvent() {
String result = "";
// check if there is a radio button selected.
if (m_group.getSelectedButton() != null) {
// set the name of the selected radio button.
result = m_group.getSelectedButton().getName();
}
ValueCha... | [
"public",
"void",
"fireChangeEvent",
"(",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"// check if there is a radio button selected.\r",
"if",
"(",
"m_group",
".",
"getSelectedButton",
"(",
")",
"!=",
"null",
")",
"{",
"// set the name of the selected radio button.\... | Represents a value change event.<p> | [
"Represents",
"a",
"value",
"change",
"event",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/CmsRadioSelectWidget.java#L149-L159 | train | This method is called to fire the ValueChangeEvent for the
button. | Create a Java method that does the following: "This method is called to fire the ValueChangeEvent for the
button.". | Of course, here is the Java code you requested:
```java
public void fireChangeEvent() {
String result = "";
// check if there is a radio button selected.
if (m_group.getSelectedButton() != null) {
// set the name of the selected radio button.
result = m_group.getS... | |
molgenis/molgenis | molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java | MappingServiceController.createIntegratedEntity | @PostMapping("/createIntegratedEntity")
public String createIntegratedEntity(
@RequestParam String mappingProjectId,
@RequestParam String targetEntityTypeId,
@RequestParam(required = false) String label,
@RequestParam(required = false, name = "package") String packageId,
@RequestParam(re... | java | @PostMapping("/createIntegratedEntity")
public String createIntegratedEntity(
@RequestParam String mappingProjectId,
@RequestParam String targetEntityTypeId,
@RequestParam(required = false) String label,
@RequestParam(required = false, name = "package") String packageId,
@RequestParam(re... | [
"@",
"PostMapping",
"(",
"\"/createIntegratedEntity\"",
")",
"public",
"String",
"createIntegratedEntity",
"(",
"@",
"RequestParam",
"String",
"mappingProjectId",
",",
"@",
"RequestParam",
"String",
"targetEntityTypeId",
",",
"@",
"RequestParam",
"(",
"required",
"=",
... | Creates the integrated entity for a mapping project's target
@param mappingProjectId ID of the mapping project
@param targetEntityTypeId ID of the target entity to create or update
@param label label of the target entity to create
@param packageId ID of the package to put the newly created entity in
@return redirect U... | [
"Creates",
"the",
"integrated",
"entity",
"for",
"a",
"mapping",
"project",
"s",
"target"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L572-L588 | train | Create an integral entity. | Create a Java method that does the following: "Create an integral entity.". | Of course, here is the Java code you requested:
```java
@PostMapping("/createIntegratedEntity")
public String createIntegratedEntity(
@RequestParam String mappingProjectId,
@RequestParam String targetEntityTypeId,
@RequestParam(required = false) String label,
@RequestParam(required = false, n... | |
blademainer/common_utils | common_helper/src/main/java/com/xiongyingqi/util/ClassHelper.java | ClassHelper.isImplementsInterface | public static boolean isImplementsInterface(Class clazz, Class enterface) {
Assert.notNull(clazz);
Assert.notNull(enterface);
Class[] interfaces = clazz.getInterfaces();
Class superclass = clazz.getSuperclass();
if (superclass != null) {
boolean implementsInterface = ... | java | public static boolean isImplementsInterface(Class clazz, Class enterface) {
Assert.notNull(clazz);
Assert.notNull(enterface);
Class[] interfaces = clazz.getInterfaces();
Class superclass = clazz.getSuperclass();
if (superclass != null) {
boolean implementsInterface = ... | [
"public",
"static",
"boolean",
"isImplementsInterface",
"(",
"Class",
"clazz",
",",
"Class",
"enterface",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
")",
";",
"Assert",
".",
"notNull",
"(",
"enterface",
")",
";",
"Class",
"[",
"]",
"interfaces",
"="... | 检查类是否直接或间接实现接口
@param clazz
@param enterface
@return | [
"检查类是否直接或间接实现接口"
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/common_helper/src/main/java/com/xiongyingqi/util/ClassHelper.java#L48-L71 | test | Check if the class implements the specified interface. | Create a Java method that does the following: "Check if the class implements the specified interface.". | Of course, here is the Java code you requested:
```java
public static boolean isImplementsInterface(Class clazz, Class enterface) {
Assert.notNull(clazz);
Assert.notNull(enterface);
Class[] interfaces = clazz.getInterfaces();
Class superclass = clazz.getSuperclass();
if (supercl... | |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java | TileWriter.isSymbolicDirectoryLink | private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
return !canonicalParentPath1.equals(canonicalParentPath2)... | java | private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
return !canonicalParentPath1.equals(canonicalParentPath2)... | [
"private",
"boolean",
"isSymbolicDirectoryLink",
"(",
"final",
"File",
"pParentDirectory",
",",
"final",
"File",
"pDirectory",
")",
"{",
"try",
"{",
"final",
"String",
"canonicalParentPath1",
"=",
"pParentDirectory",
".",
"getCanonicalPath",
"(",
")",
";",
"final",
... | Checks to see if it appears that a directory is a symbolic link. It does this by comparing
the canonical path of the parent directory and the parent directory of the directory's
canonical path. If they are equal, then they come from the same true parent. If not, then
pDirectory is a symbolic link. If we get an exceptio... | [
"Checks",
"to",
"see",
"if",
"it",
"appears",
"that",
"a",
"directory",
"is",
"a",
"symbolic",
"link",
".",
"It",
"does",
"this",
"by",
"comparing",
"the",
"canonical",
"path",
"of",
"the",
"parent",
"directory",
"and",
"the",
"parent",
"directory",
"of",
... | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java#L229-L242 | train | Checks if the given directory is a symbolic link. | Create a Java method that does the following: "Checks if the given directory is a symbolic link.". | Of course, here is the Java code you requested:
```java
private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
... | |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/MapPrinter.java | MapPrinter.setConfiguration | public final void setConfiguration(final URI newConfigFile, final byte[] configFileData)
throws IOException {
this.configFile = new File(newConfigFile);
this.configuration = this.configurationFactory
.getConfig(this.configFile, new ByteArrayInputStream(configFileData));
} | java | public final void setConfiguration(final URI newConfigFile, final byte[] configFileData)
throws IOException {
this.configFile = new File(newConfigFile);
this.configuration = this.configurationFactory
.getConfig(this.configFile, new ByteArrayInputStream(configFileData));
} | [
"public",
"final",
"void",
"setConfiguration",
"(",
"final",
"URI",
"newConfigFile",
",",
"final",
"byte",
"[",
"]",
"configFileData",
")",
"throws",
"IOException",
"{",
"this",
".",
"configFile",
"=",
"new",
"File",
"(",
"newConfigFile",
")",
";",
"this",
"... | Set the configuration file and update the configuration for this printer.
@param newConfigFile the file containing the new configuration.
@param configFileData the config file data. | [
"Set",
"the",
"configuration",
"file",
"and",
"update",
"the",
"configuration",
"for",
"this",
"printer",
"."
] | 25a452cb39f592bd8a53b20db1037703898e1e22 | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/MapPrinter.java#L70-L75 | train | Sets the configuration. | Create a Java method that does the following: "Sets the configuration.". | Of course, here is the Java code you requested:
```java
public final void setConfiguration(final URI newConfigFile, final byte[] configFileData)
throws IOException {
this.configFile = new File(newConfigFile);
this.configuration = this.configurationFactory
.getConfig(this.con... | |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/client/CurseFilter.java | CurseFilter.comicChars | public static String comicChars (int length)
{
char[] chars = new char[length];
for (int ii=0; ii < length; ii++) {
chars[ii] = RandomUtil.pickRandom(COMIC_CHARS);
}
return new String(chars);
} | java | public static String comicChars (int length)
{
char[] chars = new char[length];
for (int ii=0; ii < length; ii++) {
chars[ii] = RandomUtil.pickRandom(COMIC_CHARS);
}
return new String(chars);
} | [
"public",
"static",
"String",
"comicChars",
"(",
"int",
"length",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"length",
";",
"ii",
"++",
")",
"{",
"chars",
... | Return a comicy replacement of the specified length. | [
"Return",
"a",
"comicy",
"replacement",
"of",
"the",
"specified",
"length",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/CurseFilter.java#L48-L55 | train | Get a random string of the comic chars. | Create a Java method that does the following: "Get a random string of the comic chars.". | Of course, here is the Java code you requested:
```java
public static String comicChars (int length)
{
char[] chars = new char[length];
for (int ii=0; ii < length; ii++) {
chars[ii] = RandomUtil.pickRandom(COMIC_CHARS);
}
return new String(chars);
}
```
Hope this he... | |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java | DirContextAdapter.collectModifications | private void collectModifications(NameAwareAttribute changedAttr,
List<ModificationItem> modificationList) throws NamingException {
NameAwareAttribute currentAttribute = originalAttrs.get(changedAttr.getID());
if(currentAttribute != null && changedAttr.hasValuesAsNames()) {
try {
... | java | private void collectModifications(NameAwareAttribute changedAttr,
List<ModificationItem> modificationList) throws NamingException {
NameAwareAttribute currentAttribute = originalAttrs.get(changedAttr.getID());
if(currentAttribute != null && changedAttr.hasValuesAsNames()) {
try {
... | [
"private",
"void",
"collectModifications",
"(",
"NameAwareAttribute",
"changedAttr",
",",
"List",
"<",
"ModificationItem",
">",
"modificationList",
")",
"throws",
"NamingException",
"{",
"NameAwareAttribute",
"currentAttribute",
"=",
"originalAttrs",
".",
"get",
"(",
"c... | Collect all modifications for the changed attribute. If no changes have
been made, return immediately. If modifications have been made, and the
original size as well as the updated size of the attribute is 1, replace
the attribute. If the size of the updated attribute is 0, remove the
attribute. Otherwise, the attribut... | [
"Collect",
"all",
"modifications",
"for",
"the",
"changed",
"attribute",
".",
"If",
"no",
"changes",
"have",
"been",
"made",
"return",
"immediately",
".",
"If",
"modifications",
"have",
"been",
"made",
"and",
"the",
"original",
"size",
"as",
"well",
"as",
"t... | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java#L333-L389 | train | Collect modifications of a single attribute. | Create a Java method that does the following: "Collect modifications of a single attribute.". | Of course, here is the Java code you requested:
```java
private void collectModifications(NameAwareAttribute changedAttr,
List<ModificationItem> modificationList) throws NamingException {
NameAwareAttribute currentAttribute = originalAttrs.get(changedAttr.getID());
if(currentAttribute != null && changedAt... | |
census-instrumentation/opencensus-java | contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpClientHandler.java | HttpClientHandler.handleEnd | public void handleEnd(
HttpRequestContext context,
@Nullable Q request,
@Nullable P response,
@Nullable Throwable error) {
checkNotNull(context, "context");
int httpCode = extractor.getStatusCode(response);
recordStats(context, request, httpCode);
spanEnd(context.span, httpCode, ... | java | public void handleEnd(
HttpRequestContext context,
@Nullable Q request,
@Nullable P response,
@Nullable Throwable error) {
checkNotNull(context, "context");
int httpCode = extractor.getStatusCode(response);
recordStats(context, request, httpCode);
spanEnd(context.span, httpCode, ... | [
"public",
"void",
"handleEnd",
"(",
"HttpRequestContext",
"context",
",",
"@",
"Nullable",
"Q",
"request",
",",
"@",
"Nullable",
"P",
"response",
",",
"@",
"Nullable",
"Throwable",
"error",
")",
"{",
"checkNotNull",
"(",
"context",
",",
"\"context\"",
")",
"... | Close an HTTP span and records stats specific to the request.
<p>This method will set status of the span and end it. Additionally it will record measurements
associated with the request.
@param context the {@link HttpRequestContext} returned from {@link
HttpClientHandler#handleStart(Span, Object, Object)}
@param requ... | [
"Close",
"an",
"HTTP",
"span",
"and",
"records",
"stats",
"specific",
"to",
"the",
"request",
"."
] | deefac9bed77e40a2297bff1ca5ec5aa48a5f755 | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpClientHandler.java#L144-L153 | train | Handle end of a request. | Create a Java method that does the following: "Handle end of a request.". | Of course, here is the Java code you requested:
```java
public void handleEnd(
HttpRequestContext context,
@Nullable Q request,
@Nullable P response,
@Nullable Throwable error) {
checkNotNull(context, "context");
int httpCode = extractor.getStatusCode(response);
recordStats(context,... | |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/AbstractQuery.java | AbstractQuery.addChangeListener | @NonNull
@Override
public ListenerToken addChangeListener(Executor executor, @NonNull QueryChangeListener listener) {
if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }
return liveQuery().addChangeListener(executor, listener);
} | java | @NonNull
@Override
public ListenerToken addChangeListener(Executor executor, @NonNull QueryChangeListener listener) {
if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }
return liveQuery().addChangeListener(executor, listener);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"ListenerToken",
"addChangeListener",
"(",
"Executor",
"executor",
",",
"@",
"NonNull",
"QueryChangeListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Adds a query change listener with the dispatch queue on which changes
will be posted. If the dispatch queue is not specified, the changes will be
posted on the main queue.
@param executor The executor object that calls listener. If null, use default executor.
@param listener The listener to post changes.
@return An op... | [
"Adds",
"a",
"query",
"change",
"listener",
"with",
"the",
"dispatch",
"queue",
"on",
"which",
"changes",
"will",
"be",
"posted",
".",
"If",
"the",
"dispatch",
"queue",
"is",
"not",
"specified",
"the",
"changes",
"will",
"be",
"posted",
"on",
"the",
"main"... | cb72c44186456e6191a9ad0a7feb310011d0b081 | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractQuery.java#L185-L190 | train | Add a listener to the query. | Create a Java method that does the following: "Add a listener to the query.". | Of course, here is the Java code you requested:
```java
@NonNull
@Override
public ListenerToken addChangeListener(Executor executor, @NonNull QueryChangeListener listener) {
if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }
return liveQuery().addChangeLis... | |
aws/aws-sdk-java | aws-java-sdk-resourcegroupstaggingapi/src/main/java/com/amazonaws/services/resourcegroupstaggingapi/model/TagResourcesRequest.java | TagResourcesRequest.withResourceARNList | public TagResourcesRequest withResourceARNList(String... resourceARNList) {
if (this.resourceARNList == null) {
setResourceARNList(new java.util.ArrayList<String>(resourceARNList.length));
}
for (String ele : resourceARNList) {
this.resourceARNList.add(ele);
}
... | java | public TagResourcesRequest withResourceARNList(String... resourceARNList) {
if (this.resourceARNList == null) {
setResourceARNList(new java.util.ArrayList<String>(resourceARNList.length));
}
for (String ele : resourceARNList) {
this.resourceARNList.add(ele);
}
... | [
"public",
"TagResourcesRequest",
"withResourceARNList",
"(",
"String",
"...",
"resourceARNList",
")",
"{",
"if",
"(",
"this",
".",
"resourceARNList",
"==",
"null",
")",
"{",
"setResourceARNList",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"String",
... | <p>
A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. You can specify a minimum of 1 and
a maximum of 20 ARNs (resources) to tag. An ARN can be set to a maximum of 1600 characters. For more information,
see <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">A... | [
"<p",
">",
"A",
"list",
"of",
"ARNs",
".",
"An",
"ARN",
"(",
"Amazon",
"Resource",
"Name",
")",
"uniquely",
"identifies",
"a",
"resource",
".",
"You",
"can",
"specify",
"a",
"minimum",
"of",
"1",
"and",
"a",
"maximum",
"of",
"20",
"ARNs",
"(",
"resou... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroupstaggingapi/src/main/java/com/amazonaws/services/resourcegroupstaggingapi/model/TagResourcesRequest.java#L110-L118 | train | A list of resource ARN strings to use for the tag. | Create a Java method that does the following: "A list of resource ARN strings to use for the tag.". | Of course, here is the Java code you requested:
```java
public TagResourcesRequest withResourceARNList(String... resourceARNList) {
if (this.resourceARNList == null) {
setResourceARNList(new java.util.ArrayList<String>(resourceARNList.length));
}
for (String ele : resourceARNList) {... | |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/RecordList.java | RecordList.getUniqueRecordsBy | public RecordList getUniqueRecordsBy(String fieldName) {
Set<String> uniqueKeys = new HashSet<String>();
final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder(schema);
for (int rowIndex = 0; rowIndex < this.size(); rowIndex++) {
final Record currentRecord = this.rec... | java | public RecordList getUniqueRecordsBy(String fieldName) {
Set<String> uniqueKeys = new HashSet<String>();
final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder(schema);
for (int rowIndex = 0; rowIndex < this.size(); rowIndex++) {
final Record currentRecord = this.rec... | [
"public",
"RecordList",
"getUniqueRecordsBy",
"(",
"String",
"fieldName",
")",
"{",
"Set",
"<",
"String",
">",
"uniqueKeys",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"final",
"RecordListBuilder",
"uniqueRecordListBuilder",
"=",
"new",
"RecordLis... | Picks the first available record by given fieldName
@param fieldName the unique field value
@return | [
"Picks",
"the",
"first",
"available",
"record",
"by",
"given",
"fieldName"
] | 224280bcd6e8045bda6b673584caf0aea5e4c841 | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/RecordList.java#L82-L94 | train | Get a list of records that have the specified field name. | Create a Java method that does the following: "Get a list of records that have the specified field name.". | Of course, here is the Java code you requested:
```java
public RecordList getUniqueRecordsBy(String fieldName) {
Set<String> uniqueKeys = new HashSet<String>();
final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder(schema);
for (int rowIndex = 0; rowIndex < this.size(); rowInd... | |
Netflix/ndbench | ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsWriter.java | EsWriter.writeDocument | WriteResult writeDocument(RestClient restClient,
String key,
Boolean randomizeKeys) throws Exception {
if (isBulkWrite) {
writeBatchSizeWorthOfDocs(restClient, key, randomizeKeys);
} else {
writeSingleDoc(restClient, key... | java | WriteResult writeDocument(RestClient restClient,
String key,
Boolean randomizeKeys) throws Exception {
if (isBulkWrite) {
writeBatchSizeWorthOfDocs(restClient, key, randomizeKeys);
} else {
writeSingleDoc(restClient, key... | [
"WriteResult",
"writeDocument",
"(",
"RestClient",
"restClient",
",",
"String",
"key",
",",
"Boolean",
"randomizeKeys",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isBulkWrite",
")",
"{",
"writeBatchSizeWorthOfDocs",
"(",
"restClient",
",",
"key",
",",
"randomize... | Issues writes to esIndexName' and esDocType given 'restClient' (which determines the host/port of the
Elasticsearch cluster to write to.) | [
"Issues",
"writes",
"to",
"esIndexName",
"and",
"esDocType",
"given",
"restClient",
"(",
"which",
"determines",
"the",
"host",
"/",
"port",
"of",
"the",
"Elasticsearch",
"cluster",
"to",
"write",
"to",
".",
")"
] | 8d664244b5f9d01395248a296b86a3c822e6d764 | https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsWriter.java#L125-L135 | train | Write a document to the server. | Create a Java method that does the following: "Write a document to the server.". | Of course, here is the Java code you requested:
```java
WriteResult writeDocument(RestClient restClient,
String key,
Boolean randomizeKeys) throws Exception {
if (isBulkWrite) {
writeBatchSizeWorthOfDocs(restClient, key, randomizeKeys);
... | |
trajano/caliper | caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java | ServerSocketService.getOutputStream | private static OutputStream getOutputStream(final Socket socket) throws IOException {
final OutputStream delegate = socket.getOutputStream();
return new OutputStream() {
@Override public void close() throws IOException {
delegate.flush();
synchronized (socket) {
socket.shutdownO... | java | private static OutputStream getOutputStream(final Socket socket) throws IOException {
final OutputStream delegate = socket.getOutputStream();
return new OutputStream() {
@Override public void close() throws IOException {
delegate.flush();
synchronized (socket) {
socket.shutdownO... | [
"private",
"static",
"OutputStream",
"getOutputStream",
"(",
"final",
"Socket",
"socket",
")",
"throws",
"IOException",
"{",
"final",
"OutputStream",
"delegate",
"=",
"socket",
".",
"getOutputStream",
"(",
")",
";",
"return",
"new",
"OutputStream",
"(",
")",
"{"... | Returns an {@link OutputStream} for the socket, but unlike {@link Socket#getOutputStream()}
when you call {@link OutputStream#close() close} it only closes the output end of the socket
instead of the entire socket. | [
"Returns",
"an",
"{"
] | a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658 | https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java#L255-L286 | train | Get an output stream for the given socket. | Create a Java method that does the following: "Get an output stream for the given socket.". | Of course, here is the Java code you requested:
```java
private static OutputStream getOutputStream(final Socket socket) throws IOException {
final OutputStream delegate = socket.getOutputStream();
return new OutputStream() {
@Override public void close() throws IOException {
delegate.flush();
... | |
janus-project/guava.janusproject.io | guava/src/com/google/common/math/IntMath.java | IntMath.binomial | @GwtIncompatible("need BigIntegerMath to adequately test")
public static int binomial(int n, int k) {
checkNonNegative("n", n);
checkNonNegative("k", k);
checkArgument(k <= n, "k (%s) > n (%s)", k, n);
if (k > (n >> 1)) {
k = n - k;
}
if (k >= biggestBinomials.length || n > biggestBinomi... | java | @GwtIncompatible("need BigIntegerMath to adequately test")
public static int binomial(int n, int k) {
checkNonNegative("n", n);
checkNonNegative("k", k);
checkArgument(k <= n, "k (%s) > n (%s)", k, n);
if (k > (n >> 1)) {
k = n - k;
}
if (k >= biggestBinomials.length || n > biggestBinomi... | [
"@",
"GwtIncompatible",
"(",
"\"need BigIntegerMath to adequately test\"",
")",
"public",
"static",
"int",
"binomial",
"(",
"int",
"n",
",",
"int",
"k",
")",
"{",
"checkNonNegative",
"(",
"\"n\"",
",",
"n",
")",
";",
"checkNonNegative",
"(",
"\"k\"",
",",
"k",... | Returns {@code n} choose {@code k}, also known as the binomial coefficient of {@code n} and
{@code k}, or {@link Integer#MAX_VALUE} if the result does not fit in an {@code int}.
@throws IllegalArgumentException if {@code n < 0}, {@code k < 0} or {@code k > n} | [
"Returns",
"{",
"@code",
"n",
"}",
"choose",
"{",
"@code",
"k",
"}",
"also",
"known",
"as",
"the",
"binomial",
"coefficient",
"of",
"{",
"@code",
"n",
"}",
"and",
"{",
"@code",
"k",
"}",
"or",
"{",
"@link",
"Integer#MAX_VALUE",
"}",
"if",
"the",
"res... | 1c48fb672c9fdfddf276970570f703fa1115f588 | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/math/IntMath.java#L523-L547 | train | Binomial k - th binomial of n. | Create a Java method that does the following: "Binomial k - th binomial of n.". | Of course, here is the Java code you requested:
```java
@GwtIncompatible("need BigIntegerMath to adequately test")
public static int binomial(int n, int k) {
checkNonNegative("n", n);
checkNonNegative("k", k);
checkArgument(k <= n, "k (%s) > n (%s)", k, n);
if (k > (n >> 1)) {
k = n - k;
}
... | |
rmpestano/cukedoctor | cukedoctor-maven-plugin/src/main/java/com/github/cukedoctor/mojo/CukedoctorMojo.java | CukedoctorMojo.execute | public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping cukedoctor-maven-plugin");
return;
}
String startDir = null;
if (featuresDir != null) {
startDir = featuresDir;
}
if (startD... | java | public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping cukedoctor-maven-plugin");
return;
}
String startDir = null;
if (featuresDir != null) {
startDir = featuresDir;
}
if (startD... | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"if",
"(",
"skip",
")",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Skipping cukedoctor-maven-plugin\"",
")",
";",
"return",
";",
"}",
"String",
"sta... | only for tests | [
"only",
"for",
"tests"
] | 0e86dedbd8498ad551ce314a219e78cbabb7ff7d | https://github.com/rmpestano/cukedoctor/blob/0e86dedbd8498ad551ce314a219e78cbabb7ff7d/cukedoctor-maven-plugin/src/main/java/com/github/cukedoctor/mojo/CukedoctorMojo.java#L131-L246 | train | Execute the cukedoctor - maven - plugin. | Create a Java method that does the following: "Execute the cukedoctor - maven - plugin.". | Of course, here is the Java code you requested:
```java
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping cukedoctor-maven-plugin");
return;
}
String startDir = null;
if (featuresDir != null) {
... | |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTImageReader.java | PICTImageReader.readRectangle | private void readRectangle(DataInput pStream, Rectangle pDestRect) throws IOException {
int y = pStream.readUnsignedShort();
int x = pStream.readUnsignedShort();
int h = pStream.readUnsignedShort();
int w = pStream.readUnsignedShort();
pDestRect.setLocation(getXPtCoord(x), getYP... | java | private void readRectangle(DataInput pStream, Rectangle pDestRect) throws IOException {
int y = pStream.readUnsignedShort();
int x = pStream.readUnsignedShort();
int h = pStream.readUnsignedShort();
int w = pStream.readUnsignedShort();
pDestRect.setLocation(getXPtCoord(x), getYP... | [
"private",
"void",
"readRectangle",
"(",
"DataInput",
"pStream",
",",
"Rectangle",
"pDestRect",
")",
"throws",
"IOException",
"{",
"int",
"y",
"=",
"pStream",
".",
"readUnsignedShort",
"(",
")",
";",
"int",
"x",
"=",
"pStream",
".",
"readUnsignedShort",
"(",
... | Reads the rectangle location and size from an 8-byte rectangle stream.
@param pStream the stream to read from
@param pDestRect the rectangle to read into
@throws NullPointerException if {@code pDestRect} is {@code null}
@throws IOException if an I/O error occurs while reading the image. | [
"Reads",
"the",
"rectangle",
"location",
"and",
"size",
"from",
"an",
"8",
"-",
"byte",
"rectangle",
"stream",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTImageReader.java#L2366-L2374 | train | read a rectangle from the stream | Create a Java method that does the following: "read a rectangle from the stream". | Of course, here is the Java code you requested:
```java
private void readRectangle(DataInput pStream, Rectangle pDestRect) throws IOException {
int y = pStream.readUnsignedShort();
int x = pStream.readUnsignedShort();
int h = pStream.readUnsignedShort();
int w = pStream.readUnsignedShor... | |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.union | public List<Type> union(List<Type> cl1, List<Type> cl2, BiPredicate<Type, Type> shouldSkip) {
if (cl1.isEmpty()) {
return cl2;
} else if (cl2.isEmpty()) {
return cl1;
} else if (shouldSkip.test(cl1.head, cl2.head)) {
return union(cl1.tail, cl2.tail, shouldSkip... | java | public List<Type> union(List<Type> cl1, List<Type> cl2, BiPredicate<Type, Type> shouldSkip) {
if (cl1.isEmpty()) {
return cl2;
} else if (cl2.isEmpty()) {
return cl1;
} else if (shouldSkip.test(cl1.head, cl2.head)) {
return union(cl1.tail, cl2.tail, shouldSkip... | [
"public",
"List",
"<",
"Type",
">",
"union",
"(",
"List",
"<",
"Type",
">",
"cl1",
",",
"List",
"<",
"Type",
">",
"cl2",
",",
"BiPredicate",
"<",
"Type",
",",
"Type",
">",
"shouldSkip",
")",
"{",
"if",
"(",
"cl1",
".",
"isEmpty",
"(",
")",
")",
... | Form the union of two closures | [
"Form",
"the",
"union",
"of",
"two",
"closures"
] | a53d069bbdb2c60232ed3811c19b65e41c3e60e0 | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3493-L3508 | train | Union two sets of types. | Create a Java method that does the following: "Union two sets of types.". | Of course, here is the Java code you requested:
```java
public List<Type> union(List<Type> cl1, List<Type> cl2, BiPredicate<Type, Type> shouldSkip) {
if (cl1.isEmpty()) {
return cl2;
} else if (cl2.isEmpty()) {
return cl1;
} else if (shouldSkip.test(cl1.head, cl2.head)) ... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java | X500Name.asX500Principal | public X500Principal asX500Principal() {
if (x500Principal == null) {
try {
Object[] args = new Object[] {this};
x500Principal =
(X500Principal)principalConstructor.newInstance(args);
} catch (Exception e) {
throw ne... | java | public X500Principal asX500Principal() {
if (x500Principal == null) {
try {
Object[] args = new Object[] {this};
x500Principal =
(X500Principal)principalConstructor.newInstance(args);
} catch (Exception e) {
throw ne... | [
"public",
"X500Principal",
"asX500Principal",
"(",
")",
"{",
"if",
"(",
"x500Principal",
"==",
"null",
")",
"{",
"try",
"{",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"]",
"{",
"this",
"}",
";",
"x500Principal",
"=",
"(",
"X500Principal",
... | Get an X500Principal backed by this X500Name.
Note that we are using privileged reflection to access the hidden
package private constructor in X500Principal. | [
"Get",
"an",
"X500Principal",
"backed",
"by",
"this",
"X500Name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java#L1437-L1448 | train | Get the X500Principal object that is the same as this object. | Create a Java method that does the following: "Get the X500Principal object that is the same as this object.". | Of course, here is the Java code you requested:
```java
public X500Principal asX500Principal() {
if (x500Principal == null) {
try {
Object[] args = new Object[] {this};
x500Principal =
(X500Principal)principalConstructor.newInstance(args);
... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java | DiscriminationProcessImpl.addChannel | private void addChannel(Channel chan) {
if (channelList == null) {
channelList = new Channel[1];
channelList[0] = chan;
} else {
Channel[] oldList = channelList;
channelList = new Channel[oldList.length + 1];
System.arraycopy(oldList, 0, channe... | java | private void addChannel(Channel chan) {
if (channelList == null) {
channelList = new Channel[1];
channelList[0] = chan;
} else {
Channel[] oldList = channelList;
channelList = new Channel[oldList.length + 1];
System.arraycopy(oldList, 0, channe... | [
"private",
"void",
"addChannel",
"(",
"Channel",
"chan",
")",
"{",
"if",
"(",
"channelList",
"==",
"null",
")",
"{",
"channelList",
"=",
"new",
"Channel",
"[",
"1",
"]",
";",
"channelList",
"[",
"0",
"]",
"=",
"chan",
";",
"}",
"else",
"{",
"Channel"... | Add a channel to the channel list to be searched.
@param chan | [
"Add",
"a",
"channel",
"to",
"the",
"channel",
"list",
"to",
"be",
"searched",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/discrim/DiscriminationProcessImpl.java#L639-L649 | train | Add a Channel to the list of Channel objects. | Create a Java method that does the following: "Add a Channel to the list of Channel objects.". | Of course, here is the Java code you requested:
```java
private void addChannel(Channel chan) {
if (channelList == null) {
channelList = new Channel[1];
channelList[0] = chan;
} else {
Channel[] oldList = channelList;
channelList = new Channel[oldList.len... | |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/timerservice/TimerServiceImpl.java | TimerServiceImpl.shouldRun | public boolean shouldRun(TimerImpl timer) {
// check peristent without further check to prevent from Exception (WFLY-6152)
return !timer.isTimerPersistent() || timerPersistence.getValue().shouldRun(timer, ContextTransactionManager.getInstance());
} | java | public boolean shouldRun(TimerImpl timer) {
// check peristent without further check to prevent from Exception (WFLY-6152)
return !timer.isTimerPersistent() || timerPersistence.getValue().shouldRun(timer, ContextTransactionManager.getInstance());
} | [
"public",
"boolean",
"shouldRun",
"(",
"TimerImpl",
"timer",
")",
"{",
"// check peristent without further check to prevent from Exception (WFLY-6152)",
"return",
"!",
"timer",
".",
"isTimerPersistent",
"(",
")",
"||",
"timerPersistence",
".",
"getValue",
"(",
")",
".",
... | Check if a persistent timer is already executed from a different instance
or should be executed.
For non-persistent timer it always return <code>true</code>.
@param timer the timer which should be checked
@return <code>true</code> if the timer is not persistent or the persistent timer should start | [
"Check",
"if",
"a",
"persistent",
"timer",
"is",
"already",
"executed",
"from",
"a",
"different",
"instance",
"or",
"should",
"be",
"executed",
".",
"For",
"non",
"-",
"persistent",
"timer",
"it",
"always",
"return",
"<code",
">",
"true<",
"/",
"code",
">"... | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/timerservice/TimerServiceImpl.java#L1144-L1147 | test | Check if the timer should run. | Create a Java method that does the following: "Check if the timer should run.". | Of course, here is the Java code you requested:
```java
public boolean shouldRun(TimerImpl timer) {
// check peristent without further check to prevent from Exception (WFLY-6152)
return !timer.isTimerPersistent() || timerPersistence.getValue().shouldRun(timer, ContextTransactionManager.getInstance());
... | |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/SiteTool.java | SiteTool.fixReportChanges | private final void fixReportChanges(final Element root) {
final Collection<Element> headings; // Headings in the body
final Collection<Element> sections; // Sections in the body
final Element section; // First section
Element timeElement; // Element with the date
Element sm... | java | private final void fixReportChanges(final Element root) {
final Collection<Element> headings; // Headings in the body
final Collection<Element> sections; // Sections in the body
final Element section; // First section
Element timeElement; // Element with the date
Element sm... | [
"private",
"final",
"void",
"fixReportChanges",
"(",
"final",
"Element",
"root",
")",
"{",
"final",
"Collection",
"<",
"Element",
">",
"headings",
";",
"// Headings in the body",
"final",
"Collection",
"<",
"Element",
">",
"sections",
";",
"// Sections in the body",... | Fixes the changes report page.
@param root
root element for the report page to fix | [
"Fixes",
"the",
"changes",
"report",
"page",
"."
] | e064472faa7edb0fca11647a22d90ad72089baa3 | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L346-L400 | train | Fixes the report changes in the XML document. | Create a Java method that does the following: "Fixes the report changes in the XML document.". | Of course, here is the Java code you requested:
```java
private final void fixReportChanges(final Element root) {
final Collection<Element> headings; // Headings in the body
final Collection<Element> sections; // Sections in the body
final Element section; // First section
Element ti... | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/AttributeQualifierImpl.java | AttributeQualifierImpl.setSeqNum | public void setSeqNum(Integer newSeqNum) {
Integer oldSeqNum = seqNum;
seqNum = newSeqNum;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.ATTRIBUTE_QUALIFIER__SEQ_NUM, oldSeqNum, seqNum));
} | java | public void setSeqNum(Integer newSeqNum) {
Integer oldSeqNum = seqNum;
seqNum = newSeqNum;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.ATTRIBUTE_QUALIFIER__SEQ_NUM, oldSeqNum, seqNum));
} | [
"public",
"void",
"setSeqNum",
"(",
"Integer",
"newSeqNum",
")",
"{",
"Integer",
"oldSeqNum",
"=",
"seqNum",
";",
"seqNum",
"=",
"newSeqNum",
";",
"if",
"(",
"eNotificationRequired",
"(",
")",
")",
"eNotify",
"(",
"new",
"ENotificationImpl",
"(",
"this",
","... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/afplib/impl/AttributeQualifierImpl.java#L104-L109 | train | Sets the sequence number of the attribute. | Create a Java method that does the following: "Sets the sequence number of the attribute.". | Of course, here is the Java code you requested:
```java
public void setSeqNum(Integer newSeqNum) {
Integer oldSeqNum = seqNum;
seqNum = newSeqNum;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.ATTRIBUTE_QUALIFIER__SEQ_NUM, oldSeqNum, seqNum));
}
```
Hope th... | |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy_binding.java | autoscalepolicy_binding.get | public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception{
autoscalepolicy_binding obj = new autoscalepolicy_binding();
obj.set_name(name);
autoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(service);
return response;
} | java | public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception{
autoscalepolicy_binding obj = new autoscalepolicy_binding();
obj.set_name(name);
autoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"autoscalepolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"autoscalepolicy_binding",
"obj",
"=",
"new",
"autoscalepolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"nam... | Use this API to fetch autoscalepolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"autoscalepolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy_binding.java#L103-L108 | train | Use this API to fetch autoscalepolicy_binding resource of given name. | Create a Java method that does the following: "Use this API to fetch autoscalepolicy_binding resource of given name.". | Of course, here is the Java code you requested:
```java
public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception{
autoscalepolicy_binding obj = new autoscalepolicy_binding();
obj.set_name(name);
autoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(se... | |
apache/flink | flink-core/src/main/java/org/apache/flink/util/WrappingRuntimeException.java | WrappingRuntimeException.unwrap | public Throwable unwrap() {
Throwable cause = getCause();
return (cause instanceof WrappingRuntimeException) ? ((WrappingRuntimeException) cause).unwrap() : cause;
} | java | public Throwable unwrap() {
Throwable cause = getCause();
return (cause instanceof WrappingRuntimeException) ? ((WrappingRuntimeException) cause).unwrap() : cause;
} | [
"public",
"Throwable",
"unwrap",
"(",
")",
"{",
"Throwable",
"cause",
"=",
"getCause",
"(",
")",
";",
"return",
"(",
"cause",
"instanceof",
"WrappingRuntimeException",
")",
"?",
"(",
"(",
"WrappingRuntimeException",
")",
"cause",
")",
".",
"unwrap",
"(",
")"... | Recursively unwraps this WrappingRuntimeException and its causes, getting the first
non wrapping exception.
@return The first cause that is not a wrapping exception. | [
"Recursively",
"unwraps",
"this",
"WrappingRuntimeException",
"and",
"its",
"causes",
"getting",
"the",
"first",
"non",
"wrapping",
"exception",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/WrappingRuntimeException.java#L50-L53 | train | Unwraps the wrapped exception. | Create a Java method that does the following: "Unwraps the wrapped exception.". | Of course, here is the Java code you requested:
```java
public Throwable unwrap() {
Throwable cause = getCause();
return (cause instanceof WrappingRuntimeException) ? ((WrappingRuntimeException) cause).unwrap() : cause;
}
```
Hope this helps! | |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.isAvailableDeviceId | boolean isAvailableDeviceId(OmemoDevice userDevice, int id) {
LOGGER.log(Level.INFO, "Check if id " + id + " is available...");
// Lookup local cached device list
BareJid ownJid = userDevice.getJid();
OmemoCachedDeviceList cachedDeviceList;
cachedDeviceList = loadCachedDeviceLi... | java | boolean isAvailableDeviceId(OmemoDevice userDevice, int id) {
LOGGER.log(Level.INFO, "Check if id " + id + " is available...");
// Lookup local cached device list
BareJid ownJid = userDevice.getJid();
OmemoCachedDeviceList cachedDeviceList;
cachedDeviceList = loadCachedDeviceLi... | [
"boolean",
"isAvailableDeviceId",
"(",
"OmemoDevice",
"userDevice",
",",
"int",
"id",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Check if id \"",
"+",
"id",
"+",
"\" is available...\"",
")",
";",
"// Lookup local cached device list",
"BareJ... | Check, if our freshly generated deviceId is available (unique) in our deviceList.
@param userDevice our current device.
@param id deviceId to check for.
@return true if list did not contain our id, else false | [
"Check",
"if",
"our",
"freshly",
"generated",
"deviceId",
"is",
"available",
"(",
"unique",
")",
"in",
"our",
"deviceList",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L81-L95 | train | Check if the given id is available in the local cache. | Create a Java method that does the following: "Check if the given id is available in the local cache.". | Of course, here is the Java code you requested:
```java
boolean isAvailableDeviceId(OmemoDevice userDevice, int id) {
LOGGER.log(Level.INFO, "Check if id " + id + " is available...");
// Lookup local cached device list
BareJid ownJid = userDevice.getJid();
OmemoCachedDeviceList cachedD... | |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/SeekBarPreference.java | SeekBarPreference.setStepSize | public final void setStepSize(final int stepSize) {
if (stepSize != -1) {
Condition.INSTANCE.ensureAtLeast(stepSize, 1, "The step size must be at least 1");
Condition.INSTANCE.ensureAtMaximum(stepSize, getRange(),
"The step size must be at maximum the range");
... | java | public final void setStepSize(final int stepSize) {
if (stepSize != -1) {
Condition.INSTANCE.ensureAtLeast(stepSize, 1, "The step size must be at least 1");
Condition.INSTANCE.ensureAtMaximum(stepSize, getRange(),
"The step size must be at maximum the range");
... | [
"public",
"final",
"void",
"setStepSize",
"(",
"final",
"int",
"stepSize",
")",
"{",
"if",
"(",
"stepSize",
"!=",
"-",
"1",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureAtLeast",
"(",
"stepSize",
",",
"1",
",",
"\"The step size must be at least 1\"",
... | Sets the step size, the value should be increased or decreased by, when moving the seek bar.
@param stepSize
The step size, which should be set, as an {@link Integer} value. The value must be at
least 1 and at maximum the value of the method <code>getRange():int</code> or -1, if
the preference should allow to select a... | [
"Sets",
"the",
"step",
"size",
"the",
"value",
"should",
"be",
"increased",
"or",
"decreased",
"by",
"when",
"moving",
"the",
"seek",
"bar",
"."
] | 73a7e449458313bd041fc8d6038e290506b68eb1 | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/SeekBarPreference.java#L669-L678 | train | Sets the step size. | Create a Java method that does the following: "Sets the step size.". | Of course, here is the Java code you requested:
```java
public final void setStepSize(final int stepSize) {
if (stepSize != -1) {
Condition.INSTANCE.ensureAtLeast(stepSize, 1, "The step size must be at least 1");
Condition.INSTANCE.ensureAtMaximum(stepSize, getRange(),
... | |
eBay/parallec | src/main/java/io/parallec/core/util/PcHttpUtils.java | PcHttpUtils.replaceHttpHeaderMapNodeSpecific | public static void replaceHttpHeaderMapNodeSpecific(
Map<String, String> httpHeaderMap,
Map<String, String> requestParameters) {
boolean needToReplaceVarInHttpHeader = false;
for (String parameter : requestParameters.keySet()) {
if (parameter.contains(PcConstants.NOD... | java | public static void replaceHttpHeaderMapNodeSpecific(
Map<String, String> httpHeaderMap,
Map<String, String> requestParameters) {
boolean needToReplaceVarInHttpHeader = false;
for (String parameter : requestParameters.keySet()) {
if (parameter.contains(PcConstants.NOD... | [
"public",
"static",
"void",
"replaceHttpHeaderMapNodeSpecific",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"httpHeaderMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"boolean",
"needToReplaceVarInHttpHeader",
"=",
"false",
"... | !!!! ASSUMPTION: all VAR exists in HTTP Header must of type:
APIVARREPLACE_NAME_PREFIX_HTTP_HEADER
20140310 This may be costly (O(n^2)) of the updated related # of headers;
# of parameters in the requests.
Better to only do it when there are some replacement in the request
Parameters. a prefix :
TOBE tested
@param ... | [
"!!!!",
"ASSUMPTION",
":",
"all",
"VAR",
"exists",
"in",
"HTTP",
"Header",
"must",
"of",
"type",
":",
"APIVARREPLACE_NAME_PREFIX_HTTP_HEADER"
] | 1b4f1628f34fedfb06b24c33a5372d64d3df0952 | https://github.com/eBay/parallec/blob/1b4f1628f34fedfb06b24c33a5372d64d3df0952/src/main/java/io/parallec/core/util/PcHttpUtils.java#L70-L94 | train | Replace the HTTP header map node specific. | Create a Java method that does the following: "Replace the HTTP header map node specific.". | Of course, here is the Java code you requested:
```java
public static void replaceHttpHeaderMapNodeSpecific(
Map<String, String> httpHeaderMap,
Map<String, String> requestParameters) {
boolean needToReplaceVarInHttpHeader = false;
for (String parameter : requestParameters.keySe... | |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/images/ImageUtil.java | ImageUtil.getNewSize | public static int[] getNewSize(
int width,
int height,
int maxWidth,
int maxHeight)
{
if (width <= maxWidth && height <= maxHeight) {
return new int[]{width, height};
}
double thumbRatio = (double) maxWidth / (double) maxHeight;
double imag... | java | public static int[] getNewSize(
int width,
int height,
int maxWidth,
int maxHeight)
{
if (width <= maxWidth && height <= maxHeight) {
return new int[]{width, height};
}
double thumbRatio = (double) maxWidth / (double) maxHeight;
double imag... | [
"public",
"static",
"int",
"[",
"]",
"getNewSize",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"maxWidth",
",",
"int",
"maxHeight",
")",
"{",
"if",
"(",
"width",
"<=",
"maxWidth",
"&&",
"height",
"<=",
"maxHeight",
")",
"{",
"return",
"new",... | Calculates new size of an image with the specified max borders keeping
the ratio between height and width of the image.
@param width the initial width of an image
@param height the initial height of an image
@param maxWidth the maximal width of an image
@param maxHeight the maximal height of an image
@return a new siz... | [
"Calculates",
"new",
"size",
"of",
"an",
"image",
"with",
"the",
"specified",
"max",
"borders",
"keeping",
"the",
"ratio",
"between",
"height",
"and",
"width",
"of",
"the",
"image",
"."
] | a21cdfcb64ef5b76872e3eedf78c530f26d7beb0 | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/images/ImageUtil.java#L174-L191 | train | Get new size of the image. | Create a Java method that does the following: "Get new size of the image.". | Of course, here is the Java code you requested:
```java
public static int[] getNewSize(
int width,
int height,
int maxWidth,
int maxHeight)
{
if (width <= maxWidth && height <= maxHeight) {
return new int[]{width, height};
}
double thumbRatio = (d... | |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java | CassandraCell.create | public static <E extends IDeepType> Cell create(E e, Field field) {
return new CassandraCell(e, field);
} | java | public static <E extends IDeepType> Cell create(E e, Field field) {
return new CassandraCell(e, field);
} | [
"public",
"static",
"<",
"E",
"extends",
"IDeepType",
">",
"Cell",
"create",
"(",
"E",
"e",
",",
"Field",
"field",
")",
"{",
"return",
"new",
"CassandraCell",
"(",
"e",
",",
"field",
")",
";",
"}"
] | Constructs a Cell from a {@link com.stratio.deep.commons.annotations.DeepField} property.
@param e instance of the testentity whose field is going to generate a Cell.
@param field field that will generate the Cell.
@param <E> a subclass of IDeepType.
@return an instance of a Cell object for the provided paramete... | [
"Constructs",
"a",
"Cell",
"from",
"a",
"{",
"@link",
"com",
".",
"stratio",
".",
"deep",
".",
"commons",
".",
"annotations",
".",
"DeepField",
"}",
"property",
"."
] | b9621c9b7a6d996f80fce1d073d696a157bed095 | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java#L123-L125 | train | Creates a new Cassandra cell. | Create a Java method that does the following: "Creates a new Cassandra cell.". | Of course, here is the Java code you requested:
```java
public static <E extends IDeepType> Cell create(E e, Field field) {
return new CassandraCell(e, field);
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/expectations/JsonObjectExpectation.java | JsonObjectExpectation.verifyKeyExistenceMatchesExpectation | private void verifyKeyExistenceMatchesExpectation(JsonObject jsonDataToValidate) {
boolean jsonDataContainsKey = jsonDataToValidate.containsKey(validationKey);
if (expCheckType == JsonCheckType.KEY_DOES_NOT_EXIST) {
assertFalse("The provided content contains a \"" + validationKey + "\" key b... | java | private void verifyKeyExistenceMatchesExpectation(JsonObject jsonDataToValidate) {
boolean jsonDataContainsKey = jsonDataToValidate.containsKey(validationKey);
if (expCheckType == JsonCheckType.KEY_DOES_NOT_EXIST) {
assertFalse("The provided content contains a \"" + validationKey + "\" key b... | [
"private",
"void",
"verifyKeyExistenceMatchesExpectation",
"(",
"JsonObject",
"jsonDataToValidate",
")",
"{",
"boolean",
"jsonDataContainsKey",
"=",
"jsonDataToValidate",
".",
"containsKey",
"(",
"validationKey",
")",
";",
"if",
"(",
"expCheckType",
"==",
"JsonCheckType",... | Verifies that the specified key is present (if expected to be present) or is not present (if not expected to be present) in
the JSON data. | [
"Verifies",
"that",
"the",
"specified",
"key",
"is",
"present",
"(",
"if",
"expected",
"to",
"be",
"present",
")",
"or",
"is",
"not",
"present",
"(",
"if",
"not",
"expected",
"to",
"be",
"present",
")",
"in",
"the",
"JSON",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/expectations/JsonObjectExpectation.java#L139-L146 | train | Verify that the provided content contains a key that matches the expected expectation. | Create a Java method that does the following: "Verify that the provided content contains a key that matches the expected expectation.". | Of course, here is the Java code you requested:
```java
private void verifyKeyExistenceMatchesExpectation(JsonObject jsonDataToValidate) {
boolean jsonDataContainsKey = jsonDataToValidate.containsKey(validationKey);
if (expCheckType == JsonCheckType.KEY_DOES_NOT_EXIST) {
assertFalse("The pr... | |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201808/Product.java | Product.setNameSource | public void setNameSource(com.google.api.ads.admanager.axis.v201808.ValueSourceType nameSource) {
this.nameSource = nameSource;
} | java | public void setNameSource(com.google.api.ads.admanager.axis.v201808.ValueSourceType nameSource) {
this.nameSource = nameSource;
} | [
"public",
"void",
"setNameSource",
"(",
"com",
".",
"google",
".",
"api",
".",
"ads",
".",
"admanager",
".",
"axis",
".",
"v201808",
".",
"ValueSourceType",
"nameSource",
")",
"{",
"this",
".",
"nameSource",
"=",
"nameSource",
";",
"}"
] | Sets the nameSource value for this Product.
@param nameSource * Specifies the source of the {@link Product#name} value.
To revert an overridden value to its default, set
this field to {@link ValueSourceType#PARENT}.
<span class="constraint Applicable">This attribute
is applicable when:<ul><li>using programmatic guar... | [
"Sets",
"the",
"nameSource",
"value",
"for",
"this",
"Product",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201808/Product.java#L394-L396 | train | Sets the nameSource value for this CIDCTYPE. | Create a Java method that does the following: "Sets the nameSource value for this CIDCTYPE.". | Of course, here is the Java code you requested:
```java
public void setNameSource(com.google.api.ads.admanager.axis.v201808.ValueSourceType nameSource) {
this.nameSource = nameSource;
}
```
Hope this helps! | |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/impl/NumberConverter.java | NumberConverter.toBigInteger | private BigInteger toBigInteger(Object value) {
if (value instanceof Long) {
return BigInteger.valueOf((Long) value);
} else if(value instanceof Boolean) {
return BigInteger.valueOf((boolean)value ? 1 : 0);
}
final String valueStr = convertToStr(value);
if (StrUtil.isBlank(valueStr)) {
return... | java | private BigInteger toBigInteger(Object value) {
if (value instanceof Long) {
return BigInteger.valueOf((Long) value);
} else if(value instanceof Boolean) {
return BigInteger.valueOf((boolean)value ? 1 : 0);
}
final String valueStr = convertToStr(value);
if (StrUtil.isBlank(valueStr)) {
return... | [
"private",
"BigInteger",
"toBigInteger",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Long",
")",
"{",
"return",
"BigInteger",
".",
"valueOf",
"(",
"(",
"Long",
")",
"value",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof"... | 转换为BigInteger<br>
如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@return 结果 | [
"转换为BigInteger<br",
">",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/impl/NumberConverter.java#L185-L196 | train | Converts the value to a BigInteger. | Create a Java method that does the following: "Converts the value to a BigInteger.". | Of course, here is the Java code you requested:
```java
private BigInteger toBigInteger(Object value) {
if (value instanceof Long) {
return BigInteger.valueOf((Long) value);
} else if(value instanceof Boolean) {
return BigInteger.valueOf((boolean)value ? 1 : 0);
}
final String valueStr = convertToS... | |
google/closure-templates | java/src/com/google/template/soy/types/SoyType.java | SoyType.isAssignableFrom | public final boolean isAssignableFrom(SoyType srcType) {
// Handle unions generically. A type is assignable from a union if it is assignable from _all_
// memebers.
if (srcType instanceof UnionType) {
// By construction union types are guaranteed
// 1. not to be empty
// 2. not to contain... | java | public final boolean isAssignableFrom(SoyType srcType) {
// Handle unions generically. A type is assignable from a union if it is assignable from _all_
// memebers.
if (srcType instanceof UnionType) {
// By construction union types are guaranteed
// 1. not to be empty
// 2. not to contain... | [
"public",
"final",
"boolean",
"isAssignableFrom",
"(",
"SoyType",
"srcType",
")",
"{",
"// Handle unions generically. A type is assignable from a union if it is assignable from _all_",
"// memebers.",
"if",
"(",
"srcType",
"instanceof",
"UnionType",
")",
"{",
"// By construction... | Returns true if a parameter or field of this type can be assigned from a value of {@code
srcType}.
@param srcType The type of the incoming value.
@return True if the assignment is valid. | [
"Returns",
"true",
"if",
"a",
"parameter",
"or",
"field",
"of",
"this",
"type",
"can",
"be",
"assigned",
"from",
"a",
"value",
"of",
"{",
"@code",
"srcType",
"}",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyType.java#L162-L179 | train | Checks if the given type is assignable from this type. | Create a Java method that does the following: "Checks if the given type is assignable from this type.". | Of course, here is the Java code you requested:
```java
public final boolean isAssignableFrom(SoyType srcType) {
// Handle unions generically. A type is assignable from a union if it is assignable from _all_
// memebers.
if (srcType instanceof UnionType) {
// By construction union types are guarante... | |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/BaseClient.java | BaseClient.initialiseLifecycleObserver | private void initialiseLifecycleObserver(Application application) {
LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
for (LifecycleListener listener : lifecycleListeners) {
... | java | private void initialiseLifecycleObserver(Application application) {
LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
for (LifecycleListener listener : lifecycleListeners) {
... | [
"private",
"void",
"initialiseLifecycleObserver",
"(",
"Application",
"application",
")",
"{",
"LifeCycleController",
".",
"registerLifeCycleObserver",
"(",
"application",
",",
"new",
"LifecycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onForegrounded... | Register for application lifecycle callbacks.
@param application Application instance. | [
"Register",
"for",
"application",
"lifecycle",
"callbacks",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/BaseClient.java#L242-L258 | train | Initialise the lifecycle observer. | Create a Java method that does the following: "Initialise the lifecycle observer.". | Of course, here is the Java code you requested:
```java
private void initialiseLifecycleObserver(Application application) {
LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
for (L... | |
reactor/reactor-core | reactor-core/src/main/java/reactor/core/publisher/FluxMergeOrdered.java | FluxMergeOrdered.mergeAdditionalSource | FluxMergeOrdered<T> mergeAdditionalSource(Publisher<? extends T> source,
Comparator<? super T> otherComparator) {
int n = sources.length;
@SuppressWarnings("unchecked")
Publisher<? extends T>[] newArray = new Publisher[n + 1];
System.arraycopy(sources, 0, newArray, 0, n);
newArray[n] = source;
if (!valu... | java | FluxMergeOrdered<T> mergeAdditionalSource(Publisher<? extends T> source,
Comparator<? super T> otherComparator) {
int n = sources.length;
@SuppressWarnings("unchecked")
Publisher<? extends T>[] newArray = new Publisher[n + 1];
System.arraycopy(sources, 0, newArray, 0, n);
newArray[n] = source;
if (!valu... | [
"FluxMergeOrdered",
"<",
"T",
">",
"mergeAdditionalSource",
"(",
"Publisher",
"<",
"?",
"extends",
"T",
">",
"source",
",",
"Comparator",
"<",
"?",
"super",
"T",
">",
"otherComparator",
")",
"{",
"int",
"n",
"=",
"sources",
".",
"length",
";",
"@",
"Supp... | Returns a new instance which has the additional source to be merged together with
the current array of sources. The provided {@link Comparator} is tested for equality
with the current comparator, and if different is combined by {@link Comparator#thenComparing(Comparator)}.
<p>
This operation doesn't change the current ... | [
"Returns",
"a",
"new",
"instance",
"which",
"has",
"the",
"additional",
"source",
"to",
"be",
"merged",
"together",
"with",
"the",
"current",
"array",
"of",
"sources",
".",
"The",
"provided",
"{",
"@link",
"Comparator",
"}",
"is",
"tested",
"for",
"equality"... | df2eba4ab7d2393e1a942ce972c3307fbbd47ff9 | https://github.com/reactor/reactor-core/blob/df2eba4ab7d2393e1a942ce972c3307fbbd47ff9/reactor-core/src/main/java/reactor/core/publisher/FluxMergeOrdered.java#L78-L93 | valid | Merge the additional source. | Create a Java method that does the following: "Merge the additional source.". | Of course, here is the Java code you requested:
```java
FluxMergeOrdered<T> mergeAdditionalSource(Publisher<? extends T> source,
Comparator<? super T> otherComparator) {
int n = sources.length;
@SuppressWarnings("unchecked")
Publisher<? extends T>[] newArray = new Publisher[n + 1];
System.arraycopy(sources,... | |
fabric8io/fabric8-forge | addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CollectionHelper.java | CollectionHelper.first | public static <T> T first(Iterable<T> objects) {
if (objects != null) {
for (T object : objects) {
return object;
}
}
return null;
} | java | public static <T> T first(Iterable<T> objects) {
if (objects != null) {
for (T object : objects) {
return object;
}
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"first",
"(",
"Iterable",
"<",
"T",
">",
"objects",
")",
"{",
"if",
"(",
"objects",
"!=",
"null",
")",
"{",
"for",
"(",
"T",
"object",
":",
"objects",
")",
"{",
"return",
"object",
";",
"}",
"}",
"return",
... | Returns the first item in the given collection | [
"Returns",
"the",
"first",
"item",
"in",
"the",
"given",
"collection"
] | a59871bae4d5c5d3ece10f1e8758e73663087f19 | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CollectionHelper.java#L26-L33 | train | Gets the first instance of the Iterable of objects. | Create a Java method that does the following: "Gets the first instance of the Iterable of objects.". | Of course, here is the Java code you requested:
```java
public static <T> T first(Iterable<T> objects) {
if (objects != null) {
for (T object : objects) {
return object;
}
}
return null;
}
```
Hope this helps! | |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java | CommandExecutionSpec.checkShellExitStatus | @Deprecated
@Then("^the command exit status is '(.+?)'$")
public void checkShellExitStatus(int expectedExitStatus) throws Exception {
assertThat(commonspec.getCommandExitStatus()).as("Is equal to " + expectedExitStatus + ".").isEqualTo(expectedExitStatus);
} | java | @Deprecated
@Then("^the command exit status is '(.+?)'$")
public void checkShellExitStatus(int expectedExitStatus) throws Exception {
assertThat(commonspec.getCommandExitStatus()).as("Is equal to " + expectedExitStatus + ".").isEqualTo(expectedExitStatus);
} | [
"@",
"Deprecated",
"@",
"Then",
"(",
"\"^the command exit status is '(.+?)'$\"",
")",
"public",
"void",
"checkShellExitStatus",
"(",
"int",
"expectedExitStatus",
")",
"throws",
"Exception",
"{",
"assertThat",
"(",
"commonspec",
".",
"getCommandExitStatus",
"(",
")",
"... | Check the exitStatus of previous command execution matches the expected one
@param expectedExitStatus
@deprecated Success exit status is directly checked in the "execute remote command" method, so this is not
needed anymore. | [
"Check",
"the",
"exitStatus",
"of",
"previous",
"command",
"execution",
"matches",
"the",
"expected",
"one"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java#L218-L222 | train | Check the exit status of the shell. | Create a Java method that does the following: "Check the exit status of the shell.". | Of course, here is the Java code you requested:
```java
@Deprecated
@Then("^the command exit status is '(.+?)'$")
public void checkShellExitStatus(int expectedExitStatus) throws Exception {
assertThat(commonspec.getCommandExitStatus()).as("Is equal to " + expectedExitStatus + ".").isEqualTo(expectedExi... | |
httpcache4j/httpcache4j | httpcache4j-core/src/main/java/org/codehaus/httpcache4j/cache/HTTPCacheHelper.java | HTTPCacheHelper.isCacheableResponse | boolean isCacheableResponse(HTTPResponse response) {
if (!cacheableStatuses.contains(response.getStatus())) {
return false;
}
Headers headers = response.getHeaders();
return headers.isCachable();
} | java | boolean isCacheableResponse(HTTPResponse response) {
if (!cacheableStatuses.contains(response.getStatus())) {
return false;
}
Headers headers = response.getHeaders();
return headers.isCachable();
} | [
"boolean",
"isCacheableResponse",
"(",
"HTTPResponse",
"response",
")",
"{",
"if",
"(",
"!",
"cacheableStatuses",
".",
"contains",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"Headers",
"headers",
"=",
"response",... | A response received with a status code of 200, 203, 206, 300, 301 or 410 MAY be stored by a cache and used in reply to a subsequent request,
subject to the expiration mechanism, unless a cache-control directive prohibits caching.
However, a cache that does not support the Range and Content-Range headers MUST NOT cache ... | [
"A",
"response",
"received",
"with",
"a",
"status",
"code",
"of",
"200",
"203",
"206",
"300",
"301",
"or",
"410",
"MAY",
"be",
"stored",
"by",
"a",
"cache",
"and",
"used",
"in",
"reply",
"to",
"a",
"subsequent",
"request",
"subject",
"to",
"the",
"expi... | 9c07ebd63cd104a99eb9e771f760f14efa4fe0f6 | https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-core/src/main/java/org/codehaus/httpcache4j/cache/HTTPCacheHelper.java#L98-L104 | train | Check if the response is cacheable. | Create a Java method that does the following: "Check if the response is cacheable.". | Of course, here is the Java code you requested:
```java
boolean isCacheableResponse(HTTPResponse response) {
if (!cacheableStatuses.contains(response.getStatus())) {
return false;
}
Headers headers = response.getHeaders();
return headers.isCachable();
}
```
Hope this he... | |
VoltDB/voltdb | src/frontend/org/voltdb/utils/CatalogUtil.java | CatalogUtil.getCatalogIndexSize | public static int getCatalogIndexSize(Index index) {
int indexSize = 0;
String jsonstring = index.getExpressionsjson();
if (jsonstring.isEmpty()) {
indexSize = getSortedCatalogItems(index.getColumns(), "index").size();
} else {
try {
indexSize = A... | java | public static int getCatalogIndexSize(Index index) {
int indexSize = 0;
String jsonstring = index.getExpressionsjson();
if (jsonstring.isEmpty()) {
indexSize = getSortedCatalogItems(index.getColumns(), "index").size();
} else {
try {
indexSize = A... | [
"public",
"static",
"int",
"getCatalogIndexSize",
"(",
"Index",
"index",
")",
"{",
"int",
"indexSize",
"=",
"0",
";",
"String",
"jsonstring",
"=",
"index",
".",
"getExpressionsjson",
"(",
")",
";",
"if",
"(",
"jsonstring",
".",
"isEmpty",
"(",
")",
")",
... | -- if the index is an expression index, return number of expressions used to create the index | [
"--",
"if",
"the",
"index",
"is",
"an",
"expression",
"index",
"return",
"number",
"of",
"expressions",
"used",
"to",
"create",
"the",
"index"
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L2824-L2839 | train | Get the size of the catalog index | Create a Java method that does the following: "Get the size of the catalog index". | Of course, here is the Java code you requested:
```java
public static int getCatalogIndexSize(Index index) {
int indexSize = 0;
String jsonstring = index.getExpressionsjson();
if (jsonstring.isEmpty()) {
indexSize = getSortedCatalogItems(index.getColumns(), "index").size();
... | |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/DateTimeUtil.java | DateTimeUtil.localDateTimeUTC | public static LocalDateTime localDateTimeUTC( long millis ) {
CheckArg.isPositive(millis, "millis");
return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC);
} | java | public static LocalDateTime localDateTimeUTC( long millis ) {
CheckArg.isPositive(millis, "millis");
return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC);
} | [
"public",
"static",
"LocalDateTime",
"localDateTimeUTC",
"(",
"long",
"millis",
")",
"{",
"CheckArg",
".",
"isPositive",
"(",
"millis",
",",
"\"millis\"",
")",
";",
"return",
"LocalDateTime",
".",
"ofInstant",
"(",
"Instant",
".",
"ofEpochMilli",
"(",
"millis",
... | Creates a new UTC {@link LocalDateTime} instance based on the given millis value
@param millis a positive amount of millis
@return a {@link LocalDateTime} instance. | [
"Creates",
"a",
"new",
"UTC",
"{",
"@link",
"LocalDateTime",
"}",
"instance",
"based",
"on",
"the",
"given",
"millis",
"value"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/DateTimeUtil.java#L104-L107 | train | Create a LocalDateTime from the given millis. | Create a Java method that does the following: "Create a LocalDateTime from the given millis.". | Of course, here is the Java code you requested:
```java
public static LocalDateTime localDateTimeUTC( long millis ) {
CheckArg.isPositive(millis, "millis");
return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC);
}
```
Hope this helps! | |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getDayOfMonth | public static int getDayOfMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_MONTH);
} | java | public static int getDayOfMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_MONTH);
} | [
"public",
"static",
"int",
"getDayOfMonth",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",... | Get the day of month of the date
@param date date
@return day of month of the date | [
"Get",
"the",
"day",
"of",
"month",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L146-L150 | train | Get day of month. | Create a Java method that does the following: "Get day of month.". | Of course, here is the Java code you requested:
```java
public static int getDayOfMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_MONTH);
}
```
Hope this helps! | |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.saveReport | public static void saveReport(Report report, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
saveReport(report, fos);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
}... | java | public static void saveReport(Report report, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
saveReport(report, fos);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
}... | [
"public",
"static",
"void",
"saveReport",
"(",
"Report",
"report",
",",
"String",
"path",
")",
"{",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"path",
")",
";",
"saveReport",
"(",
"report",
",",
"... | Write a report object to a file at specified path
@param report
report object
@param path
file path | [
"Write",
"a",
"report",
"object",
"to",
"a",
"file",
"at",
"specified",
"path"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L211-L228 | train | Saves a report to a file. | Create a Java method that does the following: "Saves a report to a file.". | Of course, here is the Java code you requested:
```java
public static void saveReport(Report report, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
saveReport(report, fos);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally ... | |
JDBDT/jdbdt | src/main/java/org/jdbdt/JDBDT.java | JDBDT.assertInserted | @SafeVarargs
public static void assertInserted(String message, DataSet... dataSets) throws DBAssertionError {
multipleInsertAssertions(CallInfo.create(message), dataSets);
} | java | @SafeVarargs
public static void assertInserted(String message, DataSet... dataSets) throws DBAssertionError {
multipleInsertAssertions(CallInfo.create(message), dataSets);
} | [
"@",
"SafeVarargs",
"public",
"static",
"void",
"assertInserted",
"(",
"String",
"message",
",",
"DataSet",
"...",
"dataSets",
")",
"throws",
"DBAssertionError",
"{",
"multipleInsertAssertions",
"(",
"CallInfo",
".",
"create",
"(",
"message",
")",
",",
"dataSets",... | Assert that database changed only by insertion of given
data sets (error message variant).
@param message Assertion error message.
@param dataSets Data sets.
@throws DBAssertionError if the assertion fails.
@see #assertInserted(String,DataSet)
@since 1.2 | [
"Assert",
"that",
"database",
"changed",
"only",
"by",
"insertion",
"of",
"given",
"data",
"sets",
"(",
"error",
"message",
"variant",
")",
"."
] | 7e32845ad41dfbc5d6fd0fd561e3613697186df4 | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L546-L549 | train | Assert that multiple data sets are inserted. | Create a Java method that does the following: "Assert that multiple data sets are inserted.". | Of course, here is the Java code you requested:
```java
@SafeVarargs
public static void assertInserted(String message, DataSet... dataSets) throws DBAssertionError {
multipleInsertAssertions(CallInfo.create(message), dataSets);
}
```
Hope this helps! | |
pippo-java/pippo | pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java | InfinispanFactory.create | public static EmbeddedCacheManager create(long idleTime) {
Configuration configuration = new ConfigurationBuilder()
.expiration().maxIdle(idleTime, TimeUnit.SECONDS)
.build();
return new DefaultCacheManager(configuration);
} | java | public static EmbeddedCacheManager create(long idleTime) {
Configuration configuration = new ConfigurationBuilder()
.expiration().maxIdle(idleTime, TimeUnit.SECONDS)
.build();
return new DefaultCacheManager(configuration);
} | [
"public",
"static",
"EmbeddedCacheManager",
"create",
"(",
"long",
"idleTime",
")",
"{",
"Configuration",
"configuration",
"=",
"new",
"ConfigurationBuilder",
"(",
")",
".",
"expiration",
"(",
")",
".",
"maxIdle",
"(",
"idleTime",
",",
"TimeUnit",
".",
"SECONDS"... | Create cache manager with custom idle time.
@param idleTime idle time in seconds
@return cache manager | [
"Create",
"cache",
"manager",
"with",
"custom",
"idle",
"time",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java#L48-L53 | train | Create an EmbeddedCacheManager with idle time. | Create a Java method that does the following: "Create an EmbeddedCacheManager with idle time.". | Of course, here is the Java code you requested:
```java
public static EmbeddedCacheManager create(long idleTime) {
Configuration configuration = new ConfigurationBuilder()
.expiration().maxIdle(idleTime, TimeUnit.SECONDS)
.build();
return new DefaultCacheManager(configur... | |
reactor/reactor-core | reactor-core/src/main/java/reactor/core/publisher/Flux.java | Flux.expand | public final Flux<T> expand(Function<? super T, ? extends Publisher<? extends T>> expander) {
return expand(expander, Queues.SMALL_BUFFER_SIZE);
} | java | public final Flux<T> expand(Function<? super T, ? extends Publisher<? extends T>> expander) {
return expand(expander, Queues.SMALL_BUFFER_SIZE);
} | [
"public",
"final",
"Flux",
"<",
"T",
">",
"expand",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Publisher",
"<",
"?",
"extends",
"T",
">",
">",
"expander",
")",
"{",
"return",
"expand",
"(",
"expander",
",",
"Queues",
".",
"SMALL_B... | Recursively expand elements into a graph and emit all the resulting element using
a breadth-first traversal strategy.
<p>
That is: emit the values from this {@link Flux} first, then expand each at a first level of
recursion and emit all of the resulting values, then expand all of these at a second
level and so on..
<p>... | [
"Recursively",
"expand",
"elements",
"into",
"a",
"graph",
"and",
"emit",
"all",
"the",
"resulting",
"element",
"using",
"a",
"breadth",
"-",
"first",
"traversal",
"strategy",
".",
"<p",
">",
"That",
"is",
":",
"emit",
"the",
"values",
"from",
"this",
"{",... | df2eba4ab7d2393e1a942ce972c3307fbbd47ff9 | https://github.com/reactor/reactor-core/blob/df2eba4ab7d2393e1a942ce972c3307fbbd47ff9/reactor-core/src/main/java/reactor/core/publisher/Flux.java#L4538-L4540 | valid | Expand the input stream using the given expander. | Create a Java method that does the following: "Expand the input stream using the given expander.". | Of course, here is the Java code you requested:
```java
public final Flux<T> expand(Function<? super T, ? extends Publisher<? extends T>> expander) {
return expand(expander, Queues.SMALL_BUFFER_SIZE);
}
```
Hope this helps! | |
threerings/narya | core/src/main/java/com/threerings/crowd/server/PlaceManager.java | PlaceManager.applyToDelegates | public void applyToDelegates (DelegateOp op)
{
if (_delegates != null) {
for (int ii = 0, ll = _delegates.size(); ii < ll; ii++) {
PlaceManagerDelegate delegate = _delegates.get(ii);
if (op.shouldApply(delegate)) {
op.apply(delegate);
... | java | public void applyToDelegates (DelegateOp op)
{
if (_delegates != null) {
for (int ii = 0, ll = _delegates.size(); ii < ll; ii++) {
PlaceManagerDelegate delegate = _delegates.get(ii);
if (op.shouldApply(delegate)) {
op.apply(delegate);
... | [
"public",
"void",
"applyToDelegates",
"(",
"DelegateOp",
"op",
")",
"{",
"if",
"(",
"_delegates",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
",",
"ll",
"=",
"_delegates",
".",
"size",
"(",
")",
";",
"ii",
"<",
"ll",
";",
"ii",
"++... | Applies the supplied operation to this manager's registered delegates. | [
"Applies",
"the",
"supplied",
"operation",
"to",
"this",
"manager",
"s",
"registered",
"delegates",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceManager.java#L231-L241 | train | Apply the given operation to all delegates. | Create a Java method that does the following: "Apply the given operation to all delegates.". | Of course, here is the Java code you requested:
```java
public void applyToDelegates (DelegateOp op)
{
if (_delegates != null) {
for (int ii = 0, ll = _delegates.size(); ii < ll; ii++) {
PlaceManagerDelegate delegate = _delegates.get(ii);
if (op.shouldApply(deleg... | |
threerings/nenya | tools/src/main/java/com/threerings/media/tools/RecolorImage.java | RecolorImage.getAllRecolors | public BufferedImage getAllRecolors (boolean label)
{
if (_colRepo == null) {
return null;
}
ColorPository.ClassRecord colClass =
_colRepo.getClassRecord((String)_classList.getSelectedItem());
int classId = colClass.classId;
BufferedImage img = new B... | java | public BufferedImage getAllRecolors (boolean label)
{
if (_colRepo == null) {
return null;
}
ColorPository.ClassRecord colClass =
_colRepo.getClassRecord((String)_classList.getSelectedItem());
int classId = colClass.classId;
BufferedImage img = new B... | [
"public",
"BufferedImage",
"getAllRecolors",
"(",
"boolean",
"label",
")",
"{",
"if",
"(",
"_colRepo",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ColorPository",
".",
"ClassRecord",
"colClass",
"=",
"_colRepo",
".",
"getClassRecord",
"(",
"(",
"Str... | Gets an image with all recolorings of the selection colorization class. | [
"Gets",
"an",
"image",
"with",
"all",
"recolorings",
"of",
"the",
"selection",
"colorization",
"class",
"."
] | 3165a012fd859009db3367f87bd2a5b820cc760a | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tools/RecolorImage.java#L291-L329 | train | Get all recolors of the image. | Create a Java method that does the following: "Get all recolors of the image.". | Of course, here is the Java code you requested:
```java
public BufferedImage getAllRecolors (boolean label)
{
if (_colRepo == null) {
return null;
}
ColorPository.ClassRecord colClass =
_colRepo.getClassRecord((String)_classList.getSelectedItem());
int class... | |
nutzam/nutz | src/org/nutz/lang/Times.java | Times.secs | public static String secs(int sec) {
int hh = sec / 3600;
sec -= hh * 3600;
int mm = sec / 60;
sec -= mm * 60;
return Strings.alignRight(hh, 2, '0')
+ ":"
+ Strings.alignRight(mm, 2, '0')
+ ":"
+ Strings.alignRi... | java | public static String secs(int sec) {
int hh = sec / 3600;
sec -= hh * 3600;
int mm = sec / 60;
sec -= mm * 60;
return Strings.alignRight(hh, 2, '0')
+ ":"
+ Strings.alignRight(mm, 2, '0')
+ ":"
+ Strings.alignRi... | [
"public",
"static",
"String",
"secs",
"(",
"int",
"sec",
")",
"{",
"int",
"hh",
"=",
"sec",
"/",
"3600",
";",
"sec",
"-=",
"hh",
"*",
"3600",
";",
"int",
"mm",
"=",
"sec",
"/",
"60",
";",
"sec",
"-=",
"mm",
"*",
"60",
";",
"return",
"Strings",
... | 根据一个当天的绝对秒数,得到一个时间字符串,格式为 "HH:mm:ss"
@param sec
当天的绝对秒数
@return 时间字符串 | [
"根据一个当天的绝对秒数,得到一个时间字符串,格式为",
"HH",
":",
"mm",
":",
"ss"
] | a38694d5cbda2692e7931ab093c168487a6a4bfe | https://github.com/nutzam/nutz/blob/a38694d5cbda2692e7931ab093c168487a6a4bfe/src/org/nutz/lang/Times.java#L520-L531 | valid | Returns a string representation of the given time in seconds. | Create a Java method that does the following: "Returns a string representation of the given time in seconds.". | Of course, here is the Java code you requested:
```java
public static String secs(int sec) {
int hh = sec / 3600;
sec -= hh * 3600;
int mm = sec / 60;
sec -= mm * 60;
return Strings.alignRight(hh, 2, '0')
+ ":"
+ Strings.alignRight(mm, 2, '0'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.