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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/main/OpenCmsCore.java | OpenCmsCore.getInstance | protected static OpenCmsCore getInstance() {
if (m_errorCondition != null) {
// OpenCms is not properly initialized
throw new CmsInitException(m_errorCondition, false);
}
if (m_instance != null) {
return m_instance;
}
synchronized (LOCK) {
... | java | protected static OpenCmsCore getInstance() {
if (m_errorCondition != null) {
// OpenCms is not properly initialized
throw new CmsInitException(m_errorCondition, false);
}
if (m_instance != null) {
return m_instance;
}
synchronized (LOCK) {
... | [
"protected",
"static",
"OpenCmsCore",
"getInstance",
"(",
")",
"{",
"if",
"(",
"m_errorCondition",
"!=",
"null",
")",
"{",
"// OpenCms is not properly initialized",
"throw",
"new",
"CmsInitException",
"(",
"m_errorCondition",
",",
"false",
")",
";",
"}",
"if",
"("... | Returns the initialized OpenCms singleton instance.<p>
@return the initialized OpenCms singleton instance | [
"Returns",
"the",
"initialized",
"OpenCms",
"singleton",
"instance",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L355-L377 | train | Returns the OpenCmsCore instance. | Create a Java method that does the following: "Returns the OpenCmsCore instance.". | Of course, here is the Java code you requested:
```java
protected static OpenCmsCore getInstance() {
if (m_errorCondition != null) {
// OpenCms is not properly initialized
throw new CmsInitException(m_errorCondition, false);
}
if (m_instance != null) {
retu... | |
Waikato/moa | moa/src/main/java/moa/gui/experimentertab/TaskManagerTabPanel.java | TaskManagerTabPanel.main | public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (args.length != 0) {
... | java | public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (args.length != 0) {
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"UIManager",
".",
"setLookAndFeel",
"(",
"UIManager",
".",
"getSystemLookAndFeelClassName",
"(",
")",
")",
";",
"javax",
".",
"swing",
".",
"SwingUtilities",
".",
"i... | Main method
@param args | [
"Main",
"method"
] | 395982e5100bfe75a3a4d26115462ce2cc74cbb0 | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/TaskManagerTabPanel.java#L1345-L1366 | train | Main method for the ACS A ACS A ACS A ACS A DS A DS ACS A BA A BA A | Create a Java method that does the following: "Main method for the ACS A ACS A ACS A ACS A DS A DS ACS A BA A BA A". | Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run(... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java | SSLConfigManager.validationEnabled | public synchronized boolean validationEnabled() {
// enable/disable hostname verification
String validate = getGlobalProperty(Constants.SSLPROP_VALIDATION_ENABLED);
if (validate != null && (validate.equalsIgnoreCase("true") || validate.equalsIgnoreCase("yes"))) {
return true;
... | java | public synchronized boolean validationEnabled() {
// enable/disable hostname verification
String validate = getGlobalProperty(Constants.SSLPROP_VALIDATION_ENABLED);
if (validate != null && (validate.equalsIgnoreCase("true") || validate.equalsIgnoreCase("yes"))) {
return true;
... | [
"public",
"synchronized",
"boolean",
"validationEnabled",
"(",
")",
"{",
"// enable/disable hostname verification",
"String",
"validate",
"=",
"getGlobalProperty",
"(",
"Constants",
".",
"SSLPROP_VALIDATION_ENABLED",
")",
";",
"if",
"(",
"validate",
"!=",
"null",
"&&",
... | *
This method installs a hostname verification checker that defaults to not
check the hostname. If it does not install this hostname verification
checker, then any URL connections must have a certificate that matches the
host that sent it.
@return boolean
* | [
"*",
"This",
"method",
"installs",
"a",
"hostname",
"verification",
"checker",
"that",
"defaults",
"to",
"not",
"check",
"the",
"hostname",
".",
"If",
"it",
"does",
"not",
"install",
"this",
"hostname",
"verification",
"checker",
"then",
"any",
"URL",
"connect... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1393-L1402 | train | Returns true if validation is enabled. | Create a Java method that does the following: "Returns true if validation is enabled.". | Of course, here is the Java code you requested:
```java
public synchronized boolean validationEnabled() {
// enable/disable hostname verification
String validate = getGlobalProperty(Constants.SSLPROP_VALIDATION_ENABLED);
if (validate != null && (validate.equalsIgnoreCase("true") || validate.eq... | |
Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java | FileUtils.getFile | public static File getFile(Context context, Uri uri) {
if (uri != null) {
String path = getPath(context, uri);
if (path != null && isLocal(path)) {
return new File(path);
}
}
return null;
} | java | public static File getFile(Context context, Uri uri) {
if (uri != null) {
String path = getPath(context, uri);
if (path != null && isLocal(path)) {
return new File(path);
}
}
return null;
} | [
"public",
"static",
"File",
"getFile",
"(",
"Context",
"context",
",",
"Uri",
"uri",
")",
"{",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"String",
"path",
"=",
"getPath",
"(",
"context",
",",
"uri",
")",
";",
"if",
"(",
"path",
"!=",
"null",
"&&",
... | Convert Uri into File, if possible.
@return file A local file that the Uri was pointing to, or null if the
Uri is unsupported or pointed to a remote resource.
@see #getPath(Context, Uri)
@author paulburke | [
"Convert",
"Uri",
"into",
"File",
"if",
"possible",
"."
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java#L342-L350 | train | Gets the File object for the given URI. | Create a Java method that does the following: "Gets the File object for the given URI.". | Of course, here is the Java code you requested:
```java
public static File getFile(Context context, Uri uri) {
if (uri != null) {
String path = getPath(context, uri);
if (path != null && isLocal(path)) {
return new File(path);
}
}
return null;... | |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java | DetectDescribeAssociate.pruneTracks | private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) {
if( unassociated.size > maxInactiveTracks ) {
// make the first N elements the ones which will be dropped
int numDrop = unassociated.size-maxInactiveTracks;
for (int i = 0; i < numDrop; i++) {
int selected = rand.nextInt(unas... | java | private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) {
if( unassociated.size > maxInactiveTracks ) {
// make the first N elements the ones which will be dropped
int numDrop = unassociated.size-maxInactiveTracks;
for (int i = 0; i < numDrop; i++) {
int selected = rand.nextInt(unas... | [
"private",
"void",
"pruneTracks",
"(",
"SetTrackInfo",
"<",
"Desc",
">",
"info",
",",
"GrowQueue_I32",
"unassociated",
")",
"{",
"if",
"(",
"unassociated",
".",
"size",
">",
"maxInactiveTracks",
")",
"{",
"// make the first N elements the ones which will be dropped",
... | If there are too many unassociated tracks, randomly select some of those tracks and drop them | [
"If",
"there",
"are",
"too",
"many",
"unassociated",
"tracks",
"randomly",
"select",
"some",
"of",
"those",
"tracks",
"and",
"drop",
"them"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java#L174-L192 | train | Prune the unassociated tracks. | Create a Java method that does the following: "Prune the unassociated tracks.". | Of course, here is the Java code you requested:
```java
private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) {
if( unassociated.size > maxInactiveTracks ) {
// make the first N elements the ones which will be dropped
int numDrop = unassociated.size-maxInactiveTracks;
for (int i = 0;... | |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java | Blacklist.isUbiqueInBothContexts | private boolean isUbiqueInBothContexts(String id)
{
return context.containsKey(id) && context.get(id) == null;
} | java | private boolean isUbiqueInBothContexts(String id)
{
return context.containsKey(id) && context.get(id) == null;
} | [
"private",
"boolean",
"isUbiqueInBothContexts",
"(",
"String",
"id",
")",
"{",
"return",
"context",
".",
"containsKey",
"(",
"id",
")",
"&&",
"context",
".",
"get",
"(",
"id",
")",
"==",
"null",
";",
"}"
] | Checks if the given ID is blacklisted in both contexts together. | [
"Checks",
"if",
"the",
"given",
"ID",
"is",
"blacklisted",
"in",
"both",
"contexts",
"together",
"."
] | 2f93afa94426bf8b5afc2e0e61cd4b269a83288d | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L274-L277 | train | Checks if the given id is blacklisted in both contexts. | Create a Java method that does the following: "Checks if the given id is blacklisted in both contexts.". | Of course, here is the Java code you requested:
```java
private boolean isUbiqueInBothContexts(String id)
{
return context.containsKey(id) && context.get(id) == null;
}
```
Hope this helps! | |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/baserateservice/CreateProductPackageItemBaseRates.java | CreateProductPackageItemBaseRates.runExample | public static void runExample(
AdManagerServices adManagerServices,
AdManagerSession session,
long rateCardId,
long productPackageItemId)
throws RemoteException {
// Get the BaseRateService.
BaseRateServiceInterface baseRateService =
adManagerServices.get(session, BaseRateS... | java | public static void runExample(
AdManagerServices adManagerServices,
AdManagerSession session,
long rateCardId,
long productPackageItemId)
throws RemoteException {
// Get the BaseRateService.
BaseRateServiceInterface baseRateService =
adManagerServices.get(session, BaseRateS... | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
",",
"long",
"rateCardId",
",",
"long",
"productPackageItemId",
")",
"throws",
"RemoteException",
"{",
"// Get the BaseRateService.",
"BaseRateServic... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@param rateCardId the rate card ID to add the base rate to.
@param productPackageItemId the product package item to apply the base rate to.
@throws ApiException if the API request failed with one or more service errors.
@throw... | [
"Runs",
"the",
"example",
"."
] | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/baserateservice/CreateProductPackageItemBaseRates.java#L67-L102 | train | Example of creating a base rate for a product package item. | Create a Java method that does the following: "Example of creating a base rate for a product package item.". | Of course, here is the Java code you requested:
```java
public static void runExample(
AdManagerServices adManagerServices,
AdManagerSession session,
long rateCardId,
long productPackageItemId)
throws RemoteException {
// Get the BaseRateService.
BaseRateServiceInterface baseRateS... | |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/parse/ParserEvaluator.java | ParserEvaluator.processSample | @Override
protected final Parse processSample(final Parse reference) {
final String sentenceText = reference.getText();
final Parse[] predictions = ShiftReduceParser.parseLine(sentenceText,
this.parser, 1);
Parse prediction = null;
if (predictions.length > 0) {
prediction = prediction... | java | @Override
protected final Parse processSample(final Parse reference) {
final String sentenceText = reference.getText();
final Parse[] predictions = ShiftReduceParser.parseLine(sentenceText,
this.parser, 1);
Parse prediction = null;
if (predictions.length > 0) {
prediction = prediction... | [
"@",
"Override",
"protected",
"final",
"Parse",
"processSample",
"(",
"final",
"Parse",
"reference",
")",
"{",
"final",
"String",
"sentenceText",
"=",
"reference",
".",
"getText",
"(",
")",
";",
"final",
"Parse",
"[",
"]",
"predictions",
"=",
"ShiftReduceParse... | /*
(non-Javadoc)
@see opennlp.tools.util.eval.Evaluator#processSample(java.lang.Object) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | c817fa1e40e96ed15fc79d22c3a7c25f1a40d172 | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/ParserEvaluator.java#L102-L120 | train | Process a single sample of a CID. | Create a Java method that does the following: "Process a single sample of a CID.". | Of course, here is the Java code you requested:
```java
@Override
protected final Parse processSample(final Parse reference) {
final String sentenceText = reference.getText();
final Parse[] predictions = ShiftReduceParser.parseLine(sentenceText,
this.parser, 1);
Parse prediction = null;
if... | |
diegossilveira/jcors | src/main/java/org/jcors/web/ActualRequestHandler.java | ActualRequestHandler.checkOriginHeader | private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) {
String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER);
Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header");
String[] origins = originHeader.split(" ");
for (String origin... | java | private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) {
String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER);
Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header");
String[] origins = originHeader.split(" ");
for (String origin... | [
"private",
"String",
"checkOriginHeader",
"(",
"HttpServletRequest",
"request",
",",
"JCorsConfig",
"config",
")",
"{",
"String",
"originHeader",
"=",
"request",
".",
"getHeader",
"(",
"CorsHeaders",
".",
"ORIGIN_HEADER",
")",
";",
"Constraint",
".",
"ensureNotEmpty... | Checks if the origin is allowed
@param request
@param config | [
"Checks",
"if",
"the",
"origin",
"is",
"allowed"
] | cd56a9e2055d629baa42f93b27dd5615ced9632f | https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/web/ActualRequestHandler.java#L49-L61 | train | Check if the Origin header is present in the request. | Create a Java method that does the following: "Check if the Origin header is present in the request.". | Of course, here is the Java code you requested:
```java
private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) {
String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER);
Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header");
String[]... | |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/managers/impl/PresenceImpl.java | PresenceImpl.setCacheStatus | public PresenceImpl setCacheStatus(OnlineStatus status)
{
if (status == null)
throw new NullPointerException("Null OnlineStatus is not allowed.");
if (status == OnlineStatus.OFFLINE)
status = OnlineStatus.INVISIBLE;
this.status = status;
return this;
} | java | public PresenceImpl setCacheStatus(OnlineStatus status)
{
if (status == null)
throw new NullPointerException("Null OnlineStatus is not allowed.");
if (status == OnlineStatus.OFFLINE)
status = OnlineStatus.INVISIBLE;
this.status = status;
return this;
} | [
"public",
"PresenceImpl",
"setCacheStatus",
"(",
"OnlineStatus",
"status",
")",
"{",
"if",
"(",
"status",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Null OnlineStatus is not allowed.\"",
")",
";",
"if",
"(",
"status",
"==",
"OnlineStatus",
... | /* -- Impl Setters -- | [
"/",
"*",
"--",
"Impl",
"Setters",
"--"
] | 8ecbbe354d03f6bf448411bba573d0d4c268b560 | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/impl/PresenceImpl.java#L151-L159 | train | Sets the status of the subject. | Create a Java method that does the following: "Sets the status of the subject.". | Of course, here is the Java code you requested:
```java
public PresenceImpl setCacheStatus(OnlineStatus status)
{
if (status == null)
throw new NullPointerException("Null OnlineStatus is not allowed.");
if (status == OnlineStatus.OFFLINE)
status = OnlineStatus.INVISIBLE;
... | |
akka/akka-grpc | benchmark-java/src/main/java/akka/grpc/benchmarks/driver/LoadClient.java | LoadClient.shutdownNow | void shutdownNow() {
shutdown = true;
for (int i = 0; i < clients.length; i++) {
clients[i].close();
}
fixedThreadPool.shutdownNow();
system.terminate();
} | java | void shutdownNow() {
shutdown = true;
for (int i = 0; i < clients.length; i++) {
clients[i].close();
}
fixedThreadPool.shutdownNow();
system.terminate();
} | [
"void",
"shutdownNow",
"(",
")",
"{",
"shutdown",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"clients",
".",
"length",
";",
"i",
"++",
")",
"{",
"clients",
"[",
"i",
"]",
".",
"close",
"(",
")",
";",
"}",
"fixedThreadPoo... | Shutdown the scenario as cleanly as possible. | [
"Shutdown",
"the",
"scenario",
"as",
"cleanly",
"as",
"possible",
"."
] | 62d275a47013d995a9c7dae8ad47c4dcb36f7408 | https://github.com/akka/akka-grpc/blob/62d275a47013d995a9c7dae8ad47c4dcb36f7408/benchmark-java/src/main/java/akka/grpc/benchmarks/driver/LoadClient.java#L227-L234 | train | Shutdown all the services. | Create a Java method that does the following: "Shutdown all the services.". | Of course, here is the Java code you requested:
```java
void shutdownNow() {
shutdown = true;
for (int i = 0; i < clients.length; i++) {
clients[i].close();
}
fixedThreadPool.shutdownNow();
system.terminate();
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java | RecommendedElasticPoolsInner.getAsync | public ServiceFuture<RecommendedElasticPoolInner> getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback<RecommendedElasticPoolInner> serviceCallback) {
return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, recommende... | java | public ServiceFuture<RecommendedElasticPoolInner> getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback<RecommendedElasticPoolInner> serviceCallback) {
return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, recommende... | [
"public",
"ServiceFuture",
"<",
"RecommendedElasticPoolInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
",",
"final",
"ServiceCallback",
"<",
"RecommendedElasticPoolInner",
">",
"serviceCa... | Gets a recommented elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the recommended elastic pool to be re... | [
"Gets",
"a",
"recommented",
"elastic",
"pool",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java#L94-L96 | train | Gets a recommended elastic pool. | Create a Java method that does the following: "Gets a recommended elastic pool.". | Of course, here is the Java code you requested:
```java
public ServiceFuture<RecommendedElasticPoolInner> getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback<RecommendedElasticPoolInner> serviceCallback) {
return ServiceFuture.fromResponse(getWithServi... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbours.java | Neighbours.removeRegisteredProxies | private void removeRegisteredProxies(Neighbour neighbour,
Transaction transaction,
boolean wasRecovered) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "remov... | java | private void removeRegisteredProxies(Neighbour neighbour,
Transaction transaction,
boolean wasRecovered) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "remov... | [
"private",
"void",
"removeRegisteredProxies",
"(",
"Neighbour",
"neighbour",
",",
"Transaction",
"transaction",
",",
"boolean",
"wasRecovered",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
... | Removes all the proxies associated with this Neighbour.
@param neighbour
@param transaction | [
"Removes",
"all",
"the",
"proxies",
"associated",
"with",
"this",
"Neighbour",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbours.java#L1002-L1085 | train | Remove all the registered proxies for this Neighbour. | Create a Java method that does the following: "Remove all the registered proxies for this Neighbour.". | Of course, here is the Java code you requested:
```java
private void removeRegisteredProxies(Neighbour neighbour,
Transaction transaction,
boolean wasRecovered) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabl... | |
robolectric/robolectric | shadows/framework/src/main/java/org/robolectric/shadows/ShadowSubscriptionManager.java | ShadowSubscriptionManager.setAvailableSubscriptionInfos | public void setAvailableSubscriptionInfos(SubscriptionInfo... infos) {
if (infos == null) {
setAvailableSubscriptionInfoList(ImmutableList.of());
} else {
setAvailableSubscriptionInfoList(Arrays.asList(infos));
}
} | java | public void setAvailableSubscriptionInfos(SubscriptionInfo... infos) {
if (infos == null) {
setAvailableSubscriptionInfoList(ImmutableList.of());
} else {
setAvailableSubscriptionInfoList(Arrays.asList(infos));
}
} | [
"public",
"void",
"setAvailableSubscriptionInfos",
"(",
"SubscriptionInfo",
"...",
"infos",
")",
"{",
"if",
"(",
"infos",
"==",
"null",
")",
"{",
"setAvailableSubscriptionInfoList",
"(",
"ImmutableList",
".",
"of",
"(",
")",
")",
";",
"}",
"else",
"{",
"setAva... | Sets the active list of {@link SubscriptionInfo}. This call internally triggers {@link
OnSubscriptionsChangedListener#onSubscriptionsChanged()} to all the listeners. | [
"Sets",
"the",
"active",
"list",
"of",
"{"
] | 4fa79a2c72f8abbf742ab920419653c207b41d62 | https://github.com/robolectric/robolectric/blob/4fa79a2c72f8abbf742ab920419653c207b41d62/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSubscriptionManager.java#L227-L233 | valid | Sets the available subscription infos. | Create a Java method that does the following: "Sets the available subscription infos.". | Of course, here is the Java code you requested:
```java
public void setAvailableSubscriptionInfos(SubscriptionInfo... infos) {
if (infos == null) {
setAvailableSubscriptionInfoList(ImmutableList.of());
} else {
setAvailableSubscriptionInfoList(Arrays.asList(infos));
}
}
```
Hope this helps! | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java | RepositoryImpl.importWorkspace | public void importWorkspace(String wsName, InputStream xmlStream) throws RepositoryException, IOException
{
createWorkspace(wsName);
SessionImpl sysSession = getSystemSession(wsName);
try
{
Map<String, Object> context = new HashMap<String, Object>();
context.put(ContentImpo... | java | public void importWorkspace(String wsName, InputStream xmlStream) throws RepositoryException, IOException
{
createWorkspace(wsName);
SessionImpl sysSession = getSystemSession(wsName);
try
{
Map<String, Object> context = new HashMap<String, Object>();
context.put(ContentImpo... | [
"public",
"void",
"importWorkspace",
"(",
"String",
"wsName",
",",
"InputStream",
"xmlStream",
")",
"throws",
"RepositoryException",
",",
"IOException",
"{",
"createWorkspace",
"(",
"wsName",
")",
";",
"SessionImpl",
"sysSession",
"=",
"getSystemSession",
"(",
"wsNa... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java#L495-L521 | train | Import workspace from XML stream. | Create a Java method that does the following: "Import workspace from XML stream.". | Of course, here is the Java code you requested:
```java
public void importWorkspace(String wsName, InputStream xmlStream) throws RepositoryException, IOException
{
createWorkspace(wsName);
SessionImpl sysSession = getSystemSession(wsName);
try
{
Map<String, Object> context = new Ha... | |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java | USerializedSet.getRange | public final boolean getRange(int rangeIndex, int[] range) {
if( rangeIndex<0) {
return false;
}
if(array==null){
array = new char[8];
}
if(range==null || range.length <2){
throw new IllegalArgumentException();
}
rangeIndex*=2; ... | java | public final boolean getRange(int rangeIndex, int[] range) {
if( rangeIndex<0) {
return false;
}
if(array==null){
array = new char[8];
}
if(range==null || range.length <2){
throw new IllegalArgumentException();
}
rangeIndex*=2; ... | [
"public",
"final",
"boolean",
"getRange",
"(",
"int",
"rangeIndex",
",",
"int",
"[",
"]",
"range",
")",
"{",
"if",
"(",
"rangeIndex",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"array",
"=",
"new",
... | Returns a range of characters contained in the given serialized
set.
@param rangeIndex a non-negative integer in the range <code>0..
getSerializedRangeCount()-1</code>
@param range variable to receive the data in the range
@return true if rangeIndex is valid, otherwise false | [
"Returns",
"a",
"range",
"of",
"characters",
"contained",
"in",
"the",
"given",
"serialized",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java#L104-L143 | train | Get the range of the sequence of bytes in the sequence. | Create a Java method that does the following: "Get the range of the sequence of bytes in the sequence.". | Of course, here is the Java code you requested:
```java
public final boolean getRange(int rangeIndex, int[] range) {
if( rangeIndex<0) {
return false;
}
if(array==null){
array = new char[8];
}
if(range==null || range.length <2){
throw new Ille... | |
oblac/jodd | jodd-joy/src/main/java/jodd/joy/i18n/I18nInterceptor.java | I18nInterceptor.getActionClassName | protected String getActionClassName(final Object action) {
Class clazz = action.getClass();
clazz = ProxettaUtil.resolveTargetClass(clazz);
return clazz.getName();
} | java | protected String getActionClassName(final Object action) {
Class clazz = action.getClass();
clazz = ProxettaUtil.resolveTargetClass(clazz);
return clazz.getName();
} | [
"protected",
"String",
"getActionClassName",
"(",
"final",
"Object",
"action",
")",
"{",
"Class",
"clazz",
"=",
"action",
".",
"getClass",
"(",
")",
";",
"clazz",
"=",
"ProxettaUtil",
".",
"resolveTargetClass",
"(",
"clazz",
")",
";",
"return",
"clazz",
".",... | Returns correct action class name. Detects Proxetta classes. | [
"Returns",
"correct",
"action",
"class",
"name",
".",
"Detects",
"Proxetta",
"classes",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-joy/src/main/java/jodd/joy/i18n/I18nInterceptor.java#L52-L58 | test | Gets the action class name. | Create a Java method that does the following: "Gets the action class name.". | Of course, here is the Java code you requested:
```java
protected String getActionClassName(final Object action) {
Class clazz = action.getClass();
clazz = ProxettaUtil.resolveTargetClass(clazz);
return clazz.getName();
}
```
Hope this helps! | |
google/closure-compiler | src/com/google/javascript/jscomp/JsMessageExtractor.java | JsMessageExtractor.extractMessages | public <T extends SourceFile> Collection<JsMessage> extractMessages(Iterable<T> inputs) {
final Compiler compiler = new Compiler();
compiler.init(
ImmutableList.<SourceFile>of(),
ImmutableList.copyOf(inputs),
options);
compiler.runInCompilerThread(
() -> {
compiler.... | java | public <T extends SourceFile> Collection<JsMessage> extractMessages(Iterable<T> inputs) {
final Compiler compiler = new Compiler();
compiler.init(
ImmutableList.<SourceFile>of(),
ImmutableList.copyOf(inputs),
options);
compiler.runInCompilerThread(
() -> {
compiler.... | [
"public",
"<",
"T",
"extends",
"SourceFile",
">",
"Collection",
"<",
"JsMessage",
">",
"extractMessages",
"(",
"Iterable",
"<",
"T",
">",
"inputs",
")",
"{",
"final",
"Compiler",
"compiler",
"=",
"new",
"Compiler",
"(",
")",
";",
"compiler",
".",
"init",
... | Extracts JS messages from JavaScript code.
@param inputs the JavaScript source code inputs
@return the extracted messages collection
@throws RuntimeException if there are problems parsing the JS code or the
JS messages, or if two messages have the same key | [
"Extracts",
"JS",
"messages",
"from",
"JavaScript",
"code",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageExtractor.java#L123-L153 | train | Extract JS messages from the given input files. | Create a Java method that does the following: "Extract JS messages from the given input files.". | Of course, here is the Java code you requested:
```java
public <T extends SourceFile> Collection<JsMessage> extractMessages(Iterable<T> inputs) {
final Compiler compiler = new Compiler();
compiler.init(
ImmutableList.<SourceFile>of(),
ImmutableList.copyOf(inputs),
options);
compiler... | |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/internal/dsl/parsing/FileDefinitionParser.java | FileDefinitionParser.fillIn | private void fillIn() throws IOException {
BufferedReader br = null;
InputStream in = null;
try {
in = new FileInputStream( this.definitionFile.getEditedFile());
br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));
String line;
while(( line = nextLine( br )) != null ) {
... | java | private void fillIn() throws IOException {
BufferedReader br = null;
InputStream in = null;
try {
in = new FileInputStream( this.definitionFile.getEditedFile());
br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));
String line;
while(( line = nextLine( br )) != null ) {
... | [
"private",
"void",
"fillIn",
"(",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"br",
"=",
"null",
";",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"this",
".",
"definitionFile",
".",
"getEditedFile",
... | Parses the file and fills-in the resulting structure.
@throws IOException | [
"Parses",
"the",
"file",
"and",
"fills",
"-",
"in",
"the",
"resulting",
"structure",
"."
] | add54eead479effb138d0ff53a2d637902b82702 | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/internal/dsl/parsing/FileDefinitionParser.java#L574-L636 | train | Fills in the block list. | Create a Java method that does the following: "Fills in the block list.". | Of course, here is the Java code you requested:
```java
private void fillIn() throws IOException {
BufferedReader br = null;
InputStream in = null;
try {
in = new FileInputStream( this.definitionFile.getEditedFile());
br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));
Strin... | |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.scan | @NotNull
public <R> Stream<R> scan(
@Nullable final R identity,
@NotNull final BiFunction<? super R, ? super T, ? extends R> accumulator) {
Objects.requireNonNull(accumulator);
return new Stream<R>(params, new ObjScanIdentity<T, R>(iterator, identity, accumulator));
} | java | @NotNull
public <R> Stream<R> scan(
@Nullable final R identity,
@NotNull final BiFunction<? super R, ? super T, ? extends R> accumulator) {
Objects.requireNonNull(accumulator);
return new Stream<R>(params, new ObjScanIdentity<T, R>(iterator, identity, accumulator));
} | [
"@",
"NotNull",
"public",
"<",
"R",
">",
"Stream",
"<",
"R",
">",
"scan",
"(",
"@",
"Nullable",
"final",
"R",
"identity",
",",
"@",
"NotNull",
"final",
"BiFunction",
"<",
"?",
"super",
"R",
",",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"... | Returns a {@code Stream} produced by iterative application of a accumulation function
to an initial element {@code identity} and next element of the current stream.
Produces a {@code Stream} consisting of {@code identity}, {@code acc(identity, value1)},
{@code acc(acc(identity, value1), value2)}, etc.
<p>This is an in... | [
"Returns",
"a",
"{",
"@code",
"Stream",
"}",
"produced",
"by",
"iterative",
"application",
"of",
"a",
"accumulation",
"function",
"to",
"an",
"initial",
"element",
"{",
"@code",
"identity",
"}",
"and",
"next",
"element",
"of",
"the",
"current",
"stream",
"."... | f29fd57208c20252a4549b084d55ed082c3e58f0 | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L1277-L1283 | train | Scans the source stream for elements of a class with a given identity using a binary function. | Create a Java method that does the following: "Scans the source stream for elements of a class with a given identity using a binary function.". | Of course, here is the Java code you requested:
```java
@NotNull
public <R> Stream<R> scan(
@Nullable final R identity,
@NotNull final BiFunction<? super R, ? super T, ? extends R> accumulator) {
Objects.requireNonNull(accumulator);
return new Stream<R>(params, new ObjScanId... | |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractCIBase.java | AbstractCIBase.removeComputer | void removeComputer(final Computer computer) {
Queue.withLock(new Runnable() {
@Override
public void run() {
Map<Node,Computer> computers = getComputerMap();
for (Map.Entry<Node, Computer> e : computers.entrySet()) {
if (e.getValue() ==... | java | void removeComputer(final Computer computer) {
Queue.withLock(new Runnable() {
@Override
public void run() {
Map<Node,Computer> computers = getComputerMap();
for (Map.Entry<Node, Computer> e : computers.entrySet()) {
if (e.getValue() ==... | [
"void",
"removeComputer",
"(",
"final",
"Computer",
"computer",
")",
"{",
"Queue",
".",
"withLock",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"Map",
"<",
"Node",
",",
"Computer",
">",
"computers",
"... | /*package | [
"/",
"*",
"package"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractCIBase.java#L165-L179 | train | Remove a computer from the node. | Create a Java method that does the following: "Remove a computer from the node.". | Of course, here is the Java code you requested:
```java
void removeComputer(final Computer computer) {
Queue.withLock(new Runnable() {
@Override
public void run() {
Map<Node,Computer> computers = getComputerMap();
for (Map.Entry<Node, Computer> e : comput... | |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/vsm/VectorSpaceModel.java | VectorSpaceModel.processSpace | public void processSpace(Properties properties) {
try {
Transform transform = null;
// Load any optionally specifie transform class
String transformClass =
properties.getProperty(MATRIX_TRANSFORM_PROPERTY);
if (transformClass != null)
... | java | public void processSpace(Properties properties) {
try {
Transform transform = null;
// Load any optionally specifie transform class
String transformClass =
properties.getProperty(MATRIX_TRANSFORM_PROPERTY);
if (transformClass != null)
... | [
"public",
"void",
"processSpace",
"(",
"Properties",
"properties",
")",
"{",
"try",
"{",
"Transform",
"transform",
"=",
"null",
";",
"// Load any optionally specifie transform class",
"String",
"transformClass",
"=",
"properties",
".",
"getProperty",
"(",
"MATRIX_TRANSF... | {@inheritDoc}
@param properties {@inheritDoc} See this class's {@link VectorSpaceModel
javadoc} for the full list of supported properties. | [
"{",
"@inheritDoc",
"}"
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/vsm/VectorSpaceModel.java#L226-L247 | train | Process the matrix in the specified properties file. | Create a Java method that does the following: "Process the matrix in the specified properties file.". | Of course, here is the Java code you requested:
```java
public void processSpace(Properties properties) {
try {
Transform transform = null;
// Load any optionally specifie transform class
String transformClass =
properties.getProperty(MATRIX_TRANSFORM_PROPE... | |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java | TextBuilder.styledSpan | public TextBuilder styledSpan(final String text, final TextStyle ts) {
this.curParagraphBuilder.styledSpan(text, ts);
return this;
} | java | public TextBuilder styledSpan(final String text, final TextStyle ts) {
this.curParagraphBuilder.styledSpan(text, ts);
return this;
} | [
"public",
"TextBuilder",
"styledSpan",
"(",
"final",
"String",
"text",
",",
"final",
"TextStyle",
"ts",
")",
"{",
"this",
".",
"curParagraphBuilder",
".",
"styledSpan",
"(",
"text",
",",
"ts",
")",
";",
"return",
"this",
";",
"}"
] | Adds a TextStyle and text to the footer/header region specified by
region.<br>
The paragraph to be used is paragraph.<br>
The text will be shown in the order it was added with this function.
@param text The string with the text
@param ts The text style to be used
@return this for fluent style | [
"Adds",
"a",
"TextStyle",
"and",
"text",
"to",
"the",
"footer",
"/",
"header",
"region",
"specified",
"by",
"region",
".",
"<br",
">",
"The",
"paragraph",
"to",
"be",
"used",
"is",
"paragraph",
".",
"<br",
">",
"The",
"text",
"will",
"be",
"shown",
"in... | a034d173083ffa602dc525699b97f753082eaef9 | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java#L214-L217 | train | Styled span. | Create a Java method that does the following: "Styled span.". | Of course, here is the Java code you requested:
```java
public TextBuilder styledSpan(final String text, final TextStyle ts) {
this.curParagraphBuilder.styledSpan(text, ts);
return this;
}
```
Hope this helps! | |
eclipse/xtext-extras | org.eclipse.xtext.common.types/emf-gen/org/eclipse/xtext/common/types/impl/JvmInnerTypeReferenceImpl.java | JvmInnerTypeReferenceImpl.eIsSet | @Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TypesPackage.JVM_INNER_TYPE_REFERENCE__OUTER:
return outer != null;
}
return super.eIsSet(featureID);
} | java | @Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TypesPackage.JVM_INNER_TYPE_REFERENCE__OUTER:
return outer != null;
}
return super.eIsSet(featureID);
} | [
"@",
"Override",
"public",
"boolean",
"eIsSet",
"(",
"int",
"featureID",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"TypesPackage",
".",
"JVM_INNER_TYPE_REFERENCE__OUTER",
":",
"return",
"outer",
"!=",
"null",
";",
"}",
"return",
"super",
".",
"... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 451359541295323a29f5855e633f770cec02069a | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/emf-gen/org/eclipse/xtext/common/types/impl/JvmInnerTypeReferenceImpl.java#L187-L196 | train | Override eIsSet to check if the feature is set to a value. | Create a Java method that does the following: "Override eIsSet to check if the feature is set to a value.". | Of course, here is the Java code you requested:
```java
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TypesPackage.JVM_INNER_TYPE_REFERENCE__OUTER:
return outer != null;
}
return super.eIsSet(featureID);
}
```
Hope this helps! | |
threerings/nenya | core/src/main/java/com/threerings/util/KeyboardManager.java | KeyboardManager.ancestorRemoved | public void ancestorRemoved (AncestorEvent e)
{
lostFocus();
if (_window != null) {
_window.removeWindowFocusListener(this);
_window = null;
}
} | java | public void ancestorRemoved (AncestorEvent e)
{
lostFocus();
if (_window != null) {
_window.removeWindowFocusListener(this);
_window = null;
}
} | [
"public",
"void",
"ancestorRemoved",
"(",
"AncestorEvent",
"e",
")",
"{",
"lostFocus",
"(",
")",
";",
"if",
"(",
"_window",
"!=",
"null",
")",
"{",
"_window",
".",
"removeWindowFocusListener",
"(",
"this",
")",
";",
"_window",
"=",
"null",
";",
"}",
"}"
... | documentation inherited from interface AncestorListener | [
"documentation",
"inherited",
"from",
"interface",
"AncestorListener"
] | 3165a012fd859009db3367f87bd2a5b820cc760a | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L419-L427 | train | The ancestor removed event. | Create a Java method that does the following: "The ancestor removed event.". | Of course, here is the Java code you requested:
```java
public void ancestorRemoved (AncestorEvent e)
{
lostFocus();
if (_window != null) {
_window.removeWindowFocusListener(this);
_window = null;
}
}
```
Hope this helps! | |
mqlight/java-mqlight | mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/FFDC.java | FFDC.getThreadInfo | private static String getThreadInfo(Thread thread) {
final StringBuilder sb = new StringBuilder();
sb.append("Thread: ");
sb.append(thread.getId());
sb.append(" (");
sb.append(thread.getName());
sb.append(")");
sb.append(lineSeparator);
final StackTraceElement[] stack = thread.getSt... | java | private static String getThreadInfo(Thread thread) {
final StringBuilder sb = new StringBuilder();
sb.append("Thread: ");
sb.append(thread.getId());
sb.append(" (");
sb.append(thread.getName());
sb.append(")");
sb.append(lineSeparator);
final StackTraceElement[] stack = thread.getSt... | [
"private",
"static",
"String",
"getThreadInfo",
"(",
"Thread",
"thread",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"Thread: \"",
")",
";",
"sb",
".",
"append",
"(",
"thread",
".",
... | Gets and formats the specified thread's information.
@param thread The thread to obtain the information from.
@return A formatted string for the thread information. | [
"Gets",
"and",
"formats",
"the",
"specified",
"thread",
"s",
"information",
"."
] | a565dfa6044050826d1221697da9e3268b557aeb | https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/FFDC.java#L157-L194 | train | Get the thread info. | Create a Java method that does the following: "Get the thread info.". | Of course, here is the Java code you requested:
```java
private static String getThreadInfo(Thread thread) {
final StringBuilder sb = new StringBuilder();
sb.append("Thread: ");
sb.append(thread.getId());
sb.append(" (");
sb.append(thread.getName());
sb.append(")");
sb.append(lineSepar... | |
xmlunit/xmlunit | xmlunit-assertj/src/main/java/org/xmlunit/assertj/ValueAssert.java | ValueAssert.asDouble | public AbstractDoubleAssert<?> asDouble() {
isNotNull();
double value = 0;
try {
value = Double.parseDouble(actual);
} catch (NumberFormatException e) {
throwAssertionError(shouldBeConvertible(actual, "double"));
}
return AssertionsAdapter.assertT... | java | public AbstractDoubleAssert<?> asDouble() {
isNotNull();
double value = 0;
try {
value = Double.parseDouble(actual);
} catch (NumberFormatException e) {
throwAssertionError(shouldBeConvertible(actual, "double"));
}
return AssertionsAdapter.assertT... | [
"public",
"AbstractDoubleAssert",
"<",
"?",
">",
"asDouble",
"(",
")",
"{",
"isNotNull",
"(",
")",
";",
"double",
"value",
"=",
"0",
";",
"try",
"{",
"value",
"=",
"Double",
".",
"parseDouble",
"(",
"actual",
")",
";",
"}",
"catch",
"(",
"NumberFormatE... | Returns an {@code Assert} object that allows performing assertions on integer value of the {@link String} under test.
@throws AssertionError if the actual value is {@code null}.
@throws AssertionError if the actual value does not contain a parsable double | [
"Returns",
"an",
"{",
"@code",
"Assert",
"}",
"object",
"that",
"allows",
"performing",
"assertions",
"on",
"integer",
"value",
"of",
"the",
"{",
"@link",
"String",
"}",
"under",
"test",
"."
] | fe3d701d43f57ee83dcba336e4c1555619d3084b | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-assertj/src/main/java/org/xmlunit/assertj/ValueAssert.java#L94-L104 | train | Asserts that the actual value is a double. | Create a Java method that does the following: "Asserts that the actual value is a double.". | Of course, here is the Java code you requested:
```java
public AbstractDoubleAssert<?> asDouble() {
isNotNull();
double value = 0;
try {
value = Double.parseDouble(actual);
} catch (NumberFormatException e) {
throwAssertionError(shouldBeConvertible(actual, "doubl... | |
aws/aws-sdk-java | aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFindingFilters.java | AwsSecurityFindingFilters.setMalwareState | public void setMalwareState(java.util.Collection<StringFilter> malwareState) {
if (malwareState == null) {
this.malwareState = null;
return;
}
this.malwareState = new java.util.ArrayList<StringFilter>(malwareState);
} | java | public void setMalwareState(java.util.Collection<StringFilter> malwareState) {
if (malwareState == null) {
this.malwareState = null;
return;
}
this.malwareState = new java.util.ArrayList<StringFilter>(malwareState);
} | [
"public",
"void",
"setMalwareState",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"StringFilter",
">",
"malwareState",
")",
"{",
"if",
"(",
"malwareState",
"==",
"null",
")",
"{",
"this",
".",
"malwareState",
"=",
"null",
";",
"return",
";",
"}",
"t... | <p>
The state of the malware that was observed.
</p>
@param malwareState
The state of the malware that was observed. | [
"<p",
">",
"The",
"state",
"of",
"the",
"malware",
"that",
"was",
"observed",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFindingFilters.java#L2412-L2419 | train | Sets the value malwareState property. | Create a Java method that does the following: "Sets the value malwareState property.". | Of course, here is the Java code you requested:
```java
public void setMalwareState(java.util.Collection<StringFilter> malwareState) {
if (malwareState == null) {
this.malwareState = null;
return;
}
this.malwareState = new java.util.ArrayList<StringFilter>(malwareState)... | |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/Seconds.java | Seconds.ofHours | public static Seconds ofHours(int hours) {
if (hours == 0) {
return ZERO;
}
return new Seconds(Math.multiplyExact(hours, SECONDS_PER_HOUR));
} | java | public static Seconds ofHours(int hours) {
if (hours == 0) {
return ZERO;
}
return new Seconds(Math.multiplyExact(hours, SECONDS_PER_HOUR));
} | [
"public",
"static",
"Seconds",
"ofHours",
"(",
"int",
"hours",
")",
"{",
"if",
"(",
"hours",
"==",
"0",
")",
"{",
"return",
"ZERO",
";",
"}",
"return",
"new",
"Seconds",
"(",
"Math",
".",
"multiplyExact",
"(",
"hours",
",",
"SECONDS_PER_HOUR",
")",
")"... | Obtains a {@code Seconds} representing the number of seconds
equivalent to a number of hours.
<p>
The resulting amount will be second-based, with the number of seconds
equal to the number of hours multiplied by 3600.
@param hours the number of hours, positive or negative
@return the amount with the input hours conver... | [
"Obtains",
"a",
"{",
"@code",
"Seconds",
"}",
"representing",
"the",
"number",
"of",
"seconds",
"equivalent",
"to",
"a",
"number",
"of",
"hours",
".",
"<p",
">",
"The",
"resulting",
"amount",
"will",
"be",
"second",
"-",
"based",
"with",
"the",
"number",
... | e94ecd3592ef70e54d6eea21095239ea9ffbab78 | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/Seconds.java#L138-L143 | train | Gets Seconds of hours. | Create a Java method that does the following: "Gets Seconds of hours.". | Of course, here is the Java code you requested:
```java
public static Seconds ofHours(int hours) {
if (hours == 0) {
return ZERO;
}
return new Seconds(Math.multiplyExact(hours, SECONDS_PER_HOUR));
}
```
Hope this helps! | |
google/closure-compiler | src/com/google/javascript/rhino/jstype/PrototypeObjectType.java | PrototypeObjectType.isSubtype | private static boolean isSubtype(
ObjectType typeA,
RecordType typeB,
ImplCache implicitImplCache,
SubtypingMode subtypingMode) {
MatchStatus cached = implicitImplCache.checkCache(typeA, typeB);
if (cached != null) {
return cached.subtypeValue();
}
boolean result =
... | java | private static boolean isSubtype(
ObjectType typeA,
RecordType typeB,
ImplCache implicitImplCache,
SubtypingMode subtypingMode) {
MatchStatus cached = implicitImplCache.checkCache(typeA, typeB);
if (cached != null) {
return cached.subtypeValue();
}
boolean result =
... | [
"private",
"static",
"boolean",
"isSubtype",
"(",
"ObjectType",
"typeA",
",",
"RecordType",
"typeB",
",",
"ImplCache",
"implicitImplCache",
",",
"SubtypingMode",
"subtypingMode",
")",
"{",
"MatchStatus",
"cached",
"=",
"implicitImplCache",
".",
"checkCache",
"(",
"t... | Determines if typeA is a subtype of typeB | [
"Determines",
"if",
"typeA",
"is",
"a",
"subtype",
"of",
"typeB"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java#L433-L448 | train | Determine if the two records are of a subtype of the two records. | Create a Java method that does the following: "Determine if the two records are of a subtype of the two records.". | Of course, here is the Java code you requested:
```java
private static boolean isSubtype(
ObjectType typeA,
RecordType typeB,
ImplCache implicitImplCache,
SubtypingMode subtypingMode) {
MatchStatus cached = implicitImplCache.checkCache(typeA, typeB);
if (cached != null) {
return ... | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc4/impl/IfcFaceImpl.java | IfcFaceImpl.getHasTextureMaps | @SuppressWarnings("unchecked")
@Override
public EList<IfcTextureMap> getHasTextureMaps() {
return (EList<IfcTextureMap>) eGet(Ifc4Package.Literals.IFC_FACE__HAS_TEXTURE_MAPS, true);
} | java | @SuppressWarnings("unchecked")
@Override
public EList<IfcTextureMap> getHasTextureMaps() {
return (EList<IfcTextureMap>) eGet(Ifc4Package.Literals.IFC_FACE__HAS_TEXTURE_MAPS, true);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"EList",
"<",
"IfcTextureMap",
">",
"getHasTextureMaps",
"(",
")",
"{",
"return",
"(",
"EList",
"<",
"IfcTextureMap",
">",
")",
"eGet",
"(",
"Ifc4Package",
".",
"Literals",
".",
"... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 116803c3047d1b32217366757cee1bb3880fda63 | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/generated/org/bimserver/models/ifc4/impl/IfcFaceImpl.java#L93-L97 | train | Gets the value of the HasTextureMaps property. | Create a Java method that does the following: "Gets the value of the HasTextureMaps property.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
@Override
public EList<IfcTextureMap> getHasTextureMaps() {
return (EList<IfcTextureMap>) eGet(Ifc4Package.Literals.IFC_FACE__HAS_TEXTURE_MAPS, true);
}
```
Hope this helps! | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java program that gathers the source code of a web page, using only built-in Java libraries, and retrieve specific elements from the page. The program should also handle potential exceptions that may occur during the process. The URL of the web page should be passed as a command line argument to the program, an... | Here's a Java program that uses built-in Java libraries to gather the source code of a web page and retrieve specific elements from it. It handles potential exceptions that may occur during the process. You can pass the URL of the web page as a command line argument and specify the specific element to retrieve as an ad... | |||||||
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/migration/MigrateToExtensionSettings.java | MigrateToExtensionSettings.getFeedItemIdsFromArgument | private static Set<Long> getFeedItemIdsFromArgument(Function function) {
if (function.getLhsOperand().length == 1
&& function.getLhsOperand(0) instanceof RequestContextOperand) {
RequestContextOperand requestContextOperand =
(RequestContextOperand) function.getLhsOperand(0);
if (Reques... | java | private static Set<Long> getFeedItemIdsFromArgument(Function function) {
if (function.getLhsOperand().length == 1
&& function.getLhsOperand(0) instanceof RequestContextOperand) {
RequestContextOperand requestContextOperand =
(RequestContextOperand) function.getLhsOperand(0);
if (Reques... | [
"private",
"static",
"Set",
"<",
"Long",
">",
"getFeedItemIdsFromArgument",
"(",
"Function",
"function",
")",
"{",
"if",
"(",
"function",
".",
"getLhsOperand",
"(",
")",
".",
"length",
"==",
"1",
"&&",
"function",
".",
"getLhsOperand",
"(",
"0",
")",
"inst... | Gets the set of feed item IDs from the function if it is of the form:
<code>IN(FEED_ITEM_ID,{xxx,xxx})</code>. Otherwise, returns an empty set. | [
"Gets",
"the",
"set",
"of",
"feed",
"item",
"IDs",
"from",
"the",
"function",
"if",
"it",
"is",
"of",
"the",
"form",
":",
"<code",
">",
"IN",
"(",
"FEED_ITEM_ID",
"{",
"xxx",
"xxx",
"}",
")",
"<",
"/",
"code",
">",
".",
"Otherwise",
"returns",
"an"... | 967957cc4f6076514e3a7926fe653e4f1f7cc9c9 | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/migration/MigrateToExtensionSettings.java#L535-L551 | train | Get the feed item ids from the function argument | Create a Java method that does the following: "Get the feed item ids from the function argument". | Of course, here is the Java code you requested:
```java
private static Set<Long> getFeedItemIdsFromArgument(Function function) {
if (function.getLhsOperand().length == 1
&& function.getLhsOperand(0) instanceof RequestContextOperand) {
RequestContextOperand requestContextOperand =
(RequestCo... | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java | FileObjectReaderImpl.read | public long read(OutputStream stream, long length) throws IOException
{
if (stream instanceof FileOutputStream)
{
// use NIO
return channel.transferTo(0, length, ((FileOutputStream)stream).getChannel());
}
else
{
// bytes copy
ByteBuffer buf... | java | public long read(OutputStream stream, long length) throws IOException
{
if (stream instanceof FileOutputStream)
{
// use NIO
return channel.transferTo(0, length, ((FileOutputStream)stream).getChannel());
}
else
{
// bytes copy
ByteBuffer buf... | [
"public",
"long",
"read",
"(",
"OutputStream",
"stream",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"stream",
"instanceof",
"FileOutputStream",
")",
"{",
"// use NIO\r",
"return",
"channel",
".",
"transferTo",
"(",
"0",
",",
"length",... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java#L167-L189 | train | Reads a number of bytes from the underlying stream. | Create a Java method that does the following: "Reads a number of bytes from the underlying stream.". | Of course, here is the Java code you requested:
```java
public long read(OutputStream stream, long length) throws IOException
{
if (stream instanceof FileOutputStream)
{
// use NIO
return channel.transferTo(0, length, ((FileOutputStream)stream).getChannel());
}
else
... | |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java | OtpNode.deliver | boolean deliver(final OtpMsg m) {
OtpMbox mbox = null;
try {
final int t = m.type();
if (t == OtpMsg.regSendTag) {
final String name = m.getRecipientName();
/* special case for netKernel requests */
if (name.equals("net_kernel")) ... | java | boolean deliver(final OtpMsg m) {
OtpMbox mbox = null;
try {
final int t = m.type();
if (t == OtpMsg.regSendTag) {
final String name = m.getRecipientName();
/* special case for netKernel requests */
if (name.equals("net_kernel")) ... | [
"boolean",
"deliver",
"(",
"final",
"OtpMsg",
"m",
")",
"{",
"OtpMbox",
"mbox",
"=",
"null",
";",
"try",
"{",
"final",
"int",
"t",
"=",
"m",
".",
"type",
"(",
")",
";",
"if",
"(",
"t",
"==",
"OtpMsg",
".",
"regSendTag",
")",
"{",
"final",
"String... | /*
OtpCookedConnection delivers messages here return true if message was
delivered successfully, or false otherwise. | [
"/",
"*",
"OtpCookedConnection",
"delivers",
"messages",
"here",
"return",
"true",
"if",
"message",
"was",
"delivered",
"successfully",
"or",
"false",
"otherwise",
"."
] | ac6084fd83240355f72e94adbf303e57832d1fab | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java#L522-L548 | train | Delivers an OtpMsg to the other mbox. | Create a Java method that does the following: "Delivers an OtpMsg to the other mbox.". | Of course, here is the Java code you requested:
```java
boolean deliver(final OtpMsg m) {
OtpMbox mbox = null;
try {
final int t = m.type();
if (t == OtpMsg.regSendTag) {
final String name = m.getRecipientName();
/* special case for netKernel re... | |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java | ForegroundLinearLayout.setForegroundGravity | public void setForegroundGravity(int foregroundGravity) {
if (mForegroundGravity != foregroundGravity) {
if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
foregroundGravity |= Gravity.START;
}
if ((foregroundGravity & Gravity.VERTICAL... | java | public void setForegroundGravity(int foregroundGravity) {
if (mForegroundGravity != foregroundGravity) {
if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
foregroundGravity |= Gravity.START;
}
if ((foregroundGravity & Gravity.VERTICAL... | [
"public",
"void",
"setForegroundGravity",
"(",
"int",
"foregroundGravity",
")",
"{",
"if",
"(",
"mForegroundGravity",
"!=",
"foregroundGravity",
")",
"{",
"if",
"(",
"(",
"foregroundGravity",
"&",
"Gravity",
".",
"RELATIVE_HORIZONTAL_GRAVITY_MASK",
")",
"==",
"0",
... | Describes how the foreground is positioned. Defaults to START and TOP.
@param foregroundGravity See {@link Gravity}
@see #getForegroundGravity() | [
"Describes",
"how",
"the",
"foreground",
"is",
"positioned",
".",
"Defaults",
"to",
"START",
"and",
"TOP",
"."
] | 8644fab0f633477b1bb1dddd8147a9ef8bc03516 | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java#L94-L114 | train | Sets the foreground gravity. | Create a Java method that does the following: "Sets the foreground gravity.". | Of course, here is the Java code you requested:
```java
public void setForegroundGravity(int foregroundGravity) {
if (mForegroundGravity != foregroundGravity) {
if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
foregroundGravity |= Gravity.START;
... | |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java | HelpDoclet.includeInDocs | public boolean includeInDocs(final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) {
boolean hidden = !showHiddenFeatures() && clazz.isAnnotationPresent(Hidden.class);
return !hidden && JVMUtils.isConcrete(clazz);
} | java | public boolean includeInDocs(final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) {
boolean hidden = !showHiddenFeatures() && clazz.isAnnotationPresent(Hidden.class);
return !hidden && JVMUtils.isConcrete(clazz);
} | [
"public",
"boolean",
"includeInDocs",
"(",
"final",
"DocumentedFeature",
"documentedFeature",
",",
"final",
"ClassDoc",
"classDoc",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"boolean",
"hidden",
"=",
"!",
"showHiddenFeatures",
"(",
")",
"&&",
"c... | Determine if a particular class should be included in the output. This is called by the doclet
to determine if a DocWorkUnit should be created for this feature.
@param documentedFeature feature that is being considered for inclusion in the docs
@param classDoc for the class that is being considered for inclusion in th... | [
"Determine",
"if",
"a",
"particular",
"class",
"should",
"be",
"included",
"in",
"the",
"output",
".",
"This",
"is",
"called",
"by",
"the",
"doclet",
"to",
"determine",
"if",
"a",
"DocWorkUnit",
"should",
"be",
"created",
"for",
"this",
"feature",
"."
] | 7e56d725766b0da3baff23e79a31c3d01c3589c2 | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L361-L364 | train | Checks if the class is a class or a subclass of a class. | Create a Java method that does the following: "Checks if the class is a class or a subclass of a class.". | Of course, here is the Java code you requested:
```java
public boolean includeInDocs(final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) {
boolean hidden = !showHiddenFeatures() && clazz.isAnnotationPresent(Hidden.class);
return !hidden && JVMUtils.isConcrete(clazz... | |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/JSONEmitter.java | JSONEmitter.startArray | public JSONEmitter startArray(String name) {
checkComma();
write('"');
write(encodeString(name));
write("\":[");
push();
return this;
} | java | public JSONEmitter startArray(String name) {
checkComma();
write('"');
write(encodeString(name));
write("\":[");
push();
return this;
} | [
"public",
"JSONEmitter",
"startArray",
"(",
"String",
"name",
")",
"{",
"checkComma",
"(",
")",
";",
"write",
"(",
"'",
"'",
")",
";",
"write",
"(",
"encodeString",
"(",
"name",
")",
")",
";",
"write",
"(",
"\"\\\":[\"",
")",
";",
"push",
"(",
")",
... | Start a new array object using the given name. This emits the JSON text:
<pre>
"[name]":[
</pre>
@param name Name of new array object.
@return The same JSONEmitter object, which allows call chaining. | [
"Start",
"a",
"new",
"array",
"object",
"using",
"the",
"given",
"name",
".",
"This",
"emits",
"the",
"JSON",
"text",
":",
"<pre",
">",
"[",
"name",
"]",
":",
"[",
"<",
"/",
"pre",
">"
] | ad64d3c37922eefda68ec8869ef089c1ca604b70 | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/JSONEmitter.java#L171-L178 | train | Emit an array entry. | Create a Java method that does the following: "Emit an array entry.". | Of course, here is the Java code you requested:
```java
public JSONEmitter startArray(String name) {
checkComma();
write('"');
write(encodeString(name));
write("\":[");
push();
return this;
}
```
Hope this helps! | |
socialize/socialize-sdk-android | sdk/src/com/socialize/networks/facebook/v2/FacebookFacadeV2.java | FacebookFacadeV2.extendAccessToken | @Override
public void extendAccessToken(final Activity context, final SocializeAuthListener listener) {
try {
Facebook facebook = getFacebook(context);
if(isLinked(context)) {
if(facebook != null && !facebook.extendAccessTokenIfNeeded(context, new ServiceListener() {
@Override
public void onFaceb... | java | @Override
public void extendAccessToken(final Activity context, final SocializeAuthListener listener) {
try {
Facebook facebook = getFacebook(context);
if(isLinked(context)) {
if(facebook != null && !facebook.extendAccessTokenIfNeeded(context, new ServiceListener() {
@Override
public void onFaceb... | [
"@",
"Override",
"public",
"void",
"extendAccessToken",
"(",
"final",
"Activity",
"context",
",",
"final",
"SocializeAuthListener",
"listener",
")",
"{",
"try",
"{",
"Facebook",
"facebook",
"=",
"getFacebook",
"(",
"context",
")",
";",
"if",
"(",
"isLinked",
"... | /* (non-Javadoc)
@see com.socialize.networks.facebook.FacebookFacade#extendAccessToken(android.app.Activity, com.socialize.listener.SocializeAuthListener) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 23044d66c83718fe5c3f6f4b7b4033ac5b06fbee | https://github.com/socialize/socialize-sdk-android/blob/23044d66c83718fe5c3f6f4b7b4033ac5b06fbee/sdk/src/com/socialize/networks/facebook/v2/FacebookFacadeV2.java#L134-L264 | valid | Override the extendAccessToken method to perform the actual work of the Facebook access token. | Create a Java method that does the following: "Override the extendAccessToken method to perform the actual work of the Facebook access token.". | Of course, here is the Java code you requested:
```java
@Override
public void extendAccessToken(final Activity context, final SocializeAuthListener listener) {
try {
Facebook facebook = getFacebook(context);
if(isLinked(context)) {
if(facebook != null && !facebook.extendAccessTokenIfNeeded(context, new Se... | |
JodaOrg/joda-time | src/example/org/joda/example/time/DateTimePerformance.java | DateTimePerformance.checkJodaSetGetHour | private void checkJodaSetGetHour() {
int COUNT = COUNT_VERY_FAST;
// Is it fair to use only MutableDateTime here? You decide.
MutableDateTime dt = new MutableDateTime(GJChronology.getInstance());
for (int i = 0; i < AVERAGE; i++) {
start("Joda", "setGetHour");
for... | java | private void checkJodaSetGetHour() {
int COUNT = COUNT_VERY_FAST;
// Is it fair to use only MutableDateTime here? You decide.
MutableDateTime dt = new MutableDateTime(GJChronology.getInstance());
for (int i = 0; i < AVERAGE; i++) {
start("Joda", "setGetHour");
for... | [
"private",
"void",
"checkJodaSetGetHour",
"(",
")",
"{",
"int",
"COUNT",
"=",
"COUNT_VERY_FAST",
";",
"// Is it fair to use only MutableDateTime here? You decide.",
"MutableDateTime",
"dt",
"=",
"new",
"MutableDateTime",
"(",
"GJChronology",
".",
"getInstance",
"(",
")",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42 | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/example/org/joda/example/time/DateTimePerformance.java#L752-L765 | train | checkJodaSetGetHour Method. | Create a Java method that does the following: "checkJodaSetGetHour Method.". | Of course, here is the Java code you requested:
```java
private void checkJodaSetGetHour() {
int COUNT = COUNT_VERY_FAST;
// Is it fair to use only MutableDateTime here? You decide.
MutableDateTime dt = new MutableDateTime(GJChronology.getInstance());
for (int i = 0; i < AVERAGE; i++) {... | |
rupertlssmith/lojix | lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/printer/SourceClausePrinter.java | SourceClausePrinter.enterVariable | protected void enterVariable(Variable variable)
{
String showContextAs = interner.getVariableName(variable);
int delta = showContextAs.length();
addLineToRow(indent + showContextAs);
nextRow();
indent = indenter.generateTraceIndent(delta);
} | java | protected void enterVariable(Variable variable)
{
String showContextAs = interner.getVariableName(variable);
int delta = showContextAs.length();
addLineToRow(indent + showContextAs);
nextRow();
indent = indenter.generateTraceIndent(delta);
} | [
"protected",
"void",
"enterVariable",
"(",
"Variable",
"variable",
")",
"{",
"String",
"showContextAs",
"=",
"interner",
".",
"getVariableName",
"(",
"variable",
")",
";",
"int",
"delta",
"=",
"showContextAs",
".",
"length",
"(",
")",
";",
"addLineToRow",
"(",... | {@inheritDoc} | [
"{"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/printer/SourceClausePrinter.java#L101-L111 | test | Enter a variable in the context as table. | Create a Java method that does the following: "Enter a variable in the context as table.". | Of course, here is the Java code you requested:
```java
protected void enterVariable(Variable variable)
{
String showContextAs = interner.getVariableName(variable);
int delta = showContextAs.length();
addLineToRow(indent + showContextAs);
nextRow();
indent = indenter.gene... | |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java | ServiceDiscoveryManager.accountSupportsFeatures | public boolean accountSupportsFeatures(Collection<? extends CharSequence> features)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EntityBareJid accountJid = connection().getUser().asEntityBareJid();
return supportsFeatures(accountJid, f... | java | public boolean accountSupportsFeatures(Collection<? extends CharSequence> features)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EntityBareJid accountJid = connection().getUser().asEntityBareJid();
return supportsFeatures(accountJid, f... | [
"public",
"boolean",
"accountSupportsFeatures",
"(",
"Collection",
"<",
"?",
"extends",
"CharSequence",
">",
"features",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"EntityBareJid",
"acco... | Check if the given collection of features are supported by the connection account. This means that the discovery
information lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager.
@param features a collection of features
@return <code>true</code> if all features are support... | [
"Check",
"if",
"the",
"given",
"collection",
"of",
"features",
"are",
"supported",
"by",
"the",
"connection",
"account",
".",
"This",
"means",
"that",
"the",
"discovery",
"information",
"lookup",
"will",
"be",
"performed",
"on",
"the",
"bare",
"JID",
"of",
"... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java#L630-L634 | train | Returns true if the user supports the specified features. | Create a Java method that does the following: "Returns true if the user supports the specified features.". | Of course, here is the Java code you requested:
```java
public boolean accountSupportsFeatures(Collection<? extends CharSequence> features)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EntityBareJid accountJid = connection().getUser().asEntit... | |
diffplug/durian | src/com/diffplug/common/base/Either.java | Either.accept | public final void accept(Consumer<? super L> left, Consumer<? super R> right) {
if (isLeft()) {
left.accept(getLeft());
} else {
right.accept(getRight());
}
} | java | public final void accept(Consumer<? super L> left, Consumer<? super R> right) {
if (isLeft()) {
left.accept(getLeft());
} else {
right.accept(getRight());
}
} | [
"public",
"final",
"void",
"accept",
"(",
"Consumer",
"<",
"?",
"super",
"L",
">",
"left",
",",
"Consumer",
"<",
"?",
"super",
"R",
">",
"right",
")",
"{",
"if",
"(",
"isLeft",
"(",
")",
")",
"{",
"left",
".",
"accept",
"(",
"getLeft",
"(",
")",
... | Accepts either the left or the right consumer as appropriate. | [
"Accepts",
"either",
"the",
"left",
"or",
"the",
"right",
"consumer",
"as",
"appropriate",
"."
] | 10631a3480e5491eb6eb6ee06e752d8596914232 | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L77-L83 | train | Accepts the two consumers of this pair. | Create a Java method that does the following: "Accepts the two consumers of this pair.". | Of course, here is the Java code you requested:
```java
public final void accept(Consumer<? super L> left, Consumer<? super R> right) {
if (isLeft()) {
left.accept(getLeft());
} else {
right.accept(getRight());
}
}
```
Hope this helps! | |
igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.scheduleEmptyRequest | private void scheduleEmptyRequest(long delay) {
assertLocked();
if (delay < 0L) {
throw(new IllegalArgumentException(
"Empty request delay must be >= 0 (was: " + delay + ")"));
}
clearEmptyRequest();
if (!isWorking()) {
return;
... | java | private void scheduleEmptyRequest(long delay) {
assertLocked();
if (delay < 0L) {
throw(new IllegalArgumentException(
"Empty request delay must be >= 0 (was: " + delay + ")"));
}
clearEmptyRequest();
if (!isWorking()) {
return;
... | [
"private",
"void",
"scheduleEmptyRequest",
"(",
"long",
"delay",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"delay",
"<",
"0L",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Empty request delay must be >= 0 (was: \"",
"+",
"delay",
... | Schedule an empty request to be sent if no other requests are
sent in a reasonable amount of time. | [
"Schedule",
"an",
"empty",
"request",
"to",
"be",
"sent",
"if",
"no",
"other",
"requests",
"are",
"sent",
"in",
"a",
"reasonable",
"amount",
"of",
"time",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1310-L1333 | train | Schedule an empty request for transmission. | Create a Java method that does the following: "Schedule an empty request for transmission.". | Of course, here is the Java code you requested:
```java
private void scheduleEmptyRequest(long delay) {
assertLocked();
if (delay < 0L) {
throw(new IllegalArgumentException(
"Empty request delay must be >= 0 (was: " + delay + ")"));
}
clearEmptyRequest()... | |
finmath/finmath-lib | src/main/java6/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.sabrBerestyckiNormalVolatilityApproximation | public static double sabrBerestyckiNormalVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity)
{
// Apply displacement. Displaced model is just a shift on underlying and strike.
underlying += displacement;
strike += displ... | java | public static double sabrBerestyckiNormalVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity)
{
// Apply displacement. Displaced model is just a shift on underlying and strike.
underlying += displacement;
strike += displ... | [
"public",
"static",
"double",
"sabrBerestyckiNormalVolatilityApproximation",
"(",
"double",
"alpha",
",",
"double",
"beta",
",",
"double",
"rho",
",",
"double",
"nu",
",",
"double",
"displacement",
",",
"double",
"underlying",
",",
"double",
"strike",
",",
"double... | Return the implied normal volatility (Bachelier volatility) under a SABR model using the
approximation of Berestycki.
@param alpha initial value of the stochastic volatility process of the SABR model.
@param beta CEV parameter of the SABR model.
@param rho Correlation (leverages) of the stochastic volatility.
@param n... | [
"Return",
"the",
"implied",
"normal",
"volatility",
"(",
"Bachelier",
"volatility",
")",
"under",
"a",
"SABR",
"model",
"using",
"the",
"approximation",
"of",
"Berestycki",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L1092-L1120 | train | Sabr - Berestycki normal volatility approximation | Create a Java method that does the following: "Sabr - Berestycki normal volatility approximation". | Of course, here is the Java code you requested:
```java
public static double sabrBerestyckiNormalVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity)
{
// Apply displacement. Displaced model is just a shift on underlying an... | |
oxo42/stateless4j | src/main/java/com/github/oxo42/stateless4j/StateConfiguration.java | StateConfiguration.permitDynamicIf | public <TArg0> StateConfiguration<S, T> permitDynamicIf(TriggerWithParameters1<TArg0, T> trigger, final Func2<TArg0, S> destinationStateSelector, FuncBoolean guard) {
assert trigger != null : TRIGGER_IS_NULL;
assert destinationStateSelector != null : DESTINATION_STATE_SELECTOR_IS_NULL;
return pu... | java | public <TArg0> StateConfiguration<S, T> permitDynamicIf(TriggerWithParameters1<TArg0, T> trigger, final Func2<TArg0, S> destinationStateSelector, FuncBoolean guard) {
assert trigger != null : TRIGGER_IS_NULL;
assert destinationStateSelector != null : DESTINATION_STATE_SELECTOR_IS_NULL;
return pu... | [
"public",
"<",
"TArg0",
">",
"StateConfiguration",
"<",
"S",
",",
"T",
">",
"permitDynamicIf",
"(",
"TriggerWithParameters1",
"<",
"TArg0",
",",
"T",
">",
"trigger",
",",
"final",
"Func2",
"<",
"TArg0",
",",
"S",
">",
"destinationStateSelector",
",",
"FuncBo... | Accept the specified trigger and transition to the destination state, calculated dynamically by the supplied
function
@param trigger The accepted trigger
@param destinationStateSelector Function to calculate the state that the trigger will cause a transition to
@param guard Function... | [
"Accept",
"the",
"specified",
"trigger",
"and",
"transition",
"to",
"the",
"destination",
"state",
"calculated",
"dynamically",
"by",
"the",
"supplied",
"function"
] | 3dd512049f7920f492838f1e09fb7c5abfc6bbcf | https://github.com/oxo42/stateless4j/blob/3dd512049f7920f492838f1e09fb7c5abfc6bbcf/src/main/java/com/github/oxo42/stateless4j/StateConfiguration.java#L773-L787 | valid | Permit dynamic if. | Create a Java method that does the following: "Permit dynamic if.". | Of course, here is the Java code you requested:
```java
public <TArg0> StateConfiguration<S, T> permitDynamicIf(TriggerWithParameters1<TArg0, T> trigger, final Func2<TArg0, S> destinationStateSelector, FuncBoolean guard) {
assert trigger != null : TRIGGER_IS_NULL;
assert destinationStateSelector != nul... | |
QSFT/Doradus | doradus-jetty/src/main/java/com/dell/doradus/server/JettyWebServer.java | JettyWebServer.configureConnector | private ServerConnector configureConnector() {
ServerConnector connector = null;
if (m_tls) {
connector = createSSLConnector();
} else {
// Unsecured connector
connector = new ServerConnector(m_jettyServer);
}
if (m_restaddr != null) {
... | java | private ServerConnector configureConnector() {
ServerConnector connector = null;
if (m_tls) {
connector = createSSLConnector();
} else {
// Unsecured connector
connector = new ServerConnector(m_jettyServer);
}
if (m_restaddr != null) {
... | [
"private",
"ServerConnector",
"configureConnector",
"(",
")",
"{",
"ServerConnector",
"connector",
"=",
"null",
";",
"if",
"(",
"m_tls",
")",
"{",
"connector",
"=",
"createSSLConnector",
"(",
")",
";",
"}",
"else",
"{",
"// Unsecured connector",
"connector",
"="... | Create, configure, and return the ServerConnector object. | [
"Create",
"configure",
"and",
"return",
"the",
"ServerConnector",
"object",
"."
] | ad64d3c37922eefda68ec8869ef089c1ca604b70 | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-jetty/src/main/java/com/dell/doradus/server/JettyWebServer.java#L167-L182 | train | Configure the server connector. | Create a Java method that does the following: "Configure the server connector.". | Of course, here is the Java code you requested:
```java
private ServerConnector configureConnector() {
ServerConnector connector = null;
if (m_tls) {
connector = createSSLConnector();
} else {
// Unsecured connector
connector = new ServerConnector(m_jettyServ... | |
belaban/JGroups | src/org/jgroups/util/RequestTable.java | RequestTable.add | public long add(T element) {
lock.lock();
try {
long next=high+1;
if(next - low > capacity())
_grow(next-low);
int high_index=index(high);
buffer[high_index]=element;
return high++;
}
finally {
lock.u... | java | public long add(T element) {
lock.lock();
try {
long next=high+1;
if(next - low > capacity())
_grow(next-low);
int high_index=index(high);
buffer[high_index]=element;
return high++;
}
finally {
lock.u... | [
"public",
"long",
"add",
"(",
"T",
"element",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"long",
"next",
"=",
"high",
"+",
"1",
";",
"if",
"(",
"next",
"-",
"low",
">",
"capacity",
"(",
")",
")",
"_grow",
"(",
"next",
"-",
"low... | Adds a new element and returns the sequence number at which it was inserted. Advances the high
pointer and grows the buffer if needed.
@param element the element to be added. Must not be null or an exception will be thrown
@return the seqno at which element was added | [
"Adds",
"a",
"new",
"element",
"and",
"returns",
"the",
"sequence",
"number",
"at",
"which",
"it",
"was",
"inserted",
".",
"Advances",
"the",
"high",
"pointer",
"and",
"grows",
"the",
"buffer",
"if",
"needed",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L58-L71 | train | Add an element to the array. | Create a Java method that does the following: "Add an element to the array.". | Of course, here is the Java code you requested:
```java
public long add(T element) {
lock.lock();
try {
long next=high+1;
if(next - low > capacity())
_grow(next-low);
int high_index=index(high);
buffer[high_index]=element;
retu... | |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.skipElement | public static void skipElement(final XMLStreamReader reader) throws XMLStreamException, IOException {
if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) {
return;
}
final String namespace = reader.getNamespaceURI();
final String name = reader.getLocalName();
... | java | public static void skipElement(final XMLStreamReader reader) throws XMLStreamException, IOException {
if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) {
return;
}
final String namespace = reader.getNamespaceURI();
final String name = reader.getLocalName();
... | [
"public",
"static",
"void",
"skipElement",
"(",
"final",
"XMLStreamReader",
"reader",
")",
"throws",
"XMLStreamException",
",",
"IOException",
"{",
"if",
"(",
"reader",
".",
"getEventType",
"(",
")",
"!=",
"XMLStreamConstants",
".",
"START_ELEMENT",
")",
"{",
"r... | Method skipElement.
@param reader
XMLStreamReader
@throws XMLStreamException
if there is error skipping element
@throws IOException
if there is error skipping element | [
"Method",
"skipElement",
"."
] | 83c607044f64a7f6c005a67866c0ef7cb68d6e29 | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1392-L1412 | train | Skips the XML element. | Create a Java method that does the following: "Skips the XML element.". | Of course, here is the Java code you requested:
```java
public static void skipElement(final XMLStreamReader reader) throws XMLStreamException, IOException {
if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) {
return;
}
final String namespace = reader.getNamespaceURI();... | |
wildfly/wildfly | security/subsystem/src/main/java/org/jboss/as/security/plugins/JNDIBasedSecurityManagement.java | JNDIBasedSecurityManagement.getAuthorizationManager | public AuthorizationManager getAuthorizationManager(String securityDomain) {
AuthorizationManager am = null;
try {
am = authzMgrMap.get(securityDomain);
if (am == null) {
am = (AuthorizationManager) lookUpJNDI(securityDomain + "/authorizationMgr");
... | java | public AuthorizationManager getAuthorizationManager(String securityDomain) {
AuthorizationManager am = null;
try {
am = authzMgrMap.get(securityDomain);
if (am == null) {
am = (AuthorizationManager) lookUpJNDI(securityDomain + "/authorizationMgr");
... | [
"public",
"AuthorizationManager",
"getAuthorizationManager",
"(",
"String",
"securityDomain",
")",
"{",
"AuthorizationManager",
"am",
"=",
"null",
";",
"try",
"{",
"am",
"=",
"authzMgrMap",
".",
"get",
"(",
"securityDomain",
")",
";",
"if",
"(",
"am",
"==",
"n... | {@inheritDoc} | [
"{"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/security/subsystem/src/main/java/org/jboss/as/security/plugins/JNDIBasedSecurityManagement.java#L113-L125 | test | Get the AuthorizationManager for the given securityDomain. | Create a Java method that does the following: "Get the AuthorizationManager for the given securityDomain.". | Of course, here is the Java code you requested:
```java
public AuthorizationManager getAuthorizationManager(String securityDomain) {
AuthorizationManager am = null;
try {
am = authzMgrMap.get(securityDomain);
if (am == null) {
am = (AuthorizationManager) lookUpJN... | |
VoltDB/voltdb | src/frontend/org/voltdb/ClientAppBase.java | ClientAppBase.printLogStatic | protected static void printLogStatic(String className, String msg, Object...args) {
if (args != null) {
msg = String.format(msg, args);
}
String header = String.format("%s [%s] ",
ZonedDateTime.now().format(TIME_FORMAT),
className);
System.out... | java | protected static void printLogStatic(String className, String msg, Object...args) {
if (args != null) {
msg = String.format(msg, args);
}
String header = String.format("%s [%s] ",
ZonedDateTime.now().format(TIME_FORMAT),
className);
System.out... | [
"protected",
"static",
"void",
"printLogStatic",
"(",
"String",
"className",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"msg",
"=",
"String",
".",
"format",
"(",
"msg",
",",
"args",
")",
"... | The static method to print a log message to the console.
@param className Name of the class that prints this message.
@param msg The log message that needs to be printed.
@param args The arguments that may be needed for formatting the message. | [
"The",
"static",
"method",
"to",
"print",
"a",
"log",
"message",
"to",
"the",
"console",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ClientAppBase.java#L53-L63 | train | Print a static log message. | Create a Java method that does the following: "Print a static log message.". | Of course, here is the Java code you requested:
```java
protected static void printLogStatic(String className, String msg, Object...args) {
if (args != null) {
msg = String.format(msg, args);
}
String header = String.format("%s [%s] ",
ZonedDateTime.now().format(TIME... | |
google/guava | guava/src/com/google/common/primitives/ImmutableDoubleArray.java | ImmutableDoubleArray.copyOf | public static ImmutableDoubleArray copyOf(double[] values) {
return values.length == 0
? EMPTY
: new ImmutableDoubleArray(Arrays.copyOf(values, values.length));
} | java | public static ImmutableDoubleArray copyOf(double[] values) {
return values.length == 0
? EMPTY
: new ImmutableDoubleArray(Arrays.copyOf(values, values.length));
} | [
"public",
"static",
"ImmutableDoubleArray",
"copyOf",
"(",
"double",
"[",
"]",
"values",
")",
"{",
"return",
"values",
".",
"length",
"==",
"0",
"?",
"EMPTY",
":",
"new",
"ImmutableDoubleArray",
"(",
"Arrays",
".",
"copyOf",
"(",
"values",
",",
"values",
"... | Returns an immutable array containing the given values, in order. | [
"Returns",
"an",
"immutable",
"array",
"containing",
"the",
"given",
"values",
"in",
"order",
"."
] | 7155d12b70a2406fa84d94d4b8b3bc108e89abfd | https://github.com/google/guava/blob/7155d12b70a2406fa84d94d4b8b3bc108e89abfd/guava/src/com/google/common/primitives/ImmutableDoubleArray.java#L149-L153 | valid | Returns an immutable copy of the given double array. | Create a Java method that does the following: "Returns an immutable copy of the given double array.". | Of course, here is the Java code you requested:
```java
public static ImmutableDoubleArray copyOf(double[] values) {
return values.length == 0
? EMPTY
: new ImmutableDoubleArray(Arrays.copyOf(values, values.length));
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/xml/ParserFactory.java | ParserFactory.parseDocument | public static Document parseDocument(DocumentBuilder builder, EntityResolver entityResolver, ErrorHandler errorHandler, InputStream is) throws IOException, SAXException {
final DocumentBuilder docBuilder = builder;
final EntityResolver eResolver = entityResolver;
final ErrorHandler errHandler = ... | java | public static Document parseDocument(DocumentBuilder builder, EntityResolver entityResolver, ErrorHandler errorHandler, InputStream is) throws IOException, SAXException {
final DocumentBuilder docBuilder = builder;
final EntityResolver eResolver = entityResolver;
final ErrorHandler errHandler = ... | [
"public",
"static",
"Document",
"parseDocument",
"(",
"DocumentBuilder",
"builder",
",",
"EntityResolver",
"entityResolver",
",",
"ErrorHandler",
"errorHandler",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"final",
"DocumentBuilder"... | PQ76707 begin | [
"PQ76707",
"begin"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/xml/ParserFactory.java#L251-L281 | train | Parse a document from an input stream. | Create a Java method that does the following: "Parse a document from an input stream.". | Of course, here is the Java code you requested:
```java
public static Document parseDocument(DocumentBuilder builder, EntityResolver entityResolver, ErrorHandler errorHandler, InputStream is) throws IOException, SAXException {
final DocumentBuilder docBuilder = builder;
final EntityResolver eResolver =... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java | DefaultDelegationProvider.removeRoleToWarningMapping | public void removeRoleToWarningMapping(String appName) {
Map<String, Boolean> roleToWarningMap = roleToWarningMappingPerApp.get(appName);
if (roleToWarningMap != null) {
roleToWarningMap.clear();
}
roleToWarningMappingPerApp.remove(appName);
} | java | public void removeRoleToWarningMapping(String appName) {
Map<String, Boolean> roleToWarningMap = roleToWarningMappingPerApp.get(appName);
if (roleToWarningMap != null) {
roleToWarningMap.clear();
}
roleToWarningMappingPerApp.remove(appName);
} | [
"public",
"void",
"removeRoleToWarningMapping",
"(",
"String",
"appName",
")",
"{",
"Map",
"<",
"String",
",",
"Boolean",
">",
"roleToWarningMap",
"=",
"roleToWarningMappingPerApp",
".",
"get",
"(",
"appName",
")",
";",
"if",
"(",
"roleToWarningMap",
"!=",
"null... | Removes the role to warning mappings for a given application.
@param appName the name of the application for which the mappings belong to. | [
"Removes",
"the",
"role",
"to",
"warning",
"mappings",
"for",
"a",
"given",
"application",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProvider.java#L225-L231 | train | Remove the role - to - warning mapping for the given application. | Create a Java method that does the following: "Remove the role - to - warning mapping for the given application.". | Of course, here is the Java code you requested:
```java
public void removeRoleToWarningMapping(String appName) {
Map<String, Boolean> roleToWarningMap = roleToWarningMappingPerApp.get(appName);
if (roleToWarningMap != null) {
roleToWarningMap.clear();
}
roleToWarningMappingP... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Create a highly scalable and fault-tolerant web server in Java to handle a minimum of 1000 concurrent POST requests per second with heavy processing and large data payloads of at least 10MB each. Implement a custom encryption algorithm using multi-threading to encrypt and decrypt the data payloads before processing the... | To create a highly scalable and fault-tolerant web server in Java that can handle a minimum of 1000 concurrent POST requests per second with heavy processing and large data payloads, along with implementing a custom encryption algorithm, you can follow the steps below:
1. Choose a scalable and high-performance web ser... | |||||||
hawkular/hawkular-inventory | hawkular-inventory-rest-api/src/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java | LinkDeserializer.deserialize | @Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String tmp = jp.getText(); // {
validate(jp, tmp, "{");
jp.nextToken(); // skip over { to the rel
String rel = jp.getText();
validateText(jp, rel);
jp.nextToken(); // s... | java | @Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String tmp = jp.getText(); // {
validate(jp, tmp, "{");
jp.nextToken(); // skip over { to the rel
String rel = jp.getText();
validateText(jp, rel);
jp.nextToken(); // s... | [
"@",
"Override",
"public",
"Link",
"deserialize",
"(",
"JsonParser",
"jp",
",",
"DeserializationContext",
"ctxt",
")",
"throws",
"IOException",
"{",
"String",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"// {",
"validate",
"(",
"jp",
",",
"tmp",
",",
... | Non whitespace; could possibly be narrowed | [
"Non",
"whitespace",
";",
"could",
"possibly",
"be",
"narrowed"
] | f56dc10323dca21777feb5b609a9e9cc70ffaf62 | https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-rest-api/src/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java#L49-L76 | train | Deserialize a Link object from the JSON parser. | Create a Java method that does the following: "Deserialize a Link object from the JSON parser.". | Of course, here is the Java code you requested:
```java
@Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String tmp = jp.getText(); // {
validate(jp, tmp, "{");
jp.nextToken(); // skip over { to the rel
String rel = jp.getText();
... | |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java | ReferenceObjectCache.cleanNullReferences | public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
} | java | public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
} | [
"public",
"<",
"T",
">",
"void",
"cleanNullReferences",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Map",
"<",
"Object",
",",
"Reference",
"<",
"Object",
">",
">",
"objectMap",
"=",
"getMapForClass",
"(",
"clazz",
")",
";",
"if",
"(",
"objectMap",... | Run through the map and remove any references that have been null'd out by the GC. | [
"Run",
"through",
"the",
"map",
"and",
"remove",
"any",
"references",
"that",
"have",
"been",
"null",
"d",
"out",
"by",
"the",
"GC",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java#L150-L155 | train | Clean null references. | Create a Java method that does the following: "Clean null references.". | Of course, here is the Java code you requested:
```java
public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/transform/StartRestoreJobRequestMarshaller.java | StartRestoreJobRequestMarshaller.marshall | public void marshall(StartRestoreJobRequest startRestoreJobRequest, ProtocolMarshaller protocolMarshaller) {
if (startRestoreJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startRestoreJ... | java | public void marshall(StartRestoreJobRequest startRestoreJobRequest, ProtocolMarshaller protocolMarshaller) {
if (startRestoreJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startRestoreJ... | [
"public",
"void",
"marshall",
"(",
"StartRestoreJobRequest",
"startRestoreJobRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"startRestoreJobRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument pa... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/transform/StartRestoreJobRequestMarshaller.java#L52-L67 | train | marshalls the given parameter object. | Create a Java method that does the following: "marshalls the given parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(StartRestoreJobRequest startRestoreJobRequest, ProtocolMarshaller protocolMarshaller) {
if (startRestoreJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
tr... | |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryAPIImpl.java | ProducerRegistryAPIImpl.createIntervalList | private void createIntervalList(){
synchronized(intervalLock){
if (_cachedIntervalInfos!=null)
return;
List<Interval> intervals = intervalRegistry.getIntervals();
_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
for (Interval interval : intervals) {
_cachedIntervalInfos.add(ne... | java | private void createIntervalList(){
synchronized(intervalLock){
if (_cachedIntervalInfos!=null)
return;
List<Interval> intervals = intervalRegistry.getIntervals();
_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
for (Interval interval : intervals) {
_cachedIntervalInfos.add(ne... | [
"private",
"void",
"createIntervalList",
"(",
")",
"{",
"synchronized",
"(",
"intervalLock",
")",
"{",
"if",
"(",
"_cachedIntervalInfos",
"!=",
"null",
")",
"return",
";",
"List",
"<",
"Interval",
">",
"intervals",
"=",
"intervalRegistry",
".",
"getIntervals",
... | Creates the list of existing intervals. | [
"Creates",
"the",
"list",
"of",
"existing",
"intervals",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryAPIImpl.java#L187-L198 | train | Creates the list of intervals. | Create a Java method that does the following: "Creates the list of intervals.". | Of course, here is the Java code you requested:
```java
private void createIntervalList(){
synchronized(intervalLock){
if (_cachedIntervalInfos!=null)
return;
List<Interval> intervals = intervalRegistry.getIntervals();
_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
for (Interva... | |
G2G3Digital/substeps-framework | glossary/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java | SubstepsGlossaryMojo.saveJsonFile | private void saveJsonFile(final List<StepImplementationsDescriptor> classStepTags) {
Gson gson = new GsonBuilder().create();
final String json = gson.toJson(classStepTags);
writeOutputFile(json, "stepimplementations.json");
} | java | private void saveJsonFile(final List<StepImplementationsDescriptor> classStepTags) {
Gson gson = new GsonBuilder().create();
final String json = gson.toJson(classStepTags);
writeOutputFile(json, "stepimplementations.json");
} | [
"private",
"void",
"saveJsonFile",
"(",
"final",
"List",
"<",
"StepImplementationsDescriptor",
">",
"classStepTags",
")",
"{",
"Gson",
"gson",
"=",
"new",
"GsonBuilder",
"(",
")",
".",
"create",
"(",
")",
";",
"final",
"String",
"json",
"=",
"gson",
".",
"... | @param classStepTags | [
"@param",
"classStepTags"
] | c1ec6487e1673a7dae54b5e7b62a96f602cd280a | https://github.com/G2G3Digital/substeps-framework/blob/c1ec6487e1673a7dae54b5e7b62a96f602cd280a/glossary/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java#L212-L219 | train | Save the stepimplementations. json file. | Create a Java method that does the following: "Save the stepimplementations. json file.". | Of course, here is the Java code you requested:
```java
private void saveJsonFile(final List<StepImplementationsDescriptor> classStepTags) {
Gson gson = new GsonBuilder().create();
final String json = gson.toJson(classStepTags);
writeOutputFile(json, "stepimplementations.json");
}
```
H... | |
haifengl/smile | math/src/main/java/smile/sort/PriorityQueue.java | PriorityQueue.insert | public void insert(int v) {
pq[++n] = v;
qp[v] = n;
swim(n);
} | java | public void insert(int v) {
pq[++n] = v;
qp[v] = n;
swim(n);
} | [
"public",
"void",
"insert",
"(",
"int",
"v",
")",
"{",
"pq",
"[",
"++",
"n",
"]",
"=",
"v",
";",
"qp",
"[",
"v",
"]",
"=",
"n",
";",
"swim",
"(",
"n",
")",
";",
"}"
] | Insert a new item into queue.
@param v the index of item. | [
"Insert",
"a",
"new",
"item",
"into",
"queue",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/PriorityQueue.java#L132-L136 | train | Insert a new entry into the cache. | Create a Java method that does the following: "Insert a new entry into the cache.". | Of course, here is the Java code you requested:
```java
public void insert(int v) {
pq[++n] = v;
qp[v] = n;
swim(n);
}
```
Hope this helps! | |
ops4j/org.ops4j.pax.wicket | spi/springdm/src/main/java/org/ops4j/pax/wicket/spi/springdm/injection/spring/SpringBeanProxyTargetLocator.java | SpringBeanProxyTargetLocator.getApplicationContextFilter | @Override
protected String getApplicationContextFilter(String symbolicBundleName) {
return String.format("(&(%s=%s)(%s=%s))", Constants.BUNDLE_SYMBOLICNAME, symbolicBundleName,
Constants.OBJECTCLASS, ApplicationContext.class.getName());
} | java | @Override
protected String getApplicationContextFilter(String symbolicBundleName) {
return String.format("(&(%s=%s)(%s=%s))", Constants.BUNDLE_SYMBOLICNAME, symbolicBundleName,
Constants.OBJECTCLASS, ApplicationContext.class.getName());
} | [
"@",
"Override",
"protected",
"String",
"getApplicationContextFilter",
"(",
"String",
"symbolicBundleName",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"(&(%s=%s)(%s=%s))\"",
",",
"Constants",
".",
"BUNDLE_SYMBOLICNAME",
",",
"symbolicBundleName",
",",
"Constant... | {@inheritDoc} | [
"{"
] | ef7cb4bdf918e9e61ec69789b9c690567616faa9 | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/spi/springdm/src/main/java/org/ops4j/pax/wicket/spi/springdm/injection/spring/SpringBeanProxyTargetLocator.java#L89-L93 | train | Override to provide a filter for the application context. | Create a Java method that does the following: "Override to provide a filter for the application context.". | Of course, here is the Java code you requested:
```java
@Override
protected String getApplicationContextFilter(String symbolicBundleName) {
return String.format("(&(%s=%s)(%s=%s))", Constants.BUNDLE_SYMBOLICNAME, symbolicBundleName,
Constants.OBJECTCLASS, ApplicationContext.class.getName());
... | |
aws/aws-sdk-java | aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/AmazonRedshiftClient.java | AmazonRedshiftClient.revokeClusterSecurityGroupIngress | @Override
public ClusterSecurityGroup revokeClusterSecurityGroupIngress(RevokeClusterSecurityGroupIngressRequest request) {
request = beforeClientExecution(request);
return executeRevokeClusterSecurityGroupIngress(request);
} | java | @Override
public ClusterSecurityGroup revokeClusterSecurityGroupIngress(RevokeClusterSecurityGroupIngressRequest request) {
request = beforeClientExecution(request);
return executeRevokeClusterSecurityGroupIngress(request);
} | [
"@",
"Override",
"public",
"ClusterSecurityGroup",
"revokeClusterSecurityGroupIngress",
"(",
"RevokeClusterSecurityGroupIngressRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeRevokeClusterSecurityGroupIngress",
... | <p>
Revokes an ingress rule in an Amazon Redshift security group for a previously authorized IP range or Amazon EC2
security group. To add an ingress rule, see <a>AuthorizeClusterSecurityGroupIngress</a>. For information about
managing security groups, go to <a
href="https://docs.aws.amazon.com/redshift/latest/mgmt/wor... | [
"<p",
">",
"Revokes",
"an",
"ingress",
"rule",
"in",
"an",
"Amazon",
"Redshift",
"security",
"group",
"for",
"a",
"previously",
"authorized",
"IP",
"range",
"or",
"Amazon",
"EC2",
"security",
"group",
".",
"To",
"add",
"an",
"ingress",
"rule",
"see",
"<a",... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/AmazonRedshiftClient.java#L5737-L5741 | train | Revokes an Ingress cluster SecurityGroup. | Create a Java method that does the following: "Revokes an Ingress cluster SecurityGroup.". | Of course, here is the Java code you requested:
```java
@Override
public ClusterSecurityGroup revokeClusterSecurityGroupIngress(RevokeClusterSecurityGroupIngressRequest request) {
request = beforeClientExecution(request);
return executeRevokeClusterSecurityGroupIngress(request);
}
```
Hope thi... | |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java | XsdAsmAttributes.getAttributeList | private static XsdList getAttributeList(XsdAttribute attribute) {
return attribute.getXsdSimpleType() != null ? attribute.getXsdSimpleType().getList() : null;
} | java | private static XsdList getAttributeList(XsdAttribute attribute) {
return attribute.getXsdSimpleType() != null ? attribute.getXsdSimpleType().getList() : null;
} | [
"private",
"static",
"XsdList",
"getAttributeList",
"(",
"XsdAttribute",
"attribute",
")",
"{",
"return",
"attribute",
".",
"getXsdSimpleType",
"(",
")",
"!=",
"null",
"?",
"attribute",
".",
"getXsdSimpleType",
"(",
")",
".",
"getList",
"(",
")",
":",
"null",
... | Returns the {@link XsdList} of the {@link XsdAttribute} object.
@param attribute The {@link XsdAttribute} object.
@return The contained {@link XsdList} object or null if not present. | [
"Returns",
"the",
"{"
] | ccb78f9dd4b957ad5ac1ca349eaf24338c421e94 | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java#L360-L362 | train | Get the attribute list. | Create a Java method that does the following: "Get the attribute list.". | Of course, here is the Java code you requested:
```java
private static XsdList getAttributeList(XsdAttribute attribute) {
return attribute.getXsdSimpleType() != null ? attribute.getXsdSimpleType().getList() : null;
}
```
Hope this helps! | |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/SingleFilterAdapter.java | SingleFilterAdapter.adapt | public Filters.Filter adapt(FilterAdapterContext context, Filter hbaseFilter)
throws IOException {
T typedFilter = getTypedFilter(hbaseFilter);
return adapter.adapt(context, typedFilter);
} | java | public Filters.Filter adapt(FilterAdapterContext context, Filter hbaseFilter)
throws IOException {
T typedFilter = getTypedFilter(hbaseFilter);
return adapter.adapt(context, typedFilter);
} | [
"public",
"Filters",
".",
"Filter",
"adapt",
"(",
"FilterAdapterContext",
"context",
",",
"Filter",
"hbaseFilter",
")",
"throws",
"IOException",
"{",
"T",
"typedFilter",
"=",
"getTypedFilter",
"(",
"hbaseFilter",
")",
";",
"return",
"adapter",
".",
"adapt",
"(",... | Adapt the untyped hbaseFilter instance into a RowFilter.
@param context a {@link com.google.cloud.bigtable.hbase.adapters.filters.FilterAdapterContext} object.
@param hbaseFilter a {@link org.apache.hadoop.hbase.filter.Filter} object.
@return a {@link com.google.bigtable.v2.RowFilter} object.
@throws java.io.IOExcepti... | [
"Adapt",
"the",
"untyped",
"hbaseFilter",
"instance",
"into",
"a",
"RowFilter",
"."
] | 53543f36e4d6f9ed1963640d91a35be2a2047656 | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/SingleFilterAdapter.java#L75-L79 | train | Adapt a HBASE Filter to a HBASE Filter. | Create a Java method that does the following: "Adapt a HBASE Filter to a HBASE Filter.". | Of course, here is the Java code you requested:
```java
public Filters.Filter adapt(FilterAdapterContext context, Filter hbaseFilter)
throws IOException {
T typedFilter = getTypedFilter(hbaseFilter);
return adapter.adapt(context, typedFilter);
}
```
Hope this helps! | |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java | ClassUtils.collectMethods | public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers, Class<?> limitExclusive) {
Set<Method> methods = new HashSet<Method>();
while (c != limitExclusive) {
for (Method f : c.getDeclaredMethods()) {
if (((f.getModifiers() & ... | java | public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers, Class<?> limitExclusive) {
Set<Method> methods = new HashSet<Method>();
while (c != limitExclusive) {
for (Method f : c.getDeclaredMethods()) {
if (((f.getModifiers() & ... | [
"public",
"static",
"Method",
"[",
"]",
"collectMethods",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"int",
"inclusiveModifiers",
",",
"int",
"exclusiveModifiers",
",",
"Class",
"<",
"?",
">",
"limitExclusive",
")",
"{",
"Set",
"<",
"Method",
">",
"methods",
... | Produces an array with all the methods of the specified class
@param c The class specified
@param inclusiveModifiers An int indicating the {@link Modifier}s that may be applied
@param exclusiveModifiers An int indicating the {@link Modifier}s that must be excluded
@param limitExclusive Methods from this class or higher... | [
"Produces",
"an",
"array",
"with",
"all",
"the",
"methods",
"of",
"the",
"specified",
"class"
] | d55d0238395f0cb900531f1f08b4b2d87fa9a4f6 | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java#L284-L298 | train | Collect methods from a class. | Create a Java method that does the following: "Collect methods from a class.". | Of course, here is the Java code you requested:
```java
public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers, Class<?> limitExclusive) {
Set<Method> methods = new HashSet<Method>();
while (c != limitExclusive) {
for (Method f : c.getDecla... | |
square/okhttp | okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java | Transmitter.maybeReleaseConnection | private @Nullable IOException maybeReleaseConnection(@Nullable IOException e, boolean force) {
Socket socket;
Connection releasedConnection;
boolean callEnd;
synchronized (connectionPool) {
if (force && exchange != null) {
throw new IllegalStateException("cannot release connection while it... | java | private @Nullable IOException maybeReleaseConnection(@Nullable IOException e, boolean force) {
Socket socket;
Connection releasedConnection;
boolean callEnd;
synchronized (connectionPool) {
if (force && exchange != null) {
throw new IllegalStateException("cannot release connection while it... | [
"private",
"@",
"Nullable",
"IOException",
"maybeReleaseConnection",
"(",
"@",
"Nullable",
"IOException",
"e",
",",
"boolean",
"force",
")",
"{",
"Socket",
"socket",
";",
"Connection",
"releasedConnection",
";",
"boolean",
"callEnd",
";",
"synchronized",
"(",
"con... | Release the connection if it is no longer needed. This is called after each exchange completes
and after the call signals that no more exchanges are expected.
<p>If the transmitter was canceled or timed out, this will wrap {@code e} in an exception that
provides that additional context. Otherwise {@code e} is returned... | [
"Release",
"the",
"connection",
"if",
"it",
"is",
"no",
"longer",
"needed",
".",
"This",
"is",
"called",
"after",
"each",
"exchange",
"completes",
"and",
"after",
"the",
"call",
"signals",
"that",
"no",
"more",
"exchanges",
"are",
"expected",
"."
] | a8c65a822dd6cadd2de7d115bf94adf312e67868 | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java#L279-L310 | train | Release the connection. | Create a Java method that does the following: "Release the connection.". | Of course, here is the Java code you requested:
```java
private @Nullable IOException maybeReleaseConnection(@Nullable IOException e, boolean force) {
Socket socket;
Connection releasedConnection;
boolean callEnd;
synchronized (connectionPool) {
if (force && exchange != null) {
throw new ... | |
cryptomator/cryptolib | src/main/java/org/cryptomator/cryptolib/Cryptors.java | Cryptors.cleartextSize | public static long cleartextSize(long ciphertextSize, Cryptor cryptor) {
checkArgument(ciphertextSize >= 0, "expected ciphertextSize to be positive, but was %s", ciphertextSize);
long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize();
long ciphertextChunkSize = cryptor.fileContentCryptor().ci... | java | public static long cleartextSize(long ciphertextSize, Cryptor cryptor) {
checkArgument(ciphertextSize >= 0, "expected ciphertextSize to be positive, but was %s", ciphertextSize);
long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize();
long ciphertextChunkSize = cryptor.fileContentCryptor().ci... | [
"public",
"static",
"long",
"cleartextSize",
"(",
"long",
"ciphertextSize",
",",
"Cryptor",
"cryptor",
")",
"{",
"checkArgument",
"(",
"ciphertextSize",
">=",
"0",
",",
"\"expected ciphertextSize to be positive, but was %s\"",
",",
"ciphertextSize",
")",
";",
"long",
... | Calculates the size of the cleartext resulting from the given ciphertext decrypted with the given cryptor.
@param ciphertextSize Length of encrypted payload. Not including the {@link FileHeader#getFilesize() length of the header}.
@param cryptor The cryptor which defines the cleartext/ciphertext ratio
@return Cleartex... | [
"Calculates",
"the",
"size",
"of",
"the",
"cleartext",
"resulting",
"from",
"the",
"given",
"ciphertext",
"decrypted",
"with",
"the",
"given",
"cryptor",
"."
] | 33bc881f6ee7d4924043ea6309efd2c063ec3638 | https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/Cryptors.java#L41-L54 | train | Returns the size of a cleartext. | Create a Java method that does the following: "Returns the size of a cleartext.". | Of course, here is the Java code you requested:
```java
public static long cleartextSize(long ciphertextSize, Cryptor cryptor) {
checkArgument(ciphertextSize >= 0, "expected ciphertextSize to be positive, but was %s", ciphertextSize);
long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize();
l... | |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigData.java | CmsADEConfigData.getActiveFormatters | public Map<CmsUUID, I_CmsFormatterBean> getActiveFormatters() {
CmsFormatterConfigurationCacheState cacheState = getCachedFormatters();
Map<CmsUUID, I_CmsFormatterBean> result = Maps.newHashMap(cacheState.getAutoEnabledFormatters());
applyAllFormatterChanges(result, cacheState);
return ... | java | public Map<CmsUUID, I_CmsFormatterBean> getActiveFormatters() {
CmsFormatterConfigurationCacheState cacheState = getCachedFormatters();
Map<CmsUUID, I_CmsFormatterBean> result = Maps.newHashMap(cacheState.getAutoEnabledFormatters());
applyAllFormatterChanges(result, cacheState);
return ... | [
"public",
"Map",
"<",
"CmsUUID",
",",
"I_CmsFormatterBean",
">",
"getActiveFormatters",
"(",
")",
"{",
"CmsFormatterConfigurationCacheState",
"cacheState",
"=",
"getCachedFormatters",
"(",
")",
";",
"Map",
"<",
"CmsUUID",
",",
"I_CmsFormatterBean",
">",
"result",
"=... | Gets the active external (non-schema) formatters for this sub-sitemap.<p>
@return the map of active external formatters by structure id | [
"Gets",
"the",
"active",
"external",
"(",
"non",
"-",
"schema",
")",
"formatters",
"for",
"this",
"sub",
"-",
"sitemap",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigData.java#L298-L304 | train | Returns a map of all formatters that are currently active. | Create a Java method that does the following: "Returns a map of all formatters that are currently active.". | Of course, here is the Java code you requested:
```java
public Map<CmsUUID, I_CmsFormatterBean> getActiveFormatters() {
CmsFormatterConfigurationCacheState cacheState = getCachedFormatters();
Map<CmsUUID, I_CmsFormatterBean> result = Maps.newHashMap(cacheState.getAutoEnabledFormatters());
appl... | |
landawn/AbacusUtil | src/com/landawn/abacus/util/Iterables.java | Iterables.powerSet | public static <E> Set<Set<E>> powerSet(Set<E> set) {
return new PowerSet<>(set);
} | java | public static <E> Set<Set<E>> powerSet(Set<E> set) {
return new PowerSet<>(set);
} | [
"public",
"static",
"<",
"E",
">",
"Set",
"<",
"Set",
"<",
"E",
">",
">",
"powerSet",
"(",
"Set",
"<",
"E",
">",
"set",
")",
"{",
"return",
"new",
"PowerSet",
"<>",
"(",
"set",
")",
";",
"}"
] | Note: copy from Google Guava under Apache License v2.
<br />
Returns the set of all possible subsets of {@code set}. For example,
{@code powerSet(ImmutableSet.of(1, 2))} returns the set {@code {{},
{1}, {2}, {1, 2}}}.
<p>Elements appear in these subsets in the same iteration order as they
appeared in the input set. T... | [
"Note",
":",
"copy",
"from",
"Google",
"Guava",
"under",
"Apache",
"License",
"v2",
".",
"<br",
"/",
">"
] | 544b7720175d15e9329f83dd22a8cc5fa4515e12 | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Iterables.java#L610-L612 | train | Create a set of sets that contains all the elements in the set. | Create a Java method that does the following: "Create a set of sets that contains all the elements in the set.". | Of course, here is the Java code you requested:
```java
public static <E> Set<Set<E>> powerSet(Set<E> set) {
return new PowerSet<>(set);
}
```
Hope this helps! | |
Impetus/Kundera | src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/schemamanager/OracleNoSQLSchemaManager.java | OracleNoSQLSchemaManager.createIndex | private void createIndex(String tableName, String indexName, String... fieldNames)
{
StringBuilder builder = new StringBuilder();
builder.append("CREATE INDEX IF NOT EXISTS ");
builder.append(indexName);
builder.append(" ON ");
builder.append(tableName);
builder.appen... | java | private void createIndex(String tableName, String indexName, String... fieldNames)
{
StringBuilder builder = new StringBuilder();
builder.append("CREATE INDEX IF NOT EXISTS ");
builder.append(indexName);
builder.append(" ON ");
builder.append(tableName);
builder.appen... | [
"private",
"void",
"createIndex",
"(",
"String",
"tableName",
",",
"String",
"indexName",
",",
"String",
"...",
"fieldNames",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"CREATE INDEX IF NOT ... | Creates the index.
@param tableName
the table name
@param indexName
the index name
@param fieldName
the field name | [
"Creates",
"the",
"index",
"."
] | 268958ab1ec09d14ec4d9184f0c8ded7a9158908 | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/schemamanager/OracleNoSQLSchemaManager.java#L379-L400 | train | Create an Index on the table. | Create a Java method that does the following: "Create an Index on the table.". | Of course, here is the Java code you requested:
```java
private void createIndex(String tableName, String indexName, String... fieldNames)
{
StringBuilder builder = new StringBuilder();
builder.append("CREATE INDEX IF NOT EXISTS ");
builder.append(indexName);
builder.append(" ON ");... | |
robeio/robe | robe-hibernate/src/main/java/io/robe/hibernate/criteria/api/criterion/Restrictions.java | Restrictions.in | public static Restriction in(String name, Object value){
return new Restriction(Operator.IN, name, value);
} | java | public static Restriction in(String name, Object value){
return new Restriction(Operator.IN, name, value);
} | [
"public",
"static",
"Restriction",
"in",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Restriction",
"(",
"Operator",
".",
"IN",
",",
"name",
",",
"value",
")",
";",
"}"
] | '|=' in list operator | [
"|",
"=",
"in",
"list",
"operator"
] | a0a8c7cebd1f70f78cf24a66a002859e937badfe | https://github.com/robeio/robe/blob/a0a8c7cebd1f70f78cf24a66a002859e937badfe/robe-hibernate/src/main/java/io/robe/hibernate/criteria/api/criterion/Restrictions.java#L112-L114 | test | Create a new IN restriction | Create a Java method that does the following: "Create a new IN restriction". | Of course, here is the Java code you requested:
```java
public static Restriction in(String name, Object value){
return new Restriction(Operator.IN, name, value);
}
```
Hope this helps! | |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/Op.java | Op.join | @SuppressWarnings("unchecked")
public static <T> String join(String separator, T... items) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < items.length; ++i) {
T item = items[i];
if (item instanceof Number) {
result.append(Op.str((Number) ite... | java | @SuppressWarnings("unchecked")
public static <T> String join(String separator, T... items) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < items.length; ++i) {
T item = items[i];
if (item instanceof Number) {
result.append(Op.str((Number) ite... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"String",
"join",
"(",
"String",
"separator",
",",
"T",
"...",
"items",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"i... | Joins a variadic number of elements by the given separator into a single
string. The elements are represented as strings utilizing the Op.str()
method on each element
@tparam T determines the type of elements in the array
@param separator is the string to add between the elements
@param items are the elements to join
... | [
"Joins",
"a",
"variadic",
"number",
"of",
"elements",
"by",
"the",
"given",
"separator",
"into",
"a",
"single",
"string",
".",
"The",
"elements",
"are",
"represented",
"as",
"strings",
"utilizing",
"the",
"Op",
".",
"str",
"()",
"method",
"on",
"each",
"el... | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/Op.java#L952-L967 | train | Join a sequence of numbers into a single string. | Create a Java method that does the following: "Join a sequence of numbers into a single string.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> String join(String separator, T... items) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < items.length; ++i) {
T item = items[i];
if (item instanceof Nu... | |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java | PerformanceTracker.addMemoryTransaction | public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) {
// we calculate bytes per microsecond now
val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0));
// we skip too small values
if (bw > 0)
... | java | public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) {
// we calculate bytes per microsecond now
val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0));
// we skip too small values
if (bw > 0)
... | [
"public",
"long",
"addMemoryTransaction",
"(",
"int",
"deviceId",
",",
"long",
"timeSpentNanos",
",",
"long",
"numberOfBytes",
",",
"@",
"NonNull",
"MemcpyDirection",
"direction",
")",
"{",
"// we calculate bytes per microsecond now",
"val",
"bw",
"=",
"(",
"long",
... | This method stores bandwidth used for given transaction.
PLEASE NOTE: Bandwidth is stored in per millisecond value.
@param deviceId device used for this transaction
@param timeSpent time spent on this transaction in nanoseconds
@param numberOfBytes number of bytes
@param direction direction for the given memory trans... | [
"This",
"method",
"stores",
"bandwidth",
"used",
"for",
"given",
"transaction",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java#L79-L88 | train | Add memory transaction to the cache. | Create a Java method that does the following: "Add memory transaction to the cache.". | Of course, here is the Java code you requested:
```java
public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) {
// we calculate bytes per microsecond now
val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0));
... | |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/alert/AlertPanel.java | AlertPanel.getSelectedAlertsImpl | private Set<Alert> getSelectedAlertsImpl(boolean allAlerts) {
TreePath[] paths = getTreeAlert().getSelectionPaths();
if (paths == null || paths.length == 0) {
return Collections.emptySet();
}
Set<Alert> alerts = new HashSet<>();
if (!allAlerts) {
DefaultMutableTreeNode alertNode = (DefaultMutab... | java | private Set<Alert> getSelectedAlertsImpl(boolean allAlerts) {
TreePath[] paths = getTreeAlert().getSelectionPaths();
if (paths == null || paths.length == 0) {
return Collections.emptySet();
}
Set<Alert> alerts = new HashSet<>();
if (!allAlerts) {
DefaultMutableTreeNode alertNode = (DefaultMutab... | [
"private",
"Set",
"<",
"Alert",
">",
"getSelectedAlertsImpl",
"(",
"boolean",
"allAlerts",
")",
"{",
"TreePath",
"[",
"]",
"paths",
"=",
"getTreeAlert",
"(",
")",
".",
"getSelectionPaths",
"(",
")",
";",
"if",
"(",
"paths",
"==",
"null",
"||",
"paths",
"... | Gets the selected alerts from the {@link #treeAlert alerts tree}.
@param allAlerts {@code true} if it should return all selected alerts, {@code false} to just return the first selected
alert.
@return a {@code Set} with the selected alerts, never {@code null}. | [
"Gets",
"the",
"selected",
"alerts",
"from",
"the",
"{",
"@link",
"#treeAlert",
"alerts",
"tree",
"}",
"."
] | 0cbe5121f2ae1ecca222513d182759210c569bec | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/alert/AlertPanel.java#L553-L578 | train | Returns the alerts that are selected in the tree. | Create a Java method that does the following: "Returns the alerts that are selected in the tree.". | Of course, here is the Java code you requested:
```java
private Set<Alert> getSelectedAlertsImpl(boolean allAlerts) {
TreePath[] paths = getTreeAlert().getSelectionPaths();
if (paths == null || paths.length == 0) {
return Collections.emptySet();
}
Set<Alert> alerts = new HashSet<>();
if (!allAlert... | |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java | MultiVertexGeometryImpl.queryInterval | @Override
public Envelope1D queryInterval(int semantics, int ordinate) {
Envelope1D env = new Envelope1D();
if (isEmptyImpl()) {
env.setEmpty();
return env;
}
_updateAllDirtyIntervals(true);
return m_envelope.queryInterval(semantics, ordinate);
} | java | @Override
public Envelope1D queryInterval(int semantics, int ordinate) {
Envelope1D env = new Envelope1D();
if (isEmptyImpl()) {
env.setEmpty();
return env;
}
_updateAllDirtyIntervals(true);
return m_envelope.queryInterval(semantics, ordinate);
} | [
"@",
"Override",
"public",
"Envelope1D",
"queryInterval",
"(",
"int",
"semantics",
",",
"int",
"ordinate",
")",
"{",
"Envelope1D",
"env",
"=",
"new",
"Envelope1D",
"(",
")",
";",
"if",
"(",
"isEmptyImpl",
"(",
")",
")",
"{",
"env",
".",
"setEmpty",
"(",
... | Checked vs. Jan 11, 2011 | [
"Checked",
"vs",
".",
"Jan",
"11",
"2011"
] | 494da8ec953d76e7c6072afbc081abfe48ff07cf | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java#L520-L530 | train | Query an Envelope1D for the specified semantics and ordinate. | Create a Java method that does the following: "Query an Envelope1D for the specified semantics and ordinate.". | Of course, here is the Java code you requested:
```java
@Override
public Envelope1D queryInterval(int semantics, int ordinate) {
Envelope1D env = new Envelope1D();
if (isEmptyImpl()) {
env.setEmpty();
return env;
}
_updateAllDirtyIntervals(true);
return m_envelope.queryInterval(semantics, ordinate);
... | |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java | ReflectionUtilImpl.getSubClass | protected Class<?> getSubClass(Class<?> ancestor, Class<?> descendant) {
if (ancestor == descendant) {
return null;
}
if (!ancestor.isAssignableFrom(descendant)) {
return null;
}
Class<?> child = descendant;
if (ancestor.isInterface()) {
while (true) {
for (Class<?> ch... | java | protected Class<?> getSubClass(Class<?> ancestor, Class<?> descendant) {
if (ancestor == descendant) {
return null;
}
if (!ancestor.isAssignableFrom(descendant)) {
return null;
}
Class<?> child = descendant;
if (ancestor.isInterface()) {
while (true) {
for (Class<?> ch... | [
"protected",
"Class",
"<",
"?",
">",
"getSubClass",
"(",
"Class",
"<",
"?",
">",
"ancestor",
",",
"Class",
"<",
"?",
">",
"descendant",
")",
"{",
"if",
"(",
"ancestor",
"==",
"descendant",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"ance... | This method walks up the {@link Class}-hierarchy from {@code descendant} up to {@code ancestor} and returns the
sub-class or sub-interface of {@code ancestor} on that hierarchy-path. <br>
Please note that if {@code ancestor} is an {@link Class#isInterface() interface}, the hierarchy may NOT be unique.
In such case it w... | [
"This",
"method",
"walks",
"up",
"the",
"{",
"@link",
"Class",
"}",
"-",
"hierarchy",
"from",
"{",
"@code",
"descendant",
"}",
"up",
"to",
"{",
"@code",
"ancestor",
"}",
"and",
"returns",
"the",
"sub",
"-",
"class",
"or",
"sub",
"-",
"interface",
"of",... | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java#L215-L243 | train | Get the sub - class of the ancestor class. | Create a Java method that does the following: "Get the sub - class of the ancestor class.". | Of course, here is the Java code you requested:
```java
protected Class<?> getSubClass(Class<?> ancestor, Class<?> descendant) {
if (ancestor == descendant) {
return null;
}
if (!ancestor.isAssignableFrom(descendant)) {
return null;
}
Class<?> child = descendant;
if (ancestor.isInt... | |
apache/incubator-atlas | typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java | DefaultTypeCache.putAll | @Override
public void putAll(Collection<IDataType> types) throws AtlasException {
for (IDataType type : types) {
assertValidType(type);
types_.put(type.getName(), type);
}
} | java | @Override
public void putAll(Collection<IDataType> types) throws AtlasException {
for (IDataType type : types) {
assertValidType(type);
types_.put(type.getName(), type);
}
} | [
"@",
"Override",
"public",
"void",
"putAll",
"(",
"Collection",
"<",
"IDataType",
">",
"types",
")",
"throws",
"AtlasException",
"{",
"for",
"(",
"IDataType",
"type",
":",
"types",
")",
"{",
"assertValidType",
"(",
"type",
")",
";",
"types_",
".",
"put",
... | /*
(non-Javadoc)
@see
org.apache.atlas.typesystem.types.cache.TypeCache#putAll(java
.util.Collection) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java#L253-L260 | train | Add all the type of the given collection of types to the set. | Create a Java method that does the following: "Add all the type of the given collection of types to the set.". | Of course, here is the Java code you requested:
```java
@Override
public void putAll(Collection<IDataType> types) throws AtlasException {
for (IDataType type : types) {
assertValidType(type);
types_.put(type.getName(), type);
}
}
```
Hope this helps! | |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/term/Function.java | Function.membership | @Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
for (InputVariable inputVariable : this.engine.g... | java | @Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
for (InputVariable inputVariable : this.engine.g... | [
"@",
"Override",
"public",
"double",
"membership",
"(",
"double",
"x",
")",
"{",
"if",
"(",
"this",
".",
"root",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"[function error] function <%s> not loaded.\"",
",... | Computes the membership function value of `x` at the root node. If the
engine has been set, the current values of the input variables and output
variables are added to the map of Function::variables. In addition, the
variable `x` will also be added to the map.
@param x
@return the membership function value of `x` at t... | [
"Computes",
"the",
"membership",
"function",
"value",
"of",
"x",
"at",
"the",
"root",
"node",
".",
"If",
"the",
"engine",
"has",
"been",
"set",
"the",
"current",
"values",
"of",
"the",
"input",
"variables",
"and",
"output",
"variables",
"are",
"added",
"to... | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/term/Function.java#L555-L571 | train | Evaluate the membership function. | Create a Java method that does the following: "Evaluate the membership function.". | Of course, here is the Java code you requested:
```java
@Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
... | |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/IllegalGuardedBy.java | IllegalGuardedBy.checkGuardedBy | public static void checkGuardedBy(boolean condition, String formatString, Object... formatArgs) {
if (!condition) {
throw new IllegalGuardedBy(String.format(formatString, formatArgs));
}
} | java | public static void checkGuardedBy(boolean condition, String formatString, Object... formatArgs) {
if (!condition) {
throw new IllegalGuardedBy(String.format(formatString, formatArgs));
}
} | [
"public",
"static",
"void",
"checkGuardedBy",
"(",
"boolean",
"condition",
",",
"String",
"formatString",
",",
"Object",
"...",
"formatArgs",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalGuardedBy",
"(",
"String",
".",
"format",
"... | Throws an {@link IllegalGuardedBy} exception if the given condition is false. | [
"Throws",
"an",
"{"
] | fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/IllegalGuardedBy.java#L37-L41 | train | Check if the condition is guarded by. | Create a Java method that does the following: "Check if the condition is guarded by.". | Of course, here is the Java code you requested:
```java
public static void checkGuardedBy(boolean condition, String formatString, Object... formatArgs) {
if (!condition) {
throw new IllegalGuardedBy(String.format(formatString, formatArgs));
}
}
```
Hope this helps! | |
h2oai/h2o-3 | h2o-core/src/main/java/hex/grid/GridSearch.java | GridSearch.startGridSearch | public static <MP extends Model.Parameters> Job<Grid> startGridSearch(
final Key<Grid> destKey,
final HyperSpaceWalker<MP, ?> hyperSpaceWalker
) {
// Compute key for destination object representing grid
MP params = hyperSpaceWalker.getParams();
Key<Grid> gridKey = destKey != null ? destKey
... | java | public static <MP extends Model.Parameters> Job<Grid> startGridSearch(
final Key<Grid> destKey,
final HyperSpaceWalker<MP, ?> hyperSpaceWalker
) {
// Compute key for destination object representing grid
MP params = hyperSpaceWalker.getParams();
Key<Grid> gridKey = destKey != null ? destKey
... | [
"public",
"static",
"<",
"MP",
"extends",
"Model",
".",
"Parameters",
">",
"Job",
"<",
"Grid",
">",
"startGridSearch",
"(",
"final",
"Key",
"<",
"Grid",
">",
"destKey",
",",
"final",
"HyperSpaceWalker",
"<",
"MP",
",",
"?",
">",
"hyperSpaceWalker",
")",
... | Start a new grid search job. <p> This method launches any grid search traversing space of hyper
parameters based on specified strategy.
@param destKey A key to store result of grid search under.
@param hyperSpaceWalker defines a strategy for traversing a hyper space. The object itself
holds definition of hype... | [
"Start",
"a",
"new",
"grid",
"search",
"job",
".",
"<p",
">",
"This",
"method",
"launches",
"any",
"grid",
"search",
"traversing",
"space",
"of",
"hyper",
"parameters",
"based",
"on",
"specified",
"strategy",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/grid/GridSearch.java#L435-L446 | train | Start a grid search job. | Create a Java method that does the following: "Start a grid search job.". | Of course, here is the Java code you requested:
```java
public static <MP extends Model.Parameters> Job<Grid> startGridSearch(
final Key<Grid> destKey,
final HyperSpaceWalker<MP, ?> hyperSpaceWalker
) {
// Compute key for destination object representing grid
MP params = hyperSpaceWalker.getPara... | |
kiswanij/jk-util | src/main/java/com/jk/util/JKIOUtil.java | JKIOUtil.readConfigFile | public static JKConfig readConfigFile(String configFileName) {
URL url = getURL(configFileName);
logger.debug(configFileName + " Url is ", url.toString());
JKConfig config = new JKConfig(url);
return config;
} | java | public static JKConfig readConfigFile(String configFileName) {
URL url = getURL(configFileName);
logger.debug(configFileName + " Url is ", url.toString());
JKConfig config = new JKConfig(url);
return config;
} | [
"public",
"static",
"JKConfig",
"readConfigFile",
"(",
"String",
"configFileName",
")",
"{",
"URL",
"url",
"=",
"getURL",
"(",
"configFileName",
")",
";",
"logger",
".",
"debug",
"(",
"configFileName",
"+",
"\" Url is \"",
",",
"url",
".",
"toString",
"(",
"... | Read config file.
@param configFileName the config file name
@return the JK config | [
"Read",
"config",
"file",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L806-L811 | train | Read a config file from a file name. | Create a Java method that does the following: "Read a config file from a file name.". | Of course, here is the Java code you requested:
```java
public static JKConfig readConfigFile(String configFileName) {
URL url = getURL(configFileName);
logger.debug(configFileName + " Url is ", url.toString());
JKConfig config = new JKConfig(url);
return config;
}
```
Hope this helps! | |
wmdietl/jsr308-langtools | src/share/classes/com/sun/source/util/TreePathScanner.java | TreePathScanner.scan | @Override
public R scan(Tree tree, P p) {
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
} | java | @Override
public R scan(Tree tree, P p) {
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
} | [
"@",
"Override",
"public",
"R",
"scan",
"(",
"Tree",
"tree",
",",
"P",
"p",
")",
"{",
"if",
"(",
"tree",
"==",
"null",
")",
"return",
"null",
";",
"TreePath",
"prev",
"=",
"path",
";",
"path",
"=",
"new",
"TreePath",
"(",
"path",
",",
"tree",
")"... | Scan a single node.
The current path is updated for the duration of the scan. | [
"Scan",
"a",
"single",
"node",
".",
"The",
"current",
"path",
"is",
"updated",
"for",
"the",
"duration",
"of",
"the",
"scan",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/source/util/TreePathScanner.java#L60-L72 | train | Scan a single language tree. | Create a Java method that does the following: "Scan a single language tree.". | Of course, here is the Java code you requested:
```java
@Override
public R scan(Tree tree, P p) {
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = ... | |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/CellValue.java | CellValue.fromTypeAndObject | public static CellValue fromTypeAndObject(final TableCell.Type type, final Object o) {
// TODO: use the type hint, with a switch...
return CellValue.fromObject(o);
} | java | public static CellValue fromTypeAndObject(final TableCell.Type type, final Object o) {
// TODO: use the type hint, with a switch...
return CellValue.fromObject(o);
} | [
"public",
"static",
"CellValue",
"fromTypeAndObject",
"(",
"final",
"TableCell",
".",
"Type",
"type",
",",
"final",
"Object",
"o",
")",
"{",
"// TODO: use the type hint, with a switch...",
"return",
"CellValue",
".",
"fromObject",
"(",
"o",
")",
";",
"}"
] | Converts a value to a CellValue
@param type a hint
@param o the value
@return the CellValue | [
"Converts",
"a",
"value",
"to",
"a",
"CellValue"
] | a034d173083ffa602dc525699b97f753082eaef9 | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/CellValue.java#L64-L67 | train | Create a CellValue from a type and an object. | Create a Java method that does the following: "Create a CellValue from a type and an object.". | Of course, here is the Java code you requested:
```java
public static CellValue fromTypeAndObject(final TableCell.Type type, final Object o) {
// TODO: use the type hint, with a switch...
return CellValue.fromObject(o);
}
```
Hope this helps! | |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/FlowTwillProgramController.java | FlowTwillProgramController.changeInstances | private synchronized void changeInstances(String flowletId, int newInstanceCount, int oldInstanceCount)
throws Exception {
instanceUpdater.update(flowletId, newInstanceCount, oldInstanceCount);
} | java | private synchronized void changeInstances(String flowletId, int newInstanceCount, int oldInstanceCount)
throws Exception {
instanceUpdater.update(flowletId, newInstanceCount, oldInstanceCount);
} | [
"private",
"synchronized",
"void",
"changeInstances",
"(",
"String",
"flowletId",
",",
"int",
"newInstanceCount",
",",
"int",
"oldInstanceCount",
")",
"throws",
"Exception",
"{",
"instanceUpdater",
".",
"update",
"(",
"flowletId",
",",
"newInstanceCount",
",",
"oldI... | Change the number of instances of the running flowlet. Notice that this method needs to be
synchronized as change of instances involves multiple steps that need to be completed all at once.
@param flowletId Name of the flowlet.
@param newInstanceCount New instance count.
@param oldInstanceCount Old instance count.
@thr... | [
"Change",
"the",
"number",
"of",
"instances",
"of",
"the",
"running",
"flowlet",
".",
"Notice",
"that",
"this",
"method",
"needs",
"to",
"be",
"synchronized",
"as",
"change",
"of",
"instances",
"involves",
"multiple",
"steps",
"that",
"need",
"to",
"be",
"co... | 5be6dffd7c79519d1211bb08f75be7dcfbbad392 | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/FlowTwillProgramController.java#L73-L76 | train | Change instances of a sequence. | Create a Java method that does the following: "Change instances of a sequence.". | Of course, here is the Java code you requested:
```java
private synchronized void changeInstances(String flowletId, int newInstanceCount, int oldInstanceCount)
throws Exception {
instanceUpdater.update(flowletId, newInstanceCount, oldInstanceCount);
}
```
Hope this helps! | |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.flagStream | public void flagStream(Stream stream, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
data.put("uuid", getActiveUser().getUUID());
data.put("stream_id", stream.getStreamId());
post(FLAG_STREAM, new UrlEncodedContent(... | java | public void flagStream(Stream stream, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
data.put("uuid", getActiveUser().getUUID());
data.put("stream_id", stream.getStreamId());
post(FLAG_STREAM, new UrlEncodedContent(... | [
"public",
"void",
"flagStream",
"(",
"Stream",
"stream",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"if",
"(",
"!",
"assertActiveUserAvailable",
"(",
"cb",
")",
")",
"return",
";",
"GenericData",
"data",
"=",
"new",
"GenericData",
"(",
")",
";",
"da... | Flag a {@link io.kickflip.sdk.api.json.Stream}. Used when the active Kickflip User does not own the Stream.
<p/>
To delete a recording the active Kickflip User owns, use
{@link io.kickflip.sdk.api.KickflipApiClient#setStreamInfo(io.kickflip.sdk.api.json.Stream, KickflipCallback)}
@param stream The Stream to flag.
@par... | [
"Flag",
"a",
"{",
"@link",
"io",
".",
"kickflip",
".",
"sdk",
".",
"api",
".",
"json",
".",
"Stream",
"}",
".",
"Used",
"when",
"the",
"active",
"Kickflip",
"User",
"does",
"not",
"own",
"the",
"Stream",
".",
"<p",
"/",
">",
"To",
"delete",
"a",
... | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L474-L481 | train | Flag a stream. | Create a Java method that does the following: "Flag a stream.". | Of course, here is the Java code you requested:
```java
public void flagStream(Stream stream, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
data.put("uuid", getActiveUser().getUUID());
data.put("stream_id", stream.getStrea... | |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetLearnedRoutes | public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | java | public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | [
"public",
"GatewayRouteListResultInner",
"beginGetLearnedRoutes",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetLearnedRoutesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
... | This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the v... | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"has",
"learned",
"including",
"routes",
"learned",
"from",
"BGP",
"peers",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2407-L2409 | train | Gets the learned routes for a virtual network gateway. | Create a Java method that does the following: "Gets the learned routes for a virtual network gateway.". | Of course, here is the Java code you requested:
```java
public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
}
`... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/ServletPmiModule.java | ServletPmiModule.onAsyncContextComplete | public void onAsyncContextComplete(long responseTime, String url) {
/* if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
{
}*/
long lastUpdated = 0;
if(asyncContextResponseTime != null && responseTime >= 0){
lastUpdated = System.curre... | java | public void onAsyncContextComplete(long responseTime, String url) {
/* if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
{
}*/
long lastUpdated = 0;
if(asyncContextResponseTime != null && responseTime >= 0){
lastUpdated = System.curre... | [
"public",
"void",
"onAsyncContextComplete",
"(",
"long",
"responseTime",
",",
"String",
"url",
")",
"{",
"/*\t\tif (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))\n\t\t\t {\n\t }*/",
"long",
"lastUpdated",
"=",
"0",
";",
"if",
"(... | PK64697 end | [
"PK64697",
"end"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/ServletPmiModule.java#L314-L342 | train | This method is called by the AsyncContextHandler to indicate that the request has completed successfully. | Create a Java method that does the following: "This method is called by the AsyncContextHandler to indicate that the request has completed successfully.". | Of course, here is the Java code you requested:
```java
public void onAsyncContextComplete(long responseTime, String url) {
/* if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
{
}*/
long lastUpdated = 0;
if(asyncContextResponseTime != null && ... | |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlcontenttype.java | appfwxmlcontenttype.delete | public static base_response delete(nitro_service client, String xmlcontenttypevalue) throws Exception {
appfwxmlcontenttype deleteresource = new appfwxmlcontenttype();
deleteresource.xmlcontenttypevalue = xmlcontenttypevalue;
return deleteresource.delete_resource(client);
} | java | public static base_response delete(nitro_service client, String xmlcontenttypevalue) throws Exception {
appfwxmlcontenttype deleteresource = new appfwxmlcontenttype();
deleteresource.xmlcontenttypevalue = xmlcontenttypevalue;
return deleteresource.delete_resource(client);
} | [
"public",
"static",
"base_response",
"delete",
"(",
"nitro_service",
"client",
",",
"String",
"xmlcontenttypevalue",
")",
"throws",
"Exception",
"{",
"appfwxmlcontenttype",
"deleteresource",
"=",
"new",
"appfwxmlcontenttype",
"(",
")",
";",
"deleteresource",
".",
"xml... | Use this API to delete appfwxmlcontenttype of given name. | [
"Use",
"this",
"API",
"to",
"delete",
"appfwxmlcontenttype",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlcontenttype.java#L152-L156 | train | Use this API to delete appfwxmlcontenttype of given name. | Create a Java method that does the following: "Use this API to delete appfwxmlcontenttype of given name.". | Of course, here is the Java code you requested:
```java
public static base_response delete(nitro_service client, String xmlcontenttypevalue) throws Exception {
appfwxmlcontenttype deleteresource = new appfwxmlcontenttype();
deleteresource.xmlcontenttypevalue = xmlcontenttypevalue;
return deleteresource.delete_re... | |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilter.java | AbstractAuthenticationProcessingFilter.successfulAuthentication | protected void successfulAuthentication(HttpServletRequest request,
HttpServletResponse response, FilterChain chain, Authentication authResult)
throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Authentication success. Updating SecurityContextHolder to contain: "
+ auth... | java | protected void successfulAuthentication(HttpServletRequest request,
HttpServletResponse response, FilterChain chain, Authentication authResult)
throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Authentication success. Updating SecurityContextHolder to contain: "
+ auth... | [
"protected",
"void",
"successfulAuthentication",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"FilterChain",
"chain",
",",
"Authentication",
"authResult",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"logge... | Default behaviour for successful authentication.
<ol>
<li>Sets the successful <tt>Authentication</tt> object on the
{@link SecurityContextHolder}</li>
<li>Informs the configured <tt>RememberMeServices</tt> of the successful login</li>
<li>Fires an {@link InteractiveAuthenticationSuccessEvent} via the configured
<tt>App... | [
"Default",
"behaviour",
"for",
"successful",
"authentication",
".",
"<ol",
">",
"<li",
">",
"Sets",
"the",
"successful",
"<tt",
">",
"Authentication<",
"/",
"tt",
">",
"object",
"on",
"the",
"{",
"@link",
"SecurityContextHolder",
"}",
"<",
"/",
"li",
">",
... | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilter.java#L307-L327 | test | Called when the user has successfully authenticated. | Create a Java method that does the following: "Called when the user has successfully authenticated.". | Of course, here is the Java code you requested:
```java
protected void successfulAuthentication(HttpServletRequest request,
HttpServletResponse response, FilterChain chain, Authentication authResult)
throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Authentication success.... | |
aws/aws-sdk-java | aws-java-sdk-autoscalingplans/src/main/java/com/amazonaws/services/autoscalingplans/model/ScalingPlanResource.java | ScalingPlanResource.withScalingPolicies | public ScalingPlanResource withScalingPolicies(ScalingPolicy... scalingPolicies) {
if (this.scalingPolicies == null) {
setScalingPolicies(new java.util.ArrayList<ScalingPolicy>(scalingPolicies.length));
}
for (ScalingPolicy ele : scalingPolicies) {
this.scalingPolicies.ad... | java | public ScalingPlanResource withScalingPolicies(ScalingPolicy... scalingPolicies) {
if (this.scalingPolicies == null) {
setScalingPolicies(new java.util.ArrayList<ScalingPolicy>(scalingPolicies.length));
}
for (ScalingPolicy ele : scalingPolicies) {
this.scalingPolicies.ad... | [
"public",
"ScalingPlanResource",
"withScalingPolicies",
"(",
"ScalingPolicy",
"...",
"scalingPolicies",
")",
"{",
"if",
"(",
"this",
".",
"scalingPolicies",
"==",
"null",
")",
"{",
"setScalingPolicies",
"(",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"Sc... | <p>
The scaling policies.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setScalingPolicies(java.util.Collection)} or {@link #withScalingPolicies(java.util.Collection)} if you
want to override the existing values.
</p>
@param scalingPolicies
The scaling policies.
@retur... | [
"<p",
">",
"The",
"scaling",
"policies",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"method",
"appends",
"the",
"values",
"to",
"the",
"existing",
"list",
"(",
"if",
"any",
")",
".",
"Use",
"{",
"@li... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-autoscalingplans/src/main/java/com/amazonaws/services/autoscalingplans/model/ScalingPlanResource.java#L1049-L1057 | train | A list of ScalingPolicy objects. | Create a Java method that does the following: "A list of ScalingPolicy objects.". | Of course, here is the Java code you requested:
```java
public ScalingPlanResource withScalingPolicies(ScalingPolicy... scalingPolicies) {
if (this.scalingPolicies == null) {
setScalingPolicies(new java.util.ArrayList<ScalingPolicy>(scalingPolicies.length));
}
for (ScalingPolicy ele... | |
BellaDati/belladati-sdk-api | src/main/java/com/belladati/sdk/BellaDati.java | BellaDati.getConnectionConstructor | private static Constructor<?> getConnectionConstructor() throws ClassNotFoundException, NoSuchMethodException,
SecurityException {
Class<?> clazz = Class.forName("com.belladati.sdk.impl.BellaDatiConnectionImpl");
Constructor<?> constructor = clazz.getDeclaredConstructor(String.class, Boolean.TYPE);
constructor.... | java | private static Constructor<?> getConnectionConstructor() throws ClassNotFoundException, NoSuchMethodException,
SecurityException {
Class<?> clazz = Class.forName("com.belladati.sdk.impl.BellaDatiConnectionImpl");
Constructor<?> constructor = clazz.getDeclaredConstructor(String.class, Boolean.TYPE);
constructor.... | [
"private",
"static",
"Constructor",
"<",
"?",
">",
"getConnectionConstructor",
"(",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"SecurityException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"com.bel... | Reflectively loads the implementation's constructor to open a
{@link BellaDatiConnection}.
@return the constructor of a {@link BellaDatiConnection} implementation
@throws ClassNotFoundException if the implementing class isn't found
@throws NoSuchMethodException if no constructor exists for the expected
arguments
@thro... | [
"Reflectively",
"loads",
"the",
"implementation",
"s",
"constructor",
"to",
"open",
"a",
"{",
"@link",
"BellaDatiConnection",
"}",
"."
] | ec45a42048d8255838ad0200aa6784a8e8a121c1 | https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/BellaDati.java#L111-L117 | train | Get the connection constructor. | Create a Java method that does the following: "Get the connection constructor.". | Of course, here is the Java code you requested:
```java
private static Constructor<?> getConnectionConstructor() throws ClassNotFoundException, NoSuchMethodException,
SecurityException {
Class<?> clazz = Class.forName("com.belladati.sdk.impl.BellaDatiConnectionImpl");
Constructor<?> constructor = clazz.getDeclar... | |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPrincipalSelectionList.java | CmsPrincipalSelectionList.getIconPath | public String getIconPath(CmsListItem item) {
boolean showingUsers = isShowingUsers();
try {
CmsPrincipal principal;
if (showingUsers) {
principal = getCms().readUser((String)item.get(LIST_COLUMN_NAME));
} else {
principal = getCms().r... | java | public String getIconPath(CmsListItem item) {
boolean showingUsers = isShowingUsers();
try {
CmsPrincipal principal;
if (showingUsers) {
principal = getCms().readUser((String)item.get(LIST_COLUMN_NAME));
} else {
principal = getCms().r... | [
"public",
"String",
"getIconPath",
"(",
"CmsListItem",
"item",
")",
"{",
"boolean",
"showingUsers",
"=",
"isShowingUsers",
"(",
")",
";",
"try",
"{",
"CmsPrincipal",
"principal",
";",
"if",
"(",
"showingUsers",
")",
"{",
"principal",
"=",
"getCms",
"(",
")",... | Returns the right icon path for the given list item.<p>
@param item the list item to get the icon path for
@return the icon path for the given role | [
"Returns",
"the",
"right",
"icon",
"path",
"for",
"the",
"given",
"list",
"item",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPrincipalSelectionList.java#L310-L344 | train | Returns the icon path for the item. | Create a Java method that does the following: "Returns the icon path for the item.". | Of course, here is the Java code you requested:
```java
public String getIconPath(CmsListItem item) {
boolean showingUsers = isShowingUsers();
try {
CmsPrincipal principal;
if (showingUsers) {
principal = getCms().readUser((String)item.get(LIST_COLUMN_NAME));
... | |
aws/aws-sdk-java | aws-java-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/model/PersonMatch.java | PersonMatch.setFaceMatches | public void setFaceMatches(java.util.Collection<FaceMatch> faceMatches) {
if (faceMatches == null) {
this.faceMatches = null;
return;
}
this.faceMatches = new java.util.ArrayList<FaceMatch>(faceMatches);
} | java | public void setFaceMatches(java.util.Collection<FaceMatch> faceMatches) {
if (faceMatches == null) {
this.faceMatches = null;
return;
}
this.faceMatches = new java.util.ArrayList<FaceMatch>(faceMatches);
} | [
"public",
"void",
"setFaceMatches",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"FaceMatch",
">",
"faceMatches",
")",
"{",
"if",
"(",
"faceMatches",
"==",
"null",
")",
"{",
"this",
".",
"faceMatches",
"=",
"null",
";",
"return",
";",
"}",
"this",
... | <p>
Information about the faces in the input collection that match the face of a person in the video.
</p>
@param faceMatches
Information about the faces in the input collection that match the face of a person in the video. | [
"<p",
">",
"Information",
"about",
"the",
"faces",
"in",
"the",
"input",
"collection",
"that",
"match",
"the",
"face",
"of",
"a",
"person",
"in",
"the",
"video",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/model/PersonMatch.java#L151-L158 | train | Sets the value faceMatches property. | Create a Java method that does the following: "Sets the value faceMatches property.". | Of course, here is the Java code you requested:
```java
public void setFaceMatches(java.util.Collection<FaceMatch> faceMatches) {
if (faceMatches == null) {
this.faceMatches = null;
return;
}
this.faceMatches = new java.util.ArrayList<FaceMatch>(faceMatches);
}
```
... | |
kiswanij/jk-util | src/main/java/com/jk/util/JK.java | JK.addToSystemConfig | public static void addToSystemConfig(String prefix, Properties prop) {
for (Entry<Object, Object> entry : prop.entrySet()) {
String key = prefix.concat(entry.getKey().toString());
String value = entry.getValue().toString();
System.setProperty(key, value);
}
} | java | public static void addToSystemConfig(String prefix, Properties prop) {
for (Entry<Object, Object> entry : prop.entrySet()) {
String key = prefix.concat(entry.getKey().toString());
String value = entry.getValue().toString();
System.setProperty(key, value);
}
} | [
"public",
"static",
"void",
"addToSystemConfig",
"(",
"String",
"prefix",
",",
"Properties",
"prop",
")",
"{",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"prop",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"pre... | Adds the to system config.
@param prefix the prefix
@param prop the prop | [
"Adds",
"the",
"to",
"system",
"config",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L414-L420 | train | Adds the properties to the system config. | Create a Java method that does the following: "Adds the properties to the system config.". | Of course, here is the Java code you requested:
```java
public static void addToSystemConfig(String prefix, Properties prop) {
for (Entry<Object, Object> entry : prop.entrySet()) {
String key = prefix.concat(entry.getKey().toString());
String value = entry.getValue().toString();
System.setProperty(key, ... | |
drtrang/Copiers | src/main/java/com/github/trang/copiers/util/ClassUtil.java | ClassUtil.getPrimitiveDefaultValue | public static Object getPrimitiveDefaultValue(Class<?> primitiveType) {
if (boolean.class.equals(primitiveType)) {
return false;
} else if (byte.class.equals(primitiveType)) {
return (byte) 0;
} else if (char.class.equals(primitiveType)) {
return '\0';
... | java | public static Object getPrimitiveDefaultValue(Class<?> primitiveType) {
if (boolean.class.equals(primitiveType)) {
return false;
} else if (byte.class.equals(primitiveType)) {
return (byte) 0;
} else if (char.class.equals(primitiveType)) {
return '\0';
... | [
"public",
"static",
"Object",
"getPrimitiveDefaultValue",
"(",
"Class",
"<",
"?",
">",
"primitiveType",
")",
"{",
"if",
"(",
"boolean",
".",
"class",
".",
"equals",
"(",
"primitiveType",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"byt... | 取得primitive类型的默认值。
@param primitiveType 基本类型
@return 默认值 | [
"取得primitive类型的默认值。"
] | 775b2bc702d2df74c4ef3d3c9d7563aedc8e660b | https://github.com/drtrang/Copiers/blob/775b2bc702d2df74c4ef3d3c9d7563aedc8e660b/src/main/java/com/github/trang/copiers/util/ClassUtil.java#L99-L119 | train | Gets the default value for a primitive type. | Create a Java method that does the following: "Gets the default value for a primitive type.". | Of course, here is the Java code you requested:
```java
public static Object getPrimitiveDefaultValue(Class<?> primitiveType) {
if (boolean.class.equals(primitiveType)) {
return false;
} else if (byte.class.equals(primitiveType)) {
return (byte) 0;
} else if (char.class.... | |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java | CmsContainerpageController.getContainerpageService | public I_CmsContainerpageServiceAsync getContainerpageService() {
if (m_containerpageService == null) {
m_containerpageService = GWT.create(I_CmsContainerpageService.class);
String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.containerpage.CmsContainerpageService.gwt");
... | java | public I_CmsContainerpageServiceAsync getContainerpageService() {
if (m_containerpageService == null) {
m_containerpageService = GWT.create(I_CmsContainerpageService.class);
String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.containerpage.CmsContainerpageService.gwt");
... | [
"public",
"I_CmsContainerpageServiceAsync",
"getContainerpageService",
"(",
")",
"{",
"if",
"(",
"m_containerpageService",
"==",
"null",
")",
"{",
"m_containerpageService",
"=",
"GWT",
".",
"create",
"(",
"I_CmsContainerpageService",
".",
"class",
")",
";",
"String",
... | Returns the container-page RPC service.<p>
@return the container-page service | [
"Returns",
"the",
"container",
"-",
"page",
"RPC",
"service",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1325-L1333 | train | Gets the containerpage service. | Create a Java method that does the following: "Gets the containerpage service.". | Of course, here is the Java code you requested:
```java
public I_CmsContainerpageServiceAsync getContainerpageService() {
if (m_containerpageService == null) {
m_containerpageService = GWT.create(I_CmsContainerpageService.class);
String serviceUrl = CmsCoreProvider.get().link("org.open... | |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/rest/RestService.java | RestService.getRoles | protected List<String> getRoles(String path, String method) {
if (method.equals("GET")) {
List<String> roles = new ArrayList<>();
// restrict if view access role exists
if (UserGroupCache.getRole(Role.RUNTIME_VIEW) != null) {
roles.add(Role.RUNTIME_VIEW);
... | java | protected List<String> getRoles(String path, String method) {
if (method.equals("GET")) {
List<String> roles = new ArrayList<>();
// restrict if view access role exists
if (UserGroupCache.getRole(Role.RUNTIME_VIEW) != null) {
roles.add(Role.RUNTIME_VIEW);
... | [
"protected",
"List",
"<",
"String",
">",
"getRoles",
"(",
"String",
"path",
",",
"String",
"method",
")",
"{",
"if",
"(",
"method",
".",
"equals",
"(",
"\"GET\"",
")",
")",
"{",
"List",
"<",
"String",
">",
"roles",
"=",
"new",
"ArrayList",
"<>",
"(",... | Default impl pays no attention to method (for compatibility).
GET access if restricted if the "Runtime View" role exists. | [
"Default",
"impl",
"pays",
"no",
"attention",
"to",
"method",
"(",
"for",
"compatibility",
")",
".",
"GET",
"access",
"if",
"restricted",
"if",
"the",
"Runtime",
"View",
"role",
"exists",
"."
] | 91167fe65a25a5d7022cdcf8b0fae8506f5b87ce | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/rest/RestService.java#L101-L113 | train | Get the roles for a given path and method. | Create a Java method that does the following: "Get the roles for a given path and method.". | Of course, here is the Java code you requested:
```java
protected List<String> getRoles(String path, String method) {
if (method.equals("GET")) {
List<String> roles = new ArrayList<>();
// restrict if view access role exists
if (UserGroupCache.getRole(Role.RUNTIME_VIEW) != n... | |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java | SessionBuilder.addContactEndPoints | @NonNull
public SelfT addContactEndPoints(@NonNull Collection<EndPoint> contactPoints) {
for (EndPoint contactPoint : contactPoints) {
addContactEndPoint(contactPoint);
}
return self;
} | java | @NonNull
public SelfT addContactEndPoints(@NonNull Collection<EndPoint> contactPoints) {
for (EndPoint contactPoint : contactPoints) {
addContactEndPoint(contactPoint);
}
return self;
} | [
"@",
"NonNull",
"public",
"SelfT",
"addContactEndPoints",
"(",
"@",
"NonNull",
"Collection",
"<",
"EndPoint",
">",
"contactPoints",
")",
"{",
"for",
"(",
"EndPoint",
"contactPoint",
":",
"contactPoints",
")",
"{",
"addContactEndPoint",
"(",
"contactPoint",
")",
... | Adds contact points to use for the initial connection to the cluster.
<p>You only need this method if you use a custom {@link EndPoint} implementation. Otherwise,
use {@link #addContactPoints(Collection)}. | [
"Adds",
"contact",
"points",
"to",
"use",
"for",
"the",
"initial",
"connection",
"to",
"the",
"cluster",
"."
] | 612a63f2525618e2020e86c9ad75ab37adba6132 | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java#L157-L163 | train | Add a collection of end points to the contact. | Create a Java method that does the following: "Add a collection of end points to the contact.". | Of course, here is the Java code you requested:
```java
@NonNull
public SelfT addContactEndPoints(@NonNull Collection<EndPoint> contactPoints) {
for (EndPoint contactPoint : contactPoints) {
addContactEndPoint(contactPoint);
}
return self;
}
```
Hope this helps! | |
jboss/jboss-common-core | src/main/java/org/jboss/util/threadpool/BasicTaskWrapper.java | BasicTaskWrapper.setTask | protected void setTask(Task task)
{
if (task == null)
throw new IllegalArgumentException("Null task");
this.task = task;
this.taskString = task.toString();
this.startTime = System.currentTimeMillis();
this.waitType = task.getWaitType();
this.priority = task.getPriority();... | java | protected void setTask(Task task)
{
if (task == null)
throw new IllegalArgumentException("Null task");
this.task = task;
this.taskString = task.toString();
this.startTime = System.currentTimeMillis();
this.waitType = task.getWaitType();
this.priority = task.getPriority();... | [
"protected",
"void",
"setTask",
"(",
"Task",
"task",
")",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null task\"",
")",
";",
"this",
".",
"task",
"=",
"task",
";",
"this",
".",
"taskString",
"=",
"task"... | Set thetask for this wrapper
@param task the task | [
"Set",
"thetask",
"for",
"this",
"wrapper"
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/threadpool/BasicTaskWrapper.java#L280-L291 | test | Sets the task. | Create a Java method that does the following: "Sets the task.". | Of course, here is the Java code you requested:
```java
protected void setTask(Task task)
{
if (task == null)
throw new IllegalArgumentException("Null task");
this.task = task;
this.taskString = task.toString();
this.startTime = System.currentTimeMillis();
this.waitType = task... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.