method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static UnmarshallingContext getInstance() { return (UnmarshallingContext) Coordinator._getInstance(); }
static UnmarshallingContext function() { return (UnmarshallingContext) Coordinator._getInstance(); }
/** * When called from within the realm of the unmarshaller, this method * returns the current {@link UnmarshallingContext} in charge. */
When called from within the realm of the unmarshaller, this method returns the current <code>UnmarshallingContext</code> in charge
getInstance
{ "repo_name": "universsky/openjdk", "path": "jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java", "license": "gpl-2.0", "size": 43094 }
[ "com.sun.xml.internal.bind.v2.runtime.Coordinator" ]
import com.sun.xml.internal.bind.v2.runtime.Coordinator;
import com.sun.xml.internal.bind.v2.runtime.*;
[ "com.sun.xml" ]
com.sun.xml;
548,418
private Intent createVoiceAppSearchIntent(Intent baseIntent, SearchableInfo searchable) { ComponentName searchActivity = searchable.getSearchActivity(); // create the necessary intent to set up a search-and-forward operation // in the voice search system. We have to keep the bundle separate, // because it becomes immutable once it enters the PendingIntent Intent queryIntent = new Intent(Intent.ACTION_SEARCH); queryIntent.setComponent(searchActivity); PendingIntent pending = PendingIntent.getActivity(getContext(), 0, queryIntent, PendingIntent.FLAG_ONE_SHOT); // Now set up the bundle that will be inserted into the pending intent // when it's time to do the search. We always build it here (even if empty) // because the voice search activity will always need to insert "QUERY" into // it anyway. Bundle queryExtras = new Bundle(); // Now build the intent to launch the voice search. Add all necessary // extras to launch the voice recognizer, and then all the necessary extras // to forward the results to the searchable activity Intent voiceIntent = new Intent(baseIntent); // Add all of the configuration options supplied by the searchable's metadata String languageModel = RecognizerIntent.LANGUAGE_MODEL_FREE_FORM; String prompt = null; String language = null; int maxResults = 1; Resources resources = getResources(); if (searchable.getVoiceLanguageModeId() != 0) { languageModel = resources.getString(searchable.getVoiceLanguageModeId()); } if (searchable.getVoicePromptTextId() != 0) { prompt = resources.getString(searchable.getVoicePromptTextId()); } if (searchable.getVoiceLanguageId() != 0) { language = resources.getString(searchable.getVoiceLanguageId()); } if (searchable.getVoiceMaxResults() != 0) { maxResults = searchable.getVoiceMaxResults(); } voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel); voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt); voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language); voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults); voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, searchActivity == null ? null : searchActivity.flattenToShortString()); // Add the values that configure forwarding the results voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending); voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE, queryExtras); return voiceIntent; }
Intent function(Intent baseIntent, SearchableInfo searchable) { ComponentName searchActivity = searchable.getSearchActivity(); Intent queryIntent = new Intent(Intent.ACTION_SEARCH); queryIntent.setComponent(searchActivity); PendingIntent pending = PendingIntent.getActivity(getContext(), 0, queryIntent, PendingIntent.FLAG_ONE_SHOT); Bundle queryExtras = new Bundle(); Intent voiceIntent = new Intent(baseIntent); String languageModel = RecognizerIntent.LANGUAGE_MODEL_FREE_FORM; String prompt = null; String language = null; int maxResults = 1; Resources resources = getResources(); if (searchable.getVoiceLanguageModeId() != 0) { languageModel = resources.getString(searchable.getVoiceLanguageModeId()); } if (searchable.getVoicePromptTextId() != 0) { prompt = resources.getString(searchable.getVoicePromptTextId()); } if (searchable.getVoiceLanguageId() != 0) { language = resources.getString(searchable.getVoiceLanguageId()); } if (searchable.getVoiceMaxResults() != 0) { maxResults = searchable.getVoiceMaxResults(); } voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel); voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt); voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language); voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults); voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, searchActivity == null ? null : searchActivity.flattenToShortString()); voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending); voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE, queryExtras); return voiceIntent; }
/** * Create and return an Intent that can launch the voice search activity, perform a specific * voice transcription, and forward the results to the searchable activity. * * @param baseIntent The voice app search intent to start from * @return A completely-configured intent ready to send to the voice search activity */
Create and return an Intent that can launch the voice search activity, perform a specific voice transcription, and forward the results to the searchable activity
createVoiceAppSearchIntent
{ "repo_name": "treasure-lau/CSipSimple", "path": "actionbarsherlock-library/src/main/java/com/actionbarsherlock/widget/SearchView.java", "license": "gpl-3.0", "size": 71183 }
[ "android.app.PendingIntent", "android.app.SearchableInfo", "android.content.ComponentName", "android.content.Intent", "android.content.res.Resources", "android.os.Bundle", "android.speech.RecognizerIntent" ]
import android.app.PendingIntent; import android.app.SearchableInfo; import android.content.ComponentName; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.speech.RecognizerIntent;
import android.app.*; import android.content.*; import android.content.res.*; import android.os.*; import android.speech.*;
[ "android.app", "android.content", "android.os", "android.speech" ]
android.app; android.content; android.os; android.speech;
538,110
protected Node export(Node n, Document d) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "import.document", new Object[] {}); }
Node function(Node n, Document d) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, STR, new Object[] {}); }
/** * Exports this node to the given document. * @param n The clone node. * @param d The destination document. */
Exports this node to the given document
export
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/AbstractDocument.java", "license": "apache-2.0", "size": 95361 }
[ "org.w3c.dom.DOMException", "org.w3c.dom.Document", "org.w3c.dom.Node" ]
import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,813,035
@Test() public void testChangePrivateKeyPassword() throws Exception { // Tests changing the private key password for a certificate in a JKS // keystore. File ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); KeyStore keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates( "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", "password"); assertNotNull(keystore.getKey("server-cert", "new-password".toCharArray())); try { keystore.getKey("server-cert", "password".toCharArray()); fail("Expected an exception when trying to get a key with the wrong " + "password"); } catch (final Exception e) { // This was expected. } // Tests changing the private key password for a certificate in a PKCS #12 // keystore. ksFile = copyFile(serverPKCS12KeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "PKCS12"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates( "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "PKCS12", "password"); assertNotNull(keystore.getKey("server-cert", "new-password".toCharArray())); try { keystore.getKey("server-cert", "password".toCharArray()); fail("Expected an exception when trying to get a key with the wrong " + "password"); } catch (final Exception e) { // This was expected. } // Tests changing the private key password using passwords read from files. ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); final String newPasswordFilePath = createTempFile("new-password").getAbsolutePath(); manageCertificates( "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password-file", correctPasswordFilePath, "--new-private-key-password-file", newPasswordFilePath, "--display-keytool-command"); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", "password"); assertNotNull(keystore.getKey("server-cert", "new-password".toCharArray())); try { keystore.getKey("server-cert", "password".toCharArray()); fail("Expected an exception when trying to get a key with the wrong " + "password"); } catch (final Exception e) { // This was expected. } // Tests changing the private key password using passwords read // interactively. ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); PasswordReader.setTestReader(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(StaticUtils.getBytes( "\npassword\nnew-password\nwrong\nshort\nnew-password\n" + "new-password\n"))))); try { manageCertificates( "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--prompt-for-current-private-key-password", "--prompt-for-new-private-key-password", "--display-keytool-command"); } finally { PasswordReader.setTestReader(null); } assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", "password"); assertNotNull(keystore.getKey("server-cert", "new-password".toCharArray())); try { keystore.getKey("server-cert", "password".toCharArray()); fail("Expected an exception when trying to get a key with the wrong " + "password"); } catch (final Exception e) { // This was expected. } // Tests with an alias that doesn't exist in the keystore. ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "nonexistent", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with an alias that is associated with a trusted certificate entry // rather than a private key entry. ksFile = copyFile(serverTrustStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias, serverCertificateAlias + "-issuer-1", serverCertificateAlias + "-issuer-2")); assertEquals(getAliases(keystore, true, false), Collections.<String>emptySet()); assertEquals(getAliases(keystore, false, true), setOf(serverCertificateAlias, serverCertificateAlias + "-issuer-1", serverCertificateAlias + "-issuer-2")); manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with a wrong keystore password. ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "wrong", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with a keystore password read from an empty file. manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password-file", emptyPasswordFilePath, "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with a wrong current private key password. manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "wrong", "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with a current private key password read from an empty file. manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password-file", emptyPasswordFilePath, "--new-private-key-password", "new-password", "--display-keytool-command"); // Tests with a new private key password read from an empty file. manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password-file", emptyPasswordFilePath, "--display-keytool-command"); // Tests with a malformed keystore. ksFile = createTempFile("this is not a valid keystore"); manageCertificates(ResultCode.PARAM_ERROR, null, "change-private-key-password", "--keystore", ksFile.getAbsolutePath(), "--keystore-password", "password", "--alias", "server-cert", "--current-private-key-password", "password", "--new-private-key-password", "new-password", "--display-keytool-command"); }
@Test() void function() throws Exception { File ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); KeyStore keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates( STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, STR, STR); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", STR); assertNotNull(keystore.getKey(STR, STR.toCharArray())); try { keystore.getKey(STR, STR.toCharArray()); fail(STR + STR); } catch (final Exception e) { } ksFile = copyFile(serverPKCS12KeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), STR); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates( STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, STR, STR); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), STR, STR); assertNotNull(keystore.getKey(STR, STR.toCharArray())); try { keystore.getKey(STR, STR.toCharArray()); fail(STR + STR); } catch (final Exception e) { } ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); final String newPasswordFilePath = createTempFile(STR).getAbsolutePath(); manageCertificates( STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, correctPasswordFilePath, STR, newPasswordFilePath, STR); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", STR); assertNotNull(keystore.getKey(STR, STR.toCharArray())); try { keystore.getKey(STR, STR.toCharArray()); fail(STR + STR); } catch (final Exception e) { } ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); PasswordReader.setTestReader(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(StaticUtils.getBytes( STR + STR))))); try { manageCertificates( STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR); } finally { PasswordReader.setTestReader(null); } assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS", STR); assertNotNull(keystore.getKey(STR, STR.toCharArray())); try { keystore.getKey(STR, STR.toCharArray()); fail(STR + STR); } catch (final Exception e) { } ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, STR, STR); ksFile = copyFile(serverTrustStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias, serverCertificateAlias + STR, serverCertificateAlias + STR)); assertEquals(getAliases(keystore, true, false), Collections.<String>emptySet()); assertEquals(getAliases(keystore, false, true), setOf(serverCertificateAlias, serverCertificateAlias + STR, serverCertificateAlias + STR)); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, STR, STR); ksFile = copyFile(serverKeyStorePath); assertTrue(ksFile.exists()); keystore = getKeystore(ksFile.getAbsolutePath(), "JKS"); assertEquals(getAliases(keystore, true, true), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, true, false), setOf(serverCertificateAlias)); assertEquals(getAliases(keystore, false, true), Collections.<String>emptySet()); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, "wrong", STR, STR, STR, STR, STR, STR, STR); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, emptyPasswordFilePath, STR, STR, STR, STR, STR, STR, STR); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, "wrong", STR, STR, STR); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, emptyPasswordFilePath, STR, STR, STR); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, emptyPasswordFilePath, STR); ksFile = createTempFile(STR); manageCertificates(ResultCode.PARAM_ERROR, null, STR, STR, ksFile.getAbsolutePath(), STR, STR, STR, STR, STR, STR, STR, STR, STR); }
/** * Provides test coverage for the change-private-key-password subcommand. * * @throws Exception If an unexpected problem occurs. */
Provides test coverage for the change-private-key-password subcommand
testChangePrivateKeyPassword
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/util/ssl/cert/ManageCertificatesTestCase.java", "license": "gpl-2.0", "size": 311521 }
[ "com.unboundid.ldap.sdk.ResultCode", "com.unboundid.util.PasswordReader", "com.unboundid.util.StaticUtils", "java.io.BufferedReader", "java.io.ByteArrayInputStream", "java.io.File", "java.io.InputStreamReader", "java.security.KeyStore", "java.util.Collections", "org.testng.annotations.Test" ]
import com.unboundid.ldap.sdk.ResultCode; import com.unboundid.util.PasswordReader; import com.unboundid.util.StaticUtils; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStreamReader; import java.security.KeyStore; import java.util.Collections; import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.*; import com.unboundid.util.*; import java.io.*; import java.security.*; import java.util.*; import org.testng.annotations.*;
[ "com.unboundid.ldap", "com.unboundid.util", "java.io", "java.security", "java.util", "org.testng.annotations" ]
com.unboundid.ldap; com.unboundid.util; java.io; java.security; java.util; org.testng.annotations;
351,074
public static Period parsePeriod(String s, AtomicBoolean isRelative) throws IllegalArgumentException { return new TimeParser().parsePeriod(s, isRelative); }
static Period function(String s, AtomicBoolean isRelative) throws IllegalArgumentException { return new TimeParser().parsePeriod(s, isRelative); }
/** * TODO break this out into a TimeParser class so we can have language & timezone support. * WARNING: will return a point time (a 0-length period) for many cases * @param s a period or a time. Anything really, but only English. * @param isRelative * @return * @throws IllegalArgumentException */
TODO break this out into a TimeParser class so we can have language & timezone support
parsePeriod
{ "repo_name": "sodash/open-code", "path": "winterwell.utils/src/com/winterwell/utils/time/TimeUtils.java", "license": "mit", "size": 21909 }
[ "java.util.concurrent.atomic.AtomicBoolean" ]
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
1,848,578
public void onRatingProcessed() { SharedPreferences.Editor editor = getPrefs().edit(); editor.putBoolean(KEY_RATING_PROCESSED, true); editor.commit(); }
void function() { SharedPreferences.Editor editor = getPrefs().edit(); editor.putBoolean(KEY_RATING_PROCESSED, true); editor.commit(); }
/** * Call when the rating dialog was either accepted or declined. No more rating requests will be shown afterwards. */
Call when the rating dialog was either accepted or declined. No more rating requests will be shown afterwards
onRatingProcessed
{ "repo_name": "FauDroids/Wiesn-FindMe", "path": "app/src/main/java/org/faudroids/wiesen/app/RatingManager.java", "license": "agpl-3.0", "size": 1611 }
[ "android.content.SharedPreferences" ]
import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
2,090,578
List getSerialDateInterruptions();
List getSerialDateInterruptions();
/** * Returns a list of interruptions to the serial date containing {@link CmsCalendarSerialDateInterruption} objects.<p> * * @return a list with interruptions to the serial date */
Returns a list of interruptions to the serial date containing <code>CmsCalendarSerialDateInterruption</code> objects
getSerialDateInterruptions
{ "repo_name": "alkacon/alkacon-oamp", "path": "com.alkacon.opencms.v8.calendar/src/com/alkacon/opencms/v8/calendar/I_CmsCalendarSerialDateOptions.java", "license": "gpl-3.0", "size": 5845 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,624,782
private Set<String> findCalledFunctions(Node node) { Set<String> changed = Sets.newHashSet(); findCalledFunctions(NodeUtil.getFunctionBody(node), changed); return changed; }
Set<String> function(Node node) { Set<String> changed = Sets.newHashSet(); findCalledFunctions(NodeUtil.getFunctionBody(node), changed); return changed; }
/** * This functions that may be called directly. */
This functions that may be called directly
findCalledFunctions
{ "repo_name": "abdullah38rcc/closure-compiler", "path": "src/com/google/javascript/jscomp/InlineFunctions.java", "license": "apache-2.0", "size": 34916 }
[ "com.google.common.collect.Sets", "com.google.javascript.rhino.Node", "java.util.Set" ]
import com.google.common.collect.Sets; import com.google.javascript.rhino.Node; import java.util.Set;
import com.google.common.collect.*; import com.google.javascript.rhino.*; import java.util.*;
[ "com.google.common", "com.google.javascript", "java.util" ]
com.google.common; com.google.javascript; java.util;
982,729
public static <W extends Wizard> W openWizardSuccessfully( final Shell parentShell, final W wizard, final Point initialSize) { Integer returnCode = openWizard(parentShell, wizard, initialSize); return (returnCode != null && returnCode == Window.OK) ? wizard : null; }
static <W extends Wizard> W function( final Shell parentShell, final W wizard, final Point initialSize) { Integer returnCode = openWizard(parentShell, wizard, initialSize); return (returnCode != null && returnCode == Window.OK) ? wizard : null; }
/** * Open a wizard in the SWT thread and returns the {@link WizardDialog}'s * reference to the {@link Wizard} in case of success. * * @param wizard * @param initialSize * * @return the wizard if it was successfully finished; null otherwise */
Open a wizard in the SWT thread and returns the <code>WizardDialog</code>'s reference to the <code>Wizard</code> in case of success
openWizardSuccessfully
{ "repo_name": "bkahlert/api-usability-analyzer", "path": "de.fu_berlin.imp.apiua.groundedtheory/src/de/fu_berlin/imp/apiua/groundedtheory/ui/wizards/WizardUtils.java", "license": "mit", "size": 4225 }
[ "org.eclipse.jface.window.Window", "org.eclipse.jface.wizard.Wizard", "org.eclipse.swt.graphics.Point", "org.eclipse.swt.widgets.Shell" ]
import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.Wizard; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.window.*; import org.eclipse.jface.wizard.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
826,463
public void testTransformComplexClassToClassGen() throws ClassNotFoundException { final JavaClass jc = getTestClass(PACKAGE_BASE_NAME+".data.ComplexAnnotatedClass"); final ClassGen cgen = new ClassGen(jc); // Check annotations are correctly preserved final AnnotationEntryGen[] annotations = cgen.getAnnotationEntries(); assertTrue("Expected one annotation but found " + annotations.length, annotations.length == 1); final List<?> l = annotations[0].getValues(); boolean found = false; for (final Object name : l) { final ElementValuePairGen element = (ElementValuePairGen) name; if (element.getNameString().equals("dval")) { if (((SimpleElementValueGen) element.getValue()) .stringifyValue().equals("33.4")) { found = true; } } } assertTrue("Did not find double annotation value with value 33.4", found); }
void function() throws ClassNotFoundException { final JavaClass jc = getTestClass(PACKAGE_BASE_NAME+STR); final ClassGen cgen = new ClassGen(jc); final AnnotationEntryGen[] annotations = cgen.getAnnotationEntries(); assertTrue(STR + annotations.length, annotations.length == 1); final List<?> l = annotations[0].getValues(); boolean found = false; for (final Object name : l) { final ElementValuePairGen element = (ElementValuePairGen) name; if (element.getNameString().equals("dval")) { if (((SimpleElementValueGen) element.getValue()) .stringifyValue().equals("33.4")) { found = true; } } } assertTrue(STR, found); }
/** * Transform complex class from an immutable to a mutable object. */
Transform complex class from an immutable to a mutable object
testTransformComplexClassToClassGen
{ "repo_name": "typetools/commons-bcel", "path": "src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java", "license": "apache-2.0", "size": 32266 }
[ "java.util.List", "org.apache.bcel.classfile.JavaClass" ]
import java.util.List; import org.apache.bcel.classfile.JavaClass;
import java.util.*; import org.apache.bcel.classfile.*;
[ "java.util", "org.apache.bcel" ]
java.util; org.apache.bcel;
2,818,222
public Map<String, Object> readMap(String indexName, final String id) { GetResponse response = elasticsearchClient.prepareGet(indexName, null, id).execute().actionGet(); Map<String, Object> map = getMap(response); return map; }
Map<String, Object> function(String indexName, final String id) { GetResponse response = elasticsearchClient.prepareGet(indexName, null, id).execute().actionGet(); Map<String, Object> map = getMap(response); return map; }
/** * Read a json document from the search index for a given id. * Elasticsearch reads the '_source' field and parses the content as json. * * @param id * the unique identifier of a document * @return the document as json, matched on a Map<String, Object> object instance */
Read a json document from the search index for a given id. Elasticsearch reads the '_source' field and parses the content as json
readMap
{ "repo_name": "shivenmian/loklak_server", "path": "src/org/loklak/data/ElasticsearchClient.java", "license": "lgpl-2.1", "size": 44539 }
[ "java.util.Map", "org.elasticsearch.action.get.GetResponse" ]
import java.util.Map; import org.elasticsearch.action.get.GetResponse;
import java.util.*; import org.elasticsearch.action.get.*;
[ "java.util", "org.elasticsearch.action" ]
java.util; org.elasticsearch.action;
52,456
protected void addDigestToLibrary(DigestOutputStream digestStream, ISWCLibrary library) { if (library == null) { throw new NullPointerException("library may not be null"); } if (digestStream != null) { SWCDigest swcDigest = new SWCDigest(); swcDigest.setType(SWCDigest.SHA_256); swcDigest.setValue(digestStream.getMessageDigest().digest()); library.addDigest(swcDigest); } }
void function(DigestOutputStream digestStream, ISWCLibrary library) { if (library == null) { throw new NullPointerException(STR); } if (digestStream != null) { SWCDigest swcDigest = new SWCDigest(); swcDigest.setType(SWCDigest.SHA_256); swcDigest.setValue(digestStream.getMessageDigest().digest()); library.addDigest(swcDigest); } }
/** * Add the digest from the digestStream to the ISWCLibrary. * * @param digestStream may be null. If null no digest is created. * @param library The library to update. May not be null. * @throws NullPointerException if library is null. */
Add the digest from the digestStream to the ISWCLibrary
addDigestToLibrary
{ "repo_name": "adufilie/flex-falcon", "path": "compiler/src/org/apache/flex/swc/io/SWCWriterBase.java", "license": "apache-2.0", "size": 7413 }
[ "java.security.DigestOutputStream", "org.apache.flex.swc.ISWCLibrary", "org.apache.flex.swc.SWCDigest" ]
import java.security.DigestOutputStream; import org.apache.flex.swc.ISWCLibrary; import org.apache.flex.swc.SWCDigest;
import java.security.*; import org.apache.flex.swc.*;
[ "java.security", "org.apache.flex" ]
java.security; org.apache.flex;
1,600,655
final ID getHashKey(Key entry) { if (entry == null) { throw new IllegalArgumentException( "Parameter entry must not be null!"); } if (entry.getBytes() == null || entry.getBytes().length == 0) { throw new IllegalArgumentException( "Byte representation of Parameter must not be null or have length 0!"); } byte[] testBytes = entry.getBytes(); return this.createID(testBytes); }
final ID getHashKey(Key entry) { if (entry == null) { throw new IllegalArgumentException( STR); } if (entry.getBytes() == null entry.getBytes().length == 0) { throw new IllegalArgumentException( STR); } byte[] testBytes = entry.getBytes(); return this.createID(testBytes); }
/** * Calculates the hash value for a given data Key. * * @param entry * @return ID for the given Key. */
Calculates the hash value for a given data Key
getHashKey
{ "repo_name": "yahiaelgamal/PeerBox", "path": "src/de/uniba/wiai/lspi/chord/service/impl/HashFunction.java", "license": "gpl-2.0", "size": 5367 }
[ "de.uniba.wiai.lspi.chord.service.Key" ]
import de.uniba.wiai.lspi.chord.service.Key;
import de.uniba.wiai.lspi.chord.service.*;
[ "de.uniba.wiai" ]
de.uniba.wiai;
1,194,848
public int xToOffset(int line, int x) { TokenMarker tokenMarker = getTokenMarker(); FontMetrics fm = painter.getFontMetrics(); getLineText(line, lineSegment); char[] segmentArray = lineSegment.array; int segmentOffset = lineSegment.offset; int segmentCount = lineSegment.count; int width = horizontalOffset; if (tokenMarker == null) { for (int i = 0; i < segmentCount; i++) { char c = segmentArray[i + segmentOffset]; int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, i) - width; } else { charWidth = fm.charWidth(c); } if (painter.isBlockCaretEnabled()) { if (x - charWidth <= width) { return i; } } else { if (x - charWidth / 2 <= width) { return i; } } width += charWidth; } return segmentCount; } else { Token tokens; if (painter.currentLineIndex == line && painter.currentLineTokens != null) { tokens = painter.currentLineTokens; } else { painter.currentLineIndex = line; tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line); } int offset = 0; Font defaultFont = painter.getFont(); SyntaxStyle[] styles = painter.getStyles(); for (;;) { byte id = tokens.id; if (id == Token.END) { return offset; } if (id == Token.NULL) { fm = painter.getFontMetrics(); } else { fm = styles[id].getFontMetrics(defaultFont); } int length = tokens.length; for (int i = 0; i < length; i++) { char c = segmentArray[segmentOffset + offset + i]; int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, offset + i) - width; } else { charWidth = fm.charWidth(c); } if (painter.isBlockCaretEnabled()) { if (x - charWidth <= width) { return offset + i; } } else { if (x - charWidth / 2 <= width) { return offset + i; } } width += charWidth; } offset += length; tokens = tokens.next; } } }
int function(int line, int x) { TokenMarker tokenMarker = getTokenMarker(); FontMetrics fm = painter.getFontMetrics(); getLineText(line, lineSegment); char[] segmentArray = lineSegment.array; int segmentOffset = lineSegment.offset; int segmentCount = lineSegment.count; int width = horizontalOffset; if (tokenMarker == null) { for (int i = 0; i < segmentCount; i++) { char c = segmentArray[i + segmentOffset]; int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, i) - width; } else { charWidth = fm.charWidth(c); } if (painter.isBlockCaretEnabled()) { if (x - charWidth <= width) { return i; } } else { if (x - charWidth / 2 <= width) { return i; } } width += charWidth; } return segmentCount; } else { Token tokens; if (painter.currentLineIndex == line && painter.currentLineTokens != null) { tokens = painter.currentLineTokens; } else { painter.currentLineIndex = line; tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line); } int offset = 0; Font defaultFont = painter.getFont(); SyntaxStyle[] styles = painter.getStyles(); for (;;) { byte id = tokens.id; if (id == Token.END) { return offset; } if (id == Token.NULL) { fm = painter.getFontMetrics(); } else { fm = styles[id].getFontMetrics(defaultFont); } int length = tokens.length; for (int i = 0; i < length; i++) { char c = segmentArray[segmentOffset + offset + i]; int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, offset + i) - width; } else { charWidth = fm.charWidth(c); } if (painter.isBlockCaretEnabled()) { if (x - charWidth <= width) { return offset + i; } } else { if (x - charWidth / 2 <= width) { return offset + i; } } width += charWidth; } offset += length; tokens = tokens.next; } } }
/** * Converts an x co-ordinate to an offset within a line. * * @param line * The line * @param x * The x co-ordinate */
Converts an x co-ordinate to an offset within a line
xToOffset
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/tools/syntax/JEditTextArea.java", "license": "gpl-3.0", "size": 55315 }
[ "java.awt.Font", "java.awt.FontMetrics" ]
import java.awt.Font; import java.awt.FontMetrics;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,805,560
@Nonnull public List<Precondition> getPreconditions() { return Collections.unmodifiableList(preconditions_); }
List<Precondition> function() { return Collections.unmodifiableList(preconditions_); }
/** * Returns a read-only view of the preconditions of this application * * @return the preconditions a read-only view of the preconditions of this application. It is never <code>null</code> */
Returns a read-only view of the preconditions of this application
getPreconditions
{ "repo_name": "alessandroleite/dohko", "path": "core/src/main/java/org/excalibur/core/execution/domain/Application.java", "license": "lgpl-3.0", "size": 8229 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
866,377
public String toString() { StringBuilder string = new StringBuilder(getName()); if (getUnit() != null) { string.append(" ("); string.append(getUnit()); string.append(")"); } if (metadata.size() > 0) { string.append(": "); Set<String> keys = metadata.keySet(); Iterator<String> it = keys.iterator(); while (it.hasNext()) { String key = it.next(); string.append(key); String value = metadata.get(key); if (value.length() > 0) { string.append('='); string.append(value); } if (it.hasNext()) { string.append(", "); } } } return string.toString(); }
String function() { StringBuilder string = new StringBuilder(getName()); if (getUnit() != null) { string.append(STR); string.append(getUnit()); string.append(")"); } if (metadata.size() > 0) { string.append(STR); Set<String> keys = metadata.keySet(); Iterator<String> it = keys.iterator(); while (it.hasNext()) { String key = it.next(); string.append(key); String value = metadata.get(key); if (value.length() > 0) { string.append('='); string.append(value); } if (it.hasNext()) { string.append(STR); } } } return string.toString(); }
/** * Return a string with the channel name and all metadata. * * @return a string representation of the channel and its metadata */
Return a string with the channel name and all metadata
toString
{ "repo_name": "tectronics/rdv", "path": "src/org/rdv/data/Channel.java", "license": "mit", "size": 5862 }
[ "java.util.Iterator", "java.util.Set" ]
import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,206,364
private void load(String modelFile) { try { String dmf = ExtractionModel.loadDatamodelFolder(modelFile); if (dmf == null && DataModelManager.getCurrentModelSubfolder() != null || dmf != null && !dmf.equals(DataModelManager.getCurrentModelSubfolder())) { JOptionPane.showMessageDialog(this, "Unable to load \"" + new File(modelFile).getName() + "\"\nExtraction model is assigned to data model \"" + DataModelManager.getModelDetails(dmf).a + "\"", "Wrong Data Model", JOptionPane.ERROR_MESSAGE); return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); extractionModelEditor.extractionModelFrame = null; editorPanel.remove(extractionModelEditor); extractionModelEditor = null; editorPanel.add(extractionModelEditor = new ExtractionModelEditor(modelFile, this, isHorizontalLayout, getConnectivityState(), getConnectivityStateToolTip()), "editor"); ((CardLayout) editorPanel.getLayout()).show(editorPanel, "editor"); validate(); extractionModelEditor.closureBorderView.refresh(); restrictedDependenciesView.refresh(); updateTitle(extractionModelEditor.needsSave); } catch (Throwable t) { UIUtil.showException(this, "Error", t); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
void function(String modelFile) { try { String dmf = ExtractionModel.loadDatamodelFolder(modelFile); if (dmf == null && DataModelManager.getCurrentModelSubfolder() != null dmf != null && !dmf.equals(DataModelManager.getCurrentModelSubfolder())) { JOptionPane.showMessageDialog(this, STRSTR\STRSTR\STRWrong Data ModelSTReditorSTReditorSTRError", t); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
/** * Loads an extraction model. * * @param modelFile name of model file */
Loads an extraction model
load
{ "repo_name": "pellcorp/jailer", "path": "src/main/net/sf/jailer/ui/ExtractionModelFrame.java", "license": "apache-2.0", "size": 74975 }
[ "java.awt.Cursor", "javax.swing.JOptionPane", "net.sf.jailer.extractionmodel.ExtractionModel" ]
import java.awt.Cursor; import javax.swing.JOptionPane; import net.sf.jailer.extractionmodel.ExtractionModel;
import java.awt.*; import javax.swing.*; import net.sf.jailer.extractionmodel.*;
[ "java.awt", "javax.swing", "net.sf.jailer" ]
java.awt; javax.swing; net.sf.jailer;
1,627,619
private boolean isHCS(List<ImportContainer> containers) { if (containers == null || containers.size() == 0) return false; int count = 0; Iterator<ImportContainer> i = containers.iterator(); ImportContainer ic; while (i.hasNext()) { ic = i.next(); if (ic.getIsSPW()) count++; } return count == containers.size(); }
boolean function(List<ImportContainer> containers) { if (containers == null containers.size() == 0) return false; int count = 0; Iterator<ImportContainer> i = containers.iterator(); ImportContainer ic; while (i.hasNext()) { ic = i.next(); if (ic.getIsSPW()) count++; } return count == containers.size(); }
/** * Returns <code>true</code> if the containers are <code>HCS</code> * containers, <code>false</code> otherwise. * * @param containers The collection to handle. * @return See above. */
Returns <code>true</code> if the containers are <code>HCS</code> containers, <code>false</code> otherwise
isHCS
{ "repo_name": "hflynn/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java", "license": "gpl-2.0", "size": 61419 }
[ "java.util.Iterator", "java.util.List" ]
import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,994,418
protected String createSubmitFaxCommand(FaxJob faxJob) { // init buffer StringBuilder buffer = new StringBuilder(); // create command buffer.append(this.submitCommand); buffer.append(" "); buffer.append(this.printQueueParameter); buffer.append(" "); buffer.append(this.printQueueName); buffer.append(" "); buffer.append(this.generalParameters); buffer.append(" "); buffer.append(this.phoneParameter); buffer.append("="); buffer.append(faxJob.getTargetAddress()); String targetName = faxJob.getTargetName(); if (targetName != null && targetName.length() > 0) { buffer.append(" "); buffer.append(this.faxToParameter); buffer.append("=\""); targetName = SpiUtil.urlEncode(targetName); buffer.append(targetName); buffer.append("\""); } buffer.append(" \""); buffer.append(faxJob.getFilePath()); buffer.append("\""); // get command String command = buffer.toString(); return command; }
String function(FaxJob faxJob) { StringBuilder buffer = new StringBuilder(); buffer.append(this.submitCommand); buffer.append(" "); buffer.append(this.printQueueParameter); buffer.append(" "); buffer.append(this.printQueueName); buffer.append(" "); buffer.append(this.generalParameters); buffer.append(" "); buffer.append(this.phoneParameter); buffer.append("="); buffer.append(faxJob.getTargetAddress()); String targetName = faxJob.getTargetName(); if (targetName != null && targetName.length() > 0) { buffer.append(" "); buffer.append(this.faxToParameter); buffer.append("=\"STR\STR \STR\""); String command = buffer.toString(); return command; }
/** * Creates and returns the submit fax command. * * @param faxJob * The fax job object containing the needed information * @return The command */
Creates and returns the submit fax command
createSubmitFaxCommand
{ "repo_name": "sagiegurari/fax4j", "path": "src/main/java/org/fax4j/spi/mac/MacFaxClientSpi.java", "license": "apache-2.0", "size": 10684 }
[ "org.fax4j.FaxJob" ]
import org.fax4j.FaxJob;
import org.fax4j.*;
[ "org.fax4j" ]
org.fax4j;
2,536,663
default void reconcile(RegisteredService service) { }
default void reconcile(RegisteredService service) { }
/** * Reconcile the service definition. * Usual operations involve translating scopes * to attribute release policies if needed. * The operation is expected to persist service changes. * * @param service the service */
Reconcile the service definition. Usual operations involve translating scopes to attribute release policies if needed. The operation is expected to persist service changes
reconcile
{ "repo_name": "dodok1/cas", "path": "support/cas-server-support-oauth/src/main/java/org/apereo/cas/support/oauth/profile/OAuth20ProfileScopeToAttributesFilter.java", "license": "apache-2.0", "size": 1375 }
[ "org.apereo.cas.services.RegisteredService" ]
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.*;
[ "org.apereo.cas" ]
org.apereo.cas;
595,995
@Test public void lenientPackageResourceMatching() throws Exception { ResourceReference invalidResource = new PackageResourceReference(PackageResourceTest.class, "i_do_not_exist.txt", Locale.ENGLISH, null, null); assertNotNull( "resource i_do_not_exist.txt SHOULD be available as a packaged resource even if it doesn't exist", invalidResource.getResource()); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en.txt", null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", null, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", Locale.US, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", Locale.CANADA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", Locale.CHINA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_foo_bar_en.txt", null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_foo_bar_en_US.txt", null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_foo_bar_en_US_MAC.txt", null, null, null)); tester.getRequest().setUrl(tester.getRequestCycle().mapUrlFor(invalidResource, null)); // since the resource does not exist wicket should let the handling fall through to the next // filter/servlet which will cause a 404 later assertFalse(tester.processRequest()); }
void function() throws Exception { ResourceReference invalidResource = new PackageResourceReference(PackageResourceTest.class, STR, Locale.ENGLISH, null, null); assertNotNull( STR, invalidResource.getResource()); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, Locale.CHINA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, Locale.CHINA, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, "foo", null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, Locale.US, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, Locale.CANADA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, Locale.CHINA, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); assertTrue(PackageResource.exists(PackageResourceTest.class, STR, null, null, null)); tester.getRequest().setUrl(tester.getRequestCycle().mapUrlFor(invalidResource, null)); assertFalse(tester.processRequest()); }
/** * Test lenient matching * * @throws Exception */
Test lenient matching
lenientPackageResourceMatching
{ "repo_name": "mafulafunk/wicket", "path": "wicket-core/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java", "license": "apache-2.0", "size": 7303 }
[ "java.util.Locale", "org.apache.wicket.request.resource.PackageResource", "org.apache.wicket.request.resource.PackageResourceReference", "org.apache.wicket.request.resource.ResourceReference" ]
import java.util.Locale; import org.apache.wicket.request.resource.PackageResource; import org.apache.wicket.request.resource.PackageResourceReference; import org.apache.wicket.request.resource.ResourceReference;
import java.util.*; import org.apache.wicket.request.resource.*;
[ "java.util", "org.apache.wicket" ]
java.util; org.apache.wicket;
1,855,874
@Override public void afterPropertiesSet() throws Exception { if (stringToDateFormats == null) { stringToDateFormats = loadAndValidateFormats(CoreConstants.STRING_TO_DATE_FORMATS, STRING_TO_DATE_FORMATS); } if (stringToTimeFormats == null) { stringToTimeFormats = loadAndValidateFormats(CoreConstants.STRING_TO_TIME_FORMATS, STRING_TO_TIME_FORMATS); } if (stringToTimestampFormats == null) { stringToTimestampFormats = loadAndValidateFormats(CoreConstants.STRING_TO_TIMESTAMP_FORMATS, STRING_TO_TIMESTAMP_FORMATS); } if (dateToStringFormatForUserInterface == null) { dateToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.DATE_TO_STRING_FORMAT_FOR_USER_INTERFACE, DATE_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (timeToStringFormatForUserInterface == null) { timeToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.TIME_TO_STRING_FORMAT_FOR_USER_INTERFACE, TIME_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (timestampToStringFormatForUserInterface == null) { timestampToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.TIMESTAMP_TO_STRING_FORMAT_FOR_USER_INTERFACE, TIMESTAMP_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (dateToStringFormatForFileName == null) { dateToStringFormatForFileName = loadAndValidateFormat(CoreConstants.DATE_TO_STRING_FORMAT_FOR_FILE_NAME, DATE_TO_STRING_FORMAT_FOR_FILE_NAME); } if (timestampToStringFormatForFileName == null) { timestampToStringFormatForFileName = loadAndValidateFormat(CoreConstants.TIMESTAMP_TO_STRING_FORMAT_FOR_FILE_NAME, TIMESTAMP_TO_STRING_FORMAT_FOR_FILE_NAME); } }
void function() throws Exception { if (stringToDateFormats == null) { stringToDateFormats = loadAndValidateFormats(CoreConstants.STRING_TO_DATE_FORMATS, STRING_TO_DATE_FORMATS); } if (stringToTimeFormats == null) { stringToTimeFormats = loadAndValidateFormats(CoreConstants.STRING_TO_TIME_FORMATS, STRING_TO_TIME_FORMATS); } if (stringToTimestampFormats == null) { stringToTimestampFormats = loadAndValidateFormats(CoreConstants.STRING_TO_TIMESTAMP_FORMATS, STRING_TO_TIMESTAMP_FORMATS); } if (dateToStringFormatForUserInterface == null) { dateToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.DATE_TO_STRING_FORMAT_FOR_USER_INTERFACE, DATE_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (timeToStringFormatForUserInterface == null) { timeToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.TIME_TO_STRING_FORMAT_FOR_USER_INTERFACE, TIME_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (timestampToStringFormatForUserInterface == null) { timestampToStringFormatForUserInterface = loadAndValidateFormat(CoreConstants.TIMESTAMP_TO_STRING_FORMAT_FOR_USER_INTERFACE, TIMESTAMP_TO_STRING_FORMAT_FOR_USER_INTERFACE); } if (dateToStringFormatForFileName == null) { dateToStringFormatForFileName = loadAndValidateFormat(CoreConstants.DATE_TO_STRING_FORMAT_FOR_FILE_NAME, DATE_TO_STRING_FORMAT_FOR_FILE_NAME); } if (timestampToStringFormatForFileName == null) { timestampToStringFormatForFileName = loadAndValidateFormat(CoreConstants.TIMESTAMP_TO_STRING_FORMAT_FOR_FILE_NAME, TIMESTAMP_TO_STRING_FORMAT_FOR_FILE_NAME); } }
/** * This overridden method ... * * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */
This overridden method ..
afterPropertiesSet
{ "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "path": "rice-middleware/core/impl/src/main/java/org/kuali/rice/core/impl/datetime/DateTimeServiceImpl.java", "license": "apache-2.0", "size": 15924 }
[ "org.kuali.rice.core.api.CoreConstants" ]
import org.kuali.rice.core.api.CoreConstants;
import org.kuali.rice.core.api.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,516,871
public static <T> IModel<T> transientModel(T value) { return new TransientModel<>(value); } private static class TransientModel<T> extends AbstractReadOnlyModel<T> { private static final long serialVersionUID = -2160512073899616819L; private final T value; public TransientModel(T value) { super(); this.value = value; }
static <T> IModel<T> function(T value) { return new TransientModel<>(value); } private static class TransientModel<T> extends AbstractReadOnlyModel<T> { private static final long serialVersionUID = -2160512073899616819L; private final T value; public TransientModel(T value) { super(); this.value = value; }
/** * A constant, non-serializable model. * <p>Useful when calling */
A constant, non-serializable model. Useful when calling
transientModel
{ "repo_name": "openwide-java/owsi-core-parent", "path": "owsi-core/owsi-core-components/owsi-core-component-wicket-more/src/main/java/fr/openwide/core/wicket/more/util/model/Models.java", "license": "apache-2.0", "size": 9067 }
[ "org.apache.wicket.model.AbstractReadOnlyModel", "org.apache.wicket.model.IModel" ]
import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.*;
[ "org.apache.wicket" ]
org.apache.wicket;
2,141,205
static boolean needUpdateCDBRequest(Context context) { SharedPreferences preferences = HelperFunctions.getWebTrekkSharedPreference(context); if (preferences.contains(LAST_CBD_REQUEST_DATE)) { long dates = preferences.getLong(LAST_CBD_REQUEST_DATE, 0); return dates < getCurrentDateCounter(); }else return false; }
static boolean needUpdateCDBRequest(Context context) { SharedPreferences preferences = HelperFunctions.getWebTrekkSharedPreference(context); if (preferences.contains(LAST_CBD_REQUEST_DATE)) { long dates = preferences.getLong(LAST_CBD_REQUEST_DATE, 0); return dates < getCurrentDateCounter(); }else return false; }
/** * define if CDB request need repeat * @param context * @return */
define if CDB request need repeat
needUpdateCDBRequest
{ "repo_name": "Webtrekk/webtrekk-android-sdk", "path": "webtrekk_sdk/src/main/java/com/webtrekk/webtrekksdk/WebtrekkUserParameters.java", "license": "mit", "size": 13994 }
[ "android.content.Context", "android.content.SharedPreferences", "com.webtrekk.webtrekksdk.Utils" ]
import android.content.Context; import android.content.SharedPreferences; import com.webtrekk.webtrekksdk.Utils;
import android.content.*; import com.webtrekk.webtrekksdk.*;
[ "android.content", "com.webtrekk.webtrekksdk" ]
android.content; com.webtrekk.webtrekksdk;
815,878
private void gatewayImport() { File fakeImage = null; try { fakeImage = File.createTempFile("gateway_image", ".fake"); ImportCallback cb = new ImportCallback(); TransferFacility tf = gateway.getFacility(TransferFacility.class); // the uploadImage method will automatically create a dataset with // the same name as the directory, the image file is located in tf.uploadImage(ctx, fakeImage, cb); // wait for the upload to finish while (!cb.isFinished()) { try { Thread.sleep(250); } catch (InterruptedException e) { } } } catch (Exception e) { e.printStackTrace(); } finally { if (fakeImage != null) fakeImage.delete(); } }
void function() { File fakeImage = null; try { fakeImage = File.createTempFile(STR, ".fake"); ImportCallback cb = new ImportCallback(); TransferFacility tf = gateway.getFacility(TransferFacility.class); tf.uploadImage(ctx, fakeImage, cb); while (!cb.isFinished()) { try { Thread.sleep(250); } catch (InterruptedException e) { } } } catch (Exception e) { e.printStackTrace(); } finally { if (fakeImage != null) fakeImage.delete(); } }
/** * Import an image file via the Gateway (recommended) */
Import an image file via the Gateway (recommended)
gatewayImport
{ "repo_name": "joansmith/openmicroscopy", "path": "examples/Training/java/src/training/ImportImage.java", "license": "gpl-2.0", "size": 6878 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,017,153
public ArrayList<RenderLine> getRenderLines() { return renderLines; }
ArrayList<RenderLine> function() { return renderLines; }
/** * gets the list of render lines * @return the list of render lines */
gets the list of render lines
getRenderLines
{ "repo_name": "thecreamedcorn/city-scape", "path": "src/Model/MVCModel.java", "license": "gpl-3.0", "size": 6246 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,550,326
public Offset offset() { Element e = get(0); return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(), e.getAbsoluteTop()); }
Offset function() { Element e = get(0); return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(), e.getAbsoluteTop()); }
/** * Get the current offset of the first matched element, in pixels, relative to the document. The * returned object contains two integer properties, top and left. The method works only with * visible elements. */
Get the current offset of the first matched element, in pixels, relative to the document. The returned object contains two integer properties, top and left. The method works only with visible elements
offset
{ "repo_name": "stori-es/stori_es", "path": "dashboard/src/main/java/com/google/gwt/query/client/GQuery.java", "license": "apache-2.0", "size": 177285 }
[ "com.google.gwt.dom.client.Element" ]
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,364,323
public int compareLowerToUpperBound( byte[] b, int o, int l, boolean isInclusive, BytesComparator comparator) { if (lowerUnbound() || b == KeyRange.UNBOUND) { return -1; } int cmp = comparator.compare(lowerRange, 0, lowerRange.length, b, o, l); if (cmp > 0) { return 1; } if (cmp < 0) { return -1; } if (lowerInclusive && isInclusive) { return 0; } return 1; }
int function( byte[] b, int o, int l, boolean isInclusive, BytesComparator comparator) { if (lowerUnbound() b == KeyRange.UNBOUND) { return -1; } int cmp = comparator.compare(lowerRange, 0, lowerRange.length, b, o, l); if (cmp > 0) { return 1; } if (cmp < 0) { return -1; } if (lowerInclusive && isInclusive) { return 0; } return 1; }
/** * Compares a lower bound against an upper bound * @param b upper bound byte array * @param o upper bound offset * @param l upper bound length * @param isInclusive upper bound inclusive * @param comparator comparator used to do compare the byte array using offset and length * @return -1 if the lower bound is less than the upper bound, * 1 if the lower bound is greater than the upper bound, * and 0 if they are equal. */
Compares a lower bound against an upper bound
compareLowerToUpperBound
{ "repo_name": "apache/phoenix", "path": "phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java", "license": "apache-2.0", "size": 27149 }
[ "org.apache.phoenix.util.ScanUtil" ]
import org.apache.phoenix.util.ScanUtil;
import org.apache.phoenix.util.*;
[ "org.apache.phoenix" ]
org.apache.phoenix;
674,512
protected void managedConnectionReconnected(ConnectionListener cl) throws ResourceException { //Nothing as default }
void function(ConnectionListener cl) throws ResourceException { }
/** * For polymorphism. * <p> * * Do not invoke directly, use reconnectManagedConnection * which does the relevent exception handling * @param cl connection listener * @throws ResourceException for exception */
For polymorphism. Do not invoke directly, use reconnectManagedConnection which does the relevent exception handling
managedConnectionReconnected
{ "repo_name": "ironjacamar/ironjacamar", "path": "core/impl/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java", "license": "lgpl-2.1", "size": 30747 }
[ "javax.resource.ResourceException", "org.jboss.jca.core.connectionmanager.listener.ConnectionListener" ]
import javax.resource.ResourceException; import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
import javax.resource.*; import org.jboss.jca.core.connectionmanager.listener.*;
[ "javax.resource", "org.jboss.jca" ]
javax.resource; org.jboss.jca;
2,427,915
public RESTAPIConfigData getRestAPIConfigData() { RESTAPIConfigData restAPIConfigData = new RESTAPIConfigData(); // First set it to defaults, but do not persist restAPIConfigData.setUrl(EMPTY_STRING); restAPIConfigData.setPassword(EMPTY_STRING); restAPIConfigData.setUserName(EMPTY_STRING); // then load it from registry try { String restApiURL = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_URL); String restApiUsername = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_USER_NAME); String restApiPassword = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_PASSWORD); if (restApiURL != null && restApiUsername != null && restApiPassword != null) { restAPIConfigData.setUrl(restApiURL); restAPIConfigData.setUserName(restApiUsername); restAPIConfigData.setPassword(restApiPassword); } else { // Registry does not have rest api config. Set to defaults. update(restAPIConfigData); } } catch (Exception ignored) { // If something went wrong, then we have the default, or whatever loaded so far } return restAPIConfigData; }
RESTAPIConfigData function() { RESTAPIConfigData restAPIConfigData = new RESTAPIConfigData(); restAPIConfigData.setUrl(EMPTY_STRING); restAPIConfigData.setPassword(EMPTY_STRING); restAPIConfigData.setUserName(EMPTY_STRING); try { String restApiURL = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_URL); String restApiUsername = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_USER_NAME); String restApiPassword = getConfigurationProperty(CommonConstants.SERVICE_COMMON_REG_PATH, CommonConstants.REST_API_PASSWORD); if (restApiURL != null && restApiUsername != null && restApiPassword != null) { restAPIConfigData.setUrl(restApiURL); restAPIConfigData.setUserName(restApiUsername); restAPIConfigData.setPassword(restApiPassword); } else { update(restAPIConfigData); } } catch (Exception ignored) { } return restAPIConfigData; }
/** * Get the rest api config data * * @return RESTAPIConfigData containing the rest api config data */
Get the rest api config data
getRestAPIConfigData
{ "repo_name": "callkalpa/carbon-deployment", "path": "components/service-mgt/bam-data-agents/org.wso2.carbon.bam.service.data.publisher/src/main/java/org/wso2/carbon/bam/service/data/publisher/conf/RegistryPersistenceManager.java", "license": "apache-2.0", "size": 21144 }
[ "org.wso2.carbon.bam.service.data.publisher.util.CommonConstants" ]
import org.wso2.carbon.bam.service.data.publisher.util.CommonConstants;
import org.wso2.carbon.bam.service.data.publisher.util.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,236,751
@Reference( name = "jwt.transformer.service", service = JWTTransformer.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeJWTTransformer") protected void addJWTTransformer(JWTTransformer jwtTransformer) { ServiceReferenceHolder.getInstance().addJWTTransformer(jwtTransformer.getIssuer(), jwtTransformer); }
@Reference( name = STR, service = JWTTransformer.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = STR) void function(JWTTransformer jwtTransformer) { ServiceReferenceHolder.getInstance().addJWTTransformer(jwtTransformer.getIssuer(), jwtTransformer); }
/** * Initialize the JWTTransformer Server configuration Service Service dependency * * @param jwtTransformer {@link JWTTransformer} service reference. */
Initialize the JWTTransformer Server configuration Service Service dependency
addJWTTransformer
{ "repo_name": "chamindias/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java", "license": "apache-2.0", "size": 54004 }
[ "org.osgi.service.component.annotations.Reference", "org.osgi.service.component.annotations.ReferenceCardinality", "org.osgi.service.component.annotations.ReferencePolicy", "org.wso2.carbon.apimgt.common.gateway.jwttransformer.JWTTransformer" ]
import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.apimgt.common.gateway.jwttransformer.JWTTransformer;
import org.osgi.service.component.annotations.*; import org.wso2.carbon.apimgt.common.gateway.jwttransformer.*;
[ "org.osgi.service", "org.wso2.carbon" ]
org.osgi.service; org.wso2.carbon;
1,722,671
public void testDistributive() { a = ring.random(kl, ll, el, q); b = ring.random(kl, ll, el, q); c = ring.random(kl, ll, el, q); d = a.multiply((QuotSolvablePolynomial<BigRational>) b.sum(c)); e = (QuotSolvablePolynomial<BigRational>) a.multiply(b).sum(a.multiply(c)); assertEquals("a*(b+c) = a*b+a*c", d, e); }
void function() { a = ring.random(kl, ll, el, q); b = ring.random(kl, ll, el, q); c = ring.random(kl, ll, el, q); d = a.multiply((QuotSolvablePolynomial<BigRational>) b.sum(c)); e = (QuotSolvablePolynomial<BigRational>) a.multiply(b).sum(a.multiply(c)); assertEquals(STR, d, e); }
/** * Test distributive law. */
Test distributive law
testDistributive
{ "repo_name": "breandan/java-algebra-system", "path": "trc/edu/jas/gbmod/QuotSolvablePolynomialTest.java", "license": "gpl-2.0", "size": 21307 }
[ "edu.jas.arith.BigRational" ]
import edu.jas.arith.BigRational;
import edu.jas.arith.*;
[ "edu.jas.arith" ]
edu.jas.arith;
576,223
public Collection getVisited() { return visited; }
Collection function() { return visited; }
/** * Return collection of visitables visited so far. */
Return collection of visitables visited so far
getVisited
{ "repo_name": "cwi-swat/jjtraveler", "path": "src/jjtraveler/graph/NotVisited.java", "license": "bsd-3-clause", "size": 1000 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,697,319
private TextStyle compose(TextStyle[] styles, boolean negate) { checkNotNull(styles, "styles"); if (styles.length == 0) { return this; } else if (this.isEmpty() && styles.length == 1) { TextStyle style = checkNotNull(styles[0], "style"); return negate ? style.negate() : style; } Optional<Boolean> boldAcc = this.bold; Optional<Boolean> italicAcc = this.italic; Optional<Boolean> underlineAcc = this.underline; Optional<Boolean> strikethroughAcc = this.strikethrough; Optional<Boolean> obfuscatedAcc = this.obfuscated; if (negate) { for (TextStyle style : styles) { checkNotNull(style, "style"); boldAcc = propCompose(boldAcc, propNegate(style.bold)); italicAcc = propCompose(italicAcc, propNegate(style.italic)); underlineAcc = propCompose(underlineAcc, propNegate(style.underline)); strikethroughAcc = propCompose(strikethroughAcc, propNegate(style.strikethrough)); obfuscatedAcc = propCompose(obfuscatedAcc, propNegate(style.obfuscated)); } } else { for (TextStyle style : styles) { checkNotNull(style, "style"); boldAcc = propCompose(boldAcc, style.bold); italicAcc = propCompose(italicAcc, style.italic); underlineAcc = propCompose(underlineAcc, style.underline); strikethroughAcc = propCompose(strikethroughAcc, style.strikethrough); obfuscatedAcc = propCompose(obfuscatedAcc, style.obfuscated); } } return new TextStyle( boldAcc, italicAcc, underlineAcc, strikethroughAcc, obfuscatedAcc ); }
TextStyle function(TextStyle[] styles, boolean negate) { checkNotNull(styles, STR); if (styles.length == 0) { return this; } else if (this.isEmpty() && styles.length == 1) { TextStyle style = checkNotNull(styles[0], "style"); return negate ? style.negate() : style; } Optional<Boolean> boldAcc = this.bold; Optional<Boolean> italicAcc = this.italic; Optional<Boolean> underlineAcc = this.underline; Optional<Boolean> strikethroughAcc = this.strikethrough; Optional<Boolean> obfuscatedAcc = this.obfuscated; if (negate) { for (TextStyle style : styles) { checkNotNull(style, "style"); boldAcc = propCompose(boldAcc, propNegate(style.bold)); italicAcc = propCompose(italicAcc, propNegate(style.italic)); underlineAcc = propCompose(underlineAcc, propNegate(style.underline)); strikethroughAcc = propCompose(strikethroughAcc, propNegate(style.strikethrough)); obfuscatedAcc = propCompose(obfuscatedAcc, propNegate(style.obfuscated)); } } else { for (TextStyle style : styles) { checkNotNull(style, "style"); boldAcc = propCompose(boldAcc, style.bold); italicAcc = propCompose(italicAcc, style.italic); underlineAcc = propCompose(underlineAcc, style.underline); strikethroughAcc = propCompose(strikethroughAcc, style.strikethrough); obfuscatedAcc = propCompose(obfuscatedAcc, style.obfuscated); } } return new TextStyle( boldAcc, italicAcc, underlineAcc, strikethroughAcc, obfuscatedAcc ); }
/** * Utility method to compose the current TextStyle with the given styles, * with optional negation. * * @param styles The styles to compose with * @param negate Whether or not to negate the passed-in styles * @return The composed style */
Utility method to compose the current TextStyle with the given styles, with optional negation
compose
{ "repo_name": "nailed/nailed-api", "path": "src/main/java/jk_5/nailed/api/text/format/TextStyle.java", "license": "mit", "size": 17324 }
[ "com.google.common.base.Optional", "com.google.common.base.Preconditions" ]
import com.google.common.base.Optional; import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
312,906
boolean hasNext() throws IOException;
boolean hasNext() throws IOException;
/** * Returns <tt>true</tt> if the iteration has more elements. * * @return <tt>true</tt> if the iterator has more elements. * @throws IOException * if any IO error occurs */
Returns true if the iteration has more elements
hasNext
{ "repo_name": "dongpf/hadoop-0.19.1", "path": "src/core/org/apache/hadoop/fs/RemoteIterator.java", "license": "apache-2.0", "size": 1611 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,734,786
EClass getI1Implementation();
EClass getI1Implementation();
/** * Returns the meta object for class '{@link org.dresdenocl.modelinstancetype.test.testmodel.I1Implementation <em>I1 Implementation</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>I1 Implementation</em>'. * @see org.dresdenocl.modelinstancetype.test.testmodel.I1Implementation * @generated */
Returns the meta object for class '<code>org.dresdenocl.modelinstancetype.test.testmodel.I1Implementation I1 Implementation</code>'.
getI1Implementation
{ "repo_name": "dresden-ocl/dresdenocl", "path": "tests/org.dresdenocl.modelinstancetype.ecore.testmodel/src/org/dresdenocl/modelinstancetype/test/testmodel/TestmodelPackage.java", "license": "lgpl-3.0", "size": 89535 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,920,849
private InternalMedia getInternalMediaById(String mediaId) { Media media = getMediaService().getMedia(new MediaPK(mediaId, getComponentId())); if (media instanceof InternalMedia) { return (InternalMedia) media; } throw new WebApplicationException(Response.Status.NOT_FOUND); }
InternalMedia function(String mediaId) { Media media = getMediaService().getMedia(new MediaPK(mediaId, getComponentId())); if (media instanceof InternalMedia) { return (InternalMedia) media; } throw new WebApplicationException(Response.Status.NOT_FOUND); }
/** * Gets a, internal media from the specified identifier. * @param mediaId * @return the instance of the media behinf the specified identifier, null if it does not exist. */
Gets a, internal media from the specified identifier
getInternalMediaById
{ "repo_name": "auroreallibe/Silverpeas-Components", "path": "gallery/gallery-war/src/main/java/org/silverpeas/components/gallery/control/GallerySessionController.java", "license": "agpl-3.0", "size": 49785 }
[ "javax.ws.rs.WebApplicationException", "javax.ws.rs.core.Response", "org.silverpeas.components.gallery.model.InternalMedia", "org.silverpeas.components.gallery.model.Media", "org.silverpeas.components.gallery.model.MediaPK" ]
import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import org.silverpeas.components.gallery.model.InternalMedia; import org.silverpeas.components.gallery.model.Media; import org.silverpeas.components.gallery.model.MediaPK;
import javax.ws.rs.*; import javax.ws.rs.core.*; import org.silverpeas.components.gallery.model.*;
[ "javax.ws", "org.silverpeas.components" ]
javax.ws; org.silverpeas.components;
535,147
public JavaMailBuilder charset(CharsetDetector charsetDetector) { this.charsetDetector = charsetDetector; return this; }
JavaMailBuilder function(CharsetDetector charsetDetector) { this.charsetDetector = charsetDetector; return this; }
/** * Defines a custom detector that will indicate which charset corresponds * for a particular string. * * This value preempts any other value defined by calling * {@link #charset(Charset)} method. * * If this method is called several times, only the last provider is used. * * @param charsetDetector * the provider used to detect charset of a string * @return this instance for fluent chaining */
Defines a custom detector that will indicate which charset corresponds for a particular string. This value preempts any other value defined by calling <code>#charset(Charset)</code> method. If this method is called several times, only the last provider is used
charset
{ "repo_name": "groupe-sii/ogham", "path": "ogham-email-javamail/src/main/java/fr/sii/ogham/email/builder/javamail/JavaMailBuilder.java", "license": "apache-2.0", "size": 25568 }
[ "fr.sii.ogham.core.charset.CharsetDetector" ]
import fr.sii.ogham.core.charset.CharsetDetector;
import fr.sii.ogham.core.charset.*;
[ "fr.sii.ogham" ]
fr.sii.ogham;
1,593,148
return indexSearch; } public LuceneSearchEngine(String fileName) { try { RAMDirectory ram = new RAMDirectory(FSDirectory.open(new File(fileName))); indexSearch = new IndexSearcher(ram); analyzer = new KeywordAnalyzer(); } catch (IOException e) { e.printStackTrace(); } } public LuceneSearchEngine(RAMDirectory ram) { try { indexSearch = new IndexSearcher(ram); analyzer = new KeywordAnalyzer(); } catch (IOException e) { e.printStackTrace(); } }
return indexSearch; } public LuceneSearchEngine(String fileName) { try { RAMDirectory ram = new RAMDirectory(FSDirectory.open(new File(fileName))); indexSearch = new IndexSearcher(ram); analyzer = new KeywordAnalyzer(); } catch (IOException e) { e.printStackTrace(); } } public LuceneSearchEngine(RAMDirectory ram) { try { indexSearch = new IndexSearcher(ram); analyzer = new KeywordAnalyzer(); } catch (IOException e) { e.printStackTrace(); } }
/** * returns the indexSearcher so we can use IndexSearcher.doc(int) to get a * doc * @return IndexSearcher */
returns the indexSearcher so we can use IndexSearcher.doc(int) to get a doc
getIndexSearch
{ "repo_name": "JoeCarlson/intermine", "path": "intermine/web/main/src/org/intermine/web/autocompletion/LuceneSearchEngine.java", "license": "lgpl-2.1", "size": 6400 }
[ "java.io.File", "java.io.IOException", "org.apache.lucene.analysis.KeywordAnalyzer", "org.apache.lucene.search.IndexSearcher", "org.apache.lucene.store.FSDirectory", "org.apache.lucene.store.RAMDirectory" ]
import java.io.File; import java.io.IOException; import org.apache.lucene.analysis.KeywordAnalyzer; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.RAMDirectory;
import java.io.*; import org.apache.lucene.analysis.*; import org.apache.lucene.search.*; import org.apache.lucene.store.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
2,403,711
protected void processMessage(ActionMessages msgs, String methodName, long successCount, long failureCount) { addToMessage(msgs, methodName, true, successCount); addToMessage(msgs, methodName, false, failureCount); }
void function(ActionMessages msgs, String methodName, long successCount, long failureCount) { addToMessage(msgs, methodName, true, successCount); addToMessage(msgs, methodName, false, failureCount); }
/** * This basically adds all the action messages * that will be used for validation errors * or status messages * @param msgs container of the messages * @param methodName name of the caller method which is used as a key * @param successCount the number of successful actions * @param failureCount the number of failures. */
This basically adds all the action messages that will be used for validation errors or status messages
processMessage
{ "repo_name": "colloquium/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/action/common/BaseSetOperateOnSelectedItemsAction.java", "license": "gpl-2.0", "size": 10399 }
[ "org.apache.struts.action.ActionMessages" ]
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.*;
[ "org.apache.struts" ]
org.apache.struts;
2,202,798
public void fixAlert(AuthzSubject subject, EscalationAlertType escalationAlertType, Integer alertId, String moreInfo) throws PermissionException { fixAlert(subject, escalationAlertType, alertId, moreInfo, false); }
void function(AuthzSubject subject, EscalationAlertType escalationAlertType, Integer alertId, String moreInfo) throws PermissionException { fixAlert(subject, escalationAlertType, alertId, moreInfo, false); }
/** * Fix an alert, potentially sending out notifications. The state of the * escalation will be terminated and the alert will be marked fixed. * * @param subject Person who fixed the alert */
Fix an alert, potentially sending out notifications. The state of the escalation will be terminated and the alert will be marked fixed
fixAlert
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/escalation/server/session/EscalationManagerImpl.java", "license": "unlicense", "size": 31648 }
[ "org.hyperic.hq.authz.server.session.AuthzSubject", "org.hyperic.hq.authz.shared.PermissionException" ]
import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException;
import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*;
[ "org.hyperic.hq" ]
org.hyperic.hq;
1,339,374
return mock(null, klass, loggerName); } /** * Mocks non static {@link Logger} fields for the given instance. * * <p></p> * <b>Example:</b> * <p></p> * <pre> * final class ClassWithNonStaticLogger * { * private final Logger logger = LoggerFactory.getLogger(ClassWithNonStaticLogger.class); * }
return mock(null, klass, loggerName); } /** * Mocks non static {@link Logger} fields for the given instance. * * <p></p> * <b>Example:</b> * <p></p> * <pre> * final class ClassWithNonStaticLogger * { * private final Logger logger = LoggerFactory.getLogger(ClassWithNonStaticLogger.class); * }
/** * Mocks static {@link Logger} fields declared for the given class. * 'final' and 'static' fields can be mocked, too. * * <p></p> * <b>Example:</b> * <p></p> * <pre> * final class ClassWithStaticLogger * { * private static final Logger LOGGER = LoggerFactory.getLogger(ClassWithStaticLogger.class); * } * * .... * Logger mockedLogger = MockSlf4j.mockStatic(ClassWithStaticLogger.class, "LOGGER"); * </pre> * * @param klass * The class for which a static {@link Logger} fields has been declared. * @param loggerName * The static field name. * @return * The instance of the mock {@link Logger}. */
Mocks static <code>Logger</code> fields declared for the given class. 'final' and 'static' fields can be mocked, too. Example: <code> final class ClassWithStaticLogger { private static final Logger LOGGER = LoggerFactory.getLogger(ClassWithStaticLogger.class); } .... Logger mockedLogger = MockSlf4j.mockStatic(ClassWithStaticLogger.class, "LOGGER"); </code>
mockStatic
{ "repo_name": "answer-it/mock-slf4j", "path": "src/main/java/org/answerit/mock/slf4j/MockSlf4j.java", "license": "apache-2.0", "size": 4350 }
[ "org.slf4j.Logger", "org.slf4j.LoggerFactory" ]
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import org.slf4j.*;
[ "org.slf4j" ]
org.slf4j;
1,072,696
public void annotateSection(AnnotatedBytes out) { out.moveTo(sectionOffset); annotateSectionInner(out, itemCount); }
void function(AnnotatedBytes out) { out.moveTo(sectionOffset); annotateSectionInner(out, itemCount); }
/** * Write out annotations for this section * * @param out The AnnotatedBytes object to annotate to */
Write out annotations for this section
annotateSection
{ "repo_name": "droidefense/engine", "path": "mods/memapktool/src/main/java/org/jf/dexlib2/dexbacked/raw/SectionAnnotator.java", "license": "gpl-3.0", "size": 4114 }
[ "org.jf.dexlib2.util.AnnotatedBytes" ]
import org.jf.dexlib2.util.AnnotatedBytes;
import org.jf.dexlib2.util.*;
[ "org.jf.dexlib2" ]
org.jf.dexlib2;
773,733
public static <T> int detectIndex(Iterable<T> iterable, Predicate<? super T> predicate) { if (iterable instanceof ArrayList<?>) { return ArrayListIterate.detectIndex((ArrayList<T>) iterable, predicate); } else if (iterable instanceof List<?>) { return ListIterate.detectIndex((List<T>) iterable, predicate); } else if (iterable != null) { return IterableIterate.detectIndex(iterable, predicate); } throw new IllegalArgumentException("Cannot perform detectIndex on null"); }
static <T> int function(Iterable<T> iterable, Predicate<? super T> predicate) { if (iterable instanceof ArrayList<?>) { return ArrayListIterate.detectIndex((ArrayList<T>) iterable, predicate); } else if (iterable instanceof List<?>) { return ListIterate.detectIndex((List<T>) iterable, predicate); } else if (iterable != null) { return IterableIterate.detectIndex(iterable, predicate); } throw new IllegalArgumentException(STR); }
/** * Searches for the first occurrence where the predicate evaluates to true. */
Searches for the first occurrence where the predicate evaluates to true
detectIndex
{ "repo_name": "jlz27/gs-collections", "path": "collections/src/main/java/com/gs/collections/impl/utility/Iterate.java", "license": "apache-2.0", "size": 72978 }
[ "com.gs.collections.api.block.predicate.Predicate", "com.gs.collections.impl.utility.internal.IterableIterate", "java.util.ArrayList", "java.util.List" ]
import com.gs.collections.api.block.predicate.Predicate; import com.gs.collections.impl.utility.internal.IterableIterate; import java.util.ArrayList; import java.util.List;
import com.gs.collections.api.block.predicate.*; import com.gs.collections.impl.utility.internal.*; import java.util.*;
[ "com.gs.collections", "java.util" ]
com.gs.collections; java.util;
1,128,797
@ApiModelProperty( value = "Sum of the amounts of all statement lines where the source of the data was any other" + " category. This gives an indication on the certainty of correctness of the" + " data. Only positive transactions are included.") public Double getOtherPos() { return otherPos; }
@ApiModelProperty( value = STR + STR + STR) Double function() { return otherPos; }
/** * Sum of the amounts of all statement lines where the source of the data was any other category. * This gives an indication on the certainty of correctness of the data. Only positive * transactions are included. * * @return otherPos */
Sum of the amounts of all statement lines where the source of the data was any other category. This gives an indication on the certainty of correctness of the data. Only positive transactions are included
getOtherPos
{ "repo_name": "XeroAPI/Xero-Java", "path": "src/main/java/com/xero/models/finance/DataSourceResponse.java", "license": "mit", "size": 30465 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,491,361
@Override public Adapter adapt(Notifier notifier, Object type) { return super.adapt(notifier, this); }
Adapter function(Notifier notifier, Object type) { return super.adapt(notifier, this); }
/** * This implementation substitutes the factory itself as the key for the adapter. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implementation substitutes the factory itself as the key for the adapter.
adapt
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/citygml/transportation/provider/TransportationItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 12947 }
[ "org.eclipse.emf.common.notify.Adapter", "org.eclipse.emf.common.notify.Notifier" ]
import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,069,629
public void setCommander(final CommanderDTO selCommander) { CommanderStore.getInstance().addCommanderToCorp(thisCorp.getCorpId(), selCommander.getId(), false); }
void function(final CommanderDTO selCommander) { CommanderStore.getInstance().addCommanderToCorp(thisCorp.getCorpId(), selCommander.getId(), false); }
/** * Method that adds the selected commander to the corps * * @param selCommander */
Method that adds the selected commander to the corps
setCommander
{ "repo_name": "EaW1805/www", "path": "src/main/java/com/eaw1805/www/client/views/popups/menus/CorpsMenu.java", "license": "mit", "size": 8025 }
[ "com.eaw1805.data.dto.web.army.CommanderDTO", "com.eaw1805.www.shared.stores.units.CommanderStore" ]
import com.eaw1805.data.dto.web.army.CommanderDTO; import com.eaw1805.www.shared.stores.units.CommanderStore;
import com.eaw1805.data.dto.web.army.*; import com.eaw1805.www.shared.stores.units.*;
[ "com.eaw1805.data", "com.eaw1805.www" ]
com.eaw1805.data; com.eaw1805.www;
1,789,453
private void processVerbs(ProcessingEnvironment processingEnv, RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef, VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) { Elements elementUtils = processingEnv.getElementUtils(); if ("verbs".equals(fieldName) && supportOutputs(originalClassType)) { String kind = "element"; String name = elementRef.name(); if (isNullOrEmpty(name) || "##default".equals(name)) { name = fieldName; } name = prefix + name; TypeMirror fieldType = fieldElement.asType(); String fieldTypeName = fieldType.toString(); String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true); // gather oneOf which extends any of the output base classes Set<String> oneOfTypes = new TreeSet<String>(); // find all classes that has that superClassName Set<TypeElement> children = new LinkedHashSet<TypeElement>(); for (String superclass : ONE_OF_VERBS) { findTypeElementChildren(processingEnv, roundEnv, children, superclass); } for (TypeElement child : children) { XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class); if (rootElement != null) { String childName = rootElement.name(); if (childName != null) { oneOfTypes.add(childName); } } } EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", docComment, false, false, null, true, oneOfTypes, false); eipOptions.add(ep); } }
void function(ProcessingEnvironment processingEnv, RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef, VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) { Elements elementUtils = processingEnv.getElementUtils(); if ("verbs".equals(fieldName) && supportOutputs(originalClassType)) { String kind = STR; String name = elementRef.name(); if (isNullOrEmpty(name) STR.equals(name)) { name = fieldName; } name = prefix + name; TypeMirror fieldType = fieldElement.asType(); String fieldTypeName = fieldType.toString(); String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true); Set<String> oneOfTypes = new TreeSet<String>(); Set<TypeElement> children = new LinkedHashSet<TypeElement>(); for (String superclass : ONE_OF_VERBS) { findTypeElementChildren(processingEnv, roundEnv, children, superclass); } for (TypeElement child : children) { XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class); if (rootElement != null) { String childName = rootElement.name(); if (childName != null) { oneOfTypes.add(childName); } } } EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", docComment, false, false, null, true, oneOfTypes, false); eipOptions.add(ep); } }
/** * Special for processing an @XmlElementRef verbs field (rest-dsl) */
Special for processing an @XmlElementRef verbs field (rest-dsl)
processVerbs
{ "repo_name": "chirino/camel", "path": "tooling/apt/src/main/java/org/apache/camel/tools/apt/CoreEipAnnotationProcessor.java", "license": "apache-2.0", "size": 51318 }
[ "java.util.LinkedHashSet", "java.util.Set", "java.util.TreeSet", "javax.annotation.processing.ProcessingEnvironment", "javax.annotation.processing.RoundEnvironment", "javax.lang.model.element.TypeElement", "javax.lang.model.element.VariableElement", "javax.lang.model.type.TypeMirror", "javax.lang.mo...
import java.util.LinkedHashSet; import java.util.Set; import java.util.TreeSet; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; import org.apache.camel.tools.apt.AnnotationProcessorHelper;
import java.util.*; import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.type.*; import javax.lang.model.util.*; import javax.xml.bind.annotation.*; import org.apache.camel.tools.apt.*;
[ "java.util", "javax.annotation", "javax.lang", "javax.xml", "org.apache.camel" ]
java.util; javax.annotation; javax.lang; javax.xml; org.apache.camel;
2,706,255
int getFreeCapacity() throws IOException;
int getFreeCapacity() throws IOException;
/** * Get the total amount of free capacity available across all provisioners. * * @return Total amount of free capacity available across all provisioners * @throws IOException */
Get the total amount of free capacity available across all provisioners
getFreeCapacity
{ "repo_name": "caskdata/coopr", "path": "coopr-server/src/main/java/co/cask/coopr/store/provisioner/ProvisionerStore.java", "license": "apache-2.0", "size": 3318 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,676,476
public static //@formatter:off < In_ extends Serializable, Out_ extends Output, B_ extends Builder<In_, Out_> > //@formatter:on BuilderFactory<In_, Out_, B_> of(Class<? extends B_> builderClass, Class<In_> inputClass, InputParser<In_> parser) { return new ReflectionBuilderFactory<In_, Out_, B_>(builderClass, inputClass, parser); }
static < In_ extends Serializable, Out_ extends Output, B_ extends Builder<In_, Out_> > BuilderFactory<In_, Out_, B_> function(Class<? extends B_> builderClass, Class<In_> inputClass, InputParser<In_> parser) { return new ReflectionBuilderFactory<In_, Out_, B_>(builderClass, inputClass, parser); }
/** * Creates a BuilderFactory which creates a new builder by calling a unary * constructor of the builder class passing the input object. So builder B for * input In needs to define an accessible constructor B(In). The generated * builder factory implements proper serialization and equals checks. * * @param builderClass * the class of the builder to use * @param inputClass * the class of the input * @param parser * the input parser for the input * @return a builder factory for the both classes * @throws IllegalArgumentException * if the constructor is not found or not accessible */
Creates a BuilderFactory which creates a new builder by calling a unary constructor of the builder class passing the input object. So builder B for input In needs to define an accessible constructor B(In). The generated builder factory implements proper serialization and equals checks
of
{ "repo_name": "pluto-build/pluto", "path": "src/build/pluto/builder/factory/BuilderFactoryFactory.java", "license": "apache-2.0", "size": 2240 }
[ "build.pluto.builder.Builder", "build.pluto.executor.InputParser", "build.pluto.output.Output", "java.io.Serializable" ]
import build.pluto.builder.Builder; import build.pluto.executor.InputParser; import build.pluto.output.Output; import java.io.Serializable;
import build.pluto.builder.*; import build.pluto.executor.*; import build.pluto.output.*; import java.io.*;
[ "build.pluto.builder", "build.pluto.executor", "build.pluto.output", "java.io" ]
build.pluto.builder; build.pluto.executor; build.pluto.output; java.io;
1,293,275
public void removeServers(ServerGroup sg, Collection<Server> servers, User loggedInUser) { validateAccessCredentials(loggedInUser, sg, sg.getName()); validateAdminCredentials(loggedInUser); removeServers(sg, servers); }
void function(ServerGroup sg, Collection<Server> servers, User loggedInUser) { validateAccessCredentials(loggedInUser, sg, sg.getName()); validateAdminCredentials(loggedInUser); removeServers(sg, servers); }
/** * Dissociates a bunch of servers from a server group * @param sg the server group to process * @param servers a collection of servers to dissociate * @param loggedInUser the loggedInUser needed for credentials */
Dissociates a bunch of servers from a server group
removeServers
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/system/ServerGroupManager.java", "license": "gpl-2.0", "size": 17838 }
[ "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.domain.server.ServerGroup", "com.redhat.rhn.domain.user.User", "java.util.Collection" ]
import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.server.ServerGroup; import com.redhat.rhn.domain.user.User; import java.util.Collection;
import com.redhat.rhn.domain.server.*; import com.redhat.rhn.domain.user.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
2,372,855
public static void supportCORS(ServletResponse response) { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader("Access-Control-Allow-Origin", "*"); httpResponse.setHeader("Access-Control-Allow-Method", "GET, POST, OPTIONS"); httpResponse.setHeader("Access-Control-Allow-Headers", "Origin, accept, X-Requested-With, Content-Type, Authorization"); httpResponse.setContentType("text/json;charset=utf-8"); httpResponse.setCharacterEncoding("UTF-8"); }
static void function(ServletResponse response) { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader(STR, "*"); httpResponse.setHeader(STR, STR); httpResponse.setHeader(STR, STR); httpResponse.setContentType(STR); httpResponse.setCharacterEncoding("UTF-8"); }
/** * Response support CORS (Cross-Origin Resource Sharing). * @param response ServletResponse */
Response support CORS (Cross-Origin Resource Sharing)
supportCORS
{ "repo_name": "benson-git/ibole-infrastructure", "path": "infrastructure-web/src/main/java/com/github/ibole/infrastructure/web/spring/WsWebUtil.java", "license": "apache-2.0", "size": 3688 }
[ "javax.servlet.ServletResponse", "javax.servlet.http.HttpServletResponse" ]
import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.*; import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
75,252
private void registerSwiftModuleMergeAction( CompilationArtifacts compilationArtifacts, ObjcProvider objcProvider) { ImmutableList.Builder<Artifact> moduleFiles = new ImmutableList.Builder<>(); for (Artifact src : compilationArtifacts.getSrcs()) { if (ObjcRuleClasses.SWIFT_SOURCES.matches(src.getFilename())) { moduleFiles.add(intermediateArtifacts.swiftModuleFile(src)); } } CustomCommandLine.Builder commandLine = new CustomCommandLine.Builder() .add(SWIFT) .add("-frontend") .add("-emit-module") .add("-sdk").add(AppleToolchain.sdkDir()) .add("-target").add(swiftTarget(appleConfiguration)); if (objcConfiguration.generateDebugSymbols()) { commandLine.add("-g"); } commandLine .add("-module-name").add(getModuleName()) .add("-parse-as-library") .addExecPaths(moduleFiles.build()) .addExecPath("-o", intermediateArtifacts.swiftModule()) .addExecPath("-emit-objc-header-path", intermediateArtifacts.swiftHeader()) // The swift compiler will invoke clang itself when compiling module maps. This invocation // does not include the current working directory, causing cwd-relative imports to fail. // Including the current working directory to the header search paths ensures that these // relative imports will work. .add("-Xcc").add("-I."); // Using addExecPathBefore here adds unnecessary quotes around '-Xcc -I', which trips the // compiler. Using two add() calls generates a correctly formed command line. for (PathFragment directory : objcProvider.get(INCLUDE).toList()) { commandLine.add("-Xcc").add(String.format("-I%s", directory.toString())); } // Import the Objective-C module map. // TODO(bazel-team): Find a way to import the module map directly, instead of the parent // directory? if (objcConfiguration.moduleMapsEnabled()) { PathFragment moduleMapPath = intermediateArtifacts.moduleMap().getArtifact().getExecPath(); commandLine.add("-I").add(moduleMapPath.getParentDirectory().toString()); } commandLine.add(commonFrameworkFlags(objcProvider, appleConfiguration)); ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder( ruleContext, appleConfiguration.getIosCpuPlatform()) .setMnemonic("SwiftModuleMerge") .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(commandLine.build()) .addInputs(moduleFiles.build()) .addTransitiveInputs(objcProvider.get(HEADER)) .addTransitiveInputs(objcProvider.get(MODULE_MAP)) .addOutput(intermediateArtifacts.swiftModule()) .addOutput(intermediateArtifacts.swiftHeader()) .build(ruleContext)); }
void function( CompilationArtifacts compilationArtifacts, ObjcProvider objcProvider) { ImmutableList.Builder<Artifact> moduleFiles = new ImmutableList.Builder<>(); for (Artifact src : compilationArtifacts.getSrcs()) { if (ObjcRuleClasses.SWIFT_SOURCES.matches(src.getFilename())) { moduleFiles.add(intermediateArtifacts.swiftModuleFile(src)); } } CustomCommandLine.Builder commandLine = new CustomCommandLine.Builder() .add(SWIFT) .add(STR) .add(STR) .add("-sdk").add(AppleToolchain.sdkDir()) .add(STR).add(swiftTarget(appleConfiguration)); if (objcConfiguration.generateDebugSymbols()) { commandLine.add("-g"); } commandLine .add(STR).add(getModuleName()) .add(STR) .addExecPaths(moduleFiles.build()) .addExecPath("-o", intermediateArtifacts.swiftModule()) .addExecPath(STR, intermediateArtifacts.swiftHeader()) .add("-Xcc").add("-I."); for (PathFragment directory : objcProvider.get(INCLUDE).toList()) { commandLine.add("-Xcc").add(String.format("-I%s", directory.toString())); } if (objcConfiguration.moduleMapsEnabled()) { PathFragment moduleMapPath = intermediateArtifacts.moduleMap().getArtifact().getExecPath(); commandLine.add("-I").add(moduleMapPath.getParentDirectory().toString()); } commandLine.add(commonFrameworkFlags(objcProvider, appleConfiguration)); ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder( ruleContext, appleConfiguration.getIosCpuPlatform()) .setMnemonic(STR) .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(commandLine.build()) .addInputs(moduleFiles.build()) .addTransitiveInputs(objcProvider.get(HEADER)) .addTransitiveInputs(objcProvider.get(MODULE_MAP)) .addOutput(intermediateArtifacts.swiftModule()) .addOutput(intermediateArtifacts.swiftHeader()) .build(ruleContext)); }
/** * Merges multiple .partial_swiftmodule files together. Also produces a swift header that can be * used by Objective-C code. */
Merges multiple .partial_swiftmodule files together. Also produces a swift header that can be used by Objective-C code
registerSwiftModuleMergeAction
{ "repo_name": "whuwxl/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java", "license": "apache-2.0", "size": 63192 }
[ "com.google.common.collect.ImmutableList", "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.analysis.actions.CustomCommandLine", "com.google.devtools.build.lib.rules.apple.AppleToolchain", "com.google.devtools.build.lib.rules.objc.XcodeProvider", "com.google.devtools.build....
import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; import com.google.devtools.build.lib.rules.apple.AppleToolchain; import com.google.devtools.build.lib.rules.objc.XcodeProvider; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.actions.*; import com.google.devtools.build.lib.rules.apple.*; import com.google.devtools.build.lib.rules.objc.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
962,758
public Path createWALRootDir() throws IOException { FileSystem fs = FileSystem.get(this.conf); Path walDir = getNewDataTestDirOnTestFS(); CommonFSUtils.setWALRootDir(this.conf, walDir); fs.mkdirs(walDir); return walDir; }
Path function() throws IOException { FileSystem fs = FileSystem.get(this.conf); Path walDir = getNewDataTestDirOnTestFS(); CommonFSUtils.setWALRootDir(this.conf, walDir); fs.mkdirs(walDir); return walDir; }
/** * Creates a hbase walDir in the user's home directory. * Normally you won't make use of this method. Root hbaseWALDir * is created for you as part of mini cluster startup. You'd only use this * method if you were doing manual operation. * * @return Fully qualified path to hbase root dir * @throws IOException */
Creates a hbase walDir in the user's home directory. Normally you won't make use of this method. Root hbaseWALDir is created for you as part of mini cluster startup. You'd only use this method if you were doing manual operation
createWALRootDir
{ "repo_name": "apurtell/hbase", "path": "hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 169342 }
[ "java.io.IOException", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.util.CommonFSUtils" ]
import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.util.CommonFSUtils;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,074,833
// NEXT_MAJOR_VER: remove 'throws Exception' public Builder applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; }
Builder function( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; }
/** * Applies the given settings updater function to all of the unary API methods in this service. * * <p>Note: This method does not support applying settings to streaming methods. */
Applies the given settings updater function to all of the unary API methods in this service. Note: This method does not support applying settings to streaming methods
applyToAllUnaryMethods
{ "repo_name": "vam-google/google-cloud-java", "path": "google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStubSettings.java", "license": "apache-2.0", "size": 31692 }
[ "com.google.api.core.ApiFunction", "com.google.api.gax.rpc.UnaryCallSettings" ]
import com.google.api.core.ApiFunction; import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.core.*; import com.google.api.gax.rpc.*;
[ "com.google.api" ]
com.google.api;
1,715,670
@ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ServiceInner> listByMobileNetworkAsync( String resourceGroupName, String mobileNetworkName, Context context) { return new PagedFlux<>( () -> listByMobileNetworkSinglePageAsync(resourceGroupName, mobileNetworkName, context), nextLink -> listByMobileNetworkNextSinglePageAsync(nextLink, context)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ServiceInner> function( String resourceGroupName, String mobileNetworkName, Context context) { return new PagedFlux<>( () -> listByMobileNetworkSinglePageAsync(resourceGroupName, mobileNetworkName, context), nextLink -> listByMobileNetworkNextSinglePageAsync(nextLink, context)); }
/** * Gets all the services in a mobile network. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param mobileNetworkName The name of the mobile network. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all the services in a mobile network as paginated response with {@link PagedFlux}. */
Gets all the services in a mobile network
listByMobileNetworkAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/src/main/java/com/azure/resourcemanager/mobilenetwork/implementation/ServicesClientImpl.java", "license": "mit", "size": 69296 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.core.util.Context", "com.azure.resourcemanager.mobilenetwork.fluent.models.ServiceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Context; import com.azure.resourcemanager.mobilenetwork.fluent.models.ServiceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.mobilenetwork.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
328,651
public static FilterGraph of(final FilterChain... filterChains) { return new FilterGraph().addFilterChains(Arrays.asList(filterChains)); }
static FilterGraph function(final FilterChain... filterChains) { return new FilterGraph().addFilterChains(Arrays.asList(filterChains)); }
/** * Create {@link FilterGraph} from several filter chains. * * @param filterChains filter chains * @return FilterGraph */
Create <code>FilterGraph</code> from several filter chains
of
{ "repo_name": "kokorin/Jaffree", "path": "src/main/java/com/github/kokorin/jaffree/ffmpeg/FilterGraph.java", "license": "apache-2.0", "size": 2527 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
485,561
public void unregisterLoadListener(LoadListener listener) { ThreadUtils.assertOnUiThread(); boolean removed = mLoadListeners.removeObserver(listener); assert removed; }
void function(LoadListener listener) { ThreadUtils.assertOnUiThread(); boolean removed = mLoadListeners.removeObserver(listener); assert removed; }
/** * Unregisters a listener for the callback that indicates that the * TemplateURLService has loaded. */
Unregisters a listener for the callback that indicates that the TemplateURLService has loaded
unregisterLoadListener
{ "repo_name": "7kbird/chrome", "path": "chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java", "license": "bsd-3-clause", "size": 10702 }
[ "org.chromium.base.ThreadUtils" ]
import org.chromium.base.ThreadUtils;
import org.chromium.base.*;
[ "org.chromium.base" ]
org.chromium.base;
2,058,826
public PendingCommand removeCommand(long sequence) { return pendingCommands.remove(sequence); }
PendingCommand function(long sequence) { return pendingCommands.remove(sequence); }
/** * Removes and returns a pending command. * * @param sequence the pending command sequence number * @return the pending command or {@code null} if no command is pending for this sequence number */
Removes and returns a pending command
removeCommand
{ "repo_name": "atomix/atomix", "path": "protocols/raft/src/main/java/io/atomix/protocols/raft/session/RaftSession.java", "license": "apache-2.0", "size": 18130 }
[ "io.atomix.protocols.raft.impl.PendingCommand" ]
import io.atomix.protocols.raft.impl.PendingCommand;
import io.atomix.protocols.raft.impl.*;
[ "io.atomix.protocols" ]
io.atomix.protocols;
1,222,153
private void startPeriodicMeasurements() { showNotification(); mTimer = new Timer(); mTimer.schedule(new TimerTask() {
void function() { showNotification(); mTimer = new Timer(); mTimer.schedule(new TimerTask() {
/** * Starts active averaging. */
Starts active averaging
startPeriodicMeasurements
{ "repo_name": "destil/GPS-Averaging", "path": "app/src/main/java/org/destil/gpsaveraging/measure/PeriodicService.java", "license": "apache-2.0", "size": 4062 }
[ "java.util.Timer", "java.util.TimerTask" ]
import java.util.Timer; import java.util.TimerTask;
import java.util.*;
[ "java.util" ]
java.util;
480,821
String librarySearchPathName = getLibrarySearchPathName(); String originalLibPath = System.getenv(librarySearchPathName); String newlibPath = libDir.toString() + (originalLibPath == null ? "" : File.pathSeparator + originalLibPath); env.put(librarySearchPathName, newlibPath); }
String librarySearchPathName = getLibrarySearchPathName(); String originalLibPath = System.getenv(librarySearchPathName); String newlibPath = libDir.toString() + (originalLibPath == null ? "" : File.pathSeparator + originalLibPath); env.put(librarySearchPathName, newlibPath); }
/** * Update the library search path environment variable with the given native library directory. */
Update the library search path environment variable with the given native library directory
updateEnvironment
{ "repo_name": "tgummerer/buck", "path": "src/com/facebook/buck/jvm/java/FatJarMain.java", "license": "apache-2.0", "size": 5602 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,035,459
@Override public void start(Xid xid, int flags) throws XAException { _xaResource.start(xid, flags); }
void function(Xid xid, int flags) throws XAException { _xaResource.start(xid, flags); }
/** * Starts the resource. */
Starts the resource
start
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/sql/DisjointXAResource.java", "license": "gpl-2.0", "size": 3386 }
[ "javax.transaction.xa.XAException", "javax.transaction.xa.Xid" ]
import javax.transaction.xa.XAException; import javax.transaction.xa.Xid;
import javax.transaction.xa.*;
[ "javax.transaction" ]
javax.transaction;
236,670
private static List<String> filterArgs(Iterable<String> args) { if (args == null) { return null; } ImmutableList.Builder<String> filteredArgs = ImmutableList.builder(); for (String arg : args) { if (arg != null && !arg.startsWith("--client_env=") && !arg.startsWith("--default_override=")) { filteredArgs.add(arg); } } return filteredArgs.build(); }
static List<String> function(Iterable<String> args) { if (args == null) { return null; } ImmutableList.Builder<String> filteredArgs = ImmutableList.builder(); for (String arg : args) { if (arg != null && !arg.startsWith(STR) && !arg.startsWith(STR)) { filteredArgs.add(arg); } } return filteredArgs.build(); }
/** * Filters {@code args} by removing superfluous items: * * <ul> * <li>The client's environment variables may contain sensitive data, so we filter it out. * <li>{@code --default_override} is spammy. * </ul> */
Filters args by removing superfluous items: The client's environment variables may contain sensitive data, so we filter it out. --default_override is spammy.
filterArgs
{ "repo_name": "davidzchen/bazel", "path": "src/main/java/com/google/devtools/build/lib/bugreport/BugReport.java", "license": "apache-2.0", "size": 13262 }
[ "com.google.common.collect.ImmutableList", "java.util.List" ]
import com.google.common.collect.ImmutableList; import java.util.List;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,850,172
public Date getAccountCreateDate();
Date function();
/** * Gets the accountCreateDate attribute. * * @return Returns the accountCreateDate */
Gets the accountCreateDate attribute
getAccountCreateDate
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/coa/businessobject/AccountIntf.java", "license": "apache-2.0", "size": 31074 }
[ "java.sql.Date" ]
import java.sql.Date;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,797,267
@ServiceMethod(returns = ReturnType.SINGLE) WhatIfOperationResultInner whatIfAtSubscriptionScope( String deploymentName, DeploymentWhatIf parameters, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) WhatIfOperationResultInner whatIfAtSubscriptionScope( String deploymentName, DeploymentWhatIf parameters, Context context);
/** * Returns changes that will be made by the deployment if executed at the scope of the subscription. * * @param deploymentName The name of the deployment. * @param parameters Deployment What-if operation parameters. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of the What-If operation. */
Returns changes that will be made by the deployment if executed at the scope of the subscription
whatIfAtSubscriptionScope
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/DeploymentsClient.java", "license": "mit", "size": 209954 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.resourcemanager.resources.fluent.models.WhatIfOperationResultInner", "com.azure.resourcemanager.resources.models.DeploymentWhatIf" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.resources.fluent.models.WhatIfOperationResultInner; import com.azure.resourcemanager.resources.models.DeploymentWhatIf;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.resources.fluent.models.*; import com.azure.resourcemanager.resources.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,429,657
BgpVrfAfs bgpVrfAfs();
BgpVrfAfs bgpVrfAfs();
/** * Returns the attribute bgpVrfAfs. * * @return value of bgpVrfAfs */
Returns the attribute bgpVrfAfs
bgpVrfAfs
{ "repo_name": "mengmoya/onos", "path": "apps/l3vpn/nel3vpn/nemgr/src/main/java/org/onosproject/yang/gen/v1/ne/bgpcomm/rev20141225/nebgpcomm/bgpcomm/bgpvrfs/BgpVrf.java", "license": "apache-2.0", "size": 2118 }
[ "org.onosproject.yang.gen.v1.ne.bgpcomm.rev20141225.nebgpcomm.bgpcomm.bgpvrfs.bgpvrf.BgpVrfAfs" ]
import org.onosproject.yang.gen.v1.ne.bgpcomm.rev20141225.nebgpcomm.bgpcomm.bgpvrfs.bgpvrf.BgpVrfAfs;
import org.onosproject.yang.gen.v1.ne.bgpcomm.rev20141225.nebgpcomm.bgpcomm.bgpvrfs.bgpvrf.*;
[ "org.onosproject.yang" ]
org.onosproject.yang;
2,795,910
@UiHandler({"root"}) void onDragStart(DragStartEvent event, Element parent, Context context) { // Save the ID of the TaskProxy. DataTransfer dataTransfer = event.getDataTransfer(); dataTransfer.setData("text", String.valueOf(context.getIndex())); // Set the image. dataTransfer.setDragImage(parent, 25, 15); } } interface Driver extends RequestFactoryEditorDriver<TaskProxy, DesktopTaskEditView> { } private static DesktopTaskEditViewUiBinder uiBinder = GWT .create(DesktopTaskEditViewUiBinder.class); private static PopupPanel glassPanel;
@UiHandler({"root"}) void onDragStart(DragStartEvent event, Element parent, Context context) { DataTransfer dataTransfer = event.getDataTransfer(); dataTransfer.setData("text", String.valueOf(context.getIndex())); dataTransfer.setDragImage(parent, 25, 15); } } interface Driver extends RequestFactoryEditorDriver<TaskProxy, DesktopTaskEditView> { } private static DesktopTaskEditViewUiBinder uiBinder = GWT .create(DesktopTaskEditViewUiBinder.class); private static PopupPanel glassPanel;
/** * Handles "drag-start" events inside the element named "root". */
Handles "drag-start" events inside the element named "root"
onDragStart
{ "repo_name": "JakaCikac/dScrum", "path": "web/WEB-INF/classes/gwt-2.6.0/samples/MobileWebApp/src/main/java/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskEditView.java", "license": "gpl-2.0", "size": 10595 }
[ "com.google.gwt.dom.client.DataTransfer", "com.google.gwt.dom.client.Element", "com.google.gwt.event.dom.client.DragStartEvent", "com.google.gwt.sample.mobilewebapp.shared.TaskProxy", "com.google.gwt.uibinder.client.UiHandler", "com.google.gwt.user.client.ui.PopupPanel", "com.google.web.bindery.requestf...
import com.google.gwt.dom.client.DataTransfer; import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.DragStartEvent; import com.google.gwt.sample.mobilewebapp.shared.TaskProxy; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.PopupPanel; import com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver;
import com.google.gwt.dom.client.*; import com.google.gwt.event.dom.client.*; import com.google.gwt.sample.mobilewebapp.shared.*; import com.google.gwt.uibinder.client.*; import com.google.gwt.user.client.ui.*; import com.google.web.bindery.requestfactory.gwt.client.*;
[ "com.google.gwt", "com.google.web" ]
com.google.gwt; com.google.web;
2,705,066
void showWebPage(String url, boolean openExternal, boolean clearHistory, Map<String, Object> params);
void showWebPage(String url, boolean openExternal, boolean clearHistory, Map<String, Object> params);
/** * Load the specified URL in the Cordova webview or a new browser instance. * * NOTE: If openExternal is false, only whitelisted URLs can be loaded. * * @param url The url to load. * @param openExternal Load url in browser instead of Cordova webview. * @param clearHistory Clear the history stack, so new page becomes top of history * @param params Parameters for new app */
Load the specified URL in the Cordova webview or a new browser instance
showWebPage
{ "repo_name": "alsorokin/cordova-android", "path": "framework/src/org/apache/cordova/CordovaWebView.java", "license": "apache-2.0", "size": 4649 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,901,533
@Override public void onAdDismissed(final Ad ad) { try { AmazonAds.getInstance().requestInterstital(); } catch (Exception e){ } } }
void function(final Ad ad) { try { AmazonAds.getInstance().requestInterstital(); } catch (Exception e){ } } }
/** * This event is called when an interstitial ad has been dismissed by the user. */
This event is called when an interstitial ad has been dismissed by the user
onAdDismissed
{ "repo_name": "SonarSystems/Cocos-Helper", "path": "External Cocos Helper Android Frameworks/Frameworks/Amazon/AmazonAds.java", "license": "mit", "size": 11311 }
[ "com.amazon.device.ads.Ad" ]
import com.amazon.device.ads.Ad;
import com.amazon.device.ads.*;
[ "com.amazon.device" ]
com.amazon.device;
2,851,366
public CallableStatement prepareCall (String sql, int resultSetType, int resultSetConcurrency) throws SQLException { validateConnection(); return connection_.prepareCall(sql, resultSetType, resultSetConcurrency); } //@G4A JDBC 3.0 /** Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times. <p>Full functionality of this method requires support in OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value for resultSetHoldability will be ignored.
CallableStatement function (String sql, int resultSetType, int resultSetConcurrency) throws SQLException { validateConnection(); return connection_.prepareCall(sql, resultSetType, resultSetConcurrency); } /** Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times. <p>Full functionality of this method requires support in OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value for resultSetHoldability will be ignored.
/** * Precompiles an SQL stored procedure call with optional input * and output parameters and stores it in a CallableStatement * object. This object can be used to efficiently call the SQL * stored procedure multiple times. * * @param sql The SQL statement. * @param resultSetType The result set type. Valid values are: * <ul> * <li>ResultSet.TYPE_FORWARD_ONLY * <li>ResultSet.TYPE_SCROLL_INSENSITIVE * <li>ResultSet.TYPE_SCROLL_SENSITIVE * </ul> * @param resultSetConcurrency The result set concurrency. Valid values are: * <ul> * <li>ResultSet.CONCUR_READ_ONLY * <li>ResultSet.CONCUR_UPDATABLE * </ul> * @return The prepared statement object. * * @exception SQLException If the connection is not open, the maximum number of statements * for this connection has been reached, the result type or currency * is not valid, or an error occurs. **/
Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times
prepareCall
{ "repo_name": "piguangming/jt400", "path": "cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionHandle.java", "license": "epl-1.0", "size": 76139 }
[ "java.sql.CallableStatement", "java.sql.SQLException" ]
import java.sql.CallableStatement; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
439,128
Config readConfig(InputStream inputStream) throws ConfigIOException;
Config readConfig(InputStream inputStream) throws ConfigIOException;
/** * The method loads the configuration information from the specified {@code inputStream}, as * a {@link Config} instance. The format of the configuration information must be supported by * the {@link ConfigIO} implementation, in order to be loaded, see alse * {@link #writeConfig(ConfigSource, OutputStream)} . * * @param inputStream the input stream to load config information from, cannot be {@code null} and * must be open for read. * @return the loaded configuration information. * @throws InvalidParameterException when {@code inputStream} is {@code null}. * @throws ConfigIOException when anything goes wrong during the process of loading the config. */
The method loads the configuration information from the specified inputStream, as a <code>Config</code> instance. The format of the configuration information must be supported by the <code>ConfigIO</code> implementation, in order to be loaded, see alse <code>#writeConfig(ConfigSource, OutputStream)</code>
readConfig
{ "repo_name": "raistlic/raistlic-lib-commons-core", "path": "src/main/java/org/raistlic/common/config/io/ConfigIO.java", "license": "apache-2.0", "size": 3821 }
[ "java.io.InputStream", "org.raistlic.common.config.core.Config", "org.raistlic.common.config.exception.ConfigIOException" ]
import java.io.InputStream; import org.raistlic.common.config.core.Config; import org.raistlic.common.config.exception.ConfigIOException;
import java.io.*; import org.raistlic.common.config.core.*; import org.raistlic.common.config.exception.*;
[ "java.io", "org.raistlic.common" ]
java.io; org.raistlic.common;
1,874,467
public void write(ByteSource source) { ByteBuffer bb = source.getBackingByteBuffer(); if (bb != null) { write(bb); return; } if (this.ignoreWrites) return; checkIfWritable(); int remainingSpace = this.buffer.limit() - this.buffer.position(); if (remainingSpace < source.remaining()) { int oldLimit = source.limit(); source.limit(source.position() + remainingSpace); source.sendTo(this.buffer); source.limit(oldLimit); ensureCapacity(source.remaining()); } source.sendTo(this.buffer); }
void function(ByteSource source) { ByteBuffer bb = source.getBackingByteBuffer(); if (bb != null) { write(bb); return; } if (this.ignoreWrites) return; checkIfWritable(); int remainingSpace = this.buffer.limit() - this.buffer.position(); if (remainingSpace < source.remaining()) { int oldLimit = source.limit(); source.limit(source.position() + remainingSpace); source.sendTo(this.buffer); source.limit(oldLimit); ensureCapacity(source.remaining()); } source.sendTo(this.buffer); }
/** * Write a byte source to this HeapDataOutputStream, * * the contents of the buffer between the position and the limit are copied to the output stream. */
Write a byte source to this HeapDataOutputStream, the contents of the buffer between the position and the limit are copied to the output stream
write
{ "repo_name": "pivotal-amurmann/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java", "license": "apache-2.0", "size": 42853 }
[ "java.nio.ByteBuffer", "org.apache.geode.internal.tcp.ByteBufferInputStream" ]
import java.nio.ByteBuffer; import org.apache.geode.internal.tcp.ByteBufferInputStream;
import java.nio.*; import org.apache.geode.internal.tcp.*;
[ "java.nio", "org.apache.geode" ]
java.nio; org.apache.geode;
1,378,175
public static LogicalSchema mergeSchemasByAlias(List<LogicalSchema> schemas) throws FrontendException{ LogicalSchema mergedSchema = null; // list of schemas that have currently been merged, used in error message ArrayList<LogicalSchema> mergedSchemas = new ArrayList<LogicalSchema>(schemas.size()); for(LogicalSchema sch : schemas){ if(mergedSchema == null){ mergedSchema = sch.deepCopy(); mergedSchemas.add(sch); continue; } try{ mergedSchema = mergeSchemaByAlias( mergedSchema, sch ); mergedSchemas.add(sch); }catch(FrontendException e){ String msg = "Error merging schema: (" + sch + ") with " + "merged schema: (" + mergedSchema + ")" + " of schemas : " + mergedSchemas; throw new FrontendException(msg, e); } } return mergedSchema; }
static LogicalSchema function(List<LogicalSchema> schemas) throws FrontendException{ LogicalSchema mergedSchema = null; ArrayList<LogicalSchema> mergedSchemas = new ArrayList<LogicalSchema>(schemas.size()); for(LogicalSchema sch : schemas){ if(mergedSchema == null){ mergedSchema = sch.deepCopy(); mergedSchemas.add(sch); continue; } try{ mergedSchema = mergeSchemaByAlias( mergedSchema, sch ); mergedSchemas.add(sch); }catch(FrontendException e){ String msg = STR + sch + STR + STR + mergedSchema + ")" + STR + mergedSchemas; throw new FrontendException(msg, e); } } return mergedSchema; }
/** * Merges collection of schemas using their column aliases * (unlike mergeSchema(..) functions which merge using positions) * Schema will not be merged if types are incompatible, * as per DataType.mergeType(..) * For Tuples and Bags, SubSchemas have to be equal be considered compatible * @param schemas - list of schemas to be merged using their column alias * @return merged schema */
Merges collection of schemas using their column aliases (unlike mergeSchema(..) functions which merge using positions) Schema will not be merged if types are incompatible, as per DataType.mergeType(..) For Tuples and Bags, SubSchemas have to be equal be considered compatible
mergeSchemasByAlias
{ "repo_name": "cloudera/pig", "path": "src/org/apache/pig/newplan/logical/relational/LogicalSchema.java", "license": "apache-2.0", "size": 37339 }
[ "java.util.ArrayList", "java.util.List", "org.apache.pig.impl.logicalLayer.FrontendException" ]
import java.util.ArrayList; import java.util.List; import org.apache.pig.impl.logicalLayer.FrontendException;
import java.util.*; import org.apache.pig.impl.*;
[ "java.util", "org.apache.pig" ]
java.util; org.apache.pig;
1,939,310
public static void upDateCounters(ArrayList<Object> itemSets, Instances instances) { for (int i = 0; i < instances.numInstances(); i++) { Enumeration<Object> enu = new WekaEnumeration<Object>(itemSets); while (enu.hasMoreElements()) { ((ItemSet) enu.nextElement()).upDateCounter(instances.instance(i)); } } }
static void function(ArrayList<Object> itemSets, Instances instances) { for (int i = 0; i < instances.numInstances(); i++) { Enumeration<Object> enu = new WekaEnumeration<Object>(itemSets); while (enu.hasMoreElements()) { ((ItemSet) enu.nextElement()).upDateCounter(instances.instance(i)); } } }
/** * Updates counters for a set of item sets and a set of instances. * * @param itemSets the set of item sets which are to be updated * @param instances the instances to be used for updating the counters */
Updates counters for a set of item sets and a set of instances
upDateCounters
{ "repo_name": "mydzigear/weka.kmeanspp.silhouette_score", "path": "src/weka/associations/ItemSet.java", "license": "gpl-3.0", "size": 16976 }
[ "java.util.ArrayList", "java.util.Enumeration" ]
import java.util.ArrayList; import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,733,428
public ServiceCallConfigurationDefinition serviceChooser(ServiceChooser serviceChooser) { setServiceChooser(serviceChooser); return this; }
ServiceCallConfigurationDefinition function(ServiceChooser serviceChooser) { setServiceChooser(serviceChooser); return this; }
/** * Sets a custom {@link ServiceChooser} to use. */
Sets a custom <code>ServiceChooser</code> to use
serviceChooser
{ "repo_name": "acartapanis/camel", "path": "camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java", "license": "apache-2.0", "size": 22152 }
[ "org.apache.camel.cloud.ServiceChooser" ]
import org.apache.camel.cloud.ServiceChooser;
import org.apache.camel.cloud.*;
[ "org.apache.camel" ]
org.apache.camel;
406,906
public static void asyncExpireSession(final ZkClient zkClient) throws Exception { ZkConnection connection = ((ZkConnection) zkClient.getConnection()); ZooKeeper curZookeeper = connection.getZookeeper(); LOG.info("Before expiry. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
static void function(final ZkClient zkClient) throws Exception { ZkConnection connection = ((ZkConnection) zkClient.getConnection()); ZooKeeper curZookeeper = connection.getZookeeper(); LOG.info(STR + Long.toHexString(curZookeeper.getSessionId()));
/** * expire zk session asynchronously * @param zkClient * @throws Exception */
expire zk session asynchronously
asyncExpireSession
{ "repo_name": "AyolaJayamaha/apachehelix", "path": "helix-core/src/test/java/org/apache/helix/ZkTestHelper.java", "license": "apache-2.0", "size": 16467 }
[ "org.apache.helix.manager.zk.ZkClient", "org.apache.zookeeper.ZooKeeper" ]
import org.apache.helix.manager.zk.ZkClient; import org.apache.zookeeper.ZooKeeper;
import org.apache.helix.manager.zk.*; import org.apache.zookeeper.*;
[ "org.apache.helix", "org.apache.zookeeper" ]
org.apache.helix; org.apache.zookeeper;
2,878,177
@Override public void setRepositoryDirectory( RepositoryDirectoryInterface directory ) { this.directory = directory; setInternalKettleVariables(); }
void function( RepositoryDirectoryInterface directory ) { this.directory = directory; setInternalKettleVariables(); }
/** * Sets the directory. * * @param directory The directory to set. */
Sets the directory
setRepositoryDirectory
{ "repo_name": "Advent51/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/base/AbstractMeta.java", "license": "apache-2.0", "size": 54941 }
[ "org.pentaho.di.repository.RepositoryDirectoryInterface" ]
import org.pentaho.di.repository.RepositoryDirectoryInterface;
import org.pentaho.di.repository.*;
[ "org.pentaho.di" ]
org.pentaho.di;
81,773
public boolean equals(ItemStack stack) { if (stack.isSimilar(this.stack)) { return true; } else { return false; } }
boolean function(ItemStack stack) { if (stack.isSimilar(this.stack)) { return true; } else { return false; } }
/** * Checks if the ItemStack corresponds to this entry * * @param stack ItemStack to check * @return b>true</b> if the data matches, <b>false</b> otherwise. */
Checks if the ItemStack corresponds to this entry
equals
{ "repo_name": "pavog/Statistics-Bukkit-Plugin", "path": "src/main/java/com/wolvencraft/yasp/db/data/items/TotalItemStats.java", "license": "lgpl-3.0", "size": 7094 }
[ "org.bukkit.inventory.ItemStack" ]
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.*;
[ "org.bukkit.inventory" ]
org.bukkit.inventory;
1,978,662
public void destroy() { stop(); servers = Collections.emptyList(); // shutdown executors used by netty for native transport server workerGroup.shutdownGracefully(3, 5, TimeUnit.SECONDS).awaitUninterruptibly(); // shutdownGracefully not implemented yet in RequestThreadPoolExecutor eventExecutorGroup.shutdown(); }
void function() { stop(); servers = Collections.emptyList(); workerGroup.shutdownGracefully(3, 5, TimeUnit.SECONDS).awaitUninterruptibly(); eventExecutorGroup.shutdown(); }
/** * Ultimately stops servers and closes all resources. */
Ultimately stops servers and closes all resources
destroy
{ "repo_name": "aureagle/cassandra", "path": "src/java/org/apache/cassandra/service/NativeTransportService.java", "license": "apache-2.0", "size": 7468 }
[ "java.util.Collections", "java.util.concurrent.TimeUnit" ]
import java.util.Collections; import java.util.concurrent.TimeUnit;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,361,758
private void sendRequest(String operation, String path, byte[] content, String target, boolean context){ try { SongURI toUri = this.generateUri(path); SongURI reqEntity = this.generateUri("/m2m/applications/GA"); SongServletRequest songRequest = factory.createRequest(appSession, operation, reqEntity, toUri); songRequest.setContent(content, "application/xml; charset=utf-8"); if(context){ songRequest.setAttribute(SystemVersionServlet.REQUEST_CONTEXT, this); } if (LOG.isDebugEnabled()) { LOG.debug("Send SONG "+ operation +" request (To:" + toUri.absoluteURI() + ") (content:\n" + new String(songRequest.getRawContent()) + ")"); } if(!initialized){ this.lastOperation = operation; if(target!=null){ this.lastTarget = target; }else{ this.lastTarget = path; } }else{ this.lastOperation = null; this.lastTarget = null; } songRequest.send(); } catch (ServletException e) { LOG.error("sendRequest - fail to create local Uri from fake uri", e); timerService.createTimer(appSession, ((Integer)configuration.getValue(Configuration.Name.TIME_BETWEEN_INIT)).intValue(), false, this); } catch(IOException e) { LOG.error("sendRequest - fail to send request", e); } }
void function(String operation, String path, byte[] content, String target, boolean context){ try { SongURI toUri = this.generateUri(path); SongURI reqEntity = this.generateUri(STR); SongServletRequest songRequest = factory.createRequest(appSession, operation, reqEntity, toUri); songRequest.setContent(content, STR); if(context){ songRequest.setAttribute(SystemVersionServlet.REQUEST_CONTEXT, this); } if (LOG.isDebugEnabled()) { LOG.debug(STR+ operation +STR + toUri.absoluteURI() + STR + new String(songRequest.getRawContent()) + ")"); } if(!initialized){ this.lastOperation = operation; if(target!=null){ this.lastTarget = target; }else{ this.lastTarget = path; } }else{ this.lastOperation = null; this.lastTarget = null; } songRequest.send(); } catch (ServletException e) { LOG.error(STR, e); timerService.createTimer(appSession, ((Integer)configuration.getValue(Configuration.Name.TIME_BETWEEN_INIT)).intValue(), false, this); } catch(IOException e) { LOG.error(STR, e); } }
/** * Sends a request * @param operation * @param path * @param content * @param target * @param context */
Sends a request
sendRequest
{ "repo_name": "actility/ong", "path": "gscl/system.version/src/main/java/com/actility/m2m/system/version/ResourcesManager.java", "license": "gpl-2.0", "size": 27946 }
[ "com.actility.m2m.servlet.song.SongServletRequest", "com.actility.m2m.servlet.song.SongURI", "com.actility.m2m.system.config.Configuration", "java.io.IOException", "javax.servlet.ServletException" ]
import com.actility.m2m.servlet.song.SongServletRequest; import com.actility.m2m.servlet.song.SongURI; import com.actility.m2m.system.config.Configuration; import java.io.IOException; import javax.servlet.ServletException;
import com.actility.m2m.servlet.song.*; import com.actility.m2m.system.config.*; import java.io.*; import javax.servlet.*;
[ "com.actility.m2m", "java.io", "javax.servlet" ]
com.actility.m2m; java.io; javax.servlet;
858,900
public static Collection<?> largerBetween(Collection<?> a, Collection<?> b) { return a.size() == b.size() || b.size() > a.size() ? b : a; }
static Collection<?> function(Collection<?> a, Collection<?> b) { return a.size() == b.size() b.size() > a.size() ? b : a; }
/** * Return the collection, {@code a} or {@code b}, that has the most * elements. If both collections have the same number of elements, then the * second collection, {@code b} is returned. * * @param a * @param b * @return the collection with the most elements */
Return the collection, a or b, that has the most elements. If both collections have the same number of elements, then the second collection, b is returned
largerBetween
{ "repo_name": "hcuffy/concourse", "path": "concourse-server/src/main/java/com/cinchapi/concourse/util/TCollections.java", "license": "apache-2.0", "size": 2743 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
394,195
private static void followReferral( LDAPConnection ldapConnection, String urlString, SearchRequest searchRequest, ActionListener<SearchResult> listener, int depth, boolean ignoreErrors, SearchResult originatingResult ) throws LDAPException { final LDAPURL referralURL = new LDAPURL(urlString); final String host = referralURL.getHost(); // the host must be present in order to follow a referral if (host == null) { // nothing to really do since a null host cannot really be handled, so we treat it as // an error throw new LDAPException(ResultCode.UNAVAILABLE, "Null referral host in " + urlString); } // the referral URL often contains information necessary about the LDAP request such as // the base DN, scope, and filter. If it does not, then we reuse the values from the // originating search request final String requestBaseDN; if (referralURL.baseDNProvided()) { requestBaseDN = referralURL.getBaseDN().toString(); } else { requestBaseDN = searchRequest.getBaseDN(); } final SearchScope requestScope; if (referralURL.scopeProvided()) { requestScope = referralURL.getScope(); } else { requestScope = searchRequest.getScope(); } final Filter requestFilter; if (referralURL.filterProvided()) { requestFilter = referralURL.getFilter(); } else { requestFilter = searchRequest.getFilter(); } // in order to follow the referral we need to open a new connection and we do so using the // referral connector on the ldap connection final LDAPConnection referralConn = privilegedConnect( () -> ldapConnection.getReferralConnector().getReferralConnection(referralURL, ldapConnection) ); final LdapSearchResultListener ldapListener = new LdapSearchResultListener( referralConn, ignoreErrors, ActionListener.wrap(searchResult -> { IOUtils.close(referralConn); listener.onResponse(searchResult); }, e -> { IOUtils.closeWhileHandlingException(referralConn); if (ignoreErrors) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( new ParameterizedMessage( "Failed to retrieve results from referral URL [{}]." + " Treating as 'no results'", referralURL ), e ); } listener.onResponse(emptyResult(originatingResult)); } else { listener.onFailure(e); } }), depth ); boolean success = false; try { final SearchRequest referralSearchRequest = new SearchRequest( ldapListener, searchRequest.getControls(), requestBaseDN, requestScope, searchRequest.getDereferencePolicy(), searchRequest.getSizeLimit(), searchRequest.getTimeLimitSeconds(), searchRequest.typesOnly(), requestFilter, searchRequest.getAttributes() ); ldapListener.setSearchRequest(searchRequest); referralConn.asyncSearch(referralSearchRequest); success = true; } finally { if (success == false) { IOUtils.closeWhileHandlingException(referralConn); } } }
static void function( LDAPConnection ldapConnection, String urlString, SearchRequest searchRequest, ActionListener<SearchResult> listener, int depth, boolean ignoreErrors, SearchResult originatingResult ) throws LDAPException { final LDAPURL referralURL = new LDAPURL(urlString); final String host = referralURL.getHost(); if (host == null) { throw new LDAPException(ResultCode.UNAVAILABLE, STR + urlString); } final String requestBaseDN; if (referralURL.baseDNProvided()) { requestBaseDN = referralURL.getBaseDN().toString(); } else { requestBaseDN = searchRequest.getBaseDN(); } final SearchScope requestScope; if (referralURL.scopeProvided()) { requestScope = referralURL.getScope(); } else { requestScope = searchRequest.getScope(); } final Filter requestFilter; if (referralURL.filterProvided()) { requestFilter = referralURL.getFilter(); } else { requestFilter = searchRequest.getFilter(); } final LDAPConnection referralConn = privilegedConnect( () -> ldapConnection.getReferralConnector().getReferralConnection(referralURL, ldapConnection) ); final LdapSearchResultListener ldapListener = new LdapSearchResultListener( referralConn, ignoreErrors, ActionListener.wrap(searchResult -> { IOUtils.close(referralConn); listener.onResponse(searchResult); }, e -> { IOUtils.closeWhileHandlingException(referralConn); if (ignoreErrors) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( new ParameterizedMessage( STR + STR, referralURL ), e ); } listener.onResponse(emptyResult(originatingResult)); } else { listener.onFailure(e); } }), depth ); boolean success = false; try { final SearchRequest referralSearchRequest = new SearchRequest( ldapListener, searchRequest.getControls(), requestBaseDN, requestScope, searchRequest.getDereferencePolicy(), searchRequest.getSizeLimit(), searchRequest.getTimeLimitSeconds(), searchRequest.typesOnly(), requestFilter, searchRequest.getAttributes() ); ldapListener.setSearchRequest(searchRequest); referralConn.asyncSearch(referralSearchRequest); success = true; } finally { if (success == false) { IOUtils.closeWhileHandlingException(referralConn); } } }
/** * Performs the actual connection and following of a referral given a URL string. * This referral is being followed as it may contain a result that is relevant to our search */
Performs the actual connection and following of a referral given a URL string. This referral is being followed as it may contain a result that is relevant to our search
followReferral
{ "repo_name": "ern/elasticsearch", "path": "x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/LdapUtils.java", "license": "apache-2.0", "size": 33630 }
[ "com.unboundid.ldap.sdk.Filter", "com.unboundid.ldap.sdk.LDAPConnection", "com.unboundid.ldap.sdk.LDAPException", "com.unboundid.ldap.sdk.ResultCode", "com.unboundid.ldap.sdk.SearchRequest", "com.unboundid.ldap.sdk.SearchResult", "com.unboundid.ldap.sdk.SearchScope", "org.apache.logging.log4j.message....
import com.unboundid.ldap.sdk.Filter; import com.unboundid.ldap.sdk.LDAPConnection; import com.unboundid.ldap.sdk.LDAPException; import com.unboundid.ldap.sdk.ResultCode; import com.unboundid.ldap.sdk.SearchRequest; import com.unboundid.ldap.sdk.SearchResult; import com.unboundid.ldap.sdk.SearchScope; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.core.internal.io.IOUtils;
import com.unboundid.ldap.sdk.*; import org.apache.logging.log4j.message.*; import org.elasticsearch.action.*; import org.elasticsearch.core.internal.io.*;
[ "com.unboundid.ldap", "org.apache.logging", "org.elasticsearch.action", "org.elasticsearch.core" ]
com.unboundid.ldap; org.apache.logging; org.elasticsearch.action; org.elasticsearch.core;
2,669,944
Map<Column, String> gets(CharSequence row, Column... columns);
Map<Column, String> gets(CharSequence row, Column... columns);
/** * Wrapper for {@link #get(Bytes, Set)} that uses Strings. All strings are encoded and decoded * using UTF-8. */
Wrapper for <code>#get(Bytes, Set)</code> that uses Strings. All strings are encoded and decoded using UTF-8
gets
{ "repo_name": "mikewalch/fluo", "path": "modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java", "license": "apache-2.0", "size": 5821 }
[ "java.util.Map", "org.apache.fluo.api.data.Column" ]
import java.util.Map; import org.apache.fluo.api.data.Column;
import java.util.*; import org.apache.fluo.api.data.*;
[ "java.util", "org.apache.fluo" ]
java.util; org.apache.fluo;
1,833,697
public void setPageDown(Clickable down) { hookFocusListener(down);
void function(Clickable down) { hookFocusListener(down);
/** * Sets the pagedown button to the passed Clickable. The pagedown button is the figure * between the down arrow button and the ScrollBar's thumb figure. * * @param down the page down figure * @since 2.0 */
Sets the pagedown button to the passed Clickable. The pagedown button is the figure between the down arrow button and the ScrollBar's thumb figure
setPageDown
{ "repo_name": "ESSICS/cs-studio", "path": "applications/opibuilder/opibuilder-plugins/org.csstudio.swt.widgets/src/org/csstudio/swt/widgets/figures/ScrollbarFigure.java", "license": "epl-1.0", "size": 24324 }
[ "org.eclipse.draw2d.Clickable" ]
import org.eclipse.draw2d.Clickable;
import org.eclipse.draw2d.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
469,796
List<ArrowBuf> getFieldBuffers();
List<ArrowBuf> getFieldBuffers();
/** * (same size as getFieldVectors() since it is their content) * * @return the buffers containing the data for this vector (ready for reading) */
(same size as getFieldVectors() since it is their content)
getFieldBuffers
{ "repo_name": "siddharthteotia/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/FieldVector.java", "license": "apache-2.0", "size": 2768 }
[ "io.netty.buffer.ArrowBuf", "java.util.List" ]
import io.netty.buffer.ArrowBuf; import java.util.List;
import io.netty.buffer.*; import java.util.*;
[ "io.netty.buffer", "java.util" ]
io.netty.buffer; java.util;
1,575,119
public void testMoveNodesLocked() throws RepositoryException, NotExecutableException { // we assume repository supports locking String dstAbsPath = node2.getPath() + "/" + node1.getName(); // get other session Session otherSession = getHelper().getReadWriteSession(); try { // get lock target node in destination wsp through other session Node lockTarget = (Node) otherSession.getItem(node2.getPath()); // add mixin "lockable" to be able to lock the node ensureMixinType(lockTarget, mixLockable); lockTarget.getParent().save(); // lock dst parent node using other session lockTarget.lock(true, true); try { workspace.move(node1.getPath(), dstAbsPath); fail("LockException was expected."); } catch (LockException e) { // successful } finally { lockTarget.unlock(); } } finally { otherSession.logout(); } }
void function() throws RepositoryException, NotExecutableException { String dstAbsPath = node2.getPath() + "/" + node1.getName(); Session otherSession = getHelper().getReadWriteSession(); try { Node lockTarget = (Node) otherSession.getItem(node2.getPath()); ensureMixinType(lockTarget, mixLockable); lockTarget.getParent().save(); lockTarget.lock(true, true); try { workspace.move(node1.getPath(), dstAbsPath); fail(STR); } catch (LockException e) { } finally { lockTarget.unlock(); } } finally { otherSession.logout(); } }
/** * A LockException is thrown if a lock prevents the copy. */
A LockException is thrown if a lock prevents the copy
testMoveNodesLocked
{ "repo_name": "sdmcraft/jackrabbit", "path": "jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java", "license": "apache-2.0", "size": 6826 }
[ "javax.jcr.Node", "javax.jcr.RepositoryException", "javax.jcr.Session", "javax.jcr.lock.LockException", "org.apache.jackrabbit.test.NotExecutableException" ]
import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.lock.LockException; import org.apache.jackrabbit.test.NotExecutableException;
import javax.jcr.*; import javax.jcr.lock.*; import org.apache.jackrabbit.test.*;
[ "javax.jcr", "org.apache.jackrabbit" ]
javax.jcr; org.apache.jackrabbit;
2,005,251
public static SLAPolicyHandler create(SLA sla, Object eventSource, EventHandler eventHandler, ServiceBeanContext context, ClassLoader loader) throws Exception { if(sla==null) throw new IllegalArgumentException("sla is null"); logger.trace("Creating SLAPolicyHandler for {}", sla); Class slaPolicyHandlerClass = loader.loadClass(sla.getSlaPolicyHandler()); Constructor cons = slaPolicyHandlerClass.getConstructor(SLA.class); SLAPolicyHandler slaPolicyHandler = (SLAPolicyHandler)cons.newInstance(sla); slaPolicyHandler.initialize(eventSource, eventHandler, context); logger.debug("SLAPolicyHandler [{}] created", slaPolicyHandler.getClass().getName()); return(slaPolicyHandler); }
static SLAPolicyHandler function(SLA sla, Object eventSource, EventHandler eventHandler, ServiceBeanContext context, ClassLoader loader) throws Exception { if(sla==null) throw new IllegalArgumentException(STR); logger.trace(STR, sla); Class slaPolicyHandlerClass = loader.loadClass(sla.getSlaPolicyHandler()); Constructor cons = slaPolicyHandlerClass.getConstructor(SLA.class); SLAPolicyHandler slaPolicyHandler = (SLAPolicyHandler)cons.newInstance(sla); slaPolicyHandler.initialize(eventSource, eventHandler, context); logger.debug(STR, slaPolicyHandler.getClass().getName()); return(slaPolicyHandler); }
/** * Create a SLAPolicyHandler based on the provided SLA * * @param sla The SLA object to create an SLAPolicyHandler instance for * @param eventSource The object to be used as the remote event source * @param eventHandler Handler which sends events * @param context The ServiceBeanContext * @param loader A ClassLoader to load resources and classes, and to pass * when constructing the SLAPolicyHandler. If null, the context class * loader will be used. * * @return A SLAPolicyHandler created from the SLA * * @throws Exception If the configuration cannot be used */
Create a SLAPolicyHandler based on the provided SLA
create
{ "repo_name": "khartig/assimilator", "path": "rio-lib/src/main/java/org/rioproject/sla/SLAPolicyHandlerFactory.java", "license": "apache-2.0", "size": 3353 }
[ "java.lang.reflect.Constructor", "org.rioproject.core.jsb.ServiceBeanContext", "org.rioproject.event.EventHandler" ]
import java.lang.reflect.Constructor; import org.rioproject.core.jsb.ServiceBeanContext; import org.rioproject.event.EventHandler;
import java.lang.reflect.*; import org.rioproject.core.jsb.*; import org.rioproject.event.*;
[ "java.lang", "org.rioproject.core", "org.rioproject.event" ]
java.lang; org.rioproject.core; org.rioproject.event;
725,018
protected SarlConstructor constructor(String string, String... prefix) throws Exception { SarlClass clazz = clazz( IterableExtensions.join(Arrays.asList(prefix), getLineSeparator()) + getLineSeparator() + "class Foo { " + string + "}"); return (SarlConstructor) clazz.getMembers().get(0); }
SarlConstructor function(String string, String... prefix) throws Exception { SarlClass clazz = clazz( IterableExtensions.join(Arrays.asList(prefix), getLineSeparator()) + getLineSeparator() + STR + string + "}"); return (SarlConstructor) clazz.getMembers().get(0); }
/** Create an instance of constructor. */
Create an instance of constructor
constructor
{ "repo_name": "jgfoster/sarl", "path": "tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java", "license": "apache-2.0", "size": 70743 }
[ "io.sarl.lang.sarl.SarlClass", "io.sarl.lang.sarl.SarlConstructor", "java.util.Arrays", "org.eclipse.xtext.xbase.lib.IterableExtensions" ]
import io.sarl.lang.sarl.SarlClass; import io.sarl.lang.sarl.SarlConstructor; import java.util.Arrays; import org.eclipse.xtext.xbase.lib.IterableExtensions;
import io.sarl.lang.sarl.*; import java.util.*; import org.eclipse.xtext.xbase.lib.*;
[ "io.sarl.lang", "java.util", "org.eclipse.xtext" ]
io.sarl.lang; java.util; org.eclipse.xtext;
282,376
public void setDefaultEnableCommentPreference( ) { PreferenceFactory.getInstance( ) .getPreferences( this ) .setDefault( ENABLE_COMMENT_PREFERENCE, false ); }
void function( ) { PreferenceFactory.getInstance( ) .getPreferences( this ) .setDefault( ENABLE_COMMENT_PREFERENCE, false ); }
/** * set enable default comment preference * */
set enable default comment preference
setDefaultEnableCommentPreference
{ "repo_name": "sguan-actuate/birt", "path": "UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ReportPlugin.java", "license": "epl-1.0", "size": 54061 }
[ "org.eclipse.birt.report.designer.ui.preferences.PreferenceFactory" ]
import org.eclipse.birt.report.designer.ui.preferences.PreferenceFactory;
import org.eclipse.birt.report.designer.ui.preferences.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
2,114,292
public String toXML() { StringBuilder buf = new StringBuilder(); synchronized (payloads) { if (payloads.size() > 0) { buf.append("<").append(getElementName()); buf.append(" xmlns=\"").append(getNamespace()).append("\" >"); Iterator<JinglePayloadType> pt = payloads.listIterator(); while (pt.hasNext()) { JinglePayloadType pte = pt.next(); buf.append(pte.toXML()); } buf.append("</").append(getElementName()).append(">"); } } return buf.toString(); } public static class Audio extends JingleContentDescription { public static final String NAMESPACE = "urn:xmpp:tmp:jingle:apps:rtp"; public Audio() { super(); } public Audio(final JinglePayloadType pt) { super(); addJinglePayloadType(pt); }
String function() { StringBuilder buf = new StringBuilder(); synchronized (payloads) { if (payloads.size() > 0) { buf.append("<").append(getElementName()); buf.append(STRSTR\STR); Iterator<JinglePayloadType> pt = payloads.listIterator(); while (pt.hasNext()) { JinglePayloadType pte = pt.next(); buf.append(pte.toXML()); } buf.append("</").append(getElementName()).append(">"); } } return buf.toString(); } public static class Audio extends JingleContentDescription { public static final String NAMESPACE = STR; public Audio() { super(); } public Audio(final JinglePayloadType pt) { super(); addJinglePayloadType(pt); }
/** * Convert a Jingle description to XML. * * @return a string with the XML representation */
Convert a Jingle description to XML
toXML
{ "repo_name": "magnetsystems/message-smack", "path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java", "license": "apache-2.0", "size": 8297 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,774,911
Map<String, Datatype> mapping() { return this.mapping; }
Map<String, Datatype> mapping() { return this.mapping; }
/** * Returns ES schema for each field. Mapping is represented as field name * {@code foo.bar.qux} and type ({@code keyword}, {@code boolean}, * {@code long}). * * @return immutable mapping between field and ES type * * @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html">Mapping Types</a> */
Returns ES schema for each field. Mapping is represented as field name foo.bar.qux and type (keyword, boolean, long)
mapping
{ "repo_name": "dindin5258/calcite", "path": "elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchMapping.java", "license": "apache-2.0", "size": 6431 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,924,886
public void rSort(ReproductFood reproductFood){ for (Rstorage rstorage : this.rstorages){ if (rstorage.sortQuality(reproductFood)){ rstorage.add(reproductFood); break; } } controllQuality.sort(reproductFood); }
void function(ReproductFood reproductFood){ for (Rstorage rstorage : this.rstorages){ if (rstorage.sortQuality(reproductFood)){ rstorage.add(reproductFood); break; } } controllQuality.sort(reproductFood); }
/** * rSort method. * @param reproductFood */
rSort method
rSort
{ "repo_name": "revdaalex/learn_java", "path": "chapter3/LSP/ChapterII/src/main/java/ru/revdaalex/lsp/chapterII/rcontroll/RCotrollQuality.java", "license": "apache-2.0", "size": 1542 }
[ "ru.revdaalex.lsp.chapterII.food.ReproductFood", "ru.revdaalex.lsp.chapterII.interfaces.Rstorage" ]
import ru.revdaalex.lsp.chapterII.food.ReproductFood; import ru.revdaalex.lsp.chapterII.interfaces.Rstorage;
import ru.revdaalex.lsp.*;
[ "ru.revdaalex.lsp" ]
ru.revdaalex.lsp;
1,337,411
public void setFontHeightInPoints(short height) { font.setFontHeight(( short ) (height * Font.TWIPS_PER_POINT)); }
void function(short height) { font.setFontHeight(( short ) (height * Font.TWIPS_PER_POINT)); }
/** * set the font height * @param height height in the familiar unit of measure - points * @see #setFontHeight(short) */
set the font height
setFontHeightInPoints
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/poi/org/apache/poi/hssf/usermodel/HSSFFont.java", "license": "gpl-2.0", "size": 8509 }
[ "org.apache.poi.ss.usermodel.Font" ]
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.*;
[ "org.apache.poi" ]
org.apache.poi;
1,710,952
public synchronized void putExtraData(Object key, Object value) { if( extraData == null ) extraData = new HashMap(); extraData.put(key, value); setDirtyFlag(true); }
synchronized void function(Object key, Object value) { if( extraData == null ) extraData = new HashMap(); extraData.put(key, value); setDirtyFlag(true); }
/** * Stores extra metadata in this object. * * @param key metadata key. * @param value metadata value. */
Stores extra metadata in this object
putExtraData
{ "repo_name": "tolo/JServer", "path": "src/java/com/teletalk/jserver/queue/QueueSystemMetaData.java", "license": "apache-2.0", "size": 6444 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,858,894
private PlaylistEntry getPlaylistEntry(int position) { if (mShuffled) { int newPos = mShuffledIndex.get(position); return mPlaylist.getEntryAtPos(newPos); } else { return mPlaylist.getEntryAtPos(position); } }
PlaylistEntry function(int position) { if (mShuffled) { int newPos = mShuffledIndex.get(position); return mPlaylist.getEntryAtPos(newPos); } else { return mPlaylist.getEntryAtPos(position); } }
/** * Private helper method that makes sure that the shuffled playlist is being used if needed. */
Private helper method that makes sure that the shuffled playlist is being used if needed
getPlaylistEntry
{ "repo_name": "andi34/tomahawk-android", "path": "src/org/tomahawk/tomahawk_android/services/PlaybackService.java", "license": "gpl-3.0", "size": 58686 }
[ "org.tomahawk.libtomahawk.collection.PlaylistEntry" ]
import org.tomahawk.libtomahawk.collection.PlaylistEntry;
import org.tomahawk.libtomahawk.collection.*;
[ "org.tomahawk.libtomahawk" ]
org.tomahawk.libtomahawk;
804,831
@Test(timeout = 30000) public void testNullQuorumAuthServerShouldReturnTrue() throws Exception { Socket socket = getSocketPair(); QuorumAuthServer authServer = new NullQuorumAuthServer(); BufferedInputStream is = new BufferedInputStream( socket.getInputStream()); // It will throw exception and fail the // test if any unexpected error. Not adding any extra assertion. authServer.authenticate(socket, new DataInputStream(is)); }
@Test(timeout = 30000) void function() throws Exception { Socket socket = getSocketPair(); QuorumAuthServer authServer = new NullQuorumAuthServer(); BufferedInputStream is = new BufferedInputStream( socket.getInputStream()); authServer.authenticate(socket, new DataInputStream(is)); }
/** * NullQuorumAuthServer should return true when no auth quorum packet * received and timed out. */
NullQuorumAuthServer should return true when no auth quorum packet received and timed out
testNullQuorumAuthServerShouldReturnTrue
{ "repo_name": "shayhatsor/zookeeper", "path": "src/java/test/org/apache/zookeeper/server/quorum/QuorumCnxManagerTest.java", "license": "apache-2.0", "size": 40814 }
[ "java.io.BufferedInputStream", "java.io.DataInputStream", "java.net.Socket", "org.apache.zookeeper.server.quorum.auth.NullQuorumAuthServer", "org.apache.zookeeper.server.quorum.auth.QuorumAuthServer", "org.junit.Test" ]
import java.io.BufferedInputStream; import java.io.DataInputStream; import java.net.Socket; import org.apache.zookeeper.server.quorum.auth.NullQuorumAuthServer; import org.apache.zookeeper.server.quorum.auth.QuorumAuthServer; import org.junit.Test;
import java.io.*; import java.net.*; import org.apache.zookeeper.server.quorum.auth.*; import org.junit.*;
[ "java.io", "java.net", "org.apache.zookeeper", "org.junit" ]
java.io; java.net; org.apache.zookeeper; org.junit;
2,028,813
private void computePathLogLikelihood( HashMap<DNCRPNode, Double> nodeLogLikelihoods, DNCRPNode curNode, HashMap<Integer, Integer>[] docLevelTokenCounts, double parentLlh) { int level = curNode.getLevel(); double nodeLlh = computeLogLikelihood(curNode, docLevelTokenCounts[level]); for (DNCRPNode child : curNode.getChildren()) { computePathLogLikelihood(nodeLogLikelihoods, child, docLevelTokenCounts, parentLlh + nodeLlh); } double storeLlh = parentLlh + nodeLlh; level++; while (level < L) { storeLlh += computeLogLikelihoodForNewNode(docLevelTokenCounts[level++]); } nodeLogLikelihoods.put(curNode, storeLlh); }
void function( HashMap<DNCRPNode, Double> nodeLogLikelihoods, DNCRPNode curNode, HashMap<Integer, Integer>[] docLevelTokenCounts, double parentLlh) { int level = curNode.getLevel(); double nodeLlh = computeLogLikelihood(curNode, docLevelTokenCounts[level]); for (DNCRPNode child : curNode.getChildren()) { computePathLogLikelihood(nodeLogLikelihoods, child, docLevelTokenCounts, parentLlh + nodeLlh); } double storeLlh = parentLlh + nodeLlh; level++; while (level < L) { storeLlh += computeLogLikelihoodForNewNode(docLevelTokenCounts[level++]); } nodeLogLikelihoods.put(curNode, storeLlh); }
/** * Recursively compute the log likelihood for all path in a tree * * @param nodeLogLikelihoods Hash table to store result * @param curNode The current node * @param docLevelTokenCounts The per-level observations of this documents. * This implicitly contains the information about the level assignments. * * @param parentLlh The log likelihood passed on from the parent node */
Recursively compute the log likelihood for all path in a tree
computePathLogLikelihood
{ "repo_name": "vietansegan/segan", "path": "src/sampler/dynamic/DHLDASampler.java", "license": "apache-2.0", "size": 82530 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
775,325
protected static void assertShardingIsCompleteAndPartitioned(List<Filter> filters, List<Description> descriptions) { Map<Filter, List<Description>> run = simulateTestRun(filters, descriptions); assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions); run = simulateSelfRandomizingTestRun(filters, descriptions); assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions); }
static void function(List<Filter> filters, List<Description> descriptions) { Map<Filter, List<Description>> run = simulateTestRun(filters, descriptions); assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions); run = simulateSelfRandomizingTestRun(filters, descriptions); assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions); }
/** * Tests that the sharding is complete (each test is run at least once) and * partitioned (each test is run at most once) -- in other words, that * each test is run exactly once. This is a requirement of all test * sharding functions. */
Tests that the sharding is complete (each test is run at least once) and partitioned (each test is run at most once) -- in other words, that each test is run exactly once. This is a requirement of all test sharding functions
assertShardingIsCompleteAndPartitioned
{ "repo_name": "aehlig/bazel", "path": "src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/testing/ShardingFilterTestCase.java", "license": "apache-2.0", "size": 12059 }
[ "java.util.List", "java.util.Map", "org.junit.runner.Description", "org.junit.runner.manipulation.Filter" ]
import java.util.List; import java.util.Map; import org.junit.runner.Description; import org.junit.runner.manipulation.Filter;
import java.util.*; import org.junit.runner.*; import org.junit.runner.manipulation.*;
[ "java.util", "org.junit.runner" ]
java.util; org.junit.runner;
1,224,017
public final Point2D div(final double d) throws GeometryException { if (d == 0.0) { throw new GeometryException("can't divide by 0"); } return mul(1.0 / d); }
final Point2D function(final double d) throws GeometryException { if (d == 0.0) { throw new GeometryException(STR); } return mul(1.0 / d); }
/** * Returns a new point by diving the coordinates of this point by 'd', * i.e. (this.x / d, this.y / d) * <p> * This Point2D is not modified. * * @param d double * @return a new Point2D */
Returns a new point by diving the coordinates of this point by 'd', i.e. (this.x / d, this.y / d) This Point2D is not modified
div
{ "repo_name": "ahome-it/lienzo-core", "path": "src/main/java/com/ait/lienzo/client/core/types/Point2D.java", "license": "apache-2.0", "size": 14672 }
[ "com.ait.lienzo.client.core.util.GeometryException" ]
import com.ait.lienzo.client.core.util.GeometryException;
import com.ait.lienzo.client.core.util.*;
[ "com.ait.lienzo" ]
com.ait.lienzo;
93,129
switch (type) { case "ZooKeeper": return new ZookeeperContainer(); default: throw new RuntimeException(String.format("Governance center [%s] is unknown.", type)); } }
switch (type) { case STR: return new ZookeeperContainer(); default: throw new RuntimeException(String.format(STR, type)); } }
/** * Create new instance of governance container. * * @param type governance center type * @return new instance of governance container */
Create new instance of governance container
newInstance
{ "repo_name": "apache/incubator-shardingsphere", "path": "shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/governance/GovernanceContainerFactory.java", "license": "apache-2.0", "size": 1756 }
[ "org.apache.shardingsphere.test.integration.framework.container.atomic.governance.impl.ZookeeperContainer" ]
import org.apache.shardingsphere.test.integration.framework.container.atomic.governance.impl.ZookeeperContainer;
import org.apache.shardingsphere.test.integration.framework.container.atomic.governance.impl.*;
[ "org.apache.shardingsphere" ]
org.apache.shardingsphere;
1,471,314