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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lucee/Lucee | loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java | CFMLEngineFactory._restart | private synchronized boolean _restart() throws ServletException {
if (singelton != null) singelton.reset();
initEngine();
ConfigServer cs = getConfigServer(singelton);
if (cs != null) {
Log log = cs.getLog("application");
log.info("loader", "Lucee restarted");
}
System.gc();
return true;
} | java | private synchronized boolean _restart() throws ServletException {
if (singelton != null) singelton.reset();
initEngine();
ConfigServer cs = getConfigServer(singelton);
if (cs != null) {
Log log = cs.getLog("application");
log.info("loader", "Lucee restarted");
}
System.gc();
return true;
} | [
"private",
"synchronized",
"boolean",
"_restart",
"(",
")",
"throws",
"ServletException",
"{",
"if",
"(",
"singelton",
"!=",
"null",
")",
"singelton",
".",
"reset",
"(",
")",
";",
"initEngine",
"(",
")",
";",
"ConfigServer",
"cs",
"=",
"getConfigServer",
"("... | restart the cfml engine
@param password
@return has updated
@throws IOException
@throws ServletException | [
"restart",
"the",
"cfml",
"engine"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java#L586-L598 | train | Restart the application. | Create a Java method that does the following: "Restart the application.". | Of course, here is the Java code you requested:
```java
private synchronized boolean _restart() throws ServletException {
if (singelton != null) singelton.reset();
initEngine();
ConfigServer cs = getConfigServer(singelton);
if (cs != null) {
Log log = cs.getLog("application");
log.info("loader", "Lucee... | |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java | ImportedNamespaceAwareLocalScopeProvider.createImportedNamespaceResolver | protected ImportNormalizer createImportedNamespaceResolver(final String namespace, boolean ignoreCase) {
if (Strings.isEmpty(namespace))
return null;
QualifiedName importedNamespace = qualifiedNameConverter.toQualifiedName(namespace);
if (importedNamespace == null || importedNamespace.isEmpty()) {
return nu... | java | protected ImportNormalizer createImportedNamespaceResolver(final String namespace, boolean ignoreCase) {
if (Strings.isEmpty(namespace))
return null;
QualifiedName importedNamespace = qualifiedNameConverter.toQualifiedName(namespace);
if (importedNamespace == null || importedNamespace.isEmpty()) {
return nu... | [
"protected",
"ImportNormalizer",
"createImportedNamespaceResolver",
"(",
"final",
"String",
"namespace",
",",
"boolean",
"ignoreCase",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"namespace",
")",
")",
"return",
"null",
";",
"QualifiedName",
"importedNamesp... | Create a new {@link ImportNormalizer} for the given namespace.
@param namespace the namespace.
@param ignoreCase <code>true</code> if the resolver should be case insensitive.
@return a new {@link ImportNormalizer} or <code>null</code> if the namespace cannot be converted to a valid
qualified name. | [
"Create",
"a",
"new",
"{"
] | bac941cb75cb24706519845ec174cfef874d7557 | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java#L167-L184 | train | Create an import normalizer for the given namespace. | Create a Java method that does the following: "Create an import normalizer for the given namespace.". | Of course, here is the Java code you requested:
```java
protected ImportNormalizer createImportedNamespaceResolver(final String namespace, boolean ignoreCase) {
if (Strings.isEmpty(namespace))
return null;
QualifiedName importedNamespace = qualifiedNameConverter.toQualifiedName(namespace);
if (importedNamespa... | |
ironjacamar/ironjacamar | rarinfo/src/main/java/org/ironjacamar/rarinfo/Main.java | Main.removeIntrospectedValue | private static void removeIntrospectedValue(Map<String, String> m, String name)
{
if (m != null)
{
m.remove(name);
if (name.length() == 1)
{
name = name.toUpperCase(Locale.US);
}
else
{
name = name.substring(0, 1).toUpperCase(... | java | private static void removeIntrospectedValue(Map<String, String> m, String name)
{
if (m != null)
{
m.remove(name);
if (name.length() == 1)
{
name = name.toUpperCase(Locale.US);
}
else
{
name = name.substring(0, 1).toUpperCase(... | [
"private",
"static",
"void",
"removeIntrospectedValue",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"m",
",",
"String",
"name",
")",
"{",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"m",
".",
"remove",
"(",
"name",
")",
";",
"if",
"(",
"name",
".",
... | Remove introspected value
@param m The map
@param name The name | [
"Remove",
"introspected",
"value"
] | f0389ee7e62aa8b40ba09b251edad76d220ea796 | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/rarinfo/src/main/java/org/ironjacamar/rarinfo/Main.java#L1389-L1417 | train | Remove introspected value. | Create a Java method that does the following: "Remove introspected value.". | Of course, here is the Java code you requested:
```java
private static void removeIntrospectedValue(Map<String, String> m, String name)
{
if (m != null)
{
m.remove(name);
if (name.length() == 1)
{
name = name.toUpperCase(Locale.US);
}
else
... | |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java | OpenSslX509KeyManagerFactory.newKeyless | public static OpenSslX509KeyManagerFactory newKeyless(X509Certificate... certificateChain)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new OpenSslKeyStore(certificateChain.clone(), true);
stor... | java | public static OpenSslX509KeyManagerFactory newKeyless(X509Certificate... certificateChain)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new OpenSslKeyStore(certificateChain.clone(), true);
stor... | [
"public",
"static",
"OpenSslX509KeyManagerFactory",
"newKeyless",
"(",
"X509Certificate",
"...",
"certificateChain",
")",
"throws",
"CertificateException",
",",
"IOException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"UnrecoverableKeyException",
"{",
"K... | Returns a new initialized {@link OpenSslX509KeyManagerFactory} which will provide its private key by using the
{@link OpenSslPrivateKeyMethod}. | [
"Returns",
"a",
"new",
"initialized",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L284-L292 | train | Create a new key factory that will create a new keyless certificate store. | Create a Java method that does the following: "Create a new key factory that will create a new keyless certificate store.". | Of course, here is the Java code you requested:
```java
public static OpenSslX509KeyManagerFactory newKeyless(X509Certificate... certificateChain)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new Open... | |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.findAndFill | int findAndFill(RowCursor cursor)
{
int ptr = find(cursor);
if (ptr >= 0) {
cursor.setRow(_buffer, ptr);
cursor.setLeafBlock(this, ptr);
}
return ptr;
} | java | int findAndFill(RowCursor cursor)
{
int ptr = find(cursor);
if (ptr >= 0) {
cursor.setRow(_buffer, ptr);
cursor.setLeafBlock(this, ptr);
}
return ptr;
} | [
"int",
"findAndFill",
"(",
"RowCursor",
"cursor",
")",
"{",
"int",
"ptr",
"=",
"find",
"(",
"cursor",
")",
";",
"if",
"(",
"ptr",
">=",
"0",
")",
"{",
"cursor",
".",
"setRow",
"(",
"_buffer",
",",
"ptr",
")",
";",
"cursor",
".",
"setLeafBlock",
"("... | Searches for a row matching the cursor's key in the block.
If the key is found, fill the cursor with the row. | [
"Searches",
"for",
"a",
"row",
"matching",
"the",
"cursor",
"s",
"key",
"in",
"the",
"block",
".",
"If",
"the",
"key",
"is",
"found",
"fill",
"the",
"cursor",
"with",
"the",
"row",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L212-L222 | train | Find and fill the row cursor. | Create a Java method that does the following: "Find and fill the row cursor.". | Of course, here is the Java code you requested:
```java
int findAndFill(RowCursor cursor)
{
int ptr = find(cursor);
if (ptr >= 0) {
cursor.setRow(_buffer, ptr);
cursor.setLeafBlock(this, ptr);
}
return ptr;
}
```
Hope this helps! | |
zaproxy/zaproxy | src/org/zaproxy/zap/GuiBootstrap.java | GuiBootstrap.setupLookAndFeel | private void setupLookAndFeel() {
if (lookAndFeelSet) {
return;
}
lookAndFeelSet = true;
if (setLookAndFeel(System.getProperty("swing.defaultlaf"))) {
return;
}
OptionsParam options = Model.getSingleton().getOptionsParam();
if (setLookAn... | java | private void setupLookAndFeel() {
if (lookAndFeelSet) {
return;
}
lookAndFeelSet = true;
if (setLookAndFeel(System.getProperty("swing.defaultlaf"))) {
return;
}
OptionsParam options = Model.getSingleton().getOptionsParam();
if (setLookAn... | [
"private",
"void",
"setupLookAndFeel",
"(",
")",
"{",
"if",
"(",
"lookAndFeelSet",
")",
"{",
"return",
";",
"}",
"lookAndFeelSet",
"=",
"true",
";",
"if",
"(",
"setLookAndFeel",
"(",
"System",
".",
"getProperty",
"(",
"\"swing.defaultlaf\"",
")",
")",
")",
... | Setups Swing's look and feel.
<p>
<strong>Note:</strong> Should be called only after calling {@link #initModel()}, if not initialising ZAP for the
{@link #isFirstTime() first time}. The look and feel set up might initialise some network classes (e.g.
{@link java.net.InetAddress InetAddress}) preventing some ZAP options... | [
"Setups",
"Swing",
"s",
"look",
"and",
"feel",
".",
"<p",
">",
"<strong",
">",
"Note",
":",
"<",
"/",
"strong",
">",
"Should",
"be",
"called",
"only",
"after",
"calling",
"{"
] | 0cbe5121f2ae1ecca222513d182759210c569bec | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/GuiBootstrap.java#L354-L377 | train | Setup the look and feel. | Create a Java method that does the following: "Setup the look and feel.". | Of course, here is the Java code you requested:
```java
private void setupLookAndFeel() {
if (lookAndFeelSet) {
return;
}
lookAndFeelSet = true;
if (setLookAndFeel(System.getProperty("swing.defaultlaf"))) {
return;
}
OptionsParam options = Model... | |
infinispan/infinispan | jcache/commons/src/main/java/org/infinispan/jcache/Expiration.java | Expiration.getExpiry | public static Duration getExpiry(ExpiryPolicy policy, Operation op) {
if (policy == null) {
return getDefaultDuration();
}
switch (op) {
case CREATION:
try {
return policy.getExpiryForCreation();
} catch (Throwable t) {
log.getExp... | java | public static Duration getExpiry(ExpiryPolicy policy, Operation op) {
if (policy == null) {
return getDefaultDuration();
}
switch (op) {
case CREATION:
try {
return policy.getExpiryForCreation();
} catch (Throwable t) {
log.getExp... | [
"public",
"static",
"Duration",
"getExpiry",
"(",
"ExpiryPolicy",
"policy",
",",
"Operation",
"op",
")",
"{",
"if",
"(",
"policy",
"==",
"null",
")",
"{",
"return",
"getDefaultDuration",
"(",
")",
";",
"}",
"switch",
"(",
"op",
")",
"{",
"case",
"CREATIO... | Return expiry for a given cache operation. It returns null when the
expiry time cannot be determined, in which case clients should not update
expiry settings for the cached entry. | [
"Return",
"expiry",
"for",
"a",
"given",
"cache",
"operation",
".",
"It",
"returns",
"null",
"when",
"the",
"expiry",
"time",
"cannot",
"be",
"determined",
"in",
"which",
"case",
"clients",
"should",
"not",
"update",
"expiry",
"settings",
"for",
"the",
"cach... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/commons/src/main/java/org/infinispan/jcache/Expiration.java#L29-L60 | train | Get the expiration time for the specified operation. | Create a Java method that does the following: "Get the expiration time for the specified operation.". | Of course, here is the Java code you requested:
```java
public static Duration getExpiry(ExpiryPolicy policy, Operation op) {
if (policy == null) {
return getDefaultDuration();
}
switch (op) {
case CREATION:
try {
return policy.getExpiryForCreation();
... | |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.acceptLanguage | public static ULocale acceptLanguage(ULocale[] acceptLanguageList, ULocale[]
availableLocales, boolean[] fallback) {
// fallbacklist
int i,j;
if(fallback != null) {
fallback[0]=true;
}
for(i=0;i<acceptLanguageList.length;i++) {
ULocale aLocale ... | java | public static ULocale acceptLanguage(ULocale[] acceptLanguageList, ULocale[]
availableLocales, boolean[] fallback) {
// fallbacklist
int i,j;
if(fallback != null) {
fallback[0]=true;
}
for(i=0;i<acceptLanguageList.length;i++) {
ULocale aLocale ... | [
"public",
"static",
"ULocale",
"acceptLanguage",
"(",
"ULocale",
"[",
"]",
"acceptLanguageList",
",",
"ULocale",
"[",
"]",
"availableLocales",
",",
"boolean",
"[",
"]",
"fallback",
")",
"{",
"// fallbacklist",
"int",
"i",
",",
"j",
";",
"if",
"(",
"fallback"... | <strong>[icu]</strong> Based on a list of acceptable locales, determine an available locale for the
user. NullPointerException is thrown if acceptLanguageList or availableLocales is
null. If fallback is non-null, it will contain true if a fallback locale (one not
in the acceptLanguageList) was returned. The value on... | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Based",
"on",
"a",
"list",
"of",
"acceptable",
"locales",
"determine",
"an",
"available",
"locale",
"for",
"the",
"user",
".",
"NullPointerException",
"is",
"thrown",
"if",
"acceptLanguageList",
"or"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1954-L1999 | train | Returns the first locale in the acceptLanguageList that matches the available locales. | Create a Java method that does the following: "Returns the first locale in the acceptLanguageList that matches the available locales.". | Of course, here is the Java code you requested:
```java
public static ULocale acceptLanguage(ULocale[] acceptLanguageList, ULocale[]
availableLocales, boolean[] fallback) {
// fallbacklist
int i,j;
if(fallback != null) {
fallback[0]=true;
}
for(i=0;i<acce... | |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java | Main.inputMethod | private static List<MethodForConnection> inputMethod(BufferedReader in) throws IOException
{
List<MethodForConnection> methods = new ArrayList<MethodForConnection>();
Set<String> setMethodsSig = new HashSet<String>();
while (true)
{
System.out.print(" " + rb.getString("connection.... | java | private static List<MethodForConnection> inputMethod(BufferedReader in) throws IOException
{
List<MethodForConnection> methods = new ArrayList<MethodForConnection>();
Set<String> setMethodsSig = new HashSet<String>();
while (true)
{
System.out.print(" " + rb.getString("connection.... | [
"private",
"static",
"List",
"<",
"MethodForConnection",
">",
"inputMethod",
"(",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"List",
"<",
"MethodForConnection",
">",
"methods",
"=",
"new",
"ArrayList",
"<",
"MethodForConnection",
">",
"(",
")",
"... | Input Methods
@param in BufferedReader
@return List<MethodForConnection> list of properties
@throws IOException ioException | [
"Input",
"Methods"
] | f0389ee7e62aa8b40ba09b251edad76d220ea796 | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L926-L994 | train | Input method. | Create a Java method that does the following: "Input method.". | Of course, here is the Java code you requested:
```java
private static List<MethodForConnection> inputMethod(BufferedReader in) throws IOException
{
List<MethodForConnection> methods = new ArrayList<MethodForConnection>();
Set<String> setMethodsSig = new HashSet<String>();
while (true)
{
... | |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/Server.java | Server.getModule | public Module getModule(String role) {
if(m_moduleContext.containsBean(role)){
try{
return m_moduleContext.getBean(role,Module.class);
}
catch(Throwable e){
logger.warn(e.toString());
}
}
return null;
} | java | public Module getModule(String role) {
if(m_moduleContext.containsBean(role)){
try{
return m_moduleContext.getBean(role,Module.class);
}
catch(Throwable e){
logger.warn(e.toString());
}
}
return null;
} | [
"public",
"Module",
"getModule",
"(",
"String",
"role",
")",
"{",
"if",
"(",
"m_moduleContext",
".",
"containsBean",
"(",
"role",
")",
")",
"{",
"try",
"{",
"return",
"m_moduleContext",
".",
"getBean",
"(",
"role",
",",
"Module",
".",
"class",
")",
";",
... | Gets a loaded <code>Module</code>.
@param role
The role of the <code>Module</code> to get.
@return The <code>Module</code>, <code>null</code> if not found. | [
"Gets",
"a",
"loaded",
"<code",
">",
"Module<",
"/",
"code",
">",
"."
] | 37df51b9b857fd12c6ab8269820d406c3c4ad774 | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/Server.java#L907-L917 | train | Get a Module object from the module context. | Create a Java method that does the following: "Get a Module object from the module context.". | Of course, here is the Java code you requested:
```java
public Module getModule(String role) {
if(m_moduleContext.containsBean(role)){
try{
return m_moduleContext.getBean(role,Module.class);
}
catch(Throwable e){
logger.warn(e.toString());
... | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/GSCPImpl.java | GSCPImpl.eGet | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.GSCP__XPOS:
return getXPOS();
case AfplibPackage.GSCP__YPOS:
return getYPOS();
}
return super.eGet(featureID, resolve, coreType);
} | java | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.GSCP__XPOS:
return getXPOS();
case AfplibPackage.GSCP__YPOS:
return getYPOS();
}
return super.eGet(featureID, resolve, coreType);
} | [
"@",
"Override",
"public",
"Object",
"eGet",
"(",
"int",
"featureID",
",",
"boolean",
"resolve",
",",
"boolean",
"coreType",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"AfplibPackage",
".",
"GSCP__XPOS",
":",
"return",
"getXPOS",
"(",
")",
";"... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/afplib/impl/GSCPImpl.java#L137-L146 | train | Override eGet to return the object that corresponds to the featureID. | Create a Java method that does the following: "Override eGet to return the object that corresponds to the featureID.". | Of course, here is the Java code you requested:
```java
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.GSCP__XPOS:
return getXPOS();
case AfplibPackage.GSCP__YPOS:
return getYPOS();
}
return super.eGet(featureID, resolve, co... | |
apache/parquet-mr | parquet-hadoop/src/main/java/org/apache/parquet/hadoop/MemoryManager.java | MemoryManager.updateAllocation | private void updateAllocation() {
long totalAllocations = 0;
for (Long allocation : writerList.values()) {
totalAllocations += allocation;
}
if (totalAllocations <= totalMemoryPool) {
scale = 1.0;
} else {
scale = (double) totalMemoryPool / totalAllocations;
LOG.warn(String.f... | java | private void updateAllocation() {
long totalAllocations = 0;
for (Long allocation : writerList.values()) {
totalAllocations += allocation;
}
if (totalAllocations <= totalMemoryPool) {
scale = 1.0;
} else {
scale = (double) totalMemoryPool / totalAllocations;
LOG.warn(String.f... | [
"private",
"void",
"updateAllocation",
"(",
")",
"{",
"long",
"totalAllocations",
"=",
"0",
";",
"for",
"(",
"Long",
"allocation",
":",
"writerList",
".",
"values",
"(",
")",
")",
"{",
"totalAllocations",
"+=",
"allocation",
";",
"}",
"if",
"(",
"totalAllo... | Update the allocated size of each writer based on the current allocations and pool size. | [
"Update",
"the",
"allocated",
"size",
"of",
"each",
"writer",
"based",
"on",
"the",
"current",
"allocations",
"and",
"pool",
"size",
"."
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/MemoryManager.java#L106-L141 | test | Update the allocation of the row group. | Create a Java method that does the following: "Update the allocation of the row group.". | Of course, here is the Java code you requested:
```java
private void updateAllocation() {
long totalAllocations = 0;
for (Long allocation : writerList.values()) {
totalAllocations += allocation;
}
if (totalAllocations <= totalMemoryPool) {
scale = 1.0;
} else {
scale = (double) to... | |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.hasChildNodes | public boolean hasChildNodes(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
int firstChild = _firstch(identity);
return firstChild != DTM.NULL;
} | java | public boolean hasChildNodes(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
int firstChild = _firstch(identity);
return firstChild != DTM.NULL;
} | [
"public",
"boolean",
"hasChildNodes",
"(",
"int",
"nodeHandle",
")",
"{",
"int",
"identity",
"=",
"makeNodeIdentity",
"(",
"nodeHandle",
")",
";",
"int",
"firstChild",
"=",
"_firstch",
"(",
"identity",
")",
";",
"return",
"firstChild",
"!=",
"DTM",
".",
"NUL... | Given a node handle, test if it has child nodes.
<p> %REVIEW% This is obviously useful at the DOM layer, where it
would permit testing this without having to create a proxy
node. It's less useful in the DTM API, where
(dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and
almost as self-evident. But it's a conve... | [
"Given",
"a",
"node",
"handle",
"test",
"if",
"it",
"has",
"child",
"nodes",
".",
"<p",
">",
"%REVIEW%",
"This",
"is",
"obviously",
"useful",
"at",
"the",
"DOM",
"layer",
"where",
"it",
"would",
"permit",
"testing",
"this",
"without",
"having",
"to",
"cr... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L879-L886 | train | Returns true if the node has any child nodes. | Create a Java method that does the following: "Returns true if the node has any child nodes.". | Of course, here is the Java code you requested:
```java
public boolean hasChildNodes(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
int firstChild = _firstch(identity);
return firstChild != DTM.NULL;
}
```
Hope this helps! | |
knightliao/disconf | disconf-client/src/main/java/com/baidu/disconf/client/common/model/DisconfCenterItem.java | DisconfCenterItem.getFieldValueByType | public Object getFieldValueByType(Object fieldValue) throws Exception {
return ClassUtils.getValeByType(field.getType(), fieldValue);
} | java | public Object getFieldValueByType(Object fieldValue) throws Exception {
return ClassUtils.getValeByType(field.getType(), fieldValue);
} | [
"public",
"Object",
"getFieldValueByType",
"(",
"Object",
"fieldValue",
")",
"throws",
"Exception",
"{",
"return",
"ClassUtils",
".",
"getValeByType",
"(",
"field",
".",
"getType",
"(",
")",
",",
"fieldValue",
")",
";",
"}"
] | 返回值
@param fieldValue
@return
@throws Exception | [
"返回值"
] | d413cbce9334fe38a5a24982ce4db3a6ed8e98ea | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/common/model/DisconfCenterItem.java#L71-L73 | train | Get the value of a field by type. | Create a Java method that does the following: "Get the value of a field by type.". | Of course, here is the Java code you requested:
```java
public Object getFieldValueByType(Object fieldValue) throws Exception {
return ClassUtils.getValeByType(field.getType(), fieldValue);
}
```
Hope this helps! | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/CFIImpl.java | CFIImpl.eIsSet | @Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.CFI__FIXED_LENGTH_RG:
return fixedLengthRG != null && !fixedLengthRG.isEmpty();
}
return super.eIsSet(featureID);
} | java | @Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.CFI__FIXED_LENGTH_RG:
return fixedLengthRG != null && !fixedLengthRG.isEmpty();
}
return super.eIsSet(featureID);
} | [
"@",
"Override",
"public",
"boolean",
"eIsSet",
"(",
"int",
"featureID",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"AfplibPackage",
".",
"CFI__FIXED_LENGTH_RG",
":",
"return",
"fixedLengthRG",
"!=",
"null",
"&&",
"!",
"fixedLengthRG",
".",
"isEmp... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/afplib/impl/CFIImpl.java#L143-L150 | train | Replies if the feature is set to a value. | Create a Java method that does the following: "Replies 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 AfplibPackage.CFI__FIXED_LENGTH_RG:
return fixedLengthRG != null && !fixedLengthRG.isEmpty();
}
return super.eIsSet(featureID);
}
```
Hope this helps! | |
carrotsearch/hppc | hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java | KTypeArrayDeque.toArray | @Override
/*! #if ($TemplateOptions.KTypePrimitive)
public KType [] toArray()
#else !*/
public Object [] toArray()
/*! #end !*/
{
final int size = size();
return toArray(Intrinsics.<KType> newArray(size));
} | java | @Override
/*! #if ($TemplateOptions.KTypePrimitive)
public KType [] toArray()
#else !*/
public Object [] toArray()
/*! #end !*/
{
final int size = size();
return toArray(Intrinsics.<KType> newArray(size));
} | [
"@",
"Override",
"/*! #if ($TemplateOptions.KTypePrimitive) \n public KType [] toArray()\n #else !*/",
"public",
"Object",
"[",
"]",
"toArray",
"(",
")",
"/*! #end !*/",
"{",
"final",
"int",
"size",
"=",
"size",
"(",
")",
";",
"return",
"toArray",
"(",
"Intrinsics... | {@inheritDoc} | [
"{"
] | e359e9da358e846fcbffc64a765611df954ba3f6 | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java#L509-L518 | train | Returns an array of the elements in this array. | Create a Java method that does the following: "Returns an array of the elements in this array.". | Of course, here is the Java code you requested:
```java
@Override
/*! #if ($TemplateOptions.KTypePrimitive)
public KType [] toArray()
#else !*/
public Object [] toArray()
/*! #end !*/
{
final int size = size();
return toArray(Intrinsics.<KType> newArray(size));
}
```
Hope this helps! | |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/http/MapUriProcessor.java | MapUriProcessor.setMapping | public void setMapping(final Map<String, String> mapping) {
this.uriMapping.clear();
for (Map.Entry<String, String> entry: mapping.entrySet()) {
Pattern pattern = Pattern.compile(entry.getKey());
this.uriMapping.put(pattern, entry.getValue());
}
} | java | public void setMapping(final Map<String, String> mapping) {
this.uriMapping.clear();
for (Map.Entry<String, String> entry: mapping.entrySet()) {
Pattern pattern = Pattern.compile(entry.getKey());
this.uriMapping.put(pattern, entry.getValue());
}
} | [
"public",
"void",
"setMapping",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
")",
"{",
"this",
".",
"uriMapping",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"... | Set the uri mappings.
<p>
The key is a regular expression that must match uri's string form. The value will be used for the
replacement.
@param mapping the uri mappings. | [
"Set",
"the",
"uri",
"mappings",
".",
"<p",
">",
"The",
"key",
"is",
"a",
"regular",
"expression",
"that",
"must",
"match",
"uri",
"s",
"string",
"form",
".",
"The",
"value",
"will",
"be",
"used",
"for",
"the",
"replacement",
"."
] | 25a452cb39f592bd8a53b20db1037703898e1e22 | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/MapUriProcessor.java#L47-L53 | train | Sets the mapping. | Create a Java method that does the following: "Sets the mapping.". | Of course, here is the Java code you requested:
```java
public void setMapping(final Map<String, String> mapping) {
this.uriMapping.clear();
for (Map.Entry<String, String> entry: mapping.entrySet()) {
Pattern pattern = Pattern.compile(entry.getKey());
this.uriMapping.put(pattern... | |
ibm-bluemix-mobile-services/bms-clientsdk-android-push | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java | MFPPushUtils.storeContentInSharedPreferences | public static void storeContentInSharedPreferences(SharedPreferences sharedPreferences, String key, String value ) {
Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
} | java | public static void storeContentInSharedPreferences(SharedPreferences sharedPreferences, String key, String value ) {
Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
} | [
"public",
"static",
"void",
"storeContentInSharedPreferences",
"(",
"SharedPreferences",
"sharedPreferences",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Editor",
"editor",
"=",
"sharedPreferences",
".",
"edit",
"(",
")",
";",
"editor",
".",
"putStrin... | Store the key, value in SharedPreferences | [
"Store",
"the",
"key",
"value",
"in",
"SharedPreferences"
] | 26c048637e81a6942004693919558f3d9aa8c674 | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java#L106-L110 | train | Stores the content in the SharedPreferences. | Create a Java method that does the following: "Stores the content in the SharedPreferences.". | Of course, here is the Java code you requested:
```java
public static void storeContentInSharedPreferences(SharedPreferences sharedPreferences, String key, String value ) {
Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
}
```
Hope this helps! | |
jfrog/artifactory-client-java | services/src/main/groovy/org/jfrog/artifactory/client/impl/ArtifactoryImpl.java | ArtifactoryImpl.restCall | @Override
public ArtifactoryResponse restCall(ArtifactoryRequest artifactoryRequest) throws IOException {
HttpRequestBase httpRequest;
String requestPath = "/" + artifactoryRequest.getApiUrl();
ContentType contentType = Util.getContentType(artifactoryRequest.getRequestType());
Stri... | java | @Override
public ArtifactoryResponse restCall(ArtifactoryRequest artifactoryRequest) throws IOException {
HttpRequestBase httpRequest;
String requestPath = "/" + artifactoryRequest.getApiUrl();
ContentType contentType = Util.getContentType(artifactoryRequest.getRequestType());
Stri... | [
"@",
"Override",
"public",
"ArtifactoryResponse",
"restCall",
"(",
"ArtifactoryRequest",
"artifactoryRequest",
")",
"throws",
"IOException",
"{",
"HttpRequestBase",
"httpRequest",
";",
"String",
"requestPath",
"=",
"\"/\"",
"+",
"artifactoryRequest",
".",
"getApiUrl",
"... | Create a REST call to artifactory with a generic request
@param artifactoryRequest that should be sent to artifactory
@return {@link ArtifactoryResponse} artifactory response as per to the request sent | [
"Create",
"a",
"REST",
"call",
"to",
"artifactory",
"with",
"a",
"generic",
"request"
] | e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e | https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/services/src/main/groovy/org/jfrog/artifactory/client/impl/ArtifactoryImpl.java#L126-L188 | train | This method is called to make a HTTP call to the Crazo API. | Create a Java method that does the following: "This method is called to make a HTTP call to the Crazo API.". | Of course, here is the Java code you requested:
```java
@Override
public ArtifactoryResponse restCall(ArtifactoryRequest artifactoryRequest) throws IOException {
HttpRequestBase httpRequest;
String requestPath = "/" + artifactoryRequest.getApiUrl();
ContentType contentType = Util.getConten... | |
Terracotta-OSS/offheap-store | src/main/java/org/terracotta/offheapstore/storage/OffHeapBufferStorageEngine.java | OffHeapBufferStorageEngine.createFactory | public static <K, V> Factory<OffHeapBufferStorageEngine<K, V>> createFactory(final PointerSize width, final PageSource source, final int pageSize, final Portability<? super K> keyPortability, final Portability<? super V> valuePortability, final boolean thief, final boolean victim) {
return () -> new OffHeapBufferSt... | java | public static <K, V> Factory<OffHeapBufferStorageEngine<K, V>> createFactory(final PointerSize width, final PageSource source, final int pageSize, final Portability<? super K> keyPortability, final Portability<? super V> valuePortability, final boolean thief, final boolean victim) {
return () -> new OffHeapBufferSt... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Factory",
"<",
"OffHeapBufferStorageEngine",
"<",
"K",
",",
"V",
">",
">",
"createFactory",
"(",
"final",
"PointerSize",
"width",
",",
"final",
"PageSource",
"source",
",",
"final",
"int",
"pageSize",
",",
"fin... | /*
Future design ideas:
We might want to look in to supporting shrinking of the data areas, in case
our storage demands change (e.g. due to a change in key distribution, or
change in value types). | [
"/",
"*",
"Future",
"design",
"ideas",
":"
] | 600486cddb33c0247025c0cb69eff289eb6d7d93 | https://github.com/Terracotta-OSS/offheap-store/blob/600486cddb33c0247025c0cb69eff289eb6d7d93/src/main/java/org/terracotta/offheapstore/storage/OffHeapBufferStorageEngine.java#L57-L59 | train | Creates a factory for off - heap storage engines. | Create a Java method that does the following: "Creates a factory for off - heap storage engines.". | Of course, here is the Java code you requested:
```java
public static <K, V> Factory<OffHeapBufferStorageEngine<K, V>> createFactory(final PointerSize width, final PageSource source, final int pageSize, final Portability<? super K> keyPortability, final Portability<? super V> valuePortability, final boolean thief, fin... | |
xwiki/xwiki-rendering | xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/DefaultTransformationManager.java | DefaultTransformationManager.performTransformations | @Override
@Deprecated
public void performTransformations(XDOM dom, Syntax syntax) throws TransformationException
{
performTransformations(dom, new TransformationContext(dom, syntax));
} | java | @Override
@Deprecated
public void performTransformations(XDOM dom, Syntax syntax) throws TransformationException
{
performTransformations(dom, new TransformationContext(dom, syntax));
} | [
"@",
"Override",
"@",
"Deprecated",
"public",
"void",
"performTransformations",
"(",
"XDOM",
"dom",
",",
"Syntax",
"syntax",
")",
"throws",
"TransformationException",
"{",
"performTransformations",
"(",
"dom",
",",
"new",
"TransformationContext",
"(",
"dom",
",",
... | {@inheritDoc}
@deprecated Replaced by {@link #performTransformations(Block, TransformationContext)} | [
"{",
"@inheritDoc",
"}"
] | a21cdfcb64ef5b76872e3eedf78c530f26d7beb0 | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/DefaultTransformationManager.java#L88-L93 | train | Perform the transformation of the XML document. | Create a Java method that does the following: "Perform the transformation of the XML document.". | Of course, here is the Java code you requested:
```java
@Override
@Deprecated
public void performTransformations(XDOM dom, Syntax syntax) throws TransformationException
{
performTransformations(dom, new TransformationContext(dom, syntax));
}
```
Hope this helps! | |
prestodb/presto | presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetTypeUtils.java | ParquetTypeUtils.lookupColumnByName | public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName)
{
ColumnIO columnIO = groupColumnIO.getChild(columnName);
if (columnIO != null) {
return columnIO;
}
for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) {
if (gr... | java | public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName)
{
ColumnIO columnIO = groupColumnIO.getChild(columnName);
if (columnIO != null) {
return columnIO;
}
for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) {
if (gr... | [
"public",
"static",
"ColumnIO",
"lookupColumnByName",
"(",
"GroupColumnIO",
"groupColumnIO",
",",
"String",
"columnName",
")",
"{",
"ColumnIO",
"columnIO",
"=",
"groupColumnIO",
".",
"getChild",
"(",
"columnName",
")",
";",
"if",
"(",
"columnIO",
"!=",
"null",
"... | Parquet column names are case-sensitive unlike Hive, which converts all column names to lowercase.
Therefore, when we look up columns we first check for exact match, and if that fails we look for a case-insensitive match. | [
"Parquet",
"column",
"names",
"are",
"case",
"-",
"sensitive",
"unlike",
"Hive",
"which",
"converts",
"all",
"column",
"names",
"to",
"lowercase",
".",
"Therefore",
"when",
"we",
"look",
"up",
"columns",
"we",
"first",
"check",
"for",
"exact",
"match",
"and"... | 89de5e379d8f85e139d292b0add8c537a2a01a88 | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetTypeUtils.java#L207-L222 | train | Lookup ColumnIO by name. | Create a Java method that does the following: "Lookup ColumnIO by name.". | Of course, here is the Java code you requested:
```java
public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName)
{
ColumnIO columnIO = groupColumnIO.getChild(columnName);
if (columnIO != null) {
return columnIO;
}
for (int i = 0; i < gr... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/LocalTransactionWrapper.java | LocalTransactionWrapper.rollback | @Override
public void rollback(Xid xid) throws XAException {
if (tc.isEntryEnabled()) {
Tr.entry(this, tc, "rollback");
}
/*
*
* if (this.xid != null && !xid.equals(this.xid)) {
* final XAException e = new XAException(XAException.XAER_NOTA);
... | java | @Override
public void rollback(Xid xid) throws XAException {
if (tc.isEntryEnabled()) {
Tr.entry(this, tc, "rollback");
}
/*
*
* if (this.xid != null && !xid.equals(this.xid)) {
* final XAException e = new XAException(XAException.XAER_NOTA);
... | [
"@",
"Override",
"public",
"void",
"rollback",
"(",
"Xid",
"xid",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"rollback\"",
")",
";",
"}",
"/*\n ... | /*
This method is called by the transaction manager to roll back the current transaction. The
resource adapter is called to rollback and then end of transaction processing is performed
for the ManagedConnection | [
"/",
"*",
"This",
"method",
"is",
"called",
"by",
"the",
"transaction",
"manager",
"to",
"roll",
"back",
"the",
"current",
"transaction",
".",
"The",
"resource",
"adapter",
"is",
"called",
"to",
"rollback",
"and",
"then",
"end",
"of",
"transaction",
"process... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/LocalTransactionWrapper.java#L199-L265 | train | Rollback the transaction associated with this XAResource object. | Create a Java method that does the following: "Rollback the transaction associated with this XAResource object.". | Of course, here is the Java code you requested:
```java
@Override
public void rollback(Xid xid) throws XAException {
if (tc.isEntryEnabled()) {
Tr.entry(this, tc, "rollback");
}
/*
*
* if (this.xid != null && !xid.equals(this.xid)) {
* final XAExcept... | |
sebastiangraf/treetank | interfacemodules/iscsi/src/main/java/org/treetank/iscsi/data/BlockDataElementFactory.java | BlockDataElementFactory.deserializeData | @Override
public IData deserializeData(DataInput input) throws TTIOException {
try {
int size = input.readInt();
long dataKey = input.readLong();
byte[] data = new byte[size];
input.readFully(data);
return new BlockDataElement(dataKey, dat... | java | @Override
public IData deserializeData(DataInput input) throws TTIOException {
try {
int size = input.readInt();
long dataKey = input.readLong();
byte[] data = new byte[size];
input.readFully(data);
return new BlockDataElement(dataKey, dat... | [
"@",
"Override",
"public",
"IData",
"deserializeData",
"(",
"DataInput",
"input",
")",
"throws",
"TTIOException",
"{",
"try",
"{",
"int",
"size",
"=",
"input",
".",
"readInt",
"(",
")",
";",
"long",
"dataKey",
"=",
"input",
".",
"readLong",
"(",
")",
";"... | {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/iscsi/src/main/java/org/treetank/iscsi/data/BlockDataElementFactory.java#L45-L57 | train | Reads the data of a single block from the given input. | Create a Java method that does the following: "Reads the data of a single block from the given input.". | Of course, here is the Java code you requested:
```java
@Override
public IData deserializeData(DataInput input) throws TTIOException {
try {
int size = input.readInt();
long dataKey = input.readLong();
byte[] data = new byte[size];
input.readFully(data)... | |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java | ExcelFunctions.average | public static BigDecimal average(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
return sum(ctx, args).divide(new BigDecimal(args.length));
} | java | public static BigDecimal average(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
return sum(ctx, args).divide(new BigDecimal(args.length));
} | [
"public",
"static",
"BigDecimal",
"average",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Wrong number of arguments\"",
")",
";",
"... | Returns the average (arithmetic mean) of the arguments | [
"Returns",
"the",
"average",
"(",
"arithmetic",
"mean",
")",
"of",
"the",
"arguments"
] | b03d91ec58fc328960bce90ecb5fa49dcf467627 | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L359-L365 | train | Returns the average of the values of the given objects. | Create a Java method that does the following: "Returns the average of the values of the given objects.". | Of course, here is the Java code you requested:
```java
public static BigDecimal average(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
return sum(ctx, args).divide(new BigDecimal(args.length));
}
```
... | |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.addLabels | public AlphabeticIndex<V> addLabels(Locale... additions) {
for (Locale addition : additions) {
addIndexExemplars(ULocale.forLocale(addition));
}
buckets = null;
return this;
} | java | public AlphabeticIndex<V> addLabels(Locale... additions) {
for (Locale addition : additions) {
addIndexExemplars(ULocale.forLocale(addition));
}
buckets = null;
return this;
} | [
"public",
"AlphabeticIndex",
"<",
"V",
">",
"addLabels",
"(",
"Locale",
"...",
"additions",
")",
"{",
"for",
"(",
"Locale",
"addition",
":",
"additions",
")",
"{",
"addIndexExemplars",
"(",
"ULocale",
".",
"forLocale",
"(",
"addition",
")",
")",
";",
"}",
... | Add more index characters (aside from what are in the locale)
@param additions additional characters to add to the index, such as those in Swedish.
@return this, for chaining | [
"Add",
"more",
"index",
"characters",
"(",
"aside",
"from",
"what",
"are",
"in",
"the",
"locale",
")"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L325-L331 | train | Add labels to the index. | Create a Java method that does the following: "Add labels to the index.". | Of course, here is the Java code you requested:
```java
public AlphabeticIndex<V> addLabels(Locale... additions) {
for (Locale addition : additions) {
addIndexExemplars(ULocale.forLocale(addition));
}
buckets = null;
return this;
}
```
Hope this helps! | |
jinahya/commons-codec-proxies | src/main/java/com/github/jinahya/codec/commons/AbstractEncoderProxy.java | AbstractEncoderProxy.newInstance | protected static <P extends AbstractEncoderProxy<T>, T> Object newInstance(
final ClassLoader loader, final Class<?>[] interfaces,
final Class<P> proxyType, final Class<T> encoderType, final T encoder) {
if (loader == null) {
throw new NullPointerException("loader");
}
... | java | protected static <P extends AbstractEncoderProxy<T>, T> Object newInstance(
final ClassLoader loader, final Class<?>[] interfaces,
final Class<P> proxyType, final Class<T> encoderType, final T encoder) {
if (loader == null) {
throw new NullPointerException("loader");
}
... | [
"protected",
"static",
"<",
"P",
"extends",
"AbstractEncoderProxy",
"<",
"T",
">",
",",
"T",
">",
"Object",
"newInstance",
"(",
"final",
"ClassLoader",
"loader",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
",",
"final",
"Class",
"<",
"P... | Creates a new proxy instance.
@param <P> proxy type parameter
@param <T> encoder type parameter
@param loader class loader
@param interfaces interfaces
@param proxyType proxy type
@param encoderType encoder type
@param encoder encoder
@return a new proxy instance. | [
"Creates",
"a",
"new",
"proxy",
"instance",
"."
] | 00e1c1b205b2a04603f0d046b68ae720da0d13bf | https://github.com/jinahya/commons-codec-proxies/blob/00e1c1b205b2a04603f0d046b68ae720da0d13bf/src/main/java/com/github/jinahya/codec/commons/AbstractEncoderProxy.java#L191-L234 | train | Creates a new instance of the specified class. | Create a Java method that does the following: "Creates a new instance of the specified class.". | Of course, here is the Java code you requested:
```java
protected static <P extends AbstractEncoderProxy<T>, T> Object newInstance(
final ClassLoader loader, final Class<?>[] interfaces,
final Class<P> proxyType, final Class<T> encoderType, final T encoder) {
if (loader == null) {
... | |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java | CLI.connect | public void connect(String controllerHost, int controllerPort,
String username, char[] password, String clientBindAddress) {
connect("remote+http", controllerHost, controllerPort,
username, password, clientBindAddress);
} | java | public void connect(String controllerHost, int controllerPort,
String username, char[] password, String clientBindAddress) {
connect("remote+http", controllerHost, controllerPort,
username, password, clientBindAddress);
} | [
"public",
"void",
"connect",
"(",
"String",
"controllerHost",
",",
"int",
"controllerPort",
",",
"String",
"username",
",",
"char",
"[",
"]",
"password",
",",
"String",
"clientBindAddress",
")",
"{",
"connect",
"(",
"\"remote+http\"",
",",
"controllerHost",
",",... | Connect to the server using a specified host and port.
@param controllerHost The host name.
@param controllerPort The port.
@param username The user name for logging in.
@param password The password for logging in.
@param clientBindAddress the client bind address. | [
"Connect",
"to",
"the",
"server",
"using",
"a",
"specified",
"host",
"and",
"port",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java#L164-L168 | train | Connects to the remote + http server. | Create a Java method that does the following: "Connects to the remote + http server.". | Of course, here is the Java code you requested:
```java
public void connect(String controllerHost, int controllerPort,
String username, char[] password, String clientBindAddress) {
connect("remote+http", controllerHost, controllerPort,
username, password, clientBindAddress);
}
`... | |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/nature/FindBugsNature.java | FindBugsNature.configure | @Override
public void configure() throws CoreException {
if (DEBUG) {
System.out.println("Adding findbugs to the project build spec.");
}
// register FindBugs builder
addToBuildSpec(FindbugsPlugin.BUILDER_ID);
} | java | @Override
public void configure() throws CoreException {
if (DEBUG) {
System.out.println("Adding findbugs to the project build spec.");
}
// register FindBugs builder
addToBuildSpec(FindbugsPlugin.BUILDER_ID);
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Adding findbugs to the project build spec.\"",
")",
";",
"}",
"// register FindBugs builder",
"add... | Adds the FindBugs builder to the project.
@see IProjectNature#configure | [
"Adds",
"the",
"FindBugs",
"builder",
"to",
"the",
"project",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/nature/FindBugsNature.java#L52-L59 | train | Override this method to add FindBugs to the project build spec. | Create a Java method that does the following: "Override this method to add FindBugs to the project build spec.". | Of course, here is the Java code you requested:
```java
@Override
public void configure() throws CoreException {
if (DEBUG) {
System.out.println("Adding findbugs to the project build spec.");
}
// register FindBugs builder
addToBuildSpec(FindbugsPlugin.BUILDER_ID);
}... | |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/rule/AndRule.java | AndRule.getRule | public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid AND rule - expected two rules but received "
+ stack.size());
}
Object o2 = stack.pop();
Object o1 = stack.pop();
if ((o2 instanceof Ru... | java | public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid AND rule - expected two rules but received "
+ stack.size());
}
Object o2 = stack.pop();
Object o1 = stack.pop();
if ((o2 instanceof Ru... | [
"public",
"static",
"Rule",
"getRule",
"(",
"final",
"Stack",
"stack",
")",
"{",
"if",
"(",
"stack",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid AND rule - expected two rules but received \"",
"+",
"stac... | Create rule from top two elements of stack.
@param stack stack of rules.
@return Rule that evaluates true only if both rules are true. | [
"Create",
"rule",
"from",
"top",
"two",
"elements",
"of",
"stack",
"."
] | 493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/AndRule.java#L65-L79 | train | Gets the next rule from the stack. | Create a Java method that does the following: "Gets the next rule from the stack.". | Of course, here is the Java code you requested:
```java
public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid AND rule - expected two rules but received "
+ stack.size());
}
Object o2 = stack.pop(... | |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_debt_operation_operationId_GET | public OvhOperation order_orderId_debt_operation_operationId_GET(Long orderId, Long operationId) throws IOException {
String qPath = "/me/order/{orderId}/debt/operation/{operationId}";
StringBuilder sb = path(qPath, orderId, operationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(r... | java | public OvhOperation order_orderId_debt_operation_operationId_GET(Long orderId, Long operationId) throws IOException {
String qPath = "/me/order/{orderId}/debt/operation/{operationId}";
StringBuilder sb = path(qPath, orderId, operationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(r... | [
"public",
"OvhOperation",
"order_orderId_debt_operation_operationId_GET",
"(",
"Long",
"orderId",
",",
"Long",
"operationId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/debt/operation/{operationId}\"",
";",
"StringBuilder",
"sb",
"=",
... | Get this object properties
REST: GET /me/order/{orderId}/debt/operation/{operationId}
@param orderId [required]
@param operationId [required] | [
"Get",
"this",
"object",
"properties"
] | 6d531a40e56e09701943e334c25f90f640c55701 | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2001-L2006 | train | Get details of a specific operation | Create a Java method that does the following: "Get details of a specific operation". | Of course, here is the Java code you requested:
```java
public OvhOperation order_orderId_debt_operation_operationId_GET(Long orderId, Long operationId) throws IOException {
String qPath = "/me/order/{orderId}/debt/operation/{operationId}";
StringBuilder sb = path(qPath, orderId, operationId);
String resp = exec... | |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java | ConsumerContainer.addConsumer | public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) {
for (int i=0; i < instances; i++) {
this.consumerHolders.add(new ConsumerHolder(consumer, configuration));
}
} | java | public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) {
for (int i=0; i < instances; i++) {
this.consumerHolders.add(new ConsumerHolder(consumer, configuration));
}
} | [
"public",
"synchronized",
"void",
"addConsumer",
"(",
"Consumer",
"consumer",
",",
"ConsumerConfiguration",
"configuration",
",",
"int",
"instances",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"instances",
";",
"i",
"++",
")",
"{",
"this",
... | Adds a consumer to the container and configures it according to the consumer
configuration. Does NOT enable the consumer to consume from the message broker until the container is started.
<p>Registers the same consumer N times at the queue according to the number of specified instances.
Use this for scaling your consu... | [
"Adds",
"a",
"consumer",
"to",
"the",
"container",
"and",
"configures",
"it",
"according",
"to",
"the",
"consumer",
"configuration",
".",
"Does",
"NOT",
"enable",
"the",
"consumer",
"to",
"consume",
"from",
"the",
"message",
"broker",
"until",
"the",
"containe... | c161efda6c0f7ef319aedf09dfe40a4a90165510 | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java#L155-L159 | train | Add a consumer to the list of consumers. | Create a Java method that does the following: "Add a consumer to the list of consumers.". | Of course, here is the Java code you requested:
```java
public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) {
for (int i=0; i < instances; i++) {
this.consumerHolders.add(new ConsumerHolder(consumer, configuration));
}
}
```
H... | |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java | ParserDDL.readColumnDefinitionOrNull | ColumnSchema readColumnDefinitionOrNull(Table table, HsqlName hsqlName,
HsqlArrayList constraintList) {
boolean isIdentity = false;
boolean isPKIdentity = false;
boolean identityAlways = false;
Expression generateExpr = null;
boolean ... | java | ColumnSchema readColumnDefinitionOrNull(Table table, HsqlName hsqlName,
HsqlArrayList constraintList) {
boolean isIdentity = false;
boolean isPKIdentity = false;
boolean identityAlways = false;
Expression generateExpr = null;
boolean ... | [
"ColumnSchema",
"readColumnDefinitionOrNull",
"(",
"Table",
"table",
",",
"HsqlName",
"hsqlName",
",",
"HsqlArrayList",
"constraintList",
")",
"{",
"boolean",
"isIdentity",
"=",
"false",
";",
"boolean",
"isPKIdentity",
"=",
"false",
";",
"boolean",
"identityAlways",
... | Responsible for handling the creation of table columns during the process
of executing CREATE TABLE or ADD COLUMN etc. statements.
@param table this table
@param hsqlName column name
@param constraintList list of constraints
@return a Column object with indicated attributes | [
"Responsible",
"for",
"handling",
"the",
"creation",
"of",
"table",
"columns",
"during",
"the",
"process",
"of",
"executing",
"CREATE",
"TABLE",
"or",
"ADD",
"COLUMN",
"etc",
".",
"statements",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L2912-L3013 | train | readColumnDefinitionOrNull Method. | Create a Java method that does the following: "readColumnDefinitionOrNull Method.". | Of course, here is the Java code you requested:
```java
ColumnSchema readColumnDefinitionOrNull(Table table, HsqlName hsqlName,
HsqlArrayList constraintList) {
boolean isIdentity = false;
boolean isPKIdentity = false;
boolean identityAlways = false;
... | |
mongodb/mongo-java-driver | driver-legacy/src/main/com/mongodb/util/JSON.java | JSON.serialize | public static void serialize(final Object object, final StringBuilder buf) {
JSONSerializers.getLegacy().serialize(object, buf);
} | java | public static void serialize(final Object object, final StringBuilder buf) {
JSONSerializers.getLegacy().serialize(object, buf);
} | [
"public",
"static",
"void",
"serialize",
"(",
"final",
"Object",
"object",
",",
"final",
"StringBuilder",
"buf",
")",
"{",
"JSONSerializers",
".",
"getLegacy",
"(",
")",
".",
"serialize",
"(",
"object",
",",
"buf",
")",
";",
"}"
] | <p>Serializes an object into its JSON form.</p>
<p>This method delegates serialization to {@code JSONSerializers.getLegacy}</p>
@param object object to serialize
@param buf StringBuilder containing the JSON representation under construction
@see JSONSerializers#getLegacy() | [
"<p",
">",
"Serializes",
"an",
"object",
"into",
"its",
"JSON",
"form",
".",
"<",
"/",
"p",
">"
] | a92d47e2e9f2fca55d09229a0a2e2cdc714db085 | https://github.com/mongodb/mongo-java-driver/blob/a92d47e2e9f2fca55d09229a0a2e2cdc714db085/driver-legacy/src/main/com/mongodb/util/JSON.java#L59-L61 | valid | Serialize an object to a string buffer. | Create a Java method that does the following: "Serialize an object to a string buffer.". | Of course, here is the Java code you requested:
```java
public static void serialize(final Object object, final StringBuilder buf) {
JSONSerializers.getLegacy().serialize(object, buf);
}
```
Hope this helps! | |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FreightStreamer.java | FreightStreamer.main | public static void main(String argv[]) throws Exception {
FreightStreamer streamer = new FreightStreamer();
int res;
try {
res = ToolRunner.run(streamer, argv);
} finally {
streamer.close();
}
System.exit(res);
} | java | public static void main(String argv[]) throws Exception {
FreightStreamer streamer = new FreightStreamer();
int res;
try {
res = ToolRunner.run(streamer, argv);
} finally {
streamer.close();
}
System.exit(res);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"argv",
"[",
"]",
")",
"throws",
"Exception",
"{",
"FreightStreamer",
"streamer",
"=",
"new",
"FreightStreamer",
"(",
")",
";",
"int",
"res",
";",
"try",
"{",
"res",
"=",
"ToolRunner",
".",
"run",
"(",
... | main() has some simple utility methods | [
"main",
"()",
"has",
"some",
"simple",
"utility",
"methods"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FreightStreamer.java#L807-L816 | train | Main method for the Freight Streamer tool. | Create a Java method that does the following: "Main method for the Freight Streamer tool.". | Of course, here is the Java code you requested:
```java
public static void main(String argv[]) throws Exception {
FreightStreamer streamer = new FreightStreamer();
int res;
try {
res = ToolRunner.run(streamer, argv);
} finally {
streamer.close();
}
System.exit(res);
}
```
Hope th... | |
charithe/kafka-junit | src/main/java/com/github/charithe/kafka/KafkaHelper.java | KafkaHelper.consume | public <K, V> ListenableFuture<List<ConsumerRecord<K, V>>> consume(String topic, KafkaConsumer<K, V> consumer, int numMessagesToConsume) {
consumer.subscribe(Lists.newArrayList(topic));
ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
ret... | java | public <K, V> ListenableFuture<List<ConsumerRecord<K, V>>> consume(String topic, KafkaConsumer<K, V> consumer, int numMessagesToConsume) {
consumer.subscribe(Lists.newArrayList(topic));
ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
ret... | [
"public",
"<",
"K",
",",
"V",
">",
"ListenableFuture",
"<",
"List",
"<",
"ConsumerRecord",
"<",
"K",
",",
"V",
">",
">",
">",
"consume",
"(",
"String",
"topic",
",",
"KafkaConsumer",
"<",
"K",
",",
"V",
">",
"consumer",
",",
"int",
"numMessagesToConsum... | Attempt to consume the specified number of messages
@param topic Topic to consume
@param consumer Consumer to use
@param numMessagesToConsume Number of messages to consume
@param <K> Type of Key
@param <V> Type of Value
@return ListenableFuture | [
"Attempt",
"to",
"consume",
"the",
"specified",
"number",
"of",
"messages"
] | b808b3d1dec8105346d316f92f68950f36aeb871 | https://github.com/charithe/kafka-junit/blob/b808b3d1dec8105346d316f92f68950f36aeb871/src/main/java/com/github/charithe/kafka/KafkaHelper.java#L261-L265 | train | Consume messages from Kafka topic | Create a Java method that does the following: "Consume messages from Kafka topic". | Of course, here is the Java code you requested:
```java
public <K, V> ListenableFuture<List<ConsumerRecord<K, V>>> consume(String topic, KafkaConsumer<K, V> consumer, int numMessagesToConsume) {
consumer.subscribe(Lists.newArrayList(topic));
ListeningExecutorService executor = MoreExecutors.listeningDe... | |
cdk/cdk | descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GSR.java | RDFProtonDescriptor_GSR.getParameterType | @Override
public Object getParameterType(String name) {
if (name.equals("checkAromaticity")) return Boolean.TRUE;
return null;
} | java | @Override
public Object getParameterType(String name) {
if (name.equals("checkAromaticity")) return Boolean.TRUE;
return null;
} | [
"@",
"Override",
"public",
"Object",
"getParameterType",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"\"checkAromaticity\"",
")",
")",
"return",
"Boolean",
".",
"TRUE",
";",
"return",
"null",
";",
"}"
] | Gets the parameterType attribute of the RDFProtonDescriptor
object
@param name Description of the Parameter
@return The parameterType value | [
"Gets",
"the",
"parameterType",
"attribute",
"of",
"the",
"RDFProtonDescriptor",
"object"
] | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GSR.java#L602-L606 | train | Override the getParameterType method to return the parameter type. | Create a Java method that does the following: "Override the getParameterType method to return the parameter type.". | Of course, here is the Java code you requested:
```java
@Override
public Object getParameterType(String name) {
if (name.equals("checkAromaticity")) return Boolean.TRUE;
return null;
}
```
Hope this helps! | |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java | AbstractTermSuiteCollectionReader.getNext | @Override
public void getNext(CAS cas) throws IOException, CollectionException {
if(mCurrentIndex == 0) {
logger.info("Reading collection {} ({} documents)", inputDirPath, mFiles.size());
progressLoggerTimer.schedule(new TimerTask() {
private long lastSize = 0;
private long lastTop = System.currentTime... | java | @Override
public void getNext(CAS cas) throws IOException, CollectionException {
if(mCurrentIndex == 0) {
logger.info("Reading collection {} ({} documents)", inputDirPath, mFiles.size());
progressLoggerTimer.schedule(new TimerTask() {
private long lastSize = 0;
private long lastTop = System.currentTime... | [
"@",
"Override",
"public",
"void",
"getNext",
"(",
"CAS",
"cas",
")",
"throws",
"IOException",
",",
"CollectionException",
"{",
"if",
"(",
"mCurrentIndex",
"==",
"0",
")",
"{",
"logger",
".",
"info",
"(",
"\"Reading collection {} ({} documents)\"",
",",
"inputDi... | protected abstract TermSuiteCollection getCollectionType(); | [
"protected",
"abstract",
"TermSuiteCollection",
"getCollectionType",
"()",
";"
] | 731e5d0bc7c14180713c01a9c7dffe1925f26130 | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java#L149-L182 | train | Get the next document from the CAS. | Create a Java method that does the following: "Get the next document from the CAS.". | Of course, here is the Java code you requested:
```java
@Override
public void getNext(CAS cas) throws IOException, CollectionException {
if(mCurrentIndex == 0) {
logger.info("Reading collection {} ({} documents)", inputDirPath, mFiles.size());
progressLoggerTimer.schedule(new TimerTask() {
private long la... | |
rholder/fauxflake | fauxflake-core/src/main/java/com/github/rholder/fauxflake/IdGenerators.java | IdGenerators.newFlakeIdGenerator | public static IdGenerator newFlakeIdGenerator(MachineIdProvider machineIdProvider) {
EncodingProvider encodingProvider = new FlakeEncodingProvider(machineIdProvider.getMachineId());
return new DefaultIdGenerator(new SystemTimeProvider(), encodingProvider);
} | java | public static IdGenerator newFlakeIdGenerator(MachineIdProvider machineIdProvider) {
EncodingProvider encodingProvider = new FlakeEncodingProvider(machineIdProvider.getMachineId());
return new DefaultIdGenerator(new SystemTimeProvider(), encodingProvider);
} | [
"public",
"static",
"IdGenerator",
"newFlakeIdGenerator",
"(",
"MachineIdProvider",
"machineIdProvider",
")",
"{",
"EncodingProvider",
"encodingProvider",
"=",
"new",
"FlakeEncodingProvider",
"(",
"machineIdProvider",
".",
"getMachineId",
"(",
")",
")",
";",
"return",
"... | Create a Flake-based {@link IdGenerator} using the given
{@link MachineIdProvider}.
@return the {@link IdGenerator} | [
"Create",
"a",
"Flake",
"-",
"based",
"{",
"@link",
"IdGenerator",
"}",
"using",
"the",
"given",
"{",
"@link",
"MachineIdProvider",
"}",
"."
] | 54631faefdaf6b0b4d27b365f18c085771575cb3 | https://github.com/rholder/fauxflake/blob/54631faefdaf6b0b4d27b365f18c085771575cb3/fauxflake-core/src/main/java/com/github/rholder/fauxflake/IdGenerators.java#L73-L76 | train | Creates a new id generator for a Flake application. | Create a Java method that does the following: "Creates a new id generator for a Flake application.". | Of course, here is the Java code you requested:
```java
public static IdGenerator newFlakeIdGenerator(MachineIdProvider machineIdProvider) {
EncodingProvider encodingProvider = new FlakeEncodingProvider(machineIdProvider.getMachineId());
return new DefaultIdGenerator(new SystemTimeProvider(), encodingP... | |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/acknowledge/NegativeAcknowledger.java | NegativeAcknowledger.action | @Override
public void action(String queueUrl, List<String> receiptHandles) throws JMSException {
if (receiptHandles == null || receiptHandles.isEmpty()) {
return;
}
List<ChangeMessageVisibilityBatchRequestEntry> nackEntries = new ArrayList<ChangeMessageVisibilityBatchRequestEnt... | java | @Override
public void action(String queueUrl, List<String> receiptHandles) throws JMSException {
if (receiptHandles == null || receiptHandles.isEmpty()) {
return;
}
List<ChangeMessageVisibilityBatchRequestEntry> nackEntries = new ArrayList<ChangeMessageVisibilityBatchRequestEnt... | [
"@",
"Override",
"public",
"void",
"action",
"(",
"String",
"queueUrl",
",",
"List",
"<",
"String",
">",
"receiptHandles",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"receiptHandles",
"==",
"null",
"||",
"receiptHandles",
".",
"isEmpty",
"(",
")",
")",
... | Action call block for negative acknowledge for the list of receipt
handles. This action can be applied on multiple messages for the same
queue.
@param queueUrl
The queueUrl of the queue, which the receipt handles belong.
@param receiptHandles
The list of handles, which is be used to negative acknowledge
the messages v... | [
"Action",
"call",
"block",
"for",
"negative",
"acknowledge",
"for",
"the",
"list",
"of",
"receipt",
"handles",
".",
"This",
"action",
"can",
"be",
"applied",
"on",
"multiple",
"messages",
"for",
"the",
"same",
"queue",
"."
] | efa716d34d51ef1c5572790626cdb795419cb342 | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/acknowledge/NegativeAcknowledger.java#L88-L106 | train | Action method for the message visibility batch operation. | Create a Java method that does the following: "Action method for the message visibility batch operation.". | Of course, here is the Java code you requested:
```java
@Override
public void action(String queueUrl, List<String> receiptHandles) throws JMSException {
if (receiptHandles == null || receiptHandles.isEmpty()) {
return;
}
List<ChangeMessageVisibilityBatchRequestEntry> nackEntri... | |
crawljax/crawljax | core/src/main/java/com/crawljax/core/plugin/Plugins.java | Plugins.runPreCrawlingPlugins | public void runPreCrawlingPlugins(CrawljaxConfiguration config) {
LOGGER.debug("Running PreCrawlingPlugins...");
counters.get(PreStateCrawlingPlugin.class).inc();
for (Plugin plugin : plugins.get(PreCrawlingPlugin.class)) {
if (plugin instanceof PreCrawlingPlugin) {
LOGGER.debug("Calling plugin {}", plugin... | java | public void runPreCrawlingPlugins(CrawljaxConfiguration config) {
LOGGER.debug("Running PreCrawlingPlugins...");
counters.get(PreStateCrawlingPlugin.class).inc();
for (Plugin plugin : plugins.get(PreCrawlingPlugin.class)) {
if (plugin instanceof PreCrawlingPlugin) {
LOGGER.debug("Calling plugin {}", plugin... | [
"public",
"void",
"runPreCrawlingPlugins",
"(",
"CrawljaxConfiguration",
"config",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Running PreCrawlingPlugins...\"",
")",
";",
"counters",
".",
"get",
"(",
"PreStateCrawlingPlugin",
".",
"class",
")",
".",
"inc",
"(",
")",... | Run the {@link PreCrawlingPlugin}s. No {@link CrawlerContext} is available at this stage.
@param config The given {@link CrawljaxConfiguration}. | [
"Run",
"the",
"{",
"@link",
"PreCrawlingPlugin",
"}",
"s",
".",
"No",
"{",
"@link",
"CrawlerContext",
"}",
"is",
"available",
"at",
"this",
"stage",
"."
] | d339f4f622ca902ccd35322065821e52a62ec543 | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/core/plugin/Plugins.java#L276-L289 | train | Run all PreCrawlingPlugins. | Create a Java method that does the following: "Run all PreCrawlingPlugins.". | Of course, here is the Java code you requested:
```java
public void runPreCrawlingPlugins(CrawljaxConfiguration config) {
LOGGER.debug("Running PreCrawlingPlugins...");
counters.get(PreStateCrawlingPlugin.class).inc();
for (Plugin plugin : plugins.get(PreCrawlingPlugin.class)) {
if (plugin instanceof PreCrawl... | |
liquibase/liquibase | liquibase-core/src/main/java/liquibase/snapshot/SnapshotControl.java | SnapshotControl.addType | public boolean addType(Class<? extends DatabaseObject> type, Database database) {
boolean added = this.types.add(type);
if (added) {
for (Class<? extends DatabaseObject> container : SnapshotGeneratorFactory.getInstance().getContainerTypes(type, database)) {
addType(container,... | java | public boolean addType(Class<? extends DatabaseObject> type, Database database) {
boolean added = this.types.add(type);
if (added) {
for (Class<? extends DatabaseObject> container : SnapshotGeneratorFactory.getInstance().getContainerTypes(type, database)) {
addType(container,... | [
"public",
"boolean",
"addType",
"(",
"Class",
"<",
"?",
"extends",
"DatabaseObject",
">",
"type",
",",
"Database",
"database",
")",
"{",
"boolean",
"added",
"=",
"this",
".",
"types",
".",
"add",
"(",
"type",
")",
";",
"if",
"(",
"added",
")",
"{",
"... | Adds a new DatabaseObject type to the list of object types to be included in snapshots.
@param type The type to be added
@param database The database to check for any dependent types that need to be included as well
@return true if the type was added to the list, false if it was already present. | [
"Adds",
"a",
"new",
"DatabaseObject",
"type",
"to",
"the",
"list",
"of",
"object",
"types",
"to",
"be",
"included",
"in",
"snapshots",
"."
] | 86a3b30fa6821ac981056f252f918557f5ebcc60 | https://github.com/liquibase/liquibase/blob/86a3b30fa6821ac981056f252f918557f5ebcc60/liquibase-core/src/main/java/liquibase/snapshot/SnapshotControl.java#L135-L143 | valid | Add a type to the type list. | Create a Java method that does the following: "Add a type to the type list.". | Of course, here is the Java code you requested:
```java
public boolean addType(Class<? extends DatabaseObject> type, Database database) {
boolean added = this.types.add(type);
if (added) {
for (Class<? extends DatabaseObject> container : SnapshotGeneratorFactory.getInstance().getContainerTy... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/MessageStoreImpl.java | MessageStoreImpl.engineReloaded | @Override
public void engineReloaded(Object messagingEngine)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "engineReloaded");
// Defect 337421.1
// Our config has been reloaded so we need to essentially
// re-initialize so t... | java | @Override
public void engineReloaded(Object messagingEngine)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "engineReloaded");
// Defect 337421.1
// Our config has been reloaded so we need to essentially
// re-initialize so t... | [
"@",
"Override",
"public",
"void",
"engineReloaded",
"(",
"Object",
"messagingEngine",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"... | Notification that the configuration of the engine has changed.
@param engine The messaging engine whose configuration has been reloaded | [
"Notification",
"that",
"the",
"configuration",
"of",
"the",
"engine",
"has",
"changed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/MessageStoreImpl.java#L664-L678 | train | Called by the application to re - load the CRAs from the AICU | Create a Java method that does the following: "Called by the application to re - load the CRAs from the AICU". | Of course, here is the Java code you requested:
```java
@Override
public void engineReloaded(Object messagingEngine)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "engineReloaded");
// Defect 337421.1
// Our config has been reloade... | |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.findPermissions | public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
User user) {
requireNonNull(user, "user");
if (user.isAdmin()) {
return CompletableFuture.completedFuture(PerRolePermissi... | java | public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
User user) {
requireNonNull(user, "user");
if (user.isAdmin()) {
return CompletableFuture.completedFuture(PerRolePermissi... | [
"public",
"CompletableFuture",
"<",
"Collection",
"<",
"Permission",
">",
">",
"findPermissions",
"(",
"String",
"projectName",
",",
"String",
"repoName",
",",
"User",
"user",
")",
"{",
"requireNonNull",
"(",
"user",
",",
"\"user\"",
")",
";",
"if",
"(",
"us... | Finds {@link Permission}s which belong to the specified {@link User} or {@link UserWithToken}
from the specified {@code repoName} in the specified {@code projectName}. | [
"Finds",
"{"
] | b9e46c67fbc26628c2186ce2f46e7fb303c831e9 | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L585-L596 | train | Find permissions for a user. | Create a Java method that does the following: "Find permissions for a user.". | Of course, here is the Java code you requested:
```java
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
User user) {
requireNonNull(user, "user");
if (user.isAdmin()) {
... | |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/FlexyPoolDataSource.java | FlexyPoolDataSource.getConnection | private Connection getConnection(ConnectionRequestContext context) throws SQLException {
concurrentConnectionRequestCountHistogram.update(concurrentConnectionRequestCount.incrementAndGet());
long startNanos = System.nanoTime();
try {
Connection connection = null;
if ... | java | private Connection getConnection(ConnectionRequestContext context) throws SQLException {
concurrentConnectionRequestCountHistogram.update(concurrentConnectionRequestCount.incrementAndGet());
long startNanos = System.nanoTime();
try {
Connection connection = null;
if ... | [
"private",
"Connection",
"getConnection",
"(",
"ConnectionRequestContext",
"context",
")",
"throws",
"SQLException",
"{",
"concurrentConnectionRequestCountHistogram",
".",
"update",
"(",
"concurrentConnectionRequestCount",
".",
"incrementAndGet",
"(",
")",
")",
";",
"long",... | Try to obtain a connection by going through all available strategies
@param context context
@return connection
@throws SQLException | [
"Try",
"to",
"obtain",
"a",
"connection",
"by",
"going",
"through",
"all",
"available",
"strategies"
] | d763d359e68299c2b4e28e4b67770581ae083431 | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/FlexyPoolDataSource.java#L293-L328 | train | Gets a connection from the FlexyPoolDataSource. | Create a Java method that does the following: "Gets a connection from the FlexyPoolDataSource.". | Of course, here is the Java code you requested:
```java
private Connection getConnection(ConnectionRequestContext context) throws SQLException {
concurrentConnectionRequestCountHistogram.update(concurrentConnectionRequestCount.incrementAndGet());
long startNanos = System.nanoTime();
try {
... | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/CapacityUtil.java | CapacityUtil.roundCapacity | public static long roundCapacity(long requestedCapacity) {
if (requestedCapacity > MAX_LONG_CAPACITY) {
throw new IllegalArgumentException(requestedCapacity + " is greater than max allowed capacity["
+ MAX_LONG_CAPACITY + "].");
}
return Math.max(MIN_CAPACITY, Qu... | java | public static long roundCapacity(long requestedCapacity) {
if (requestedCapacity > MAX_LONG_CAPACITY) {
throw new IllegalArgumentException(requestedCapacity + " is greater than max allowed capacity["
+ MAX_LONG_CAPACITY + "].");
}
return Math.max(MIN_CAPACITY, Qu... | [
"public",
"static",
"long",
"roundCapacity",
"(",
"long",
"requestedCapacity",
")",
"{",
"if",
"(",
"requestedCapacity",
">",
"MAX_LONG_CAPACITY",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"requestedCapacity",
"+",
"\" is greater than max allowed capacity... | Round the capacity to the next allowed value. | [
"Round",
"the",
"capacity",
"to",
"the",
"next",
"allowed",
"value",
"."
] | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/CapacityUtil.java#L47-L54 | train | Round the requested capacity to the next power of two. | Create a Java method that does the following: "Round the requested capacity to the next power of two.". | Of course, here is the Java code you requested:
```java
public static long roundCapacity(long requestedCapacity) {
if (requestedCapacity > MAX_LONG_CAPACITY) {
throw new IllegalArgumentException(requestedCapacity + " is greater than max allowed capacity["
+ MAX_LONG_CAPACITY + "... | |
openwms/org.openwms | org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java | FireAfterTransactionAspect.fireEvent | public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException {
try {
for (int i = 0; i < events.events().length; i++) {
Class<? extends EventObject> event = events.events()[i];
if (ApplicationEvent.class.isAssignableFrom(event)) {
... | java | public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException {
try {
for (int i = 0; i < events.events().length; i++) {
Class<? extends EventObject> event = events.events()[i];
if (ApplicationEvent.class.isAssignableFrom(event)) {
... | [
"public",
"void",
"fireEvent",
"(",
"Object",
"publisher",
",",
"FireAfterTransaction",
"events",
")",
"throws",
"RuntimeException",
"{",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"events",
".",
"events",
"(",
")",
".",
"length",
";",
... | Only {@link ApplicationEvent}s are created and published over Springs
{@link ApplicationContext}.
@param publisher The instance that is publishing the event
@param events A list of event classes to fire
@throws RuntimeException Any exception is re-thrown | [
"Only",
"{",
"@link",
"ApplicationEvent",
"}",
"s",
"are",
"created",
"and",
"published",
"over",
"Springs",
"{",
"@link",
"ApplicationContext",
"}",
"."
] | b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e | https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java#L73-L84 | train | Fire events to the application. | Create a Java method that does the following: "Fire events to the application.". | Of course, here is the Java code you requested:
```java
public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException {
try {
for (int i = 0; i < events.events().length; i++) {
Class<? extends EventObject> event = events.events()[i];
if... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java | AbstractCommand.updatedEnabledState | protected void updatedEnabledState() {
boolean isEnabled = isEnabled();
if (oldEnabledState == null || hasChanged(oldEnabledState.booleanValue(), isEnabled)) {
firePropertyChange(ENABLED_PROPERTY_NAME, oldEnabledState == null ? !isEnabled : oldEnabledState
.booleanValue(), isEnabled);
}
oldEnabledState ... | java | protected void updatedEnabledState() {
boolean isEnabled = isEnabled();
if (oldEnabledState == null || hasChanged(oldEnabledState.booleanValue(), isEnabled)) {
firePropertyChange(ENABLED_PROPERTY_NAME, oldEnabledState == null ? !isEnabled : oldEnabledState
.booleanValue(), isEnabled);
}
oldEnabledState ... | [
"protected",
"void",
"updatedEnabledState",
"(",
")",
"{",
"boolean",
"isEnabled",
"=",
"isEnabled",
"(",
")",
";",
"if",
"(",
"oldEnabledState",
"==",
"null",
"||",
"hasChanged",
"(",
"oldEnabledState",
".",
"booleanValue",
"(",
")",
",",
"isEnabled",
")",
... | This method is called when any predicate for enabled state has changed.
This implementation fires the enabled changed event if the return value
of {@link #isEnabled()} has changed.
<p>
Subclasses which have an additional predicate to enabled state must call
this method if the state of the predicate changes. | [
"This",
"method",
"is",
"called",
"when",
"any",
"predicate",
"for",
"enabled",
"state",
"has",
"changed",
".",
"This",
"implementation",
"fires",
"the",
"enabled",
"changed",
"event",
"if",
"the",
"return",
"value",
"of",
"{"
] | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java#L523-L530 | train | Updates the enabled state of the component. | Create a Java method that does the following: "Updates the enabled state of the component.". | Of course, here is the Java code you requested:
```java
protected void updatedEnabledState() {
boolean isEnabled = isEnabled();
if (oldEnabledState == null || hasChanged(oldEnabledState.booleanValue(), isEnabled)) {
firePropertyChange(ENABLED_PROPERTY_NAME, oldEnabledState == null ? !isEnabled : oldEnabledState... | |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java | AptControlImplementation.initClients | protected ArrayList<AptClientField> initClients()
{
ArrayList<AptClientField> clients = new ArrayList<AptClientField>();
if ( _implDecl == null || _implDecl.getFields() == null )
return clients;
Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
... | java | protected ArrayList<AptClientField> initClients()
{
ArrayList<AptClientField> clients = new ArrayList<AptClientField>();
if ( _implDecl == null || _implDecl.getFields() == null )
return clients;
Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
... | [
"protected",
"ArrayList",
"<",
"AptClientField",
">",
"initClients",
"(",
")",
"{",
"ArrayList",
"<",
"AptClientField",
">",
"clients",
"=",
"new",
"ArrayList",
"<",
"AptClientField",
">",
"(",
")",
";",
"if",
"(",
"_implDecl",
"==",
"null",
"||",
"_implDecl... | Initializes the list of ClientFields declared directly by this ControlImpl | [
"Initializes",
"the",
"list",
"of",
"ClientFields",
"declared",
"directly",
"by",
"this",
"ControlImpl"
] | 4246a0cc40ce3c05f1a02c2da2653ac622703d77 | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L188-L202 | train | Initializes the list of clients. | Create a Java method that does the following: "Initializes the list of clients.". | Of course, here is the Java code you requested:
```java
protected ArrayList<AptClientField> initClients()
{
ArrayList<AptClientField> clients = new ArrayList<AptClientField>();
if ( _implDecl == null || _implDecl.getFields() == null )
return clients;
Collection<FieldDe... | |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/dump/writer/SQLFileWriter.java | SQLFileWriter.writeHeader | protected void writeHeader()
throws ConfigurationException, IOException
{
if (writer != null) {
writer.close();
}
this.fileCounter++;
String filePath = PATH_OUTPUT_SQL_FILES + this.outputName + "_"
+ fileCounter + ".sql";
SQLConsumerLogMessages.logFileCreation(logger, filePath);
this.sqlFile =... | java | protected void writeHeader()
throws ConfigurationException, IOException
{
if (writer != null) {
writer.close();
}
this.fileCounter++;
String filePath = PATH_OUTPUT_SQL_FILES + this.outputName + "_"
+ fileCounter + ".sql";
SQLConsumerLogMessages.logFileCreation(logger, filePath);
this.sqlFile =... | [
"protected",
"void",
"writeHeader",
"(",
")",
"throws",
"ConfigurationException",
",",
"IOException",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"writer",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"fileCounter",
"++",
";",
"String",
"filePath",... | Creates a new output file and writes the header information.
@throws ConfigurationException
if an error occurred while accessing the configuration
@throws IOException
if an error occurred while writing a file | [
"Creates",
"a",
"new",
"output",
"file",
"and",
"writes",
"the",
"header",
"information",
"."
] | 0a0304b6a0aa13acc18838957994e06dd4613a58 | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/dump/writer/SQLFileWriter.java#L243-L273 | train | Write the header of the SQL file. | Create a Java method that does the following: "Write the header of the SQL file.". | Of course, here is the Java code you requested:
```java
protected void writeHeader()
throws ConfigurationException, IOException
{
if (writer != null) {
writer.close();
}
this.fileCounter++;
String filePath = PATH_OUTPUT_SQL_FILES + this.outputName + "_"
+ fileCounter + ".sql";
SQLConsumerLogMess... | |
io7m/jcanephora | com.io7m.jcanephora.lwjgl3/src/main/java/com/io7m/jcanephora/lwjgl3/LWJGL3TypeConversions.java | LWJGL3TypeConversions.textureWrapTFromGL | public static JCGLTextureWrapT textureWrapTFromGL(
final int wrap)
{
switch (wrap) {
case GL12.GL_CLAMP_TO_EDGE:
return JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE;
case GL11.GL_REPEAT:
return JCGLTextureWrapT.TEXTURE_WRAP_REPEAT;
case GL14.GL_MIRRORED_REPEAT:
return ... | java | public static JCGLTextureWrapT textureWrapTFromGL(
final int wrap)
{
switch (wrap) {
case GL12.GL_CLAMP_TO_EDGE:
return JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE;
case GL11.GL_REPEAT:
return JCGLTextureWrapT.TEXTURE_WRAP_REPEAT;
case GL14.GL_MIRRORED_REPEAT:
return ... | [
"public",
"static",
"JCGLTextureWrapT",
"textureWrapTFromGL",
"(",
"final",
"int",
"wrap",
")",
"{",
"switch",
"(",
"wrap",
")",
"{",
"case",
"GL12",
".",
"GL_CLAMP_TO_EDGE",
":",
"return",
"JCGLTextureWrapT",
".",
"TEXTURE_WRAP_CLAMP_TO_EDGE",
";",
"case",
"GL11"... | Convert wrapping modes from GL constants.
@param wrap The GL constant.
@return The value. | [
"Convert",
"wrapping",
"modes",
"from",
"GL",
"constants",
"."
] | 0004c1744b7f0969841d04cd4fa693f402b10980 | https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.lwjgl3/src/main/java/com/io7m/jcanephora/lwjgl3/LWJGL3TypeConversions.java#L988-L1001 | train | Get the texture wrap type from the GL constants. | Create a Java method that does the following: "Get the texture wrap type from the GL constants.". | Of course, here is the Java code you requested:
```java
public static JCGLTextureWrapT textureWrapTFromGL(
final int wrap)
{
switch (wrap) {
case GL12.GL_CLAMP_TO_EDGE:
return JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE;
case GL11.GL_REPEAT:
return JCGLTextureWrapT.TEXTURE_WRAP_RE... | |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWorkerPoolsAsync | public Observable<Page<WorkerPoolResourceInner>> listWorkerPoolsAsync(final String resourceGroupName, final String name) {
return listWorkerPoolsWithServiceResponseAsync(resourceGroupName, name)
.map(new Func1<ServiceResponse<Page<WorkerPoolResourceInner>>, Page<WorkerPoolResourceInner>>() {
... | java | public Observable<Page<WorkerPoolResourceInner>> listWorkerPoolsAsync(final String resourceGroupName, final String name) {
return listWorkerPoolsWithServiceResponseAsync(resourceGroupName, name)
.map(new Func1<ServiceResponse<Page<WorkerPoolResourceInner>>, Page<WorkerPoolResourceInner>>() {
... | [
"public",
"Observable",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
"listWorkerPoolsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
")",
"{",
"return",
"listWorkerPoolsWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Get all worker pools of an App Service Environment.
Get all worker pools of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return t... | [
"Get",
"all",
"worker",
"pools",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"all",
"worker",
"pools",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5004-L5012 | train | List all worker pools in a resource group. | Create a Java method that does the following: "List all worker pools in a resource group.". | Of course, here is the Java code you requested:
```java
public Observable<Page<WorkerPoolResourceInner>> listWorkerPoolsAsync(final String resourceGroupName, final String name) {
return listWorkerPoolsWithServiceResponseAsync(resourceGroupName, name)
.map(new Func1<ServiceResponse<Page<WorkerPoolRe... | |
lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java | JsonUtils.quoteIfNeeded | static Object quoteIfNeeded(Object source) {
if (source instanceof String) {
return quoteIfNeeded((String) source);
} else {
return source;
}
} | java | static Object quoteIfNeeded(Object source) {
if (source instanceof String) {
return quoteIfNeeded((String) source);
} else {
return source;
}
} | [
"static",
"Object",
"quoteIfNeeded",
"(",
"Object",
"source",
")",
"{",
"if",
"(",
"source",
"instanceof",
"String",
")",
"{",
"return",
"quoteIfNeeded",
"(",
"(",
"String",
")",
"source",
")",
";",
"}",
"else",
"{",
"return",
"source",
";",
"}",
"}"
] | Add quotes around the object iff it's not a JSON object.
@param source
@return | [
"Add",
"quotes",
"around",
"the",
"object",
"iff",
"it",
"s",
"not",
"a",
"JSON",
"object",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java#L171-L177 | train | Quote the source object if necessary. | Create a Java method that does the following: "Quote the source object if necessary.". | Of course, here is the Java code you requested:
```java
static Object quoteIfNeeded(Object source) {
if (source instanceof String) {
return quoteIfNeeded((String) source);
} else {
return source;
}
}
```
Hope this helps! | |
guardtime/ksi-java-sdk | ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java | AbstractApacheHttpClient.createProxyRoutePlanner | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credential... | java | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credential... | [
"private",
"DefaultProxyRoutePlanner",
"createProxyRoutePlanner",
"(",
"HttpSettings",
"settings",
",",
"HttpAsyncClientBuilder",
"httpClientBuilder",
")",
"{",
"HttpHost",
"proxy",
"=",
"new",
"HttpHost",
"(",
"settings",
".",
"getProxyUrl",
"(",
")",
".",
"getHost",
... | Creates default proxy route planner.
@param settings
settings to use.
@param httpClientBuilder
http client builder.
@return Instance of {@link DefaultProxyRoutePlanner}. | [
"Creates",
"default",
"proxy",
"route",
"planner",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java#L153-L164 | train | Create proxy route planner. | Create a Java method that does the following: "Create proxy route planner.". | Of course, here is the Java code you requested:
```java
private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUse... | |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/breadcrumbs/BreadcrumbsRenderer.java | BreadcrumbsRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ResponseWriter rw = context.getResponseWriter();
// End point / current page
UIComponent end = component.getFacet("end");
if (end != null) {
rw.startElement("li"... | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ResponseWriter rw = context.getResponseWriter();
// End point / current page
UIComponent end = component.getFacet("end");
if (end != null) {
rw.startElement("li"... | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"ResponseWriter",
"rw"... | This methods generates the HTML code of the current b:breadcrumbs. <code>encodeBegin</code> generates the
start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML
code between the beginning and the end of the component. For instance, in the case of a panel component ... | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"breadcrumbs",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framewor... | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/breadcrumbs/BreadcrumbsRenderer.java#L91-L108 | train | Override encodeEnd to handle the end of the HTML. | Create a Java method that does the following: "Override encodeEnd to handle the end of the HTML.". | Of course, here is the Java code you requested:
```java
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
ResponseWriter rw = context.getResponseWriter();
// End point / current page
UIComponent end = component.getF... | |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java | ServersInner.listByResourceGroupAsync | public Observable<Page<ServerInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<ServerInner>>, Page<ServerInner>>() {
@Override
public Page<Server... | java | public Observable<Page<ServerInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<ServerInner>>, Page<ServerInner>>() {
@Override
public Page<Server... | [
"public",
"Observable",
"<",
"Page",
"<",
"ServerInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1... | Gets a list of servers in a resource groups.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList... | [
"Gets",
"a",
"list",
"of",
"servers",
"in",
"a",
"resource",
"groups",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java#L268-L276 | train | Gets a list of a CDNA server. | Create a Java method that does the following: "Gets a list of a CDNA server.". | Of course, here is the Java code you requested:
```java
public Observable<Page<ServerInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<ServerInner>>, Page<ServerInner>>() {
... | |
skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.nextMajor | public Version nextMajor(String[] newPrelease) {
require(newPrelease != null, "newPreRelease is null");
final String[] newPreReleaseParts = verifyAndCopyArray(newPrelease, false);
return new Version(this.major + 1, 0, 0, newPreReleaseParts, EMPTY_ARRAY);
} | java | public Version nextMajor(String[] newPrelease) {
require(newPrelease != null, "newPreRelease is null");
final String[] newPreReleaseParts = verifyAndCopyArray(newPrelease, false);
return new Version(this.major + 1, 0, 0, newPreReleaseParts, EMPTY_ARRAY);
} | [
"public",
"Version",
"nextMajor",
"(",
"String",
"[",
"]",
"newPrelease",
")",
"{",
"require",
"(",
"newPrelease",
"!=",
"null",
",",
"\"newPreRelease is null\"",
")",
";",
"final",
"String",
"[",
"]",
"newPreReleaseParts",
"=",
"verifyAndCopyArray",
"(",
"newPr... | Given this Version, returns the next major Version. That is, the major part is
incremented by 1 and the remaining parts are set to 0. The pre-release part will be
set to the given identifier and the build-meta-data is dropped.
@param newPrelease The pre-release part for the resulting Version.
@return The incremented v... | [
"Given",
"this",
"Version",
"returns",
"the",
"next",
"major",
"Version",
".",
"That",
"is",
"the",
"major",
"part",
"is",
"incremented",
"by",
"1",
"and",
"the",
"remaining",
"parts",
"are",
"set",
"to",
"0",
".",
"The",
"pre",
"-",
"release",
"part",
... | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L737-L741 | train | Returns a new version with the next major version. | Create a Java method that does the following: "Returns a new version with the next major version.". | Of course, here is the Java code you requested:
```java
public Version nextMajor(String[] newPrelease) {
require(newPrelease != null, "newPreRelease is null");
final String[] newPreReleaseParts = verifyAndCopyArray(newPrelease, false);
return new Version(this.major + 1, 0, 0, newPreReleaseParts... | |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/AuthenticationProtocol.java | AuthenticationProtocol.getAuthenticationMethods | public String getAuthenticationMethods(String username, String servicename)
throws SshException {
sendRequest(username, servicename, "none", null);
try {
readMessage();
transport
.disconnect(TransportProtocol.PROTOCOL_ERROR,
"Unexpected response received from Authentication Protocol");
thro... | java | public String getAuthenticationMethods(String username, String servicename)
throws SshException {
sendRequest(username, servicename, "none", null);
try {
readMessage();
transport
.disconnect(TransportProtocol.PROTOCOL_ERROR,
"Unexpected response received from Authentication Protocol");
thro... | [
"public",
"String",
"getAuthenticationMethods",
"(",
"String",
"username",
",",
"String",
"servicename",
")",
"throws",
"SshException",
"{",
"sendRequest",
"(",
"username",
",",
"servicename",
",",
"\"none\"",
",",
"null",
")",
";",
"try",
"{",
"readMessage",
"(... | Get a list of available authentication methods for the user. It is
advisable to call this method after contsructing the protocol instance
and setting a <a href="BannerDisplay.html">BannerDisplay</a>. If the
server has a banner message to display it is most likely that the server
will send it before completing this list... | [
"Get",
"a",
"list",
"of",
"available",
"authentication",
"methods",
"for",
"the",
"user",
".",
"It",
"is",
"advisable",
"to",
"call",
"this",
"method",
"after",
"contsructing",
"the",
"protocol",
"instance",
"and",
"setting",
"a",
"<a",
"href",
"=",
"BannerD... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/AuthenticationProtocol.java#L234-L260 | train | Get the authentication methods of the specified username. | Create a Java method that does the following: "Get the authentication methods of the specified username.". | Of course, here is the Java code you requested:
```java
public String getAuthenticationMethods(String username, String servicename)
throws SshException {
sendRequest(username, servicename, "none", null);
try {
readMessage();
transport
.disconnect(TransportProtocol.PROTOCOL_ERROR,
"Unexpected ... | |
windup/windup | config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java | Iteration.getCurrentPayload | @SuppressWarnings("unchecked")
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name)
throws IllegalStateException, IllegalArgumentException
{
Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek();
Iterable<... | java | @SuppressWarnings("unchecked")
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name)
throws IllegalStateException, IllegalArgumentException
{
Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek();
Iterable<... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"FRAMETYPE",
"extends",
"WindupVertexFrame",
">",
"FRAMETYPE",
"getCurrentPayload",
"(",
"Variables",
"stack",
",",
"String",
"name",
")",
"throws",
"IllegalStateException",
",",
"IllegalArgu... | Get the {@link Iteration} payload with the given name.
@throws IllegalArgumentException if the given variable refers to a non-payload. | [
"Get",
"the",
"{",
"@link",
"Iteration",
"}",
"payload",
"with",
"the",
"given",
"name",
"."
] | 6668f09e7f012d24a0b4212ada8809417225b2ad | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L416-L431 | train | Gets the current payload of a single iteration. | Create a Java method that does the following: "Gets the current payload of a single iteration.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name)
throws IllegalStateException, IllegalArgumentException
{
Map<String, Iterable<? extends Wi... | |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java | PersistentTokenBasedRememberMeServices.onLoginSuccess | protected void onLoginSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication successfulAuthentication) {
String username = successfulAuthentication.getName();
logger.debug("Creating new persistent login for user " + username);
PersistentRememberMeToken persistentToken = new Persiste... | java | protected void onLoginSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication successfulAuthentication) {
String username = successfulAuthentication.getName();
logger.debug("Creating new persistent login for user " + username);
PersistentRememberMeToken persistentToken = new Persiste... | [
"protected",
"void",
"onLoginSuccess",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"Authentication",
"successfulAuthentication",
")",
"{",
"String",
"username",
"=",
"successfulAuthentication",
".",
"getName",
"(",
")",
";",
"logge... | Creates a new persistent login token with a new series number, stores the data in
the persistent token repository and adds the corresponding cookie to the response. | [
"Creates",
"a",
"new",
"persistent",
"login",
"token",
"with",
"a",
"new",
"series",
"number",
"stores",
"the",
"data",
"in",
"the",
"persistent",
"token",
"repository",
"and",
"adds",
"the",
"corresponding",
"cookie",
"to",
"the",
"response",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java#L158-L173 | test | Called when a persistent login is successful. | Create a Java method that does the following: "Called when a persistent login is successful.". | Of course, here is the Java code you requested:
```java
protected void onLoginSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication successfulAuthentication) {
String username = successfulAuthentication.getName();
logger.debug("Creating new persistent login for user " + username);
... | |
clanie/clanie-core | src/main/java/dk/clanie/collections/NumberMap.java | NumberMap.newLongMap | public static <K> NumberMap<K, Long> newLongMap() {
return new NumberMap<K, Long>() {
@Override
public void add(K key, Long addend) {
put(key, containsKey(key) ? (get(key) + addend) : addend);
}
@Override
public void sub(K key, Long subtrahend) {
put(key, (containsKey(key) ? get(key) : 0l) - su... | java | public static <K> NumberMap<K, Long> newLongMap() {
return new NumberMap<K, Long>() {
@Override
public void add(K key, Long addend) {
put(key, containsKey(key) ? (get(key) + addend) : addend);
}
@Override
public void sub(K key, Long subtrahend) {
put(key, (containsKey(key) ? get(key) : 0l) - su... | [
"public",
"static",
"<",
"K",
">",
"NumberMap",
"<",
"K",
",",
"Long",
">",
"newLongMap",
"(",
")",
"{",
"return",
"new",
"NumberMap",
"<",
"K",
",",
"Long",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"add",
"(",
"K",
"key",
",",
"Lon... | Creates a NumberMap for Longs.
@param <K>
@return NumberMap<K> | [
"Creates",
"a",
"NumberMap",
"for",
"Longs",
"."
] | ac8a655b93127f0e281b741c4d53f429be2816ad | https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/NumberMap.java#L192-L203 | train | Creates a NumberMap object that maps Long values to Long values. | Create a Java method that does the following: "Creates a NumberMap object that maps Long values to Long values.". | Of course, here is the Java code you requested:
```java
public static <K> NumberMap<K, Long> newLongMap() {
return new NumberMap<K, Long>() {
@Override
public void add(K key, Long addend) {
put(key, containsKey(key) ? (get(key) + addend) : addend);
}
@Override
public void sub(K key, Long subtrahen... | |
leancloud/java-sdk-all | realtime/src/main/java/cn/leancloud/im/v2/AVIMConversationsQuery.java | AVIMConversationsQuery.whereNotContainsIn | public AVIMConversationsQuery whereNotContainsIn(String key, Collection<?> value) {
conditions.whereNotContainedIn(key, value);
return this;
} | java | public AVIMConversationsQuery whereNotContainsIn(String key, Collection<?> value) {
conditions.whereNotContainedIn(key, value);
return this;
} | [
"public",
"AVIMConversationsQuery",
"whereNotContainsIn",
"(",
"String",
"key",
",",
"Collection",
"<",
"?",
">",
"value",
")",
"{",
"conditions",
".",
"whereNotContainedIn",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | 增加查询条件,当conversation的属性中对应的字段对应的值不包含在指定值中时即可返回
@param key
@param value
@return | [
"增加查询条件,当conversation的属性中对应的字段对应的值不包含在指定值中时即可返回"
] | 323f8e7ee38051b1350790e5192304768c5c9f5f | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversationsQuery.java#L197-L200 | train | Add a constraint to the query that requires a constraint to be included in the result set. | Create a Java method that does the following: "Add a constraint to the query that requires a constraint to be included in the result set.". | Of course, here is the Java code you requested:
```java
public AVIMConversationsQuery whereNotContainsIn(String key, Collection<?> value) {
conditions.whereNotContainedIn(key, value);
return this;
}
```
Hope this helps! | |
Pkmmte/PkRSS | pkrss/src/main/java/com/pkmmte/pkrss/Article.java | Article.putExtra | public Article putExtra(String key, String value) {
this.extras.putString(key, value);
return this;
} | java | public Article putExtra(String key, String value) {
this.extras.putString(key, value);
return this;
} | [
"public",
"Article",
"putExtra",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"extras",
".",
"putString",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a given value into a Bundle associated with this Article instance.
@param key A String key.
@param value Value to insert. | [
"Inserts",
"a",
"given",
"value",
"into",
"a",
"Bundle",
"associated",
"with",
"this",
"Article",
"instance",
"."
] | 0bc536d3bad1dade4538616f71c3a8f068eac89a | https://github.com/Pkmmte/PkRSS/blob/0bc536d3bad1dade4538616f71c3a8f068eac89a/pkrss/src/main/java/com/pkmmte/pkrss/Article.java#L118-L121 | train | Add an extra string to the article. | Create a Java method that does the following: "Add an extra string to the article.". | Of course, here is the Java code you requested:
```java
public Article putExtra(String key, String value) {
this.extras.putString(key, value);
return this;
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java | BeanO.getHandleList | HandleList getHandleList(boolean create) // d662032
{
if (connectionHandleList == null && create)
{
connectionHandleList = new HandleList();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getHandleList: created " + connectionHan... | java | HandleList getHandleList(boolean create) // d662032
{
if (connectionHandleList == null && create)
{
connectionHandleList = new HandleList();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getHandleList: created " + connectionHan... | [
"HandleList",
"getHandleList",
"(",
"boolean",
"create",
")",
"// d662032",
"{",
"if",
"(",
"connectionHandleList",
"==",
"null",
"&&",
"create",
")",
"{",
"connectionHandleList",
"=",
"new",
"HandleList",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAn... | Gets the handle list associated with this bean, optionally creating one
if the bean does not have a handle list yet.
@param create true if a handle list should be created if the bean does
not already have a handle list | [
"Gets",
"the",
"handle",
"list",
"associated",
"with",
"this",
"bean",
"optionally",
"creating",
"one",
"if",
"the",
"bean",
"does",
"not",
"have",
"a",
"handle",
"list",
"yet",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L1764-L1774 | train | Returns the handle list. | Create a Java method that does the following: "Returns the handle list.". | Of course, here is the Java code you requested:
```java
HandleList getHandleList(boolean create) // d662032
{
if (connectionHandleList == null && create)
{
connectionHandleList = new HandleList();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
... | |
Stratio/cassandra-lucene-index | plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/FloatMapper.java | FloatMapper.sortField | @Override
public SortField sortField(String name, boolean reverse) {
return new SortedNumericSortField(name, Type.FLOAT, reverse);
} | java | @Override
public SortField sortField(String name, boolean reverse) {
return new SortedNumericSortField(name, Type.FLOAT, reverse);
} | [
"@",
"Override",
"public",
"SortField",
"sortField",
"(",
"String",
"name",
",",
"boolean",
"reverse",
")",
"{",
"return",
"new",
"SortedNumericSortField",
"(",
"name",
",",
"Type",
".",
"FLOAT",
",",
"reverse",
")",
";",
"}"
] | {@inheritDoc} | [
"{"
] | a94a4d9af6c25d40e1108729974c35c27c54441c | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/FloatMapper.java#L88-L91 | train | Override this method to return a sorted numeric sort field. | Create a Java method that does the following: "Override this method to return a sorted numeric sort field.". | Of course, here is the Java code you requested:
```java
@Override
public SortField sortField(String name, boolean reverse) {
return new SortedNumericSortField(name, Type.FLOAT, reverse);
}
```
Hope this helps! | |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/collections/list/FastArrayList.java | FastArrayList.remove | public boolean remove(Object o) {
hashCodeUpToDate = false;
if (o == null) {
for (int index = 0; index < size; index++)
if (elementData[index] == null) {
fastRemove(index);
return true;
}
} else {
for (int index = 0; index < size; index++)
if (o.equals(elementData[index])) {
... | java | public boolean remove(Object o) {
hashCodeUpToDate = false;
if (o == null) {
for (int index = 0; index < size; index++)
if (elementData[index] == null) {
fastRemove(index);
return true;
}
} else {
for (int index = 0; index < size; index++)
if (o.equals(elementData[index])) {
... | [
"public",
"boolean",
"remove",
"(",
"Object",
"o",
")",
"{",
"hashCodeUpToDate",
"=",
"false",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"size",
";",
"index",
"++",
")",
"if",
"(",
"elem... | Removes the first occurrence of the specified element from this list, if
it is present. If the list does not contain the element, it is unchanged.
More formally, removes the element with the lowest index <tt>i</tt> such
that
<tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>
(if such an element ex... | [
"Removes",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"element",
"from",
"this",
"list",
"if",
"it",
"is",
"present",
".",
"If",
"the",
"list",
"does",
"not",
"contain",
"the",
"element",
"it",
"is",
"unchanged",
".",
"More",
"formally",
"remo... | b7e1d293adeadaf35d208ffe8884028d6c06b63b | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/collections/list/FastArrayList.java#L533-L549 | train | Removes the object from the list. | Create a Java method that does the following: "Removes the object from the list.". | Of course, here is the Java code you requested:
```java
public boolean remove(Object o) {
hashCodeUpToDate = false;
if (o == null) {
for (int index = 0; index < size; index++)
if (elementData[index] == null) {
fastRemove(index);
return true;
}
} else {
for (int index = 0; index <... | |
stevespringett/Alpine | alpine/src/main/java/alpine/logging/Logger.java | Logger.warn | public void warn(final String message, final Throwable throwable) {
log.warn(sanitize(message), throwable);
} | java | public void warn(final String message, final Throwable throwable) {
log.warn(sanitize(message), throwable);
} | [
"public",
"void",
"warn",
"(",
"final",
"String",
"message",
",",
"final",
"Throwable",
"throwable",
")",
"{",
"log",
".",
"warn",
"(",
"sanitize",
"(",
"message",
")",
",",
"throwable",
")",
";",
"}"
] | Log a message at the WARN level.
@param message the message string to be logged
@param throwable the exception (throwable) to log
@since 1.0.0 | [
"Log",
"a",
"message",
"at",
"the",
"WARN",
"level",
"."
] | 6c5ef5e1ba4f38922096f1307d3950c09edb3093 | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/logging/Logger.java#L451-L453 | train | Logs a warning message. | Create a Java method that does the following: "Logs a warning message.". | Of course, here is the Java code you requested:
```java
public void warn(final String message, final Throwable throwable) {
log.warn(sanitize(message), throwable);
}
```
Hope this helps! | |
atomix/atomix | protocols/gossip/src/main/java/io/atomix/protocols/gossip/value/Value.java | Value.isNewerThan | public boolean isNewerThan(Value other) {
if (other == null) {
return true;
}
return this.timestamp.isNewerThan(other.timestamp);
} | java | public boolean isNewerThan(Value other) {
if (other == null) {
return true;
}
return this.timestamp.isNewerThan(other.timestamp);
} | [
"public",
"boolean",
"isNewerThan",
"(",
"Value",
"other",
")",
"{",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"this",
".",
"timestamp",
".",
"isNewerThan",
"(",
"other",
".",
"timestamp",
")",
";",
"}"
] | Tests if this value is newer than the specified SetElement.
@param other the value to be compared
@return true if this value is newer than other | [
"Tests",
"if",
"this",
"value",
"is",
"newer",
"than",
"the",
"specified",
"SetElement",
"."
] | 3a94b7c80576d762dd0d396d4645df07a0b37c31 | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/gossip/src/main/java/io/atomix/protocols/gossip/value/Value.java#L69-L74 | train | Is this value newer than other? | Create a Java method that does the following: "Is this value newer than other?". | Of course, here is the Java code you requested:
```java
public boolean isNewerThan(Value other) {
if (other == null) {
return true;
}
return this.timestamp.isNewerThan(other.timestamp);
}
```
Hope this helps! | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ByteArrayValueData.java | ByteArrayValueData.getString | protected String getString() throws ValueFormatException
{
try
{
return new String(value, Constants.DEFAULT_ENCODING);
}
catch (UnsupportedEncodingException e)
{
throw new ValueFormatException("Unsupported encoding " + Constants.DEFAULT_ENCODING, e);
}
} | java | protected String getString() throws ValueFormatException
{
try
{
return new String(value, Constants.DEFAULT_ENCODING);
}
catch (UnsupportedEncodingException e)
{
throw new ValueFormatException("Unsupported encoding " + Constants.DEFAULT_ENCODING, e);
}
} | [
"protected",
"String",
"getString",
"(",
")",
"throws",
"ValueFormatException",
"{",
"try",
"{",
"return",
"new",
"String",
"(",
"value",
",",
"Constants",
".",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"th... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ByteArrayValueData.java#L127-L137 | train | Get the string value. | Create a Java method that does the following: "Get the string value.". | Of course, here is the Java code you requested:
```java
protected String getString() throws ValueFormatException
{
try
{
return new String(value, Constants.DEFAULT_ENCODING);
}
catch (UnsupportedEncodingException e)
{
throw new ValueFormatException("Unsupported encodi... | |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/AnimatedLabel.java | AnimatedLabel.startAnimation | public synchronized AnimatedLabel startAnimation(long millisecondsPerFrame) {
if(TIMER == null) {
TIMER = new Timer("AnimatedLabel");
}
AnimationTimerTask animationTimerTask = new AnimationTimerTask(this);
SCHEDULED_TASKS.put(this, animationTimerTask);
TIMER.scheduleA... | java | public synchronized AnimatedLabel startAnimation(long millisecondsPerFrame) {
if(TIMER == null) {
TIMER = new Timer("AnimatedLabel");
}
AnimationTimerTask animationTimerTask = new AnimationTimerTask(this);
SCHEDULED_TASKS.put(this, animationTimerTask);
TIMER.scheduleA... | [
"public",
"synchronized",
"AnimatedLabel",
"startAnimation",
"(",
"long",
"millisecondsPerFrame",
")",
"{",
"if",
"(",
"TIMER",
"==",
"null",
")",
"{",
"TIMER",
"=",
"new",
"Timer",
"(",
"\"AnimatedLabel\"",
")",
";",
"}",
"AnimationTimerTask",
"animationTimerTask... | Starts the animation thread which will periodically call {@code nextFrame()} at the interval specified by the
{@code millisecondsPerFrame} parameter. After all frames have been cycled through, it will start over from the
first frame again.
@param millisecondsPerFrame The interval in between every frame
@return Itself | [
"Starts",
"the",
"animation",
"thread",
"which",
"will",
"periodically",
"call",
"{"
] | 8dfd62206ff46ab10223b2ef2dbb0a2c51850954 | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/AnimatedLabel.java#L124-L132 | train | Start an animation of this label. | Create a Java method that does the following: "Start an animation of this label.". | Of course, here is the Java code you requested:
```java
public synchronized AnimatedLabel startAnimation(long millisecondsPerFrame) {
if(TIMER == null) {
TIMER = new Timer("AnimatedLabel");
}
AnimationTimerTask animationTimerTask = new AnimationTimerTask(this);
SCHEDULED_TAS... | |
JodaOrg/joda-beans | src/main/java/org/joda/beans/gen/PropertyData.java | PropertyData.resolveEqualsHashCodeStyle | public void resolveEqualsHashCodeStyle(File file, int lineIndex) {
if (equalsHashCodeStyle.equals("smart")) {
equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter");
}
if (equalsHashCodeStyle.equals("omit") ||
equalsHashCodeStyle.equals("getter") ||
... | java | public void resolveEqualsHashCodeStyle(File file, int lineIndex) {
if (equalsHashCodeStyle.equals("smart")) {
equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter");
}
if (equalsHashCodeStyle.equals("omit") ||
equalsHashCodeStyle.equals("getter") ||
... | [
"public",
"void",
"resolveEqualsHashCodeStyle",
"(",
"File",
"file",
",",
"int",
"lineIndex",
")",
"{",
"if",
"(",
"equalsHashCodeStyle",
".",
"equals",
"(",
"\"smart\"",
")",
")",
"{",
"equalsHashCodeStyle",
"=",
"(",
"bean",
".",
"isImmutable",
"(",
")",
"... | Resolves the equals hashCode generator.
@param file the file
@param lineIndex the line index | [
"Resolves",
"the",
"equals",
"hashCode",
"generator",
"."
] | f07dbe42947150b23a173f35984c6ab33c5529bf | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/PropertyData.java#L453-L464 | train | Resolves the equalsHashCodeStyle property. | Create a Java method that does the following: "Resolves the equalsHashCodeStyle property.". | Of course, here is the Java code you requested:
```java
public void resolveEqualsHashCodeStyle(File file, int lineIndex) {
if (equalsHashCodeStyle.equals("smart")) {
equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter");
}
if (equalsHashCodeStyle.equals("omit") ||
... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java program to remove the duplicates in an array while maintaining the original order of elements, using only constant extra space. | Here is a Java program that removes duplicates from an array while maintaining the original order of elements using only constant extra space:
```java
import java.util.Arrays;
public class RemoveDuplicates {
public static int[] removeDuplicates(int[] arr) {
int n = arr.length;
if (n == 0 || n... | |||||||
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/model/buffered/XSequentialEventBuffer.java | XSequentialEventBuffer.navigateToIndex | protected synchronized void navigateToIndex(int reqIndex)
throws IOException {
// determine if navigation is necessary
if (reqIndex != index) {
// ensure that the requested index is valid
if (reqIndex < 0 || reqIndex >= size) {
throw new IndexOutOfBoundsException();
}
// navigate to requested ind... | java | protected synchronized void navigateToIndex(int reqIndex)
throws IOException {
// determine if navigation is necessary
if (reqIndex != index) {
// ensure that the requested index is valid
if (reqIndex < 0 || reqIndex >= size) {
throw new IndexOutOfBoundsException();
}
// navigate to requested ind... | [
"protected",
"synchronized",
"void",
"navigateToIndex",
"(",
"int",
"reqIndex",
")",
"throws",
"IOException",
"{",
"// determine if navigation is necessary",
"if",
"(",
"reqIndex",
"!=",
"index",
")",
"{",
"// ensure that the requested index is valid",
"if",
"(",
"reqInde... | Repositions the low-level layer to read from the specified index.
@param reqIndex
Index to position the file pointer to. | [
"Repositions",
"the",
"low",
"-",
"level",
"layer",
"to",
"read",
"from",
"the",
"specified",
"index",
"."
] | e791cb07a6e62ecf837d760d58a25f32fbf6bbca | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/model/buffered/XSequentialEventBuffer.java#L324-L363 | train | Navigate to the requested index in the file. | Create a Java method that does the following: "Navigate to the requested index in the file.". | Of course, here is the Java code you requested:
```java
protected synchronized void navigateToIndex(int reqIndex)
throws IOException {
// determine if navigation is necessary
if (reqIndex != index) {
// ensure that the requested index is valid
if (reqIndex < 0 || reqIndex >= size) {
throw new IndexOut... | |
bwkimmel/jdcp | jdcp-console/src/main/java/ca/eandb/jdcp/console/ServerState.java | ServerState.start | @CommandArgument
public void start() {
System.out.println("Starting server");
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
EmbeddedDataSource ds = new EmbeddedDataSource();
ds.setConnectionAttributes("create=true");
ds.setDatabaseName("classes");
logger.info("In... | java | @CommandArgument
public void start() {
System.out.println("Starting server");
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
EmbeddedDataSource ds = new EmbeddedDataSource();
ds.setConnectionAttributes("create=true");
ds.setDatabaseName("classes");
logger.info("In... | [
"@",
"CommandArgument",
"public",
"void",
"start",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting server\"",
")",
";",
"try",
"{",
"Class",
".",
"forName",
"(",
"\"org.apache.derby.jdbc.EmbeddedDriver\"",
")",
";",
"EmbeddedDataSource",
"d... | Starts the server. | [
"Starts",
"the",
"server",
"."
] | 630c5150c245054e2556ff370f4bad2ec793dfb7 | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/console/ServerState.java#L104-L148 | train | Start the server. | Create a Java method that does the following: "Start the server.". | Of course, here is the Java code you requested:
```java
@CommandArgument
public void start() {
System.out.println("Starting server");
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
EmbeddedDataSource ds = new EmbeddedDataSource();
ds.setConnectionAttributes("create=true");
... | |
robolectric/robolectric | shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager9.java | ShadowArscAssetManager9.nativeCreate | @Implementation(minSdk = P)
protected static long nativeCreate() {
// AssetManager2 needs to be protected by a lock. To avoid cache misses, we allocate the lock and
// AssetManager2 in a contiguous block (GuardedAssetManager).
// return reinterpret_cast<long>(new GuardedAssetManager());
long cppAsset... | java | @Implementation(minSdk = P)
protected static long nativeCreate() {
// AssetManager2 needs to be protected by a lock. To avoid cache misses, we allocate the lock and
// AssetManager2 in a contiguous block (GuardedAssetManager).
// return reinterpret_cast<long>(new GuardedAssetManager());
long cppAsset... | [
"@",
"Implementation",
"(",
"minSdk",
"=",
"P",
")",
"protected",
"static",
"long",
"nativeCreate",
"(",
")",
"{",
"// AssetManager2 needs to be protected by a lock. To avoid cache misses, we allocate the lock and",
"// AssetManager2 in a contiguous block (GuardedAssetManager).",
"//... | static jlong NativeCreate(JNIEnv* /*env*/, jclass /*clazz*/) { | [
"static",
"jlong",
"NativeCreate",
"(",
"JNIEnv",
"*",
"/",
"*",
"env",
"*",
"/",
"jclass",
"/",
"*",
"clazz",
"*",
"/",
")",
"{"
] | 4fa79a2c72f8abbf742ab920419653c207b41d62 | https://github.com/robolectric/robolectric/blob/4fa79a2c72f8abbf742ab920419653c207b41d62/shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager9.java#L488-L511 | valid | Create a native C ++ AssetManager2. | Create a Java method that does the following: "Create a native C ++ AssetManager2.". | Of course, here is the Java code you requested:
```java
@Implementation(minSdk = P)
protected static long nativeCreate() {
// AssetManager2 needs to be protected by a lock. To avoid cache misses, we allocate the lock and
// AssetManager2 in a contiguous block (GuardedAssetManager).
// return reinterpret_... | |
eclipse/xtext-core | org.eclipse.xtext.xtext.ide/src-gen/org/eclipse/xtext/xtext/ide/contentassist/antlr/internal/InternalXtextParser.java | InternalXtextParser.ruleCrossReference | public final void ruleCrossReference() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtext.g:1008:2: ( ( ( rule__CrossReference__Group__0 ) ) )
// InternalXtext.g:1009:2: ( ( rule__CrossReference__Group__0 ) )
{
... | java | public final void ruleCrossReference() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtext.g:1008:2: ( ( ( rule__CrossReference__Group__0 ) ) )
// InternalXtext.g:1009:2: ( ( rule__CrossReference__Group__0 ) )
{
... | [
"public",
"final",
"void",
"ruleCrossReference",
"(",
")",
"throws",
"RecognitionException",
"{",
"int",
"stackSize",
"=",
"keepStackSize",
"(",
")",
";",
"try",
"{",
"// InternalXtext.g:1008:2: ( ( ( rule__CrossReference__Group__0 ) ) )",
"// InternalXtext.g:1009:2: ( ( rule__... | InternalXtext.g:1004:1: ruleCrossReference : ( ( rule__CrossReference__Group__0 ) ) ; | [
"InternalXtext",
".",
"g",
":",
"1004",
":",
"1",
":",
"ruleCrossReference",
":",
"(",
"(",
"rule__CrossReference__Group__0",
")",
")",
";"
] | bac941cb75cb24706519845ec174cfef874d7557 | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.ide/src-gen/org/eclipse/xtext/xtext/ide/contentassist/antlr/internal/InternalXtextParser.java#L3039-L3080 | train | Generates the code of ruleCrossReference | Create a Java method that does the following: "Generates the code of ruleCrossReference". | Of course, here is the Java code you requested:
```java
public final void ruleCrossReference() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtext.g:1008:2: ( ( ( rule__CrossReference__Group__0 ) ) )
// InternalXtext.g:1009:2: ( ( r... | |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/ComplianceItemMarshaller.java | ComplianceItemMarshaller.marshall | public void marshall(ComplianceItem complianceItem, ProtocolMarshaller protocolMarshaller) {
if (complianceItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(complianceItem.getComplianceType(), C... | java | public void marshall(ComplianceItem complianceItem, ProtocolMarshaller protocolMarshaller) {
if (complianceItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(complianceItem.getComplianceType(), C... | [
"public",
"void",
"marshall",
"(",
"ComplianceItem",
"complianceItem",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"complianceItem",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to marshall(...)\""... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/ComplianceItemMarshaller.java#L60-L79 | train | marshalls the given complianceItem to the JSON object. | Create a Java method that does the following: "marshalls the given complianceItem to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(ComplianceItem complianceItem, ProtocolMarshaller protocolMarshaller) {
if (complianceItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocol... | |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.getModuleRoots | @Deprecated
public FilePath[] getModuleRoots() {
AbstractBuild b = getBuildForDeprecatedMethods();
return b != null ? b.getModuleRoots() : null;
} | java | @Deprecated
public FilePath[] getModuleRoots() {
AbstractBuild b = getBuildForDeprecatedMethods();
return b != null ? b.getModuleRoots() : null;
} | [
"@",
"Deprecated",
"public",
"FilePath",
"[",
"]",
"getModuleRoots",
"(",
")",
"{",
"AbstractBuild",
"b",
"=",
"getBuildForDeprecatedMethods",
"(",
")",
";",
"return",
"b",
"!=",
"null",
"?",
"b",
".",
"getModuleRoots",
"(",
")",
":",
"null",
";",
"}"
] | Returns the root directories of all checked-out modules.
<p>
Some SCMs support checking out multiple modules into the same workspace.
In these cases, the returned array will have a length greater than one.
@return The roots of all modules checked out from the SCM.
@deprecated as of 1.319
See {@link #getWorkspace()} fo... | [
"Returns",
"the",
"root",
"directories",
"of",
"all",
"checked",
"-",
"out",
"modules",
".",
"<p",
">",
"Some",
"SCMs",
"support",
"checking",
"out",
"multiple",
"modules",
"into",
"the",
"same",
"workspace",
".",
"In",
"these",
"cases",
"the",
"returned",
... | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L598-L602 | train | Get the module roots for this build. | Create a Java method that does the following: "Get the module roots for this build.". | Of course, here is the Java code you requested:
```java
@Deprecated
public FilePath[] getModuleRoots() {
AbstractBuild b = getBuildForDeprecatedMethods();
return b != null ? b.getModuleRoots() : null;
}
```
Hope this helps! | |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.startCopy | public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
throws SQLException {
waitOnLock();
if (!suppressBegin) {
doSubprotocolBegin();
}
byte[] buf = Utils.encodeUTF8(sql);
try {
LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)");
pgStream.sendChar('... | java | public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
throws SQLException {
waitOnLock();
if (!suppressBegin) {
doSubprotocolBegin();
}
byte[] buf = Utils.encodeUTF8(sql);
try {
LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)");
pgStream.sendChar('... | [
"public",
"synchronized",
"CopyOperation",
"startCopy",
"(",
"String",
"sql",
",",
"boolean",
"suppressBegin",
")",
"throws",
"SQLException",
"{",
"waitOnLock",
"(",
")",
";",
"if",
"(",
"!",
"suppressBegin",
")",
"{",
"doSubprotocolBegin",
"(",
")",
";",
"}",... | Sends given query to BE to start, initialize and lock connection for a CopyOperation.
@param sql COPY FROM STDIN / COPY TO STDOUT statement
@return CopyIn or CopyOut operation object
@throws SQLException on failure | [
"Sends",
"given",
"query",
"to",
"BE",
"to",
"start",
"initialize",
"and",
"lock",
"connection",
"for",
"a",
"CopyOperation",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L853-L876 | train | Start a copy of the database. | Create a Java method that does the following: "Start a copy of the database.". | Of course, here is the Java code you requested:
```java
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
throws SQLException {
waitOnLock();
if (!suppressBegin) {
doSubprotocolBegin();
}
byte[] buf = Utils.encodeUTF8(sql);
try {
LOGGER.log(Level.FINE... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java | Instant.until | @Override
public long until(Temporal endExclusive, TemporalUnit unit) {
Instant end = Instant.from(endExclusive);
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return nanosUntil(end);
case MICROS: ... | java | @Override
public long until(Temporal endExclusive, TemporalUnit unit) {
Instant end = Instant.from(endExclusive);
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return nanosUntil(end);
case MICROS: ... | [
"@",
"Override",
"public",
"long",
"until",
"(",
"Temporal",
"endExclusive",
",",
"TemporalUnit",
"unit",
")",
"{",
"Instant",
"end",
"=",
"Instant",
".",
"from",
"(",
"endExclusive",
")",
";",
"if",
"(",
"unit",
"instanceof",
"ChronoUnit",
")",
"{",
"Chro... | Calculates the amount of time until another instant in terms of the specified unit.
<p>
This calculates the amount of time between two {@code Instant}
objects in terms of a single {@code TemporalUnit}.
The start and end points are {@code this} and the specified instant.
The result will be negative if the end is before ... | [
"Calculates",
"the",
"amount",
"of",
"time",
"until",
"another",
"instant",
"in",
"terms",
"of",
"the",
"specified",
"unit",
".",
"<p",
">",
"This",
"calculates",
"the",
"amount",
"of",
"time",
"between",
"two",
"{",
"@code",
"Instant",
"}",
"objects",
"in... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java#L1136-L1154 | train | Override the method to return the number of seconds until the specified unit occurs in this datetime. | Create a Java method that does the following: "Override the method to return the number of seconds until the specified unit occurs in this datetime.". | Of course, here is the Java code you requested:
```java
@Override
public long until(Temporal endExclusive, TemporalUnit unit) {
Instant end = Instant.from(endExclusive);
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NAN... | |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java | DisksInner.createOrUpdateWithServiceResponseAsync | public Observable<ServiceResponse<DiskInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String diskName, DiskInner disk) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
... | java | public Observable<ServiceResponse<DiskInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String diskName, DiskInner disk) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
... | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"DiskInner",
">",
">",
"createOrUpdateWithServiceResponseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
",",
"DiskInner",
"disk",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"subscri... | Creates or updates a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param disk D... | [
"Creates",
"or",
"updates",
"a",
"disk",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L189-L208 | train | Creates or updates a disk. | Create a Java method that does the following: "Creates or updates a disk.". | Of course, here is the Java code you requested:
```java
public Observable<ServiceResponse<DiskInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String diskName, DiskInner disk) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.cl... | |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.get | public BlobContainerInner get(String resourceGroupName, String accountName, String containerName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body();
} | java | public BlobContainerInner get(String resourceGroupName, String accountName, String containerName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body();
} | [
"public",
"BlobContainerInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"containerName",
")",
".",
"t... | Gets properties of a specified container.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and... | [
"Gets",
"properties",
"of",
"a",
"specified",
"container",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L608-L610 | train | Gets a blob container. | Create a Java method that does the following: "Gets a blob container.". | Of course, here is the Java code you requested:
```java
public BlobContainerInner get(String resourceGroupName, String accountName, String containerName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body();
}
```
Hope this helps! | |
google/closure-compiler | src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java | ExtractPrototypeMemberDeclarations.replacePrototypeMemberDeclaration | private void replacePrototypeMemberDeclaration(PrototypeMemberDeclaration declar) {
// x.prototype.y = ... -> t.y = ...
Node assignment = declar.node.getFirstChild();
Node lhs = assignment.getFirstChild();
Node name = NodeUtil.newQName(
compiler,
PROTOTYPE_ALIAS + "." + declar.memberNa... | java | private void replacePrototypeMemberDeclaration(PrototypeMemberDeclaration declar) {
// x.prototype.y = ... -> t.y = ...
Node assignment = declar.node.getFirstChild();
Node lhs = assignment.getFirstChild();
Node name = NodeUtil.newQName(
compiler,
PROTOTYPE_ALIAS + "." + declar.memberNa... | [
"private",
"void",
"replacePrototypeMemberDeclaration",
"(",
"PrototypeMemberDeclaration",
"declar",
")",
"{",
"// x.prototype.y = ... -> t.y = ...",
"Node",
"assignment",
"=",
"declar",
".",
"node",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"lhs",
"=",
"assignment... | Replaces a member declaration to an assignment to the temp prototype
object. | [
"Replaces",
"a",
"member",
"declaration",
"to",
"an",
"assignment",
"to",
"the",
"temp",
"prototype",
"object",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java#L222-L242 | train | Replaces the prototype member declaration with a name. | Create a Java method that does the following: "Replaces the prototype member declaration with a name.". | Of course, here is the Java code you requested:
```java
private void replacePrototypeMemberDeclaration(PrototypeMemberDeclaration declar) {
// x.prototype.y = ... -> t.y = ...
Node assignment = declar.node.getFirstChild();
Node lhs = assignment.getFirstChild();
Node name = NodeUtil.newQName(
... | |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/config/BuildImageConfiguration.java | BuildImageConfiguration.initDockerFileFile | private void initDockerFileFile(Logger log) {
// can't have dockerFile/dockerFileDir and dockerArchive
if ((dockerFile != null || dockerFileDir != null) && dockerArchive != null) {
throw new IllegalArgumentException("Both <dockerFile> (<dockerFileDir>) and <dockerArchive> are set. " +
... | java | private void initDockerFileFile(Logger log) {
// can't have dockerFile/dockerFileDir and dockerArchive
if ((dockerFile != null || dockerFileDir != null) && dockerArchive != null) {
throw new IllegalArgumentException("Both <dockerFile> (<dockerFileDir>) and <dockerArchive> are set. " +
... | [
"private",
"void",
"initDockerFileFile",
"(",
"Logger",
"log",
")",
"{",
"// can't have dockerFile/dockerFileDir and dockerArchive",
"if",
"(",
"(",
"dockerFile",
"!=",
"null",
"||",
"dockerFileDir",
"!=",
"null",
")",
"&&",
"dockerArchive",
"!=",
"null",
")",
"{",
... | Initialize the dockerfile location and the build mode | [
"Initialize",
"the",
"dockerfile",
"location",
"and",
"the",
"build",
"mode"
] | 70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3 | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/config/BuildImageConfiguration.java#L628-L639 | train | Initialize the image file. | Create a Java method that does the following: "Initialize the image file.". | Of course, here is the Java code you requested:
```java
private void initDockerFileFile(Logger log) {
// can't have dockerFile/dockerFileDir and dockerArchive
if ((dockerFile != null || dockerFileDir != null) && dockerArchive != null) {
throw new IllegalArgumentException("Both <dockerFile> ... | |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java | SegmentManager.nextSegment | public synchronized Segment nextSegment() {
assertOpen();
Segment lastSegment = lastSegment();
SegmentDescriptor descriptor = SegmentDescriptor.builder()
.withId(lastSegment != null ? lastSegment.descriptor().id() + 1 : 1)
.withVersion(1)
.withIndex(currentSegment.lastIndex() + 1)
.w... | java | public synchronized Segment nextSegment() {
assertOpen();
Segment lastSegment = lastSegment();
SegmentDescriptor descriptor = SegmentDescriptor.builder()
.withId(lastSegment != null ? lastSegment.descriptor().id() + 1 : 1)
.withVersion(1)
.withIndex(currentSegment.lastIndex() + 1)
.w... | [
"public",
"synchronized",
"Segment",
"nextSegment",
"(",
")",
"{",
"assertOpen",
"(",
")",
";",
"Segment",
"lastSegment",
"=",
"lastSegment",
"(",
")",
";",
"SegmentDescriptor",
"descriptor",
"=",
"SegmentDescriptor",
".",
"builder",
"(",
")",
".",
"withId",
"... | Creates and returns the next segment.
@return The next segment.
@throws IllegalStateException if the segment manager is not open | [
"Creates",
"and",
"returns",
"the",
"next",
"segment",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java#L205-L221 | train | Returns the next segment in the list. | Create a Java method that does the following: "Returns the next segment in the list.". | Of course, here is the Java code you requested:
```java
public synchronized Segment nextSegment() {
assertOpen();
Segment lastSegment = lastSegment();
SegmentDescriptor descriptor = SegmentDescriptor.builder()
.withId(lastSegment != null ? lastSegment.descriptor().id() + 1 : 1)
.withVersion(1)
... | |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MessagePredicates.java | MessagePredicates.forSubject | public static Predicate<MailMessage> forSubject(final Pattern subjectPattern) {
return new Predicate<MailMessage>() {
@Override
public boolean apply(final MailMessage input) {
return subjectPattern.matcher(input.getSubject()).matches();
}
@Override
public String toString() {
return String.form... | java | public static Predicate<MailMessage> forSubject(final Pattern subjectPattern) {
return new Predicate<MailMessage>() {
@Override
public boolean apply(final MailMessage input) {
return subjectPattern.matcher(input.getSubject()).matches();
}
@Override
public String toString() {
return String.form... | [
"public",
"static",
"Predicate",
"<",
"MailMessage",
">",
"forSubject",
"(",
"final",
"Pattern",
"subjectPattern",
")",
"{",
"return",
"new",
"Predicate",
"<",
"MailMessage",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"final",
"M... | Creates a {@link Predicate} for matching the subject only.
@param subjectPattern
the regex pattern to match
@return the predicate | [
"Creates",
"a",
"{",
"@link",
"Predicate",
"}",
"for",
"matching",
"the",
"subject",
"only",
"."
] | 5b9fecac5778b988bb458085ded39ea9a4c7c2ae | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MessagePredicates.java#L161-L173 | train | Create a predicate that accepts a mail message subject that matches the given pattern. | Create a Java method that does the following: "Create a predicate that accepts a mail message subject that matches the given pattern.". | Of course, here is the Java code you requested:
```java
public static Predicate<MailMessage> forSubject(final Pattern subjectPattern) {
return new Predicate<MailMessage>() {
@Override
public boolean apply(final MailMessage input) {
return subjectPattern.matcher(input.getSubject()).matches();
}
@Over... | |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java | CmsImportExportUserDialog.getRolesList | private List<CmsRole> getRolesList(VerticalLayout parent, boolean importCase) {
List<CmsRole> res = new ArrayList<CmsRole>();
CmsEditableGroup editableGroup = importCase ? m_importRolesGroup : m_exportRolesGroup;
for (I_CmsEditableGroupRow row : editableGroup.getRows()) {
res.add((... | java | private List<CmsRole> getRolesList(VerticalLayout parent, boolean importCase) {
List<CmsRole> res = new ArrayList<CmsRole>();
CmsEditableGroup editableGroup = importCase ? m_importRolesGroup : m_exportRolesGroup;
for (I_CmsEditableGroupRow row : editableGroup.getRows()) {
res.add((... | [
"private",
"List",
"<",
"CmsRole",
">",
"getRolesList",
"(",
"VerticalLayout",
"parent",
",",
"boolean",
"importCase",
")",
"{",
"List",
"<",
"CmsRole",
">",
"res",
"=",
"new",
"ArrayList",
"<",
"CmsRole",
">",
"(",
")",
";",
"CmsEditableGroup",
"editableGro... | Get selected roles list.<p>
@param parent layout
@param importCase boolean
@return List of roles | [
"Get",
"selected",
"roles",
"list",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L748-L757 | train | Gets the roles list. | Create a Java method that does the following: "Gets the roles list.". | Of course, here is the Java code you requested:
```java
private List<CmsRole> getRolesList(VerticalLayout parent, boolean importCase) {
List<CmsRole> res = new ArrayList<CmsRole>();
CmsEditableGroup editableGroup = importCase ? m_importRolesGroup : m_exportRolesGroup;
for (I_CmsEditableGroupR... | |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java | GoogleDriveUtils.listPermissions | public static PermissionList listPermissions(Drive drive, String fileId) throws IOException {
return drive.permissions().list(fileId).execute();
} | java | public static PermissionList listPermissions(Drive drive, String fileId) throws IOException {
return drive.permissions().list(fileId).execute();
} | [
"public",
"static",
"PermissionList",
"listPermissions",
"(",
"Drive",
"drive",
",",
"String",
"fileId",
")",
"throws",
"IOException",
"{",
"return",
"drive",
".",
"permissions",
"(",
")",
".",
"list",
"(",
"fileId",
")",
".",
"execute",
"(",
")",
";",
"}"... | Permissions | [
"Permissions"
] | d91a0b54f954b33b4ee674a1bdf03612d76c3305 | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L206-L208 | train | Get permissions for a file | Create a Java method that does the following: "Get permissions for a file". | Of course, here is the Java code you requested:
```java
public static PermissionList listPermissions(Drive drive, String fileId) throws IOException {
return drive.permissions().list(fileId).execute();
}
```
Hope this helps! | |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/types/SampleCount.java | SampleCount.subtractPrecise | public SampleCount subtractPrecise(SampleCount that) throws ResamplingException
{
final long thatSamples = that.getSamplesPrecise(this.rate);
if (thatSamples != 0)
{
return new SampleCount(this.samples - thatSamples, this.rate);
}
else
{
return this;
}
} | java | public SampleCount subtractPrecise(SampleCount that) throws ResamplingException
{
final long thatSamples = that.getSamplesPrecise(this.rate);
if (thatSamples != 0)
{
return new SampleCount(this.samples - thatSamples, this.rate);
}
else
{
return this;
}
} | [
"public",
"SampleCount",
"subtractPrecise",
"(",
"SampleCount",
"that",
")",
"throws",
"ResamplingException",
"{",
"final",
"long",
"thatSamples",
"=",
"that",
".",
"getSamplesPrecise",
"(",
"this",
".",
"rate",
")",
";",
"if",
"(",
"thatSamples",
"!=",
"0",
"... | @param that
the sample count to subtract
@return
@throws ResamplingException
if the delta cannot be expressed without losing accuracy | [
"@param",
"that",
"the",
"sample",
"count",
"to",
"subtract"
] | d4025d2f881bc0542b1e004c5f65a1ccaf895836 | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/SampleCount.java#L87-L99 | train | Subtracts the given sample count from this one. | Create a Java method that does the following: "Subtracts the given sample count from this one.". | Of course, here is the Java code you requested:
```java
public SampleCount subtractPrecise(SampleCount that) throws ResamplingException
{
final long thatSamples = that.getSamplesPrecise(this.rate);
if (thatSamples != 0)
{
return new SampleCount(this.samples - thatSamples, this.rate);
}
else
{
retur... | |
jayantk/jklol | src/com/jayantkrish/jklol/models/dynamic/DynamicVariableSet.java | DynamicVariableSet.fromVariables | public static DynamicVariableSet fromVariables(VariableNumMap variables) {
return new DynamicVariableSet(variables, Collections.<String> emptyList(),
Collections.<DynamicVariableSet> emptyList(), new int[0]);
} | java | public static DynamicVariableSet fromVariables(VariableNumMap variables) {
return new DynamicVariableSet(variables, Collections.<String> emptyList(),
Collections.<DynamicVariableSet> emptyList(), new int[0]);
} | [
"public",
"static",
"DynamicVariableSet",
"fromVariables",
"(",
"VariableNumMap",
"variables",
")",
"{",
"return",
"new",
"DynamicVariableSet",
"(",
"variables",
",",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
",",
"Collections",
".",
"<",
"D... | Creates a {@code DynamicVariableSet} containing {@code variables}
and no plates.
@param variables
@return | [
"Creates",
"a",
"{",
"@code",
"DynamicVariableSet",
"}",
"containing",
"{",
"@code",
"variables",
"}",
"and",
"no",
"plates",
"."
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/dynamic/DynamicVariableSet.java#L63-L66 | train | Creates a new variable set from a set of variable numbers. | Create a Java method that does the following: "Creates a new variable set from a set of variable numbers.". | Of course, here is the Java code you requested:
```java
public static DynamicVariableSet fromVariables(VariableNumMap variables) {
return new DynamicVariableSet(variables, Collections.<String> emptyList(),
Collections.<DynamicVariableSet> emptyList(), new int[0]);
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java | EJSHome.postCreateCommon | private EJSWrapperCommon postCreateCommon(BeanO beanO,
Object primaryKey,
boolean supportEJBPostCreateChanges)
throws CreateException,
RemoteException
{
final boolean isTraceOn... | java | private EJSWrapperCommon postCreateCommon(BeanO beanO,
Object primaryKey,
boolean supportEJBPostCreateChanges)
throws CreateException,
RemoteException
{
final boolean isTraceOn... | [
"private",
"EJSWrapperCommon",
"postCreateCommon",
"(",
"BeanO",
"beanO",
",",
"Object",
"primaryKey",
",",
"boolean",
"supportEJBPostCreateChanges",
")",
"throws",
"CreateException",
",",
"RemoteException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
"... | f111627 d142250 | [
"f111627",
"d142250"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L2562-L2630 | train | Post create method. | Create a Java method that does the following: "Post create method.". | Of course, here is the Java code you requested:
```java
private EJSWrapperCommon postCreateCommon(BeanO beanO,
Object primaryKey,
boolean supportEJBPostCreateChanges)
throws CreateException,
... | |
Talend/tesb-rt-se | examples/camel/jaxrs-jms-http/common/src/main/java/talend/camel/examples/jaxrsjmshttp/common/ObjectFactory.java | ObjectFactory.createBookList | @XmlElementDecl(namespace = "http://books.com", name = "BookList")
public JAXBElement<BookList> createBookList(BookList value) {
return new JAXBElement<BookList>(_BookList_QNAME, BookList.class, null, value);
} | java | @XmlElementDecl(namespace = "http://books.com", name = "BookList")
public JAXBElement<BookList> createBookList(BookList value) {
return new JAXBElement<BookList>(_BookList_QNAME, BookList.class, null, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"http://books.com\"",
",",
"name",
"=",
"\"BookList\"",
")",
"public",
"JAXBElement",
"<",
"BookList",
">",
"createBookList",
"(",
"BookList",
"value",
")",
"{",
"return",
"new",
"JAXBElement",
"<",
"BookList",
">"... | Create an instance of {@link JAXBElement }{@code <}
{@link Book }{@code >} | [
"Create",
"an",
"instance",
"of",
"{"
] | 0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886 | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/examples/camel/jaxrs-jms-http/common/src/main/java/talend/camel/examples/jaxrsjmshttp/common/ObjectFactory.java#L45-L48 | train | Create an instance of BookList in the books. org namespace. | Create a Java method that does the following: "Create an instance of BookList in the books. org namespace.". | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "http://books.com", name = "BookList")
public JAXBElement<BookList> createBookList(BookList value) {
return new JAXBElement<BookList>(_BookList_QNAME, BookList.class, null, value);
}
```
Hope this helps! | |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java | GVRTransform.setScale | public GVRTransform setScale(float x, float y, float z) {
NativeTransform.setScale(getNative(), x, y, z);
return this;
} | java | public GVRTransform setScale(float x, float y, float z) {
NativeTransform.setScale(getNative(), x, y, z);
return this;
} | [
"public",
"GVRTransform",
"setScale",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"NativeTransform",
".",
"setScale",
"(",
"getNative",
"(",
")",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"return",
"this",
";",
"}"
] | Set [X, Y, Z] current scale
@param x
Scaling factor on the 'X' axis.
@param y
Scaling factor on the 'Y' axis.
@param z
Scaling factor on the 'Z' axis. | [
"Set",
"[",
"X",
"Y",
"Z",
"]",
"current",
"scale"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java#L263-L266 | train | Sets the scale of this transform to the given values. | Create a Java method that does the following: "Sets the scale of this transform to the given values.". | Of course, here is the Java code you requested:
```java
public GVRTransform setScale(float x, float y, float z) {
NativeTransform.setScale(getNative(), x, y, z);
return this;
}
```
Hope this helps! | |
AgNO3/jcifs-ng | src/main/java/jcifs/smb/NtlmPasswordAuthentication.java | NtlmPasswordAuthentication.getUserSessionKey | @Override
public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException {
if ( this.hashesExternal ) {
return;
}
super.getUserSessionKey(tc, chlng, dest, offset);
} | java | @Override
public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException {
if ( this.hashesExternal ) {
return;
}
super.getUserSessionKey(tc, chlng, dest, offset);
} | [
"@",
"Override",
"public",
"void",
"getUserSessionKey",
"(",
"CIFSContext",
"tc",
",",
"byte",
"[",
"]",
"chlng",
",",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
")",
"throws",
"SmbException",
"{",
"if",
"(",
"this",
".",
"hashesExternal",
")",
"{",... | {@inheritDoc}
@see jcifs.smb.NtlmPasswordAuthenticator#getUserSessionKey(jcifs.CIFSContext, byte[], byte[], int) | [
"{",
"@inheritDoc",
"}"
] | 0311107a077ea372527ae74839eec8042197332f | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/smb/NtlmPasswordAuthentication.java#L245-L251 | train | Override getUserSessionKey to override the default behavior. | Create a Java method that does the following: "Override getUserSessionKey to override the default behavior.". | Of course, here is the Java code you requested:
```java
@Override
public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException {
if ( this.hashesExternal ) {
return;
}
super.getUserSessionKey(tc, chlng, dest, offset);
}
```
Hop... | |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java | TextUtils.joinEscaped | public static String joinEscaped(String[] input, char separator, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
char[] schars = new char[(special != null ? special.length : 0) + 1];
if (special != null && special.length > 0) {
System.arraycopy(special, 0, schar... | java | public static String joinEscaped(String[] input, char separator, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
char[] schars = new char[(special != null ? special.length : 0) + 1];
if (special != null && special.length > 0) {
System.arraycopy(special, 0, schar... | [
"public",
"static",
"String",
"joinEscaped",
"(",
"String",
"[",
"]",
"input",
",",
"char",
"separator",
",",
"char",
"echar",
",",
"char",
"[",
"]",
"special",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"[",
"... | Join an array of strings with the given separator, escape char, and other special chars for escaping
@param input input string
@param separator separator
@param echar escape char
@param special all special chars not necessarily including the echar or separator
@return joined string | [
"Join",
"an",
"array",
"of",
"strings",
"with",
"the",
"given",
"separator",
"escape",
"char",
"and",
"other",
"special",
"chars",
"for",
"escaping"
] | 8070f774f55bffaa1118ff0c03aea319d40a9668 | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java#L192-L206 | train | Join a string with the specified separator and escaped special characters. | Create a Java method that does the following: "Join a string with the specified separator and escaped special characters.". | Of course, here is the Java code you requested:
```java
public static String joinEscaped(String[] input, char separator, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
char[] schars = new char[(special != null ? special.length : 0) + 1];
if (special != null && special.len... | |
dustin/java-memcached-client | src/main/java/net/spy/memcached/util/StringUtils.java | StringUtils.validateKey | public static void validateKey(final String key, final boolean binary) {
byte[] keyBytes = KeyUtil.getKeyBytes(key);
int keyLength = keyBytes.length;
if (keyLength > MAX_KEY_LENGTH) {
throw KEY_TOO_LONG_EXCEPTION;
}
if (keyLength == 0) {
throw KEY_EMPTY_EXCEPTION;
}
if(!binary... | java | public static void validateKey(final String key, final boolean binary) {
byte[] keyBytes = KeyUtil.getKeyBytes(key);
int keyLength = keyBytes.length;
if (keyLength > MAX_KEY_LENGTH) {
throw KEY_TOO_LONG_EXCEPTION;
}
if (keyLength == 0) {
throw KEY_EMPTY_EXCEPTION;
}
if(!binary... | [
"public",
"static",
"void",
"validateKey",
"(",
"final",
"String",
"key",
",",
"final",
"boolean",
"binary",
")",
"{",
"byte",
"[",
"]",
"keyBytes",
"=",
"KeyUtil",
".",
"getKeyBytes",
"(",
"key",
")",
";",
"int",
"keyLength",
"=",
"keyBytes",
".",
"leng... | Check if a given key is valid to transmit.
@param key the key to check.
@param binary if binary protocol is used. | [
"Check",
"if",
"a",
"given",
"key",
"is",
"valid",
"to",
"transmit",
"."
] | c232307ad8e0c7ccc926e495dd7d5aad2d713318 | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/util/StringUtils.java#L122-L143 | train | Validate the key. | Create a Java method that does the following: "Validate the key.". | Of course, here is the Java code you requested:
```java
public static void validateKey(final String key, final boolean binary) {
byte[] keyBytes = KeyUtil.getKeyBytes(key);
int keyLength = keyBytes.length;
if (keyLength > MAX_KEY_LENGTH) {
throw KEY_TOO_LONG_EXCEPTION;
}
if (keyLength == 0)... | |
filestack/filestack-android | filestack/src/main/java/com/filestack/android/internal/Util.java | Util.createPictureFile | public static File createPictureFile(Context context) throws IOException {
Locale locale = Locale.getDefault();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
String fileName = "JPEG_" + timeStamp + "_";
// Store in normal camera directory
... | java | public static File createPictureFile(Context context) throws IOException {
Locale locale = Locale.getDefault();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
String fileName = "JPEG_" + timeStamp + "_";
// Store in normal camera directory
... | [
"public",
"static",
"File",
"createPictureFile",
"(",
"Context",
"context",
")",
"throws",
"IOException",
"{",
"Locale",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"String",
"timeStamp",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyyMMdd_HHmmss\"",
... | Create a file with a path appropriate to save a photo. Uses directory internal to app. | [
"Create",
"a",
"file",
"with",
"a",
"path",
"appropriate",
"to",
"save",
"a",
"photo",
".",
"Uses",
"directory",
"internal",
"to",
"app",
"."
] | 8dafa1cb5c77542c351d631be0742717b5a9d45d | https://github.com/filestack/filestack-android/blob/8dafa1cb5c77542c351d631be0742717b5a9d45d/filestack/src/main/java/com/filestack/android/internal/Util.java#L168-L175 | train | Create a picture file in the image directory. | Create a Java method that does the following: "Create a picture file in the image directory.". | Of course, here is the Java code you requested:
```java
public static File createPictureFile(Context context) throws IOException {
Locale locale = Locale.getDefault();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
String fileName = "JPEG_" + timeStamp + ... | |
jboss/jboss-el-api_spec | src/main/java/javax/el/LambdaExpression.java | LambdaExpression.invoke | public Object invoke(ELContext elContext, Object... args)
throws ELException {
int i = 0;
Map<String, Object> lambdaArgs = new HashMap<String, Object>();
// First get arguments injected from the outter lambda, if any
lambdaArgs.putAll(envirArgs);
for (String fParam... | java | public Object invoke(ELContext elContext, Object... args)
throws ELException {
int i = 0;
Map<String, Object> lambdaArgs = new HashMap<String, Object>();
// First get arguments injected from the outter lambda, if any
lambdaArgs.putAll(envirArgs);
for (String fParam... | [
"public",
"Object",
"invoke",
"(",
"ELContext",
"elContext",
",",
"Object",
"...",
"args",
")",
"throws",
"ELException",
"{",
"int",
"i",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"lambdaArgs",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Invoke the encapsulated Lambda expression.
<p> The supplied arguments are matched, in
the same order, to the formal parameters. If there are more arguments
than the formal parameters, the extra arguments are ignored. If there
are less arguments than the formal parameters, an
<code>ELException</code> is thrown.</p>
<... | [
"Invoke",
"the",
"encapsulated",
"Lambda",
"expression",
".",
"<p",
">",
"The",
"supplied",
"arguments",
"are",
"matched",
"in",
"the",
"same",
"order",
"to",
"the",
"formal",
"parameters",
".",
"If",
"there",
"are",
"more",
"arguments",
"than",
"the",
"form... | 4cef117cae3ccf9f76439845687a8d219ad2eb43 | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/LambdaExpression.java#L126-L161 | train | Invoke the method in the ELContext. | Create a Java method that does the following: "Invoke the method in the ELContext.". | Of course, here is the Java code you requested:
```java
public Object invoke(ELContext elContext, Object... args)
throws ELException {
int i = 0;
Map<String, Object> lambdaArgs = new HashMap<String, Object>();
// First get arguments injected from the outter lambda, if any
... | |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webapp25/WebAppTypeImpl.java | WebAppTypeImpl.getOrCreateJspConfig | public JspConfigType<WebAppType<T>> getOrCreateJspConfig()
{
List<Node> nodeList = childNode.get("jsp-config");
if (nodeList != null && nodeList.size() > 0)
{
return new JspConfigTypeImpl<WebAppType<T>>(this, "jsp-config", childNode, nodeList.get(0));
}
return createJspConfig(... | java | public JspConfigType<WebAppType<T>> getOrCreateJspConfig()
{
List<Node> nodeList = childNode.get("jsp-config");
if (nodeList != null && nodeList.size() > 0)
{
return new JspConfigTypeImpl<WebAppType<T>>(this, "jsp-config", childNode, nodeList.get(0));
}
return createJspConfig(... | [
"public",
"JspConfigType",
"<",
"WebAppType",
"<",
"T",
">",
">",
"getOrCreateJspConfig",
"(",
")",
"{",
"List",
"<",
"Node",
">",
"nodeList",
"=",
"childNode",
".",
"get",
"(",
"\"jsp-config\"",
")",
";",
"if",
"(",
"nodeList",
"!=",
"null",
"&&",
"node... | If not already created, a new <code>jsp-config</code> element will be created and returned.
Otherwise, the first existing <code>jsp-config</code> element will be returned.
@return the instance defined for the element <code>jsp-config</code> | [
"If",
"not",
"already",
"created",
"a",
"new",
"<code",
">",
"jsp",
"-",
"config<",
"/",
"code",
">",
"element",
"will",
"be",
"created",
"and",
"returned",
".",
"Otherwise",
"the",
"first",
"existing",
"<code",
">",
"jsp",
"-",
"config<",
"/",
"code",
... | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webapp25/WebAppTypeImpl.java#L1451-L1459 | train | Gets the jsp - config. | Create a Java method that does the following: "Gets the jsp - config.". | Of course, here is the Java code you requested:
```java
public JspConfigType<WebAppType<T>> getOrCreateJspConfig()
{
List<Node> nodeList = childNode.get("jsp-config");
if (nodeList != null && nodeList.size() > 0)
{
return new JspConfigTypeImpl<WebAppType<T>>(this, "jsp-config", childNode... | |
JoeKerouac/utils | src/main/java/com/joe/utils/math/MathUtil.java | MathUtil.factorial | public static long factorial(int arg) {
if (arg <= 0) {
throw new IllegalArgumentException("参数必须大于0");
}
long result = 1;
for (int i = arg; i > 0; i--) {
result *= i;
}
return result;
} | java | public static long factorial(int arg) {
if (arg <= 0) {
throw new IllegalArgumentException("参数必须大于0");
}
long result = 1;
for (int i = arg; i > 0; i--) {
result *= i;
}
return result;
} | [
"public",
"static",
"long",
"factorial",
"(",
"int",
"arg",
")",
"{",
"if",
"(",
"arg",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"参数必须大于0\");",
"",
"",
"}",
"long",
"result",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
... | 计算阶乘
@param arg 要计算的参数,必须大于0
@return 阶乘计算结果(如果结果大于long可以表示的最大值将会出现不确定结果) | [
"计算阶乘"
] | 45e1b2dc4d736956674fc4dcbe6cf84eaee69278 | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/math/MathUtil.java#L224-L234 | train | Gets factorial. | Create a Java method that does the following: "Gets factorial.". | Of course, here is the Java code you requested:
```java
public static long factorial(int arg) {
if (arg <= 0) {
throw new IllegalArgumentException("参数必须大于0");
}
long result = 1;
for (int i = arg; i > 0; i--) {
result *= i;
}
return result;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.