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 void copy(Max source, Max dest)
throws NullArgumentException {
MathUtils.checkNotNull(source);
MathUtils.checkNotNull(dest);
dest.setData(source.getDataRef());
dest.n = source.n;
dest.value = source.value;
} | static void function(Max source, Max dest) throws NullArgumentException { MathUtils.checkNotNull(source); MathUtils.checkNotNull(dest); dest.setData(source.getDataRef()); dest.n = source.n; dest.value = source.value; } | /**
* Copies source to dest.
* <p>Neither source nor dest can be null.</p>
*
* @param source Max to copy
* @param dest Max to copy to
* @throws NullArgumentException if either source or dest is null
*/ | Copies source to dest. Neither source nor dest can be null | copy | {
"repo_name": "tbepler/seq-svm",
"path": "src/org/apache/commons/math3/stat/descriptive/rank/Max.java",
"license": "mit",
"size": 5476
} | [
"org.apache.commons.math3.exception.NullArgumentException",
"org.apache.commons.math3.util.MathUtils"
] | import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.util.MathUtils; | import org.apache.commons.math3.exception.*; import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 842,411 |
@Test
public void whenAreaThenTwo() {
Point aPoint = new Point(1, 2);
Point bPoint = new Point(0, 0);
Point cPoint = new Point(2, 0);
Triangle triangle = new Triangle(aPoint, bPoint, cPoint);
double result = triangle.area();
double expected = 2D;
assertThat(result, closeTo(expected, 0.01));
} | void function() { Point aPoint = new Point(1, 2); Point bPoint = new Point(0, 0); Point cPoint = new Point(2, 0); Triangle triangle = new Triangle(aPoint, bPoint, cPoint); double result = triangle.area(); double expected = 2D; assertThat(result, closeTo(expected, 0.01)); } | /**
*Test for method "area".
*Tested the result of the method "area" for the triangle by three Point(x,y): aPoint(1,2), bPoint(0, 0), cPoint(2, 0).
*The exepted result is 2.0.
*/ | Test for method "area". Tested the result of the method "area" for the triangle by three Point(x,y): aPoint(1,2), bPoint(0, 0), cPoint(2, 0). The exepted result is 2.0 | whenAreaThenTwo | {
"repo_name": "artemprokopov/aprokopov",
"path": "chapter_001/src/test/java/ru/job4j/condition/TriangleTest.java",
"license": "apache-2.0",
"size": 5265
} | [
"org.hamcrest.number.IsCloseTo",
"org.junit.Assert"
] | import org.hamcrest.number.IsCloseTo; import org.junit.Assert; | import org.hamcrest.number.*; import org.junit.*; | [
"org.hamcrest.number",
"org.junit"
] | org.hamcrest.number; org.junit; | 893,626 |
public void
applyTrench() throws MapException {
int y = (int)(Math.random() * map.getTileSet(0).getMapHeight());
// Make it tend towards the equator.
y = ((map.getTileSet(0).getMapHeight()/2)+y)/2;
for (int x=getLeft(y); x <= getRight(y); x++) {
raise(x, y-2, -25);
raise(x, y-1, -50);
raise(x, y, -75);
raise(x, y+1, -50);
raise(x, y+2, -25);
}
} | void function() throws MapException { int y = (int)(Math.random() * map.getTileSet(0).getMapHeight()); y = ((map.getTileSet(0).getMapHeight()/2)+y)/2; for (int x=getLeft(y); x <= getRight(y); x++) { raise(x, y-2, -25); raise(x, y-1, -50); raise(x, y, -75); raise(x, y+1, -50); raise(x, y+2, -25); } } | /**
* Apply a trench which runs around the world east to west.
* The trench is quite deep, and very straight.
*/ | Apply a trench which runs around the world east to west. The trench is quite deep, and very straight | applyTrench | {
"repo_name": "samuelpenn/mapcraft",
"path": "mapcraft/src/net/sourceforge/mapcraft/generators/TerrestrialWorld.java",
"license": "gpl-2.0",
"size": 10715
} | [
"net.sourceforge.mapcraft.map.MapException"
] | import net.sourceforge.mapcraft.map.MapException; | import net.sourceforge.mapcraft.map.*; | [
"net.sourceforge.mapcraft"
] | net.sourceforge.mapcraft; | 1,726,559 |
public static InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return Libcore.os.android_getaddrinfo(node, hints, netId); } | public static InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return Libcore.os.android_getaddrinfo(node, hints, netId); } | /**
* See <a href="http://man7.org/linux/man-pages/man2/access.2.html">access(2)</a>.
*/ | See access(2) | access | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "luni/src/main/java/android/system/Os.java",
"license": "gpl-2.0",
"size": 28673
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 815,349 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btnCabecaEquipado = new javax.swing.JButton();
btnPescocoEquipado = new javax.swing.JButton();
btnPeitoralEquipado = new javax.swing.JButton();
btnBracoDireitoEquipado = new javax.swing.JButton();
btnBracoEsquerdoEquipado = new javax.swing.JButton();
btnCinturaoEquipado = new javax.swing.JButton();
btnPernaDireitaEquipado = new javax.swing.JButton();
btnPernaEsquerdaEquipado = new javax.swing.JButton();
btnBotaEquipado = new javax.swing.JButton();
btnAnelDireitoEquipado = new javax.swing.JButton();
btnAnelEsquerdoEquipado = new javax.swing.JButton();
btnCancelar = new javax.swing.JButton();
btnEquiparCabeca = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
selectItemCabeca = new javax.swing.JComboBox<String>();
btnEquiparPescoco = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
selectItemPescoco = new javax.swing.JComboBox<String>();
btnEquiparPeitoral = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
selectItemPeitoral = new javax.swing.JComboBox<String>();
btnEquiparBracoDireito = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
selectItemBracoDireito = new javax.swing.JComboBox<String>();
btnEquiparBracoEsquerdo = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
selectItemBracoEsquerdo = new javax.swing.JComboBox<String>();
btnEquiparCinturao = new javax.swing.JButton();
jLabel11 = new javax.swing.JLabel();
selectItemCinturao = new javax.swing.JComboBox<String>();
btnEquiparAnelEsquerdo = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
selectItemAnelEsquerdo = new javax.swing.JComboBox<String>();
btnEquiparAnelDireito = new javax.swing.JButton();
jLabel13 = new javax.swing.JLabel();
selectItemAnelDireito = new javax.swing.JComboBox<String>();
btnEquiparPernaDireita = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
selectItemPernaDireita = new javax.swing.JComboBox<String>();
btnEquiparPernaEsquerda = new javax.swing.JButton();
jLabel15 = new javax.swing.JLabel();
selectItemPernaEsquerda = new javax.swing.JComboBox<String>();
btnEquiparBota = new javax.swing.JButton();
jLabel16 = new javax.swing.JLabel();
selectItemBota = new javax.swing.JComboBox<String>();
btnEquiparArma = new javax.swing.JButton();
selectItemArma = new javax.swing.JComboBox<String>();
btnBotaEquipado1 = new javax.swing.JButton();
btnArmaEquipada = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
lblInfoItemTitulo = new javax.swing.JLabel();
lblPontosItem = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
lblPontosTotaisItensEquipados = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(1000, 650));
setResizable(false);
setSize(new java.awt.Dimension(660, 600));
getContentPane().setLayout(null); | @SuppressWarnings(STR) void function() { btnCabecaEquipado = new javax.swing.JButton(); btnPescocoEquipado = new javax.swing.JButton(); btnPeitoralEquipado = new javax.swing.JButton(); btnBracoDireitoEquipado = new javax.swing.JButton(); btnBracoEsquerdoEquipado = new javax.swing.JButton(); btnCinturaoEquipado = new javax.swing.JButton(); btnPernaDireitaEquipado = new javax.swing.JButton(); btnPernaEsquerdaEquipado = new javax.swing.JButton(); btnBotaEquipado = new javax.swing.JButton(); btnAnelDireitoEquipado = new javax.swing.JButton(); btnAnelEsquerdoEquipado = new javax.swing.JButton(); btnCancelar = new javax.swing.JButton(); btnEquiparCabeca = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); selectItemCabeca = new javax.swing.JComboBox<String>(); btnEquiparPescoco = new javax.swing.JButton(); jLabel7 = new javax.swing.JLabel(); selectItemPescoco = new javax.swing.JComboBox<String>(); btnEquiparPeitoral = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); selectItemPeitoral = new javax.swing.JComboBox<String>(); btnEquiparBracoDireito = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); selectItemBracoDireito = new javax.swing.JComboBox<String>(); btnEquiparBracoEsquerdo = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); selectItemBracoEsquerdo = new javax.swing.JComboBox<String>(); btnEquiparCinturao = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); selectItemCinturao = new javax.swing.JComboBox<String>(); btnEquiparAnelEsquerdo = new javax.swing.JButton(); jLabel12 = new javax.swing.JLabel(); selectItemAnelEsquerdo = new javax.swing.JComboBox<String>(); btnEquiparAnelDireito = new javax.swing.JButton(); jLabel13 = new javax.swing.JLabel(); selectItemAnelDireito = new javax.swing.JComboBox<String>(); btnEquiparPernaDireita = new javax.swing.JButton(); jLabel14 = new javax.swing.JLabel(); selectItemPernaDireita = new javax.swing.JComboBox<String>(); btnEquiparPernaEsquerda = new javax.swing.JButton(); jLabel15 = new javax.swing.JLabel(); selectItemPernaEsquerda = new javax.swing.JComboBox<String>(); btnEquiparBota = new javax.swing.JButton(); jLabel16 = new javax.swing.JLabel(); selectItemBota = new javax.swing.JComboBox<String>(); btnEquiparArma = new javax.swing.JButton(); selectItemArma = new javax.swing.JComboBox<String>(); btnBotaEquipado1 = new javax.swing.JButton(); btnArmaEquipada = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); lblInfoItemTitulo = new javax.swing.JLabel(); lblPontosItem = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); lblPontosTotaisItensEquipados = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(1000, 650)); setResizable(false); setSize(new java.awt.Dimension(660, 600)); getContentPane().setLayout(null); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "vitorlofonseca/nyte",
"path": "src/ControllerView/GerenciaItens.java",
"license": "gpl-3.0",
"size": 59771
} | [
"java.awt.Dimension",
"javax.swing.JComboBox"
] | import java.awt.Dimension; import javax.swing.JComboBox; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,221,132 |
@Test
public void testEnsureOnlySingleAuditor() throws Exception {
BookieServer auditor = verifyAuditor();
// shutdown bookie which is not an auditor
int indexOf = indexOfServer(auditor);
int bkIndexDownBookie;
if (indexOf < lastBookieIndex()) {
bkIndexDownBookie = indexOf + 1;
} else {
bkIndexDownBookie = indexOf - 1;
}
shutdownBookie(serverByIndex(bkIndexDownBookie));
startNewBookie();
startNewBookie();
// grace period for the auditor re-election if any
BookieServer newAuditor = waitForNewAuditor(auditor);
assertSame(
"Auditor re-election is not happened for auditor failure!",
auditor, newAuditor);
} | void function() throws Exception { BookieServer auditor = verifyAuditor(); int indexOf = indexOfServer(auditor); int bkIndexDownBookie; if (indexOf < lastBookieIndex()) { bkIndexDownBookie = indexOf + 1; } else { bkIndexDownBookie = indexOf - 1; } shutdownBookie(serverByIndex(bkIndexDownBookie)); startNewBookie(); startNewBookie(); BookieServer newAuditor = waitForNewAuditor(auditor); assertSame( STR, auditor, newAuditor); } | /**
* Test should ensure only one should act as Auditor. Starting/shutdown
* other than auditor bookie shouldn't initiate re-election and multiple
* auditors.
*/ | Test should ensure only one should act as Auditor. Starting/shutdown other than auditor bookie shouldn't initiate re-election and multiple auditors | testEnsureOnlySingleAuditor | {
"repo_name": "apache/bookkeeper",
"path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorBookieTest.java",
"license": "apache-2.0",
"size": 9856
} | [
"org.apache.bookkeeper.proto.BookieServer",
"org.junit.Assert"
] | import org.apache.bookkeeper.proto.BookieServer; import org.junit.Assert; | import org.apache.bookkeeper.proto.*; import org.junit.*; | [
"org.apache.bookkeeper",
"org.junit"
] | org.apache.bookkeeper; org.junit; | 1,466,534 |
@Override
public int getParameterCount() throws SQLException {
return realParameterMetaData.getParameterCount();
} | int function() throws SQLException { return realParameterMetaData.getParameterCount(); } | /**
* Retrieves the number of parameters in the <code>PreparedStatement</code>
* object for which this <code>ParameterMetaData</code> object contains
* information.
*
* @return the number of parameters
* @throws SQLException if a database access error occurs
* @since 1.4
*/ | Retrieves the number of parameters in the <code>PreparedStatement</code> object for which this <code>ParameterMetaData</code> object contains information | getParameterCount | {
"repo_name": "mattyb149/pentaho-orientdb-jdbc",
"path": "src/main/java/org/pentaho/community/di/database/orientdb/delegate/DelegateParameterMetaData.java",
"license": "apache-2.0",
"size": 8692
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,676,003 |
private void removeValueChangeListener(Item item, Object propertyId) {
Property<?> property = item.getItemProperty(propertyId);
if (property instanceof ValueChangeNotifier) {
((ValueChangeNotifier) property).removeListener(this);
}
} | void function(Item item, Object propertyId) { Property<?> property = item.getItemProperty(propertyId); if (property instanceof ValueChangeNotifier) { ((ValueChangeNotifier) property).removeListener(this); } } | /**
* Remove this container as a listener for the given property.
*
* @param item
* The {@link Item} that contains the property
* @param propertyId
* The id of the property
*/ | Remove this container as a listener for the given property | removeValueChangeListener | {
"repo_name": "carrchang/vaadin",
"path": "server/src/com/vaadin/data/util/AbstractBeanContainer.java",
"license": "apache-2.0",
"size": 30216
} | [
"com.vaadin.data.Item",
"com.vaadin.data.Property"
] | import com.vaadin.data.Item; import com.vaadin.data.Property; | import com.vaadin.data.*; | [
"com.vaadin.data"
] | com.vaadin.data; | 2,358,336 |
List<Noticia> noticias = noticiaService.findUltimasNoticias();
assertNotNull(noticias);
} | List<Noticia> noticias = noticiaService.findUltimasNoticias(); assertNotNull(noticias); } | /**
* Test method by {@link NoticiaServiceImpl#findUltimasNoticias()}
*
* @author <a href="elmerdiazlazo@gmail.com">Elmer Jose Diaz Lazo</a>
* @date 31/10/2013
*/ | Test method by <code>NoticiaServiceImpl#findUltimasNoticias()</code> | findUltimasNoticiasTest | {
"repo_name": "kaisenlean/troca.co",
"path": "src/test/java/co/icesi/troca/test/service/noticia/NoticiaServiceImplTest.java",
"license": "gpl-2.0",
"size": 3927
} | [
"co.icesi.troca.model.noticia.Noticia",
"java.util.List",
"org.junit.Assert"
] | import co.icesi.troca.model.noticia.Noticia; import java.util.List; import org.junit.Assert; | import co.icesi.troca.model.noticia.*; import java.util.*; import org.junit.*; | [
"co.icesi.troca",
"java.util",
"org.junit"
] | co.icesi.troca; java.util; org.junit; | 2,443,721 |
public static LocationLocalDataSource provideLocationLocalDataSource(@NonNull Context context) {
checkNotNull(context);
return LocationLocalDataSourceImpl.getInstance(context);
} | static LocationLocalDataSource function(@NonNull Context context) { checkNotNull(context); return LocationLocalDataSourceImpl.getInstance(context); } | /**
* Provides {@code LocationLocalDataSourceImpl} concrete implementation for {@code FrameLocalDataSource}.
* @param context the context used for the local data source.
* @return {@code FrameLocalDataSourceImpl}.
*/ | Provides LocationLocalDataSourceImpl concrete implementation for FrameLocalDataSource | provideLocationLocalDataSource | {
"repo_name": "openstreetview/android",
"path": "app/src/main/java/com/telenav/osv/common/Injection.java",
"license": "lgpl-3.0",
"size": 32142
} | [
"android.content.Context",
"androidx.annotation.NonNull",
"com.google.common.base.Preconditions",
"com.telenav.osv.data.location.datasource.LocationLocalDataSource",
"com.telenav.osv.data.location.datasource.LocationLocalDataSourceImpl"
] | import android.content.Context; import androidx.annotation.NonNull; import com.google.common.base.Preconditions; import com.telenav.osv.data.location.datasource.LocationLocalDataSource; import com.telenav.osv.data.location.datasource.LocationLocalDataSourceImpl; | import android.content.*; import androidx.annotation.*; import com.google.common.base.*; import com.telenav.osv.data.location.datasource.*; | [
"android.content",
"androidx.annotation",
"com.google.common",
"com.telenav.osv"
] | android.content; androidx.annotation; com.google.common; com.telenav.osv; | 2,028,510 |
public DataTypeAdapter<T>[] getDataAdapters(String globalVisibility); | DataTypeAdapter<T>[] function(String globalVisibility); | /**
* Get all writable adapters used by this plugin
*
* @param globalVisibility If on the command-line the user specifies a global visibility to write
* to the visibility column in GeoWave, it is passed along here. It is assumed that this is
* the same visibility string that will be passed to IngestPluginBase.toGeoWaveData()
* @return An array of adapters that may be used by this plugin
*/ | Get all writable adapters used by this plugin | getDataAdapters | {
"repo_name": "spohnan/geowave",
"path": "core/store/src/main/java/org/locationtech/geowave/core/store/ingest/DataAdapterProvider.java",
"license": "apache-2.0",
"size": 1636
} | [
"org.locationtech.geowave.core.store.api.DataTypeAdapter"
] | import org.locationtech.geowave.core.store.api.DataTypeAdapter; | import org.locationtech.geowave.core.store.api.*; | [
"org.locationtech.geowave"
] | org.locationtech.geowave; | 599,803 |
public void update(boolean reconfigureSourceViewer) {
// TODO: gets called way to often on editor opening
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { | void function(boolean reconfigureSourceViewer) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { | /**
* Updates the editor. Needed when some changes are made to the way the editor
* content should be displayed or when the behaviour of the editor should
* change.<br>
* <br>
* <b>Note:</b> This method can be called from any Thread
*
* @param reconfigureSourceViewer
* Whether it is necessary to reconfigure the sourceVieweer
*/ | Updates the editor. Needed when some changes are made to the way the editor content should be displayed or when the behaviour of the editor should change. Note: This method can be called from any Thread | update | {
"repo_name": "Krzmbrzl/SQF-EclipsePlugin",
"path": "plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicCodeEditor.java",
"license": "mit",
"size": 21058
} | [
"org.eclipse.ui.PlatformUI"
] | import org.eclipse.ui.PlatformUI; | import org.eclipse.ui.*; | [
"org.eclipse.ui"
] | org.eclipse.ui; | 2,695,722 |
@Test
public void testShortCircuitFallbackCounter() {
TestCircuitBreaker circuitBreaker = new TestCircuitBreaker().setForceShortCircuit(true);
try {
new KnownFailureTestCommandWithFallback(circuitBreaker).execute();
assertEquals(1, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED));
KnownFailureTestCommandWithFallback command = new KnownFailureTestCommandWithFallback(circuitBreaker);
command.execute();
assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED));
// will be -1 because it never attempted execution
assertTrue(command.getExecutionTimeInMilliseconds() == -1);
assertTrue(command.isResponseShortCircuited());
assertFalse(command.isResponseTimedOut());
// because it was short-circuited to a fallback we don't count an error
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT));
} catch (Exception e) {
e.printStackTrace();
fail("We should have received a response from the fallback.");
}
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE));
assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_MISSING));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED));
assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT));
assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE));
assertEquals(100, circuitBreaker.metrics.getHealthCounts().getErrorPercentage());
assertEquals(0, circuitBreaker.metrics.getCurrentConcurrentExecutionCount());
assertSaneHystrixRequestLog(2);
} | void function() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker().setForceShortCircuit(true); try { new KnownFailureTestCommandWithFallback(circuitBreaker).execute(); assertEquals(1, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); KnownFailureTestCommandWithFallback command = new KnownFailureTestCommandWithFallback(circuitBreaker); command.execute(); assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertTrue(command.getExecutionTimeInMilliseconds() == -1); assertTrue(command.isResponseShortCircuited()); assertFalse(command.isResponseTimedOut()); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); } catch (Exception e) { e.printStackTrace(); fail(STR); } assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE)); assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_MISSING)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED)); assertEquals(2, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, circuitBreaker.metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE)); assertEquals(100, circuitBreaker.metrics.getHealthCounts().getErrorPercentage()); assertEquals(0, circuitBreaker.metrics.getCurrentConcurrentExecutionCount()); assertSaneHystrixRequestLog(2); } | /**
* Test that the circuit-breaker counts a command execution timeout as a 'timeout' and not just failure.
*/ | Test that the circuit-breaker counts a command execution timeout as a 'timeout' and not just failure | testShortCircuitFallbackCounter | {
"repo_name": "davidkarlsen/Hystrix",
"path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java",
"license": "apache-2.0",
"size": 282697
} | [
"com.netflix.hystrix.HystrixCircuitBreakerTest",
"com.netflix.hystrix.util.HystrixRollingNumberEvent",
"org.junit.Assert"
] | import com.netflix.hystrix.HystrixCircuitBreakerTest; import com.netflix.hystrix.util.HystrixRollingNumberEvent; import org.junit.Assert; | import com.netflix.hystrix.*; import com.netflix.hystrix.util.*; import org.junit.*; | [
"com.netflix.hystrix",
"org.junit"
] | com.netflix.hystrix; org.junit; | 2,046,045 |
@SuppressWarnings("unchecked")
protected List<Observation<?>> querySeriesObservation(GetResultRequest request,
Collection<String> featureIdentifiers, String procedure, Session session) throws OwsExceptionReport {
final Criteria c = createCriteriaFor(AbstractSeriesObservation.class, session);
addSpatialFilteringProfileRestrictions(c, request, session);
List<Series> series = DaoFactory.getInstance().getSeriesDAO().getSeries(procedure, request.getObservedProperty(), request.getOffering(), featureIdentifiers, session);
if (CollectionHelper.isEmpty(series)) {
return null;
} else {
c.add(Restrictions.in(AbstractSeriesObservation.SERIES, series));
}
if (request.isSetOffering()) {
addOfferingRestriction(c, request.getOffering());
}
if (request.getTemporalFilter() != null && !request.getTemporalFilter().isEmpty()) {
addTemporalFilter(c, request.getTemporalFilter());
}
LOGGER.debug("QUERY queryObservation(request, featureIdentifiers): {}", HibernateHelper.getSqlString(c));
return c.list();
} | @SuppressWarnings(STR) List<Observation<?>> function(GetResultRequest request, Collection<String> featureIdentifiers, String procedure, Session session) throws OwsExceptionReport { final Criteria c = createCriteriaFor(AbstractSeriesObservation.class, session); addSpatialFilteringProfileRestrictions(c, request, session); List<Series> series = DaoFactory.getInstance().getSeriesDAO().getSeries(procedure, request.getObservedProperty(), request.getOffering(), featureIdentifiers, session); if (CollectionHelper.isEmpty(series)) { return null; } else { c.add(Restrictions.in(AbstractSeriesObservation.SERIES, series)); } if (request.isSetOffering()) { addOfferingRestriction(c, request.getOffering()); } if (request.getTemporalFilter() != null && !request.getTemporalFilter().isEmpty()) { addTemporalFilter(c, request.getTemporalFilter()); } LOGGER.debug(STR, HibernateHelper.getSqlString(c)); return c.list(); } | /**
* Query series observations from database depending on requested filters
*
* @param request
* GetObservation request
* @param featureIdentifiers
* Set of feature identifiers. If <tt>null</tt>, query filter
* will not be added. If <tt>empty</tt>, <tt>null</tt> will be
* returned.
* @param procedure
* @param session
* Hibernate session
* @return List of Observation objects
* @throws OwsExceptionReport
* If an error occurs.
*/ | Query series observations from database depending on requested filters | querySeriesObservation | {
"repo_name": "ahuarte47/SOS",
"path": "hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java",
"license": "gpl-2.0",
"size": 14978
} | [
"java.util.Collection",
"java.util.List",
"org.hibernate.Criteria",
"org.hibernate.Session",
"org.hibernate.criterion.Restrictions",
"org.n52.sos.ds.hibernate.dao.DaoFactory",
"org.n52.sos.ds.hibernate.entities.observation.Observation",
"org.n52.sos.ds.hibernate.entities.observation.series.AbstractSer... | import java.util.Collection; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import org.n52.sos.ds.hibernate.dao.DaoFactory; import org.n52.sos.ds.hibernate.entities.observation.Observation; import org.n52.sos.ds.hibernate.entities.observation.series.AbstractSeriesObservation; import org.n52.sos.ds.hibernate.entities.observation.series.Series; import org.n52.sos.ds.hibernate.util.HibernateHelper; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.request.GetResultRequest; import org.n52.sos.util.CollectionHelper; | import java.util.*; import org.hibernate.*; import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.dao.*; import org.n52.sos.ds.hibernate.entities.observation.*; import org.n52.sos.ds.hibernate.entities.observation.series.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.ogc.ows.*; import org.n52.sos.request.*; import org.n52.sos.util.*; | [
"java.util",
"org.hibernate",
"org.hibernate.criterion",
"org.n52.sos"
] | java.util; org.hibernate; org.hibernate.criterion; org.n52.sos; | 2,683,704 |
@Test
public void checkAllMatrixMult() {
int numChecked = 0;
Method methods[] = CCommonOps.class.getMethods();
for (Method method : methods) {
String name = method.getName();
if( !name.startsWith("mult"))
continue;
// System.out.println(name);
Class[] params = method.getParameterTypes();
boolean add = name.contains("Add");
boolean hasAlpha = double.class == params[0];
try {
TestCMatrixMatrixMult.check(method, add, hasAlpha);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
numChecked++;
}
assertEquals(4,numChecked);
} | void function() { int numChecked = 0; Method methods[] = CCommonOps.class.getMethods(); for (Method method : methods) { String name = method.getName(); if( !name.startsWith("mult")) continue; Class[] params = method.getParameterTypes(); boolean add = name.contains("Add"); boolean hasAlpha = double.class == params[0]; try { TestCMatrixMatrixMult.check(method, add, hasAlpha); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } numChecked++; } assertEquals(4,numChecked); } | /**
* Make sure the multiplication methods here have the same behavior as the ones in MatrixMatrixMult.
*/ | Make sure the multiplication methods here have the same behavior as the ones in MatrixMatrixMult | checkAllMatrixMult | {
"repo_name": "raydtang/ejml",
"path": "main/denseC64/test/org/ejml/ops/TestCCommonOps.java",
"license": "apache-2.0",
"size": 21552
} | [
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method",
"org.ejml.alg.dense.mult.TestCMatrixMatrixMult",
"org.junit.Assert"
] | import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.ejml.alg.dense.mult.TestCMatrixMatrixMult; import org.junit.Assert; | import java.lang.reflect.*; import org.ejml.alg.dense.mult.*; import org.junit.*; | [
"java.lang",
"org.ejml.alg",
"org.junit"
] | java.lang; org.ejml.alg; org.junit; | 2,491,066 |
EList<CreateProcedureType> getCreateProcedure();
| EList<CreateProcedureType> getCreateProcedure(); | /**
* Returns the value of the '<em><b>Create Procedure</b></em>' containment reference list.
* The list contents are of type {@link org.liquibase.xml.ns.dbchangelog.CreateProcedureType}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Create Procedure</em>' containment reference list.
* @see org.liquibase.xml.ns.dbchangelog.DbchangelogPackage#getRollbackType_CreateProcedure()
* @model containment="true" transient="true" volatile="true" derived="true"
* extendedMetaData="kind='element' name='createProcedure' namespace='##targetNamespace' group='#ChangeSetChildren:1'"
* @generated
*/ | Returns the value of the 'Create Procedure' containment reference list. The list contents are of type <code>org.liquibase.xml.ns.dbchangelog.CreateProcedureType</code>. | getCreateProcedure | {
"repo_name": "Treehopper/EclipseAugments",
"path": "liquibase-editor/eu.hohenegger.xsd.liquibase/src-gen/org/liquibase/xml/ns/dbchangelog/RollbackType.java",
"license": "epl-1.0",
"size": 44628
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 733,275 |
public void setOriginal_text(String original_text) {
this.original_text = original_text;
}
public Document (String original_text) {
this.original_text = original_text;
this.text_units = new HashMap<String, ArrayList<Annotation>>();
this.instance_change_log = new ArrayList<String>();
}
public Document () {
this.text_units = new HashMap<String, ArrayList<Annotation>>();
this.instance_change_log = new ArrayList<String>();
}
| void function(String original_text) { this.original_text = original_text; } public Document (String original_text) { this.original_text = original_text; this.text_units = new HashMap<String, ArrayList<Annotation>>(); this.instance_change_log = new ArrayList<String>(); } public Document () { this.text_units = new HashMap<String, ArrayList<Annotation>>(); this.instance_change_log = new ArrayList<String>(); } | /**
* Set the text of the document.
* @param original_text
*/ | Set the text of the document | setOriginal_text | {
"repo_name": "AndreasMuellerAtStuttgart/TEANLIS",
"path": "src/Document.java",
"license": "gpl-2.0",
"size": 15878
} | [
"java.util.ArrayList",
"java.util.HashMap"
] | import java.util.ArrayList; import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,313,139 |
protected String getAccessTokenAndCacheUserData(TestSettings settings) throws Exception {
return getAccessTokenAndCacheUserData(settings, true);
} | String function(TestSettings settings) throws Exception { return getAccessTokenAndCacheUserData(settings, true); } | /**
* Gets an access token that's been cached by the test class or obtains a new access token if a cached token is not found.
*/ | Gets an access token that's been cached by the test class or obtains a new access token if a cached token is not found | getAccessTokenAndCacheUserData | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.oauth.oidc_fat.common/src/com/ibm/ws/security/oauth_oidc/fat/commonTest/app/passwords_tokens/ListAppPasswordsOrTokensTests.java",
"license": "epl-1.0",
"size": 19721
} | [
"com.ibm.ws.security.oauth_oidc.fat.commonTest.TestSettings"
] | import com.ibm.ws.security.oauth_oidc.fat.commonTest.TestSettings; | import com.ibm.ws.security.oauth_oidc.fat.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 639,480 |
public static void saveBestResult(MainResult mainResult) {
ResultParsing.saveBestResult(mainResult);
} | static void function(MainResult mainResult) { ResultParsing.saveBestResult(mainResult); } | /**
* Salveaza cel mai bun rezultat
* @param mainResult
*/ | Salveaza cel mai bun rezultat | saveBestResult | {
"repo_name": "genomeartist/genomeartist",
"path": "sources_java/guiTransposon/src/ro/genomeartist/gui/controller/externalcalls/ExternalLink.java",
"license": "gpl-3.0",
"size": 20669
} | [
"ro.genomeartist.gui.controller.query.MainResult"
] | import ro.genomeartist.gui.controller.query.MainResult; | import ro.genomeartist.gui.controller.query.*; | [
"ro.genomeartist.gui"
] | ro.genomeartist.gui; | 2,705,905 |
MethodInvocation getMethodInvocation(); | MethodInvocation getMethodInvocation(); | /**
* Allows to access information about method which is under retry
* @return MethodInvocation of the advised method
*/ | Allows to access information about method which is under retry | getMethodInvocation | {
"repo_name": "Playtika/spring-retry",
"path": "src/main/java/org/springframework/retry/RetryCallback.java",
"license": "apache-2.0",
"size": 1523
} | [
"org.aopalliance.intercept.MethodInvocation"
] | import org.aopalliance.intercept.MethodInvocation; | import org.aopalliance.intercept.*; | [
"org.aopalliance.intercept"
] | org.aopalliance.intercept; | 403,438 |
protected EmrCluster terminateClusterImpl(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, boolean overrideTerminationProtection) throws Exception
{
AwsParamsDto awsParamsDto = emrHelper.getAwsParamsDto();
// Perform the request validation.
emrHelper.validateEmrClusterKey(emrClusterAlternateKeyDto);
// Get the namespace and ensure it exists.
NamespaceEntity namespaceEntity = herdDaoHelper.getNamespaceEntity(emrClusterAlternateKeyDto.getNamespace());
// Get the EMR cluster definition and ensure it exists.
EmrClusterDefinitionEntity emrClusterDefinitionEntity =
herdDaoHelper.getEmrClusterDefinitionEntity(emrClusterAlternateKeyDto.getNamespace(), emrClusterAlternateKeyDto.getEmrClusterDefinitionName());
String clusterId = null;
String clusterName =
emrHelper.buildEmrClusterName(namespaceEntity.getCode(), emrClusterDefinitionEntity.getName(), emrClusterAlternateKeyDto.getEmrClusterName());
try
{
clusterId = emrDao.terminateEmrCluster(clusterName, overrideTerminationProtection, awsParamsDto);
}
catch (AmazonServiceException ex)
{
handleAmazonException(ex, "An Amazon exception occurred while terminating EMR cluster with name \"" + clusterName + "\".");
}
return createEmrClusterFromRequest(clusterId, namespaceEntity.getCode(), emrClusterDefinitionEntity.getName(),
emrClusterAlternateKeyDto.getEmrClusterName(), emrDao.getEmrClusterStatusById(clusterId, awsParamsDto), null, null, null);
} | EmrCluster function(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, boolean overrideTerminationProtection) throws Exception { AwsParamsDto awsParamsDto = emrHelper.getAwsParamsDto(); emrHelper.validateEmrClusterKey(emrClusterAlternateKeyDto); NamespaceEntity namespaceEntity = herdDaoHelper.getNamespaceEntity(emrClusterAlternateKeyDto.getNamespace()); EmrClusterDefinitionEntity emrClusterDefinitionEntity = herdDaoHelper.getEmrClusterDefinitionEntity(emrClusterAlternateKeyDto.getNamespace(), emrClusterAlternateKeyDto.getEmrClusterDefinitionName()); String clusterId = null; String clusterName = emrHelper.buildEmrClusterName(namespaceEntity.getCode(), emrClusterDefinitionEntity.getName(), emrClusterAlternateKeyDto.getEmrClusterName()); try { clusterId = emrDao.terminateEmrCluster(clusterName, overrideTerminationProtection, awsParamsDto); } catch (AmazonServiceException ex) { handleAmazonException(ex, STRSTR\"."); } return createEmrClusterFromRequest(clusterId, namespaceEntity.getCode(), emrClusterDefinitionEntity.getName(), emrClusterAlternateKeyDto.getEmrClusterName(), emrDao.getEmrClusterStatusById(clusterId, awsParamsDto), null, null, null); } | /**
* Terminates the EMR Cluster.
*
* @param emrClusterAlternateKeyDto the EMR cluster alternate key
* @param overrideTerminationProtection parameter for whether to override termination protection
*
* @return the terminated EMR cluster object
* @throws Exception if there were any errors while terminating the cluster.
*/ | Terminates the EMR Cluster | terminateClusterImpl | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/EmrServiceImpl.java",
"license": "apache-2.0",
"size": 55398
} | [
"com.amazonaws.AmazonServiceException",
"org.finra.herd.model.api.xml.EmrCluster",
"org.finra.herd.model.dto.AwsParamsDto",
"org.finra.herd.model.dto.EmrClusterAlternateKeyDto",
"org.finra.herd.model.jpa.EmrClusterDefinitionEntity",
"org.finra.herd.model.jpa.NamespaceEntity"
] | import com.amazonaws.AmazonServiceException; import org.finra.herd.model.api.xml.EmrCluster; import org.finra.herd.model.dto.AwsParamsDto; import org.finra.herd.model.dto.EmrClusterAlternateKeyDto; import org.finra.herd.model.jpa.EmrClusterDefinitionEntity; import org.finra.herd.model.jpa.NamespaceEntity; | import com.amazonaws.*; import org.finra.herd.model.api.xml.*; import org.finra.herd.model.dto.*; import org.finra.herd.model.jpa.*; | [
"com.amazonaws",
"org.finra.herd"
] | com.amazonaws; org.finra.herd; | 2,631,798 |
public static uncompensatedBarometricPressure_r13Type fromPerUnaligned(byte[] encodedBytes) {
uncompensatedBarometricPressure_r13Type result = new uncompensatedBarometricPressure_r13Type();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
} | static uncompensatedBarometricPressure_r13Type function(byte[] encodedBytes) { uncompensatedBarometricPressure_r13Type result = new uncompensatedBarometricPressure_r13Type(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new uncompensatedBarometricPressure_r13Type from encoded stream.
*/ | Creates a new uncompensatedBarometricPressure_r13Type from encoded stream | fromPerUnaligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/Sensor_MeasurementList_r13.java",
"license": "apache-2.0",
"size": 13723
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
] | import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
] | com.google.location; | 1,182,122 |
public void allocateAsync(AllocateRequest request,
AsyncCallback<AllocateResponse> callback) throws YarnException {
try {
this.requestQueue.put(new AsyncAllocateRequestInfo(request, callback));
} catch (InterruptedException ex) {
// Should not happen as we have MAX_INT queue length
LOG.debug("Interrupted while waiting to put on response queue", ex);
}
// Two possible cases why the UAM is not successfully registered yet:
// 1. launchUAM is not called at all. Should throw here.
// 2. launchUAM is called but hasn't successfully returned.
//
// In case 2, we have already save the allocate request above, so if the
// registration succeed later, no request is lost.
if (this.rmProxyRelayer == null) {
if (this.connectionInitiated) {
LOG.info("Unmanaged AM still not successfully launched/registered yet."
+ " Saving the allocate request and send later.");
} else {
throw new YarnException(
"AllocateAsync should not be called before launchUAM");
}
}
} | void function(AllocateRequest request, AsyncCallback<AllocateResponse> callback) throws YarnException { try { this.requestQueue.put(new AsyncAllocateRequestInfo(request, callback)); } catch (InterruptedException ex) { LOG.debug(STR, ex); } if (this.rmProxyRelayer == null) { if (this.connectionInitiated) { LOG.info(STR + STR); } else { throw new YarnException( STR); } } } | /**
* Sends the specified heart beat request to the resource manager and invokes
* the callback asynchronously with the response.
*
* @param request the allocate request
* @param callback the callback method for the request
* @throws YarnException if registerAM is not called yet
*/ | Sends the specified heart beat request to the resource manager and invokes the callback asynchronously with the response | allocateAsync | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/uam/UnmanagedApplicationManager.java",
"license": "apache-2.0",
"size": 25262
} | [
"org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest",
"org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse",
"org.apache.hadoop.yarn.exceptions.YarnException",
"org.apache.hadoop.yarn.util.AsyncCallback"
] | import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest; import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.util.AsyncCallback; | import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*; import org.apache.hadoop.yarn.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,883,775 |
public List<IdeaDetail> getIdeasForListing(RetrievalInfo retrievalInfo) {
List<IdeaDetail> ideaDtoList = null;
retrievalInfo.setNoOfRecords(retrievalInfo.getNoOfRecords() + ONE);
List<Idea> ideaList = ideaService.getIdeas(retrievalInfo);
if (ideaList != null && ideaList.size() > 0) {
ideaDtoList = convertToIdeaDetailList(ideaList, true, true, true, true);
}
return ideaDtoList;
} | List<IdeaDetail> function(RetrievalInfo retrievalInfo) { List<IdeaDetail> ideaDtoList = null; retrievalInfo.setNoOfRecords(retrievalInfo.getNoOfRecords() + ONE); List<Idea> ideaList = ideaService.getIdeas(retrievalInfo); if (ideaList != null && ideaList.size() > 0) { ideaDtoList = convertToIdeaDetailList(ideaList, true, true, true, true); } return ideaDtoList; } | /**
* Retrieves the list of published ideas along with their tags and teams.
*
* @param retrievalInfo the idea list retrieval information
* @return Returns the list of IdeaDetail objects
*/ | Retrieves the list of published ideas along with their tags and teams | getIdeasForListing | {
"repo_name": "akrain/thoughtsite",
"path": "src/main/java/com/google/ie/common/builder/IdeaBuilder.java",
"license": "apache-2.0",
"size": 10732
} | [
"com.google.ie.business.domain.Idea",
"com.google.ie.dto.IdeaDetail",
"com.google.ie.dto.RetrievalInfo",
"java.util.List"
] | import com.google.ie.business.domain.Idea; import com.google.ie.dto.IdeaDetail; import com.google.ie.dto.RetrievalInfo; import java.util.List; | import com.google.ie.business.domain.*; import com.google.ie.dto.*; import java.util.*; | [
"com.google.ie",
"java.util"
] | com.google.ie; java.util; | 2,389,467 |
public static Properties getProperties() {
return PropertiesUtil.getProperties();
} | static Properties function() { return PropertiesUtil.getProperties(); } | /**
* Returns the properties accessible for this system.
*
* @return a Properties object
*/ | Returns the properties accessible for this system | getProperties | {
"repo_name": "elsiklab/intermine",
"path": "intermine/api/main/src/org/intermine/api/query/PathQueryAPI.java",
"license": "lgpl-2.1",
"size": 6747
} | [
"java.util.Properties",
"org.intermine.util.PropertiesUtil"
] | import java.util.Properties; import org.intermine.util.PropertiesUtil; | import java.util.*; import org.intermine.util.*; | [
"java.util",
"org.intermine.util"
] | java.util; org.intermine.util; | 1,725,926 |
public JDialog createDialog(String uiKey, JFrame owner) {
JDialog d = new JDialog(owner);
initDialog(d, uiKey);
return d;
} | JDialog function(String uiKey, JFrame owner) { JDialog d = new JDialog(owner); initDialog(d, uiKey); return d; } | /**
* Create an empty dialog. <br>
* See <code>initDialog(JDialog,String)</code> for required resources.
* @param uiKey the base name of the resource to be used
* @param owner the parent frame of this dialog
* @return an empty dialog component
* @see #initDialog
*/ | Create an empty dialog. See <code>initDialog(JDialog,String)</code> for required resources | createDialog | {
"repo_name": "otmarjr/jtreg-fork",
"path": "dist-with-aspectj/jtreg/lib/javatest/com/sun/javatest/tool/UIFactory.java",
"license": "gpl-2.0",
"size": 141944
} | [
"javax.swing.JDialog",
"javax.swing.JFrame"
] | import javax.swing.JDialog; import javax.swing.JFrame; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,112,936 |
public void fillInLines(OrderDTO dto, Integer entityId)
throws NamingException, SessionInternalError {
ItemBL itemBl = new ItemBL();
for (OrderLineDTO line : dto.getLines()) {
itemBl.set(line.getItemId());
Integer languageId = itemBl.getEntity().getEntity().
getLanguageId();
// this is needed for the basic pluggable task to work
ItemDAS itemDas = new ItemDAS();
line.setItem(itemDas.find(line.getItemId()));
if (line.getPrice() == null) {
line.setPrice(itemBl.getPrice(dto.getUserId(),
dto.getCurrencyId(), entityId));
}
if (line.getDescription() == null) {
line.setDescription(itemBl.getEntity().getDescription(
languageId));
}
}
}
| void function(OrderDTO dto, Integer entityId) throws NamingException, SessionInternalError { ItemBL itemBl = new ItemBL(); for (OrderLineDTO line : dto.getLines()) { itemBl.set(line.getItemId()); Integer languageId = itemBl.getEntity().getEntity(). getLanguageId(); ItemDAS itemDas = new ItemDAS(); line.setItem(itemDas.find(line.getItemId())); if (line.getPrice() == null) { line.setPrice(itemBl.getPrice(dto.getUserId(), dto.getCurrencyId(), entityId)); } if (line.getDescription() == null) { line.setDescription(itemBl.getEntity().getDescription( languageId)); } } } | /**
* To be called from the http api, this simply looks for lines
* in the order that lack some fields, it finds that info based
* in the item.
* @param dto
*/ | To be called from the http api, this simply looks for lines in the order that lack some fields, it finds that info based in the item | fillInLines | {
"repo_name": "othmanelmoulat/jbilling-2.2-Extentions",
"path": "src/classes/com/sapienter/jbilling/server/order/OrderBL.java",
"license": "agpl-3.0",
"size": 62032
} | [
"com.sapienter.jbilling.common.SessionInternalError",
"com.sapienter.jbilling.server.item.ItemBL",
"com.sapienter.jbilling.server.item.db.ItemDAS",
"com.sapienter.jbilling.server.order.db.OrderDTO",
"com.sapienter.jbilling.server.order.db.OrderLineDTO",
"javax.naming.NamingException"
] | import com.sapienter.jbilling.common.SessionInternalError; import com.sapienter.jbilling.server.item.ItemBL; import com.sapienter.jbilling.server.item.db.ItemDAS; import com.sapienter.jbilling.server.order.db.OrderDTO; import com.sapienter.jbilling.server.order.db.OrderLineDTO; import javax.naming.NamingException; | import com.sapienter.jbilling.common.*; import com.sapienter.jbilling.server.item.*; import com.sapienter.jbilling.server.item.db.*; import com.sapienter.jbilling.server.order.db.*; import javax.naming.*; | [
"com.sapienter.jbilling",
"javax.naming"
] | com.sapienter.jbilling; javax.naming; | 582,167 |
public Subject getInvocationSubject() {
return invocationSubject;
} | Subject function() { return invocationSubject; } | /**
* Gets the invocation subject.
*/ | Gets the invocation subject | getInvocationSubject | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security/src/com/ibm/ws/security/context/internal/SubjectThreadContext.java",
"license": "epl-1.0",
"size": 1601
} | [
"javax.security.auth.Subject"
] | import javax.security.auth.Subject; | import javax.security.auth.*; | [
"javax.security"
] | javax.security; | 1,662,057 |
try {
app = new DCLApplication(new InetSocketAddress(InetAddress.getLocalHost(), 2000), Sblit.APPLICATION_IDENTIFIER);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "DCL Service must be installed and running on your device!\nPlease start Sblit again after you made sure that DCL is running!\nDetailed Error: " +
e.getMessage(), "DCL not running", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
System.exit(0);
}
String os = System.getProperty("os.name");
System.out.println(os);
if(os.contains("Windows")){
configurationDirectory = new File(System.getenv("APPDATA") + "/SBLIT/");
} else {
configurationDirectory = new File("~/.SBLIT/");
}
System.out.println(configurationDirectory.getAbsolutePath());
// TODO AddressConfiguration addressConfiguration = new AddressConfiguration(configurationDirectory, os);
// TODO privateAddressKey = addressConfiguration.getPrivateKey();
// TODO publicAddressKey = addressConfiguration.getPublicKey();
DataDirectoryChooser dataDirectoryChooser = new DataDirectoryChooser(configurationDirectory);
dataDirectory = dataDirectoryChooser.getDataDirectory();
//TODO passwordConfiguration
}
| try { app = new DCLApplication(new InetSocketAddress(InetAddress.getLocalHost(), 2000), Sblit.APPLICATION_IDENTIFIER); } catch (Exception e) { JOptionPane.showMessageDialog(null, STR + e.getMessage(), STR, JOptionPane.ERROR_MESSAGE); e.printStackTrace(); System.exit(0); } String os = System.getProperty(STR); System.out.println(os); if(os.contains(STR)){ configurationDirectory = new File(System.getenv(STR) + STR); } else { configurationDirectory = new File(STR); } System.out.println(configurationDirectory.getAbsolutePath()); DataDirectoryChooser dataDirectoryChooser = new DataDirectoryChooser(configurationDirectory); dataDirectory = dataDirectoryChooser.getDataDirectory(); } | /**
* This method has to be called while starting Sblit
* If Sblit is configured already, this class reads the configuration from the files.
* If not, it initializes the configuration-dialogs and generates the files that are needed.
*/ | This method has to be called while starting Sblit If Sblit is configured already, this class reads the configuration from the files. If not, it initializes the configuration-dialogs and generates the files that are needed | initialize | {
"repo_name": "martinexner/dcl",
"path": "dcl/src/org/sblit/configuration/Configuration.java",
"license": "gpl-3.0",
"size": 3931
} | [
"java.io.File",
"java.net.InetAddress",
"java.net.InetSocketAddress",
"javax.swing.JOptionPane",
"org.dclayer.lib.DCLApplication",
"org.sblit.Sblit",
"org.sblit.configuration.gui.DataDirectoryChooser"
] | import java.io.File; import java.net.InetAddress; import java.net.InetSocketAddress; import javax.swing.JOptionPane; import org.dclayer.lib.DCLApplication; import org.sblit.Sblit; import org.sblit.configuration.gui.DataDirectoryChooser; | import java.io.*; import java.net.*; import javax.swing.*; import org.dclayer.lib.*; import org.sblit.*; import org.sblit.configuration.gui.*; | [
"java.io",
"java.net",
"javax.swing",
"org.dclayer.lib",
"org.sblit",
"org.sblit.configuration"
] | java.io; java.net; javax.swing; org.dclayer.lib; org.sblit; org.sblit.configuration; | 509,088 |
@Deprecated
protected NHttpMessageParser<HttpResponse> createResponseParser(
final SessionInputBuffer buffer,
final HttpResponseFactory responseFactory,
final HttpParams params) {
// override in derived class to specify a line parser
final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
return new DefaultHttpResponseParser(buffer, null, responseFactory, constraints);
} | NHttpMessageParser<HttpResponse> function( final SessionInputBuffer buffer, final HttpResponseFactory responseFactory, final HttpParams params) { final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params); return new DefaultHttpResponseParser(buffer, null, responseFactory, constraints); } | /**
* Creates an instance of {@link NHttpMessageParser} to be used
* by this connection for parsing incoming {@link HttpResponse} messages.
* <p>
* This method can be overridden in a super class in order to provide
* a different implementation of the {@link NHttpMessageParser} interface.
*
* @return HTTP response parser.
*
* @deprecated (4.3) use constructor.
*/ | Creates an instance of <code>NHttpMessageParser</code> to be used by this connection for parsing incoming <code>HttpResponse</code> messages. This method can be overridden in a super class in order to provide a different implementation of the <code>NHttpMessageParser</code> interface | createResponseParser | {
"repo_name": "viapp/httpcore-nio-android",
"path": "src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java",
"license": "apache-2.0",
"size": 14602
} | [
"org.apache.http.HttpResponse",
"org.apache.http.HttpResponseFactory",
"org.apache.http.config.MessageConstraints",
"org.apache.http.impl.nio.codecs.DefaultHttpResponseParser",
"org.apache.http.nio.NHttpMessageParser",
"org.apache.http.nio.reactor.SessionInputBuffer",
"org.apache.http.params.HttpParamCo... | import org.apache.http.HttpResponse; import org.apache.http.HttpResponseFactory; import org.apache.http.config.MessageConstraints; import org.apache.http.impl.nio.codecs.DefaultHttpResponseParser; import org.apache.http.nio.NHttpMessageParser; import org.apache.http.nio.reactor.SessionInputBuffer; import org.apache.http.params.HttpParamConfig; import org.apache.http.params.HttpParams; | import org.apache.http.*; import org.apache.http.config.*; import org.apache.http.impl.nio.codecs.*; import org.apache.http.nio.*; import org.apache.http.nio.reactor.*; import org.apache.http.params.*; | [
"org.apache.http"
] | org.apache.http; | 1,716,342 |
public void addChat(String chat, boolean isWhisper) {
if (!m_availableChats.containsKey(chat)){
m_availableChats.put(chat, new ArrayList<String>());
m_possibleChats.addElement(chat);
m_possibleChats.setSelected(chat);
if (!isWhisper)
m_chatList.add(m_availableChats.get(chat));
} else {
m_possibleChats.setSelected(chat);
}
} | void function(String chat, boolean isWhisper) { if (!m_availableChats.containsKey(chat)){ m_availableChats.put(chat, new ArrayList<String>()); m_possibleChats.addElement(chat); m_possibleChats.setSelected(chat); if (!isWhisper) m_chatList.add(m_availableChats.get(chat)); } else { m_possibleChats.setSelected(chat); } } | /**
* Creates a new private chat channel
* @param chat
*/ | Creates a new private chat channel | addChat | {
"repo_name": "Nushio/ArenaClient",
"path": "src/net/k3rnel/arena/client/ui/frames/ChatDialog.java",
"license": "gpl-3.0",
"size": 6783
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 974,287 |
void setImage(Drawable drawable, float progress, boolean immediate); | void setImage(Drawable drawable, float progress, boolean immediate); | /**
* Called by controller when the future that provides the actual image completes successfully.
* Hierarchy should display the actual image.
* @param drawable drawable to be set as the temporary image
* @param progress number in range [0, 1] that indicates progress
* @param immediate if true, image will be shown immediately (without fade effect)
*/ | Called by controller when the future that provides the actual image completes successfully. Hierarchy should display the actual image | setImage | {
"repo_name": "s1rius/fresco",
"path": "drawee/src/main/java/com/facebook/drawee/interfaces/SettableDraweeHierarchy.java",
"license": "mit",
"size": 3444
} | [
"android.graphics.drawable.Drawable"
] | import android.graphics.drawable.Drawable; | import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 1,357,017 |
@Test
public void testGet04() throws Exception {
// given
String token = login();
String email = "app2@formkiq.com";
String secret = "secret2";
createUser(email, secret);
token = login(email, secret);
createFolder(token, email);
String url = getDefaultHostAndPort() + API_USER_GET
+ "?access_token=" + token
+ "&email=" + email;
// when
ResponseEntity<String> entity = exchangeRest(HttpMethod.GET, url);
// then
assertEquals(SC_OK, entity.getStatusCode().value());
UserDTO dto = this.jsonService.readValue(entity.getBody(),
UserDTO.class);
assertEquals(email, dto.getEmail());
assertEquals(UserRole.ROLE_USER.name(), dto.getRole());
assertEquals(UserStatus.ACTIVE.name(), dto.getStatus());
assertEquals(1, dto.getFolders().size());
assertEquals(email,
dto.getFolders().get(0).getName());
assertEquals("[PERM_FORM_ADMIN, PERM_FORM_RESULTS, PERM_FORM_DESIGN, "
+ "PERM_FORM_ENTRY]",
dto.getFolders().get(0).getPermissions().toString());
} | void function() throws Exception { String token = login(); String email = STR; String secret = STR; createUser(email, secret); token = login(email, secret); createFolder(token, email); String url = getDefaultHostAndPort() + API_USER_GET + STR + token + STR + email; ResponseEntity<String> entity = exchangeRest(HttpMethod.GET, url); assertEquals(SC_OK, entity.getStatusCode().value()); UserDTO dto = this.jsonService.readValue(entity.getBody(), UserDTO.class); assertEquals(email, dto.getEmail()); assertEquals(UserRole.ROLE_USER.name(), dto.getRole()); assertEquals(UserStatus.ACTIVE.name(), dto.getStatus()); assertEquals(1, dto.getFolders().size()); assertEquals(email, dto.getFolders().get(0).getName()); assertEquals(STR + STR, dto.getFolders().get(0).getPermissions().toString()); } | /**
* testGet04().
* non-admin get own data
* @throws Exception Exception
*/ | testGet04(). non-admin get own data | testGet04 | {
"repo_name": "formkiq/formkiq-server",
"path": "web/src/test/java/com/formkiq/web/UsersControllerIntegrationTest.java",
"license": "apache-2.0",
"size": 38086
} | [
"com.formkiq.core.domain.type.UserDTO",
"com.formkiq.core.domain.type.UserRole",
"com.formkiq.core.domain.type.UserStatus",
"org.junit.Assert",
"org.springframework.http.HttpMethod",
"org.springframework.http.ResponseEntity"
] | import com.formkiq.core.domain.type.UserDTO; import com.formkiq.core.domain.type.UserRole; import com.formkiq.core.domain.type.UserStatus; import org.junit.Assert; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; | import com.formkiq.core.domain.type.*; import org.junit.*; import org.springframework.http.*; | [
"com.formkiq.core",
"org.junit",
"org.springframework.http"
] | com.formkiq.core; org.junit; org.springframework.http; | 898,643 |
public int rmr(String[] argv) throws IOException {
if (argv.length != 2) {
System.out.println("Usage: tfs rmr <path>");
return -1;
}
TachyonURI path = new TachyonURI(argv[1]);
TachyonFS tachyonClient = createFS(path);
if (tachyonClient.delete(path, true)) {
System.out.println(path + " has been removed");
return 0;
} else {
return -1;
}
} | int function(String[] argv) throws IOException { if (argv.length != 2) { System.out.println(STR); return -1; } TachyonURI path = new TachyonURI(argv[1]); TachyonFS tachyonClient = createFS(path); if (tachyonClient.delete(path, true)) { System.out.println(path + STR); return 0; } else { return -1; } } | /**
* Removes the file or directory specified by argv. Will remove all files and directories in the
* directory if a directory is specified.
*
* @param argv [] Array of arguments given by the user's input from the terminal
* @return 0 if command is successful, -1 if an error occurred.
* @throws IOException
*/ | Removes the file or directory specified by argv. Will remove all files and directories in the directory if a directory is specified | rmr | {
"repo_name": "carsonwang/tachyon",
"path": "core/src/main/java/tachyon/command/TFsShell.java",
"license": "apache-2.0",
"size": 24723
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 268,726 |
public Coin getBalance(CoinSelector selector) {
lock.lock();
try {
checkNotNull(selector);
List<TransactionOutput> candidates = calculateAllSpendCandidates(true, false);
CoinSelection selection = selector.select(params.getMaxMoney(), candidates);
return selection.valueGathered;
} finally {
lock.unlock();
}
}
private static class BalanceFutureRequest {
public final ListenableCompletableFuture<Coin> future;
public final Coin value;
public final BalanceType type;
private BalanceFutureRequest(ListenableCompletableFuture<Coin> future, Coin value, BalanceType type) {
this.future = future;
this.value = value;
this.type = type;
}
}
@GuardedBy("lock") private final List<BalanceFutureRequest> balanceFutureRequests = new LinkedList<>(); | Coin function(CoinSelector selector) { lock.lock(); try { checkNotNull(selector); List<TransactionOutput> candidates = calculateAllSpendCandidates(true, false); CoinSelection selection = selector.select(params.getMaxMoney(), candidates); return selection.valueGathered; } finally { lock.unlock(); } } private static class BalanceFutureRequest { public final ListenableCompletableFuture<Coin> future; public final Coin value; public final BalanceType type; private BalanceFutureRequest(ListenableCompletableFuture<Coin> future, Coin value, BalanceType type) { this.future = future; this.value = value; this.type = type; } } @GuardedBy("lock") private final List<BalanceFutureRequest> balanceFutureRequests = new LinkedList<>(); | /**
* Returns the balance that would be considered spendable by the given coin selector, including watched outputs
* (i.e. balance includes outputs we don't have the private keys for). Just asks it to select as many coins as
* possible and returns the total.
*/ | Returns the balance that would be considered spendable by the given coin selector, including watched outputs (i.e. balance includes outputs we don't have the private keys for). Just asks it to select as many coins as possible and returns the total | getBalance | {
"repo_name": "bitcoinj/bitcoinj",
"path": "core/src/main/java/org/bitcoinj/wallet/Wallet.java",
"license": "apache-2.0",
"size": 267304
} | [
"com.google.common.base.Preconditions",
"java.util.LinkedList",
"java.util.List",
"net.jcip.annotations.GuardedBy",
"org.bitcoinj.core.Coin",
"org.bitcoinj.core.TransactionOutput",
"org.bitcoinj.utils.ListenableCompletableFuture"
] | import com.google.common.base.Preconditions; import java.util.LinkedList; import java.util.List; import net.jcip.annotations.GuardedBy; import org.bitcoinj.core.Coin; import org.bitcoinj.core.TransactionOutput; import org.bitcoinj.utils.ListenableCompletableFuture; | import com.google.common.base.*; import java.util.*; import net.jcip.annotations.*; import org.bitcoinj.core.*; import org.bitcoinj.utils.*; | [
"com.google.common",
"java.util",
"net.jcip.annotations",
"org.bitcoinj.core",
"org.bitcoinj.utils"
] | com.google.common; java.util; net.jcip.annotations; org.bitcoinj.core; org.bitcoinj.utils; | 2,791,190 |
protected Set<Artifact> resolveArtifactDependencies( final DependableCoordinate artifact )
throws DependencyResolverException
{
ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest();
Iterable<ArtifactResult> artifactResults =
getDependencyResolver().resolveDependencies( buildingRequest, artifact, null );
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
for ( final ArtifactResult artifactResult : artifactResults )
{
artifacts.add( artifactResult.getArtifact() );
}
return artifacts;
} | Set<Artifact> function( final DependableCoordinate artifact ) throws DependencyResolverException { ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest(); Iterable<ArtifactResult> artifactResults = getDependencyResolver().resolveDependencies( buildingRequest, artifact, null ); Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); for ( final ArtifactResult artifactResult : artifactResults ) { artifacts.add( artifactResult.getArtifact() ); } return artifacts; } | /**
* This method resolves all transitive dependencies of an artifact.
*
* @param artifact the artifact used to retrieve dependencies
* @return resolved set of dependencies
* @throws DependencyResolverException
*/ | This method resolves all transitive dependencies of an artifact | resolveArtifactDependencies | {
"repo_name": "hgschmie/apache-maven-plugins",
"path": "maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/resolvers/AbstractResolveMojo.java",
"license": "apache-2.0",
"size": 6314
} | [
"java.util.LinkedHashSet",
"java.util.Set",
"org.apache.maven.artifact.Artifact",
"org.apache.maven.project.ProjectBuildingRequest",
"org.apache.maven.shared.artifact.resolve.ArtifactResult",
"org.apache.maven.shared.dependencies.DependableCoordinate",
"org.apache.maven.shared.dependencies.resolve.Depen... | import java.util.LinkedHashSet; import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.artifact.resolve.ArtifactResult; import org.apache.maven.shared.dependencies.DependableCoordinate; import org.apache.maven.shared.dependencies.resolve.DependencyResolverException; | import java.util.*; import org.apache.maven.artifact.*; import org.apache.maven.project.*; import org.apache.maven.shared.artifact.resolve.*; import org.apache.maven.shared.dependencies.*; import org.apache.maven.shared.dependencies.resolve.*; | [
"java.util",
"org.apache.maven"
] | java.util; org.apache.maven; | 2,901,092 |
public static int getNode(BayesianReasonerShanksAgent agent, String nodeName)
throws ShanksException {
return ShanksAgentBayesianReasoningCapability.getNode(
agent.getBayesianNetwork(), nodeName);
} | static int function(BayesianReasonerShanksAgent agent, String nodeName) throws ShanksException { return ShanksAgentBayesianReasoningCapability.getNode( agent.getBayesianNetwork(), nodeName); } | /**
* Return the complete node
*
* @param agent
* @param nodeName
* @return the ProbabilisticNode object
* @throws ShanksException
*/ | Return the complete node | getNode | {
"repo_name": "gsi-upm/Shanks",
"path": "shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java",
"license": "gpl-2.0",
"size": 25021
} | [
"es.upm.dit.gsi.shanks.exception.ShanksException"
] | import es.upm.dit.gsi.shanks.exception.ShanksException; | import es.upm.dit.gsi.shanks.exception.*; | [
"es.upm.dit"
] | es.upm.dit; | 1,256,754 |
protected void fillWithAir(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8) {
for (int var9 = par4; var9 <= par7; ++var9) {
for (int var10 = par3; var10 <= par6; ++var10) {
for (int var11 = par5; var11 <= par8; ++var11) {
this.placeBlockAtCurrentPosition(par1World, 0, 0, var10, var9, var11, par2StructureBoundingBox);
}
}
}
} | void function(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8) { for (int var9 = par4; var9 <= par7; ++var9) { for (int var10 = par3; var10 <= par6; ++var10) { for (int var11 = par5; var11 <= par8; ++var11) { this.placeBlockAtCurrentPosition(par1World, 0, 0, var10, var9, var11, par2StructureBoundingBox); } } } } | /**
* arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
* maxZ)
*/ | arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) | fillWithAir | {
"repo_name": "DirectCodeGraveyard/Minetweak",
"path": "src/main/java/net/minecraft/world/structure/StructureComponent.java",
"license": "lgpl-3.0",
"size": 26475
} | [
"net.minecraft.world.World"
] | import net.minecraft.world.World; | import net.minecraft.world.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 1,956,265 |
public ChunkPos getChunkPos () {
return this.chunkPos.get();
} | ChunkPos function () { return this.chunkPos.get(); } | /**
* Gets the current chunk position of the tile. This is used to optimize chunk related
* calculations. The chunk position is not serialized with the tile entity and is
* initialized on demand.
*
* @return The ChunkPos that this tile entity is within.
*/ | Gets the current chunk position of the tile. This is used to optimize chunk related calculations. The chunk position is not serialized with the tile entity and is initialized on demand | getChunkPos | {
"repo_name": "Darkhax-Minecraft/Bookshelf",
"path": "src/main/java/net/darkhax/bookshelf/block/tileentity/TileEntityBasic.java",
"license": "lgpl-2.1",
"size": 4636
} | [
"net.minecraft.util.math.ChunkPos"
] | import net.minecraft.util.math.ChunkPos; | import net.minecraft.util.math.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 512,020 |
public void setTransform(Transform transform){
this.transform = transform;
fireDrawableChanged(DrawableChangedEvent.FIELD_TRANSFORM);
}
| void function(Transform transform){ this.transform = transform; fireDrawableChanged(DrawableChangedEvent.FIELD_TRANSFORM); } | /**
* Set object's transformation that is applied at the
* beginning of a call to {@link #draw(GL,GLU,Camera)}.
* @param transform
*/ | Set object's transformation that is applied at the beginning of a call to <code>#draw(GL,GLU,Camera)</code> | setTransform | {
"repo_name": "jzy3d/jzy3d-api-0.8.4",
"path": "src/api/org/jzy3d/plot3d/primitives/AbstractDrawable.java",
"license": "bsd-3-clause",
"size": 6400
} | [
"org.jzy3d.events.DrawableChangedEvent",
"org.jzy3d.plot3d.transform.Transform"
] | import org.jzy3d.events.DrawableChangedEvent; import org.jzy3d.plot3d.transform.Transform; | import org.jzy3d.events.*; import org.jzy3d.plot3d.transform.*; | [
"org.jzy3d.events",
"org.jzy3d.plot3d"
] | org.jzy3d.events; org.jzy3d.plot3d; | 1,454,976 |
static void dbconnect(String servers, int ratelimit) throws InterruptedException, Exception {
final Splitter COMMA_SPLITTER = Splitter.on(",").omitEmptyStrings().trimResults();
log.info("Connecting to VoltDB Interface...");
ClientConfig clientConfig = new ClientConfig();
clientConfig.setMaxTransactionsPerSecond(ratelimit);
clientConfig.setReconnectOnConnectionLoss(true);
client = ClientFactory.createClient(clientConfig);
for (String server: COMMA_SPLITTER.split(servers)) {
log.info("..." + server);
client.createConnection(server);
}
} | static void dbconnect(String servers, int ratelimit) throws InterruptedException, Exception { final Splitter COMMA_SPLITTER = Splitter.on(",").omitEmptyStrings().trimResults(); log.info(STR); ClientConfig clientConfig = new ClientConfig(); clientConfig.setMaxTransactionsPerSecond(ratelimit); clientConfig.setReconnectOnConnectionLoss(true); client = ClientFactory.createClient(clientConfig); for (String server: COMMA_SPLITTER.split(servers)) { log.info("..." + server); client.createConnection(server); } } | /**
* Connect to one or more VoltDB servers.
*
* @param servers A comma separated list of servers using the hostname:port
* syntax (where :port is optional). Assumes 21212 if not specified otherwise.
* @throws InterruptedException if anything bad happens with the threads.
*/ | Connect to one or more VoltDB servers | dbconnect | {
"repo_name": "paulmartel/voltdb",
"path": "tests/test_apps/kafkaimporter/client/kafkaimporter/KafkaImportBenchmark.java",
"license": "agpl-3.0",
"size": 19352
} | [
"com.google_voltpatches.common.base.Splitter",
"org.voltdb.client.ClientConfig",
"org.voltdb.client.ClientFactory"
] | import com.google_voltpatches.common.base.Splitter; import org.voltdb.client.ClientConfig; import org.voltdb.client.ClientFactory; | import com.google_voltpatches.common.base.*; import org.voltdb.client.*; | [
"com.google_voltpatches.common",
"org.voltdb.client"
] | com.google_voltpatches.common; org.voltdb.client; | 1,883,012 |
public synchronized CustomizedViewMonitor getOrCreateCustomizedViewMonitor(String clusterName) {
if (_customizedViewMonitor == null) {
_customizedViewMonitor = new CustomizedViewMonitor(clusterName);
try {
_customizedViewMonitor.register();
} catch (JMException e) {
LOG.error("Failed to register CustomizedViewMonitorMBean for cluster " + _clusterName, e);
}
}
return _customizedViewMonitor;
} | synchronized CustomizedViewMonitor function(String clusterName) { if (_customizedViewMonitor == null) { _customizedViewMonitor = new CustomizedViewMonitor(clusterName); try { _customizedViewMonitor.register(); } catch (JMException e) { LOG.error(STR + _clusterName, e); } } return _customizedViewMonitor; } | /**
* Lazy initialization of customized view monitor
* @param clusterName the cluster name of the cluster to be monitored
* @return a customized view monitor instance
*/ | Lazy initialization of customized view monitor | getOrCreateCustomizedViewMonitor | {
"repo_name": "apache/helix",
"path": "helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java",
"license": "apache-2.0",
"size": 41507
} | [
"javax.management.JMException"
] | import javax.management.JMException; | import javax.management.*; | [
"javax.management"
] | javax.management; | 2,860,060 |
void confirmCancel() {
if (m_saveButton.isEnabled()) {
CmsConfirmDialog dialog = new CmsConfirmDialog(
org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_DIALOG_RESET_TITLE_0),
org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_DIALOG_RESET_TEXT_0));
dialog.setHandler(new I_CmsConfirmDialogHandler() {
| void confirmCancel() { if (m_saveButton.isEnabled()) { CmsConfirmDialog dialog = new CmsConfirmDialog( org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_DIALOG_RESET_TITLE_0), org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_DIALOG_RESET_TEXT_0)); dialog.setHandler(new I_CmsConfirmDialogHandler() { | /**
* Asks the user to confirm resetting all changes.<p>
*/ | Asks the user to confirm resetting all changes | confirmCancel | {
"repo_name": "victos/opencms-core",
"path": "src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java",
"license": "lgpl-2.1",
"size": 87331
} | [
"org.opencms.gwt.client.ui.CmsConfirmDialog"
] | import org.opencms.gwt.client.ui.CmsConfirmDialog; | import org.opencms.gwt.client.ui.*; | [
"org.opencms.gwt"
] | org.opencms.gwt; | 262,878 |
private LockState executeRollback(final Procedure proc) {
try {
proc.doRollback(getEnvironment());
} catch (IOException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Roll back attempt failed for " + proc, e);
}
return LockState.LOCK_YIELD_WAIT;
} catch (InterruptedException e) {
handleInterruptedException(proc, e);
return LockState.LOCK_YIELD_WAIT;
} catch (Throwable e) {
// Catch NullPointerExceptions or similar errors...
LOG.fatal("CODE-BUG: Uncaught runtime exception fo " + proc, e);
}
// allows to kill the executor before something is stored to the wal.
// useful to test the procedure recovery.
if (testing != null && testing.shouldKillBeforeStoreUpdate()) {
LOG.debug("TESTING: Kill before store update");
stop();
return LockState.LOCK_YIELD_WAIT;
}
if (proc.removeStackIndex()) {
proc.setState(ProcedureState.ROLLEDBACK);
// update metrics on finishing the procedure (fail)
proc.updateMetricsOnFinish(getEnvironment(), proc.elapsedTime(), false);
if (proc.hasParent()) {
store.delete(proc.getProcId());
procedures.remove(proc.getProcId());
} else {
final long[] childProcIds = rollbackStack.get(proc.getProcId()).getSubprocedureIds();
if (childProcIds != null) {
store.delete(proc, childProcIds);
} else {
store.update(proc);
}
}
} else {
store.update(proc);
}
return LockState.LOCK_ACQUIRED;
} | LockState function(final Procedure proc) { try { proc.doRollback(getEnvironment()); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(STR + proc, e); } return LockState.LOCK_YIELD_WAIT; } catch (InterruptedException e) { handleInterruptedException(proc, e); return LockState.LOCK_YIELD_WAIT; } catch (Throwable e) { LOG.fatal(STR + proc, e); } if (testing != null && testing.shouldKillBeforeStoreUpdate()) { LOG.debug(STR); stop(); return LockState.LOCK_YIELD_WAIT; } if (proc.removeStackIndex()) { proc.setState(ProcedureState.ROLLEDBACK); proc.updateMetricsOnFinish(getEnvironment(), proc.elapsedTime(), false); if (proc.hasParent()) { store.delete(proc.getProcId()); procedures.remove(proc.getProcId()); } else { final long[] childProcIds = rollbackStack.get(proc.getProcId()).getSubprocedureIds(); if (childProcIds != null) { store.delete(proc, childProcIds); } else { store.update(proc); } } } else { store.update(proc); } return LockState.LOCK_ACQUIRED; } | /**
* Execute the rollback of the procedure step.
* It updates the store with the new state (stack index)
* or will remove completly the procedure in case it is a child.
*/ | Execute the rollback of the procedure step. It updates the store with the new state (stack index) or will remove completly the procedure in case it is a child | executeRollback | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java",
"license": "apache-2.0",
"size": 72887
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.procedure2.Procedure",
"org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos"
] | import java.io.IOException; import org.apache.hadoop.hbase.procedure2.Procedure; import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos; | import java.io.*; import org.apache.hadoop.hbase.procedure2.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,430,315 |
@Override
public Reader getCodeReader() throws IOException {
if (hasSourceInMemory()) {
return super.getCodeReader();
} else {
// If we haven't pulled the code into memory yet, don't.
return Resources.asCharSource(url, StandardCharsets.UTF_8).openStream();
}
} | Reader function() throws IOException { if (hasSourceInMemory()) { return super.getCodeReader(); } else { return Resources.asCharSource(url, StandardCharsets.UTF_8).openStream(); } } | /**
* Gets a reader for the code at this URL.
*/ | Gets a reader for the code at this URL | getCodeReader | {
"repo_name": "MatrixFrog/closure-compiler",
"path": "src/com/google/javascript/jscomp/SourceFile.java",
"license": "apache-2.0",
"size": 24983
} | [
"com.google.common.io.Resources",
"java.io.IOException",
"java.io.Reader",
"java.nio.charset.StandardCharsets"
] | import com.google.common.io.Resources; import java.io.IOException; import java.io.Reader; import java.nio.charset.StandardCharsets; | import com.google.common.io.*; import java.io.*; import java.nio.charset.*; | [
"com.google.common",
"java.io",
"java.nio"
] | com.google.common; java.io; java.nio; | 343,567 |
@Override
public final StructureDefinition fetchStructureDefinition(
final FhirContext theCtx,
final String theUrl) {
logD(
"CareConnectValidator asked to fetch StructureDefinition: %s%n",
theUrl);
if (!isSupported(theUrl)) {
log.trace(" Returning null as it's an HL7 one");
return null;
}
if (cachedResource.get(theUrl) == null) {
IBaseResource response = fetchURL(theUrl);
log.trace(" About to parse response into a StructureDefinition");
cachedResource.put(theUrl, (StructureDefinition) response);
logD(" StructureDefinition now added to the cache: %s%n", theUrl);
} else {
logD(" This URL was already loaded: %s%n", theUrl);
}
StructureDefinition sd
= (StructureDefinition)
cachedResource.get(theUrl);
return sd;
} | final StructureDefinition function( final FhirContext theCtx, final String theUrl) { logD( STR, theUrl); if (!isSupported(theUrl)) { log.trace(STR); return null; } if (cachedResource.get(theUrl) == null) { IBaseResource response = fetchURL(theUrl); log.trace(STR); cachedResource.put(theUrl, (StructureDefinition) response); logD(STR, theUrl); } else { logD(STR, theUrl); } StructureDefinition sd = (StructureDefinition) cachedResource.get(theUrl); return sd; } | /**
* Method to fetch a remote StructureDefinition resource.
*
* Caches results.
*
* @param theCtx FHIR Context
* @param theUrl The URL to fetch from
* @return The StructureDefinition resource or null
*/ | Method to fetch a remote StructureDefinition resource. Caches results | fetchStructureDefinition | {
"repo_name": "nhsconnect/careconnect-reference-implementation",
"path": "ccri-fhirserver/src/main/java/uk/nhs/careconnect/ccri/fhirserver/r4/validationsupport/CareConnectProfileDbValidationSupportR4.java",
"license": "apache-2.0",
"size": 17138
} | [
"ca.uhn.fhir.context.FhirContext",
"org.hl7.fhir.instance.model.api.IBaseResource",
"org.hl7.fhir.r4.model.StructureDefinition"
] | import ca.uhn.fhir.context.FhirContext; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.StructureDefinition; | import ca.uhn.fhir.context.*; import org.hl7.fhir.instance.model.api.*; import org.hl7.fhir.r4.model.*; | [
"ca.uhn.fhir",
"org.hl7.fhir"
] | ca.uhn.fhir; org.hl7.fhir; | 1,119,962 |
private List<NameValuePair> generatePairsForOnlineRequest(Map<String, Object> params, String url) {
if (url.endsWith(Constants.SERVER_URL_SUFFIX_SESSION_START)) {
params.put(Constants.HTTP_PARAM_API_KEY, clientInstance.getStaticFeatureSet().getApiKey());
params.put(Constants.HTTP_PARAM_TRACKING_CODE, clientInstance.getStaticFeatureSet().getTrackingCode());
params.put(Constants.HTTP_PARAM_VISITOR_CODE, clientInstance.getStaticFeatureSet().getVisitorCode());
params.put(Constants.HTTP_PARAM_SESSION_TIMEOUT, clientInstance.getStaticFeatureSet().getSessionTimeout());
params.put(Constants.HTTP_PARAM_SCREEN_WIDTH, clientInstance.getStaticFeatureSet().getDeviceScreenWidth());
params.put(Constants.HTTP_PARAM_SCREEN_HEIGHT, clientInstance.getStaticFeatureSet().getDeviceScreenHeight());
params.put(Constants.HTTP_PARAM_ACTIVITY_WIDTH, clientInstance.getStaticFeatureSet().getActivityWidth());
params.put(Constants.HTTP_PARAM_ACTIVITY_HEIGHT, clientInstance.getStaticFeatureSet().getActivityHeight());
params.put(Constants.HTTP_PARAM_LANG, clientInstance.getStaticFeatureSet().getLanguage());
params.put(Constants.HTTP_PARAM_SIM_OPERATOR, clientInstance.getStaticFeatureSet().getSimOperator());
params.put(Constants.HTTP_PARAM_SIM_COUNTRY_ISO, clientInstance.getStaticFeatureSet().getSimCountryIso());
params.put(Constants.HTTP_PARAM_NETWORK_OPERATOR_NAME, clientInstance.getStaticFeatureSet().getNetworkOperatorName());
params.put(Constants.HTTP_PARAM_INTERNET_CONN_TYPE, clientInstance.getStaticFeatureSet().getConnType());
params.put(Constants.HTTP_PARAM_BRAND, clientInstance.getStaticFeatureSet().getBrand());
params.put(Constants.HTTP_PARAM_MODEL, clientInstance.getStaticFeatureSet().getModel());
params.put(Constants.HTTP_PARAM_OS_TYPE, clientInstance.getStaticFeatureSet().getOs());
params.put(Constants.HTTP_PARAM_OS_VERSION, clientInstance.getStaticFeatureSet().getOsVersion());
params.put(Constants.HTTP_PARAM_CURIO_SDK_VERSION, clientInstance.getStaticFeatureSet().getSdkVersion());
params.put(Constants.HTTP_PARAM_APP_VERSION, clientInstance.getStaticFeatureSet().getAppVersionName());
params.put(Constants.HTTP_PARAM_BT_STATE, clientInstance.getStaticFeatureSet().getBtStatus());
params.put(Constants.HTTP_PARAM_AVAILABLE_STORAGE, clientInstance.getStaticFeatureSet().getAvailableStorage());
params.put(Constants.HTTP_PARAM_BATTERY_LEVEL, clientInstance.getStaticFeatureSet().getBattLevel());
} else {
params.put(Constants.HTTP_PARAM_SESSION_CODE, clientInstance.getSessionCode(false));
params.put(Constants.HTTP_PARAM_TRACKING_CODE, clientInstance.getStaticFeatureSet().getTrackingCode());
params.put(Constants.HTTP_PARAM_VISITOR_CODE, clientInstance.getStaticFeatureSet().getVisitorCode());
params.put(Constants.HTTP_PARAM_SESSION_TIMEOUT, clientInstance.getStaticFeatureSet().getSessionTimeout());
}
List<NameValuePair> newPairs = new ArrayList<NameValuePair>();
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (entry.getValue() != null) {
NameValuePair newPair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString());
CurioLogger.d(TAG, "PARAM --> " + newPair.getName() + " : " + newPair.getValue());
newPairs.add(newPair);
}
}
return newPairs;
}
| List<NameValuePair> function(Map<String, Object> params, String url) { if (url.endsWith(Constants.SERVER_URL_SUFFIX_SESSION_START)) { params.put(Constants.HTTP_PARAM_API_KEY, clientInstance.getStaticFeatureSet().getApiKey()); params.put(Constants.HTTP_PARAM_TRACKING_CODE, clientInstance.getStaticFeatureSet().getTrackingCode()); params.put(Constants.HTTP_PARAM_VISITOR_CODE, clientInstance.getStaticFeatureSet().getVisitorCode()); params.put(Constants.HTTP_PARAM_SESSION_TIMEOUT, clientInstance.getStaticFeatureSet().getSessionTimeout()); params.put(Constants.HTTP_PARAM_SCREEN_WIDTH, clientInstance.getStaticFeatureSet().getDeviceScreenWidth()); params.put(Constants.HTTP_PARAM_SCREEN_HEIGHT, clientInstance.getStaticFeatureSet().getDeviceScreenHeight()); params.put(Constants.HTTP_PARAM_ACTIVITY_WIDTH, clientInstance.getStaticFeatureSet().getActivityWidth()); params.put(Constants.HTTP_PARAM_ACTIVITY_HEIGHT, clientInstance.getStaticFeatureSet().getActivityHeight()); params.put(Constants.HTTP_PARAM_LANG, clientInstance.getStaticFeatureSet().getLanguage()); params.put(Constants.HTTP_PARAM_SIM_OPERATOR, clientInstance.getStaticFeatureSet().getSimOperator()); params.put(Constants.HTTP_PARAM_SIM_COUNTRY_ISO, clientInstance.getStaticFeatureSet().getSimCountryIso()); params.put(Constants.HTTP_PARAM_NETWORK_OPERATOR_NAME, clientInstance.getStaticFeatureSet().getNetworkOperatorName()); params.put(Constants.HTTP_PARAM_INTERNET_CONN_TYPE, clientInstance.getStaticFeatureSet().getConnType()); params.put(Constants.HTTP_PARAM_BRAND, clientInstance.getStaticFeatureSet().getBrand()); params.put(Constants.HTTP_PARAM_MODEL, clientInstance.getStaticFeatureSet().getModel()); params.put(Constants.HTTP_PARAM_OS_TYPE, clientInstance.getStaticFeatureSet().getOs()); params.put(Constants.HTTP_PARAM_OS_VERSION, clientInstance.getStaticFeatureSet().getOsVersion()); params.put(Constants.HTTP_PARAM_CURIO_SDK_VERSION, clientInstance.getStaticFeatureSet().getSdkVersion()); params.put(Constants.HTTP_PARAM_APP_VERSION, clientInstance.getStaticFeatureSet().getAppVersionName()); params.put(Constants.HTTP_PARAM_BT_STATE, clientInstance.getStaticFeatureSet().getBtStatus()); params.put(Constants.HTTP_PARAM_AVAILABLE_STORAGE, clientInstance.getStaticFeatureSet().getAvailableStorage()); params.put(Constants.HTTP_PARAM_BATTERY_LEVEL, clientInstance.getStaticFeatureSet().getBattLevel()); } else { params.put(Constants.HTTP_PARAM_SESSION_CODE, clientInstance.getSessionCode(false)); params.put(Constants.HTTP_PARAM_TRACKING_CODE, clientInstance.getStaticFeatureSet().getTrackingCode()); params.put(Constants.HTTP_PARAM_VISITOR_CODE, clientInstance.getStaticFeatureSet().getVisitorCode()); params.put(Constants.HTTP_PARAM_SESSION_TIMEOUT, clientInstance.getStaticFeatureSet().getSessionTimeout()); } List<NameValuePair> newPairs = new ArrayList<NameValuePair>(); for (Map.Entry<String, Object> entry : params.entrySet()) { if (entry.getValue() != null) { NameValuePair newPair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString()); CurioLogger.d(TAG, STR + newPair.getName() + STR + newPair.getValue()); newPairs.add(newPair); } } return newPairs; } | /**
* Generates name value pairs from given params and URL for online requests.
*
* @param params
* @return
*/ | Generates name value pairs from given params and URL for online requests | generatePairsForOnlineRequest | {
"repo_name": "Turkcell/Curio_android_SDK_Gradle",
"path": "curioSDKLib/src/main/java/com/turkcell/curio/CurioRequestProcessor.java",
"license": "apache-2.0",
"size": 28544
} | [
"com.turkcell.curio.utils.Constants",
"com.turkcell.curio.utils.CurioLogger",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.apache.http.NameValuePair",
"org.apache.http.message.BasicNameValuePair"
] | import com.turkcell.curio.utils.Constants; import com.turkcell.curio.utils.CurioLogger; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; | import com.turkcell.curio.utils.*; import java.util.*; import org.apache.http.*; import org.apache.http.message.*; | [
"com.turkcell.curio",
"java.util",
"org.apache.http"
] | com.turkcell.curio; java.util; org.apache.http; | 250,826 |
@DELETE
public Response deleteObject() {
hasRestrictedPath(externalPath);
if (resource() instanceof Container) {
final String depth = headers.getHeaderString("Depth");
LOGGER.debug("Depth header value is: {}", depth);
if (depth != null && !depth.equalsIgnoreCase("infinity")) {
throw new ClientErrorException("Depth header, if present, must be set to 'infinity' for containers",
SC_BAD_REQUEST);
}
}
if (resource() instanceof NonRdfSourceDescription && resource().isOriginalResource()) {
LOGGER.debug("Trying to delete binary description directly.");
throw new ClientErrorException(
"NonRDFSource descriptions are removed when their associated NonRDFSource object is removed.",
METHOD_NOT_ALLOWED);
}
evaluateRequestPreconditions(request, servletResponse, resource(), transaction);
LOGGER.info("Delete resource '{}'", externalPath);
deleteResourceService.perform(transaction, resource());
transaction.commitIfShortLived();
return noContent().build();
} | Response function() { hasRestrictedPath(externalPath); if (resource() instanceof Container) { final String depth = headers.getHeaderString("Depth"); LOGGER.debug(STR, depth); if (depth != null && !depth.equalsIgnoreCase(STR)) { throw new ClientErrorException(STR, SC_BAD_REQUEST); } } if (resource() instanceof NonRdfSourceDescription && resource().isOriginalResource()) { LOGGER.debug(STR); throw new ClientErrorException( STR, METHOD_NOT_ALLOWED); } evaluateRequestPreconditions(request, servletResponse, resource(), transaction); LOGGER.info(STR, externalPath); deleteResourceService.perform(transaction, resource()); transaction.commitIfShortLived(); return noContent().build(); } | /**
* Deletes an object.
*
* @return response
*/ | Deletes an object | deleteObject | {
"repo_name": "bseeger/fcrepo4",
"path": "fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraLdp.java",
"license": "apache-2.0",
"size": 37542
} | [
"javax.ws.rs.ClientErrorException",
"javax.ws.rs.core.Response",
"org.fcrepo.kernel.api.models.Container",
"org.fcrepo.kernel.api.models.NonRdfSourceDescription"
] | import javax.ws.rs.ClientErrorException; import javax.ws.rs.core.Response; import org.fcrepo.kernel.api.models.Container; import org.fcrepo.kernel.api.models.NonRdfSourceDescription; | import javax.ws.rs.*; import javax.ws.rs.core.*; import org.fcrepo.kernel.api.models.*; | [
"javax.ws",
"org.fcrepo.kernel"
] | javax.ws; org.fcrepo.kernel; | 2,653,467 |
protected int errorReported(String line) {
if (line.lastIndexOf(NOCHECKSUM) != -1) {
String after_error = line.substring(line.lastIndexOf(NOCHECKSUM) + NOCHECKSUM.length());
String x = getNumberPortion(after_error);
int err = 0;
try {
err = Integer.decode(x);
Log.error("NOCHECKSUM "+err);
} catch (Exception e) {}
return err;
}
if (line.lastIndexOf(BADCHECKSUM) != -1) {
String after_error = line.substring(line.lastIndexOf(BADCHECKSUM) + BADCHECKSUM.length());
String x = getNumberPortion(after_error);
int err = 0;
try {
err = Integer.decode(x);
Log.error("BADCHECKSUM "+err);
} catch (Exception e) {}
return err;
}
if (line.lastIndexOf(BADLINENUM) != -1) {
String after_error = line.substring(line.lastIndexOf(BADLINENUM) + BADLINENUM.length());
String x = getNumberPortion(after_error);
int err = 0;
try {
err = Integer.decode(x);
Log.error("BADLINENUM "+err);
} catch (Exception e) {}
return err;
}
return -1;
} | int function(String line) { if (line.lastIndexOf(NOCHECKSUM) != -1) { String after_error = line.substring(line.lastIndexOf(NOCHECKSUM) + NOCHECKSUM.length()); String x = getNumberPortion(after_error); int err = 0; try { err = Integer.decode(x); Log.error(STR+err); } catch (Exception e) {} return err; } if (line.lastIndexOf(BADCHECKSUM) != -1) { String after_error = line.substring(line.lastIndexOf(BADCHECKSUM) + BADCHECKSUM.length()); String x = getNumberPortion(after_error); int err = 0; try { err = Integer.decode(x); Log.error(STR+err); } catch (Exception e) {} return err; } if (line.lastIndexOf(BADLINENUM) != -1) { String after_error = line.substring(line.lastIndexOf(BADLINENUM) + BADLINENUM.length()); String x = getNumberPortion(after_error); int err = 0; try { err = Integer.decode(x); Log.error(STR+err); } catch (Exception e) {} return err; } return -1; } | /**
* Check if the robot reports an error and if so what line number.
*
* @return -1 if there was no error, otherwise the line number containing the error.
*/ | Check if the robot reports an error and if so what line number | errorReported | {
"repo_name": "rossonet/RAM",
"path": "modelli/progetti/plotter_a_corde/Makelangelo-software-master/java/src/main/java/com/marginallyclever/communications/serial/SerialConnection.java",
"license": "lgpl-3.0",
"size": 6994
} | [
"com.marginallyclever.makelangelo.Log"
] | import com.marginallyclever.makelangelo.Log; | import com.marginallyclever.makelangelo.*; | [
"com.marginallyclever.makelangelo"
] | com.marginallyclever.makelangelo; | 2,295,361 |
public void callReceived(CallEvent evt) {
try {
Call call = evt.getSourceCall();
Interlocutor interlocutor = new Interlocutor();
interlocutor.setCall(call);
guiManager.addInterlocutor(interlocutor);
call.addStateChangeListener(this);
// handleAnswerRequest(interlocutor);
}
catch (Exception e) {
Log.error("callReceived", e);
}
}
| void function(CallEvent evt) { try { Call call = evt.getSourceCall(); Interlocutor interlocutor = new Interlocutor(); interlocutor.setCall(call); guiManager.addInterlocutor(interlocutor); call.addStateChangeListener(this); } catch (Exception e) { Log.error(STR, e); } } | /**
* Fired when a call is received
*
* @param evt CallEvent
*/ | Fired when a call is received | callReceived | {
"repo_name": "joshuairl/toothchat-client",
"path": "src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java",
"license": "apache-2.0",
"size": 38087
} | [
"net.java.sipmack.common.Log",
"net.java.sipmack.sip.Call",
"net.java.sipmack.sip.Interlocutor",
"net.java.sipmack.sip.event.CallEvent"
] | import net.java.sipmack.common.Log; import net.java.sipmack.sip.Call; import net.java.sipmack.sip.Interlocutor; import net.java.sipmack.sip.event.CallEvent; | import net.java.sipmack.common.*; import net.java.sipmack.sip.*; import net.java.sipmack.sip.event.*; | [
"net.java.sipmack"
] | net.java.sipmack; | 1,139,525 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ElasticPoolInner> createOrUpdateAsync(
String resourceGroupName,
String serverName,
String elasticPoolName,
ElasticPoolInner parameters,
Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<ElasticPoolInner> function( String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Creates or updates an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @param parameters An elastic pool.
* @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 an elastic pool.
*/ | Creates or updates an elastic pool | createOrUpdateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/implementation/ElasticPoolsClientImpl.java",
"license": "mit",
"size": 108421
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context",
"com.azure.resourcemanager.sql.fluent.models.ElasticPoolInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.sql.fluent.models.ElasticPoolInner; | import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.sql.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 330,992 |
public void testNegNegFirstLonger() {
byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
int aSign = -1;
int bSign = -1;
byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
BigInteger aNumber = new BigInteger(aSign, aBytes);
BigInteger bNumber = new BigInteger(bSign, bBytes);
BigInteger result = aNumber.or(bNumber);
byte resBytes[] = new byte[rBytes.length];
resBytes = result.toByteArray();
for(int i = 0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign", -1, result.signum());
} | void function() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; int aSign = -1; int bSign = -1; byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.or(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, -1, result.signum()); } | /**
* Or for two negative numbers; the first is longer
*/ | Or for two negative numbers; the first is longer | testNegNegFirstLonger | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/org/apache/harmony/tests/java/math/BigIntegerOrTest.java",
"license": "apache-2.0",
"size": 17130
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 1,556,254 |
public static ReplayPosition getReplayPosition(Iterable<? extends SSTableReader> sstables)
{
if (Iterables.isEmpty(sstables))
return NONE; | static ReplayPosition function(Iterable<? extends SSTableReader> sstables) { if (Iterables.isEmpty(sstables)) return NONE; | /**
* Convenience method to compute the replay position for a group of SSTables.
* @param sstables
* @return the most recent (highest) replay position
*/ | Convenience method to compute the replay position for a group of SSTables | getReplayPosition | {
"repo_name": "nvoron23/cassandra",
"path": "src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java",
"license": "apache-2.0",
"size": 4724
} | [
"com.google.common.collect.Iterables",
"org.apache.cassandra.io.sstable.format.SSTableReader"
] | import com.google.common.collect.Iterables; import org.apache.cassandra.io.sstable.format.SSTableReader; | import com.google.common.collect.*; import org.apache.cassandra.io.sstable.format.*; | [
"com.google.common",
"org.apache.cassandra"
] | com.google.common; org.apache.cassandra; | 2,719,387 |
void prepare(Map<String, Object> config); | void prepare(Map<String, Object> config); | /**
* Called after the filter is instantiated.
*
* @param config A map of the properties from the 'filter' section of the reporter configuration.
*/ | Called after the filter is instantiated | prepare | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "storm-client/src/jvm/org/apache/storm/metrics2/filters/StormMetricsFilter.java",
"license": "apache-2.0",
"size": 1177
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 41,023 |
int count = 0;
final StringBuilder list = new StringBuilder();
for (final DebuggerTemplate debugger : debuggers) {
list.append("- ");
list.append(debugger.getName());
list.append('\n');
count++;
if ((count == MAX_LIST_LENGTH) && (debuggers.length != MAX_LIST_LENGTH)) {
list.append("\n... ");
list.append(String.format("%d others ...", debuggers.length - count));
break;
}
}
return list.toString();
} | int count = 0; final StringBuilder list = new StringBuilder(); for (final DebuggerTemplate debugger : debuggers) { list.append(STR); list.append(debugger.getName()); list.append('\n'); count++; if ((count == MAX_LIST_LENGTH) && (debuggers.length != MAX_LIST_LENGTH)) { list.append(STR); list.append(String.format(STR, debuggers.length - count)); break; } } return list.toString(); } | /**
* Generates a name list from the names of the given debuggers.
*
* @param debuggers The debuggers that provide the names.
*
* @return The generated name list.
*/ | Generates a name list from the names of the given debuggers | getNameList | {
"repo_name": "google/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Gui/MainWindow/Implementations/CNameListGenerators.java",
"license": "apache-2.0",
"size": 5942
} | [
"com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate"
] | import com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate; | import com.google.security.zynamics.binnavi.debug.debugger.*; | [
"com.google.security"
] | com.google.security; | 1,605,213 |
private long getFolderSize(File dir) {
if (dir.exists()) {
long result = 0;
File[] fileList = dir.listFiles();
for(int i = 0; i < fileList.length; i++) {
if(fileList[i].isDirectory()) {
result += getFolderSize(fileList[i]);
} else {
result += fileList[i].length();
}
}
return result;
}
return 0;
} | long function(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i = 0; i < fileList.length; i++) { if(fileList[i].isDirectory()) { result += getFolderSize(fileList[i]); } else { result += fileList[i].length(); } } return result; } return 0; } | /**
* Local Folder size
* @param dir File
* @return Size in bytes
*/ | Local Folder size | getFolderSize | {
"repo_name": "Barbu5177/android",
"path": "src/com/owncloud/android/ui/adapter/FileListListAdapter.java",
"license": "gpl-2.0",
"size": 19755
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 777,276 |
static void log(ArrayList<PrintWriter> writers, RecordTypes recordType,
Keys[] keys, String[] values) {
// First up calculate the length of buffer, so that we are performant
// enough.
int length = recordType.name().length() + keys.length * 4 + 2;
for (int i = 0; i < keys.length; i++) {
values[i] = escapeString(values[i]);
length += values[i].length() + keys[i].toString().length();
}
// We have the length of the buffer, now construct it.
StringBuilder builder = new StringBuilder(length);
builder.append(recordType.name());
builder.append(DELIMITER);
for(int i =0; i< keys.length; i++){
builder.append(keys[i]);
builder.append("=\"");
builder.append(values[i]);
builder.append("\"");
builder.append(DELIMITER);
}
builder.append(LINE_DELIMITER_CHAR);
for (PrintWriter out : writers) {
out.println(builder.toString());
}
} | static void log(ArrayList<PrintWriter> writers, RecordTypes recordType, Keys[] keys, String[] values) { int length = recordType.name().length() + keys.length * 4 + 2; for (int i = 0; i < keys.length; i++) { values[i] = escapeString(values[i]); length += values[i].length() + keys[i].toString().length(); } StringBuilder builder = new StringBuilder(length); builder.append(recordType.name()); builder.append(DELIMITER); for(int i =0; i< keys.length; i++){ builder.append(keys[i]); builder.append("=\"STR\""); builder.append(DELIMITER); } builder.append(LINE_DELIMITER_CHAR); for (PrintWriter out : writers) { out.println(builder.toString()); } } | /**
* Log a number of keys and values with record. the array length of keys and values
* should be same.
* @param recordType type of log event
* @param keys type of log event
* @param values type of log event
*/ | Log a number of keys and values with record. the array length of keys and values should be same | log | {
"repo_name": "jbellis/hadoop-common",
"path": "src/mapred/org/apache/hadoop/mapred/JobHistory.java",
"license": "apache-2.0",
"size": 82113
} | [
"java.io.PrintWriter",
"java.util.ArrayList"
] | import java.io.PrintWriter; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,719,148 |
@StrutsTagAttribute(description="Deprecated. Use 'var' instead")
public void setId(String id) {
setVar(id);
}
| @StrutsTagAttribute(description=STR) void function(String id) { setVar(id); } | /**
* To keep backward compatibility
* TODO remove after 2.1
*/ | To keep backward compatibility TODO remove after 2.1 | setId | {
"repo_name": "xiaguangme/struts2-src-study",
"path": "src/org/apache/struts2/components/ContextBean.java",
"license": "apache-2.0",
"size": 1971
} | [
"org.apache.struts2.views.annotations.StrutsTagAttribute"
] | import org.apache.struts2.views.annotations.StrutsTagAttribute; | import org.apache.struts2.views.annotations.*; | [
"org.apache.struts2"
] | org.apache.struts2; | 564,502 |
void fireIngestJobCompleted(long ingestJobId) {
AutopsyEvent event = new AutopsyEvent(IngestJobEvent.COMPLETED.toString(), ingestJobId, null);
eventPublishingExecutor.submit(new PublishEventTask(event, jobEventPublisher));
} | void fireIngestJobCompleted(long ingestJobId) { AutopsyEvent event = new AutopsyEvent(IngestJobEvent.COMPLETED.toString(), ingestJobId, null); eventPublishingExecutor.submit(new PublishEventTask(event, jobEventPublisher)); } | /**
* Publishes an ingest event signifying an ingest job finished.
*
* @param ingestJobId The ingest job id.
*/ | Publishes an ingest event signifying an ingest job finished | fireIngestJobCompleted | {
"repo_name": "dgrove727/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java",
"license": "apache-2.0",
"size": 48764
} | [
"org.sleuthkit.autopsy.events.AutopsyEvent"
] | import org.sleuthkit.autopsy.events.AutopsyEvent; | import org.sleuthkit.autopsy.events.*; | [
"org.sleuthkit.autopsy"
] | org.sleuthkit.autopsy; | 1,470,988 |
public void copy(final ExpiryFolder newFolder)
throws IllegalStateException, IllegalArgumentException {
// Check arguments
MandatoryArgumentChecker.check("newFolder", newFolder);
if (newFolder == this) {
String detail = "Folder can not be copied into itself.";
Utils.logProgrammingError(detail);
throw new IllegalArgumentException(detail);
}
if (newFolder._strategy.getPrecision() != _strategy.getPrecision()) {
String detail = "Folders must have the same precision.";
Utils.logProgrammingError(detail);
throw new IllegalArgumentException(detail);
}
// Avoid a potential deadlock by always locking on the instance with the
// lowest instance number first
Object firstLock = (_instanceNum < newFolder._instanceNum) ? _lock : newFolder._lock;
Object secondLock = (_instanceNum < newFolder._instanceNum) ? newFolder._lock : _lock;
synchronized (firstLock) {
synchronized (secondLock) {
// Copy the recentlyAccessed
newFolder._recentlyAccessed = new HashMap(_recentlyAccessed);
// Copy the slots
for (int i = 0; i < _slotCount && i < newFolder._slotCount; i++) {
newFolder._slots[i] = new HashMap(_slots[i]);
}
}
}
} | void function(final ExpiryFolder newFolder) throws IllegalStateException, IllegalArgumentException { MandatoryArgumentChecker.check(STR, newFolder); if (newFolder == this) { String detail = STR; Utils.logProgrammingError(detail); throw new IllegalArgumentException(detail); } if (newFolder._strategy.getPrecision() != _strategy.getPrecision()) { String detail = STR; Utils.logProgrammingError(detail); throw new IllegalArgumentException(detail); } Object firstLock = (_instanceNum < newFolder._instanceNum) ? _lock : newFolder._lock; Object secondLock = (_instanceNum < newFolder._instanceNum) ? newFolder._lock : _lock; synchronized (firstLock) { synchronized (secondLock) { newFolder._recentlyAccessed = new HashMap(_recentlyAccessed); for (int i = 0; i < _slotCount && i < newFolder._slotCount; i++) { newFolder._slots[i] = new HashMap(_slots[i]); } } } } | /**
* Copies the entries of this <code>ExpiryFolder</code> into another one.
* This method does not perform a deep copy, so if a key is added or
* removed, both folders will be modified.
*
* @param newFolder
* the new folder where the entries should be copied into,
* cannot be <code>null</code>, cannot be <code>this</code>.
*
* @throws IllegalStateException
* if the associated {@link ExpiryStrategy} has stopped already.
*
* @throws IllegalArgumentException
* if <code>newFolder == null</code> or <code>newFolder == this</code>
* or if the precision of <code>newFolder</code> is not the same as for
* this <code>ExpiryFolder</code>.
*/ | Copies the entries of this <code>ExpiryFolder</code> into another one. This method does not perform a deep copy, so if a key is added or removed, both folders will be modified | copy | {
"repo_name": "muloem/xins",
"path": "src/java-common/org/xins/common/collections/expiry/ExpiryFolder.java",
"license": "bsd-3-clause",
"size": 26889
} | [
"java.util.HashMap",
"org.xins.common.MandatoryArgumentChecker",
"org.xins.common.Utils"
] | import java.util.HashMap; import org.xins.common.MandatoryArgumentChecker; import org.xins.common.Utils; | import java.util.*; import org.xins.common.*; | [
"java.util",
"org.xins.common"
] | java.util; org.xins.common; | 2,132,765 |
@Test
public void testWebHttpTokenEndpt() throws Exception {
// Create the conversation object which will maintain state for us
WebConversation wc = new WebConversation();
TestSettings updatedTestSettings = testSettings.copyTestSettings();
if (eSettings.getProviderType() == Constants.OAUTH_OP) {
updatedTestSettings.setTokenEndpt(testOPServer.getHttpString() + updatedTestSettings.getDetailOAuthOPTokenEndpt());
} else {
updatedTestSettings.setTokenEndpt(testOPServer.getHttpString() + updatedTestSettings.getDetailOIDCOPTokenEndpt());
}
// expect good (200) status codes for all steps except login
String expected404Step = Constants.PERFORM_LOGIN;
List<validationData> expectations = validationTools.getDefault404VDataExpectationsWithOtherwiseSuccessfulStatusCodes(expected404Step);
// we expect a 404 as https is required
expectations = vData.addNoTokensInResponseExpectations(expectations, expected404Step);
testOPServer.addIgnoredServerExceptions("CWOAU0037E");
genericOP(_testName, wc, updatedTestSettings, Constants.BASIC_AUTHENTICATION_ACTIONS, expectations);
} | void function() throws Exception { WebConversation wc = new WebConversation(); TestSettings updatedTestSettings = testSettings.copyTestSettings(); if (eSettings.getProviderType() == Constants.OAUTH_OP) { updatedTestSettings.setTokenEndpt(testOPServer.getHttpString() + updatedTestSettings.getDetailOAuthOPTokenEndpt()); } else { updatedTestSettings.setTokenEndpt(testOPServer.getHttpString() + updatedTestSettings.getDetailOIDCOPTokenEndpt()); } String expected404Step = Constants.PERFORM_LOGIN; List<validationData> expectations = validationTools.getDefault404VDataExpectationsWithOtherwiseSuccessfulStatusCodes(expected404Step); expectations = vData.addNoTokensInResponseExpectations(expectations, expected404Step); testOPServer.addIgnoredServerExceptions(STR); genericOP(_testName, wc, updatedTestSettings, Constants.BASIC_AUTHENTICATION_ACTIONS, expectations); } | /***
* Test Purpose: Set the authorizeeEndpoint url using the http port instead of the https port
* Response should contain a 404 status code and a message that https must be used.
*
* @throws Exception
*/ | Test Purpose: Set the authorizeeEndpoint url using the http port instead of the https port Response should contain a 404 status code and a message that https must be used | testWebHttpTokenEndpt | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.security.oidc.server_fat/fat/src/com/ibm/ws/security/openidconnect/server/fat/BasicTests/CommonTests/genericWebClientAuthCodeTest.java",
"license": "epl-1.0",
"size": 99591
} | [
"com.ibm.ws.security.oauth_oidc.fat.commonTest.Constants",
"com.ibm.ws.security.oauth_oidc.fat.commonTest.TestSettings",
"com.meterware.httpunit.WebConversation",
"java.util.List"
] | import com.ibm.ws.security.oauth_oidc.fat.commonTest.Constants; import com.ibm.ws.security.oauth_oidc.fat.commonTest.TestSettings; import com.meterware.httpunit.WebConversation; import java.util.List; | import com.ibm.ws.security.oauth_oidc.fat.*; import com.meterware.httpunit.*; import java.util.*; | [
"com.ibm.ws",
"com.meterware.httpunit",
"java.util"
] | com.ibm.ws; com.meterware.httpunit; java.util; | 840,464 |
public VectorAggregator factorizeVector(VectorColumnSelectorFactory selectorFactory)
{
throw new UOE("Aggregator[%s] cannot vectorize", getClass().getName());
} | VectorAggregator function(VectorColumnSelectorFactory selectorFactory) { throw new UOE(STR, getClass().getName()); } | /**
* Create a VectorAggregator based on the provided column selector factory. Will throw an exception if
* this aggregation class does not support vectorization: check "canVectorize" first.
*/ | Create a VectorAggregator based on the provided column selector factory. Will throw an exception if this aggregation class does not support vectorization: check "canVectorize" first | factorizeVector | {
"repo_name": "nishantmonu51/druid",
"path": "processing/src/main/java/org/apache/druid/query/aggregation/AggregatorFactory.java",
"license": "apache-2.0",
"size": 17011
} | [
"org.apache.druid.segment.vector.VectorColumnSelectorFactory"
] | import org.apache.druid.segment.vector.VectorColumnSelectorFactory; | import org.apache.druid.segment.vector.*; | [
"org.apache.druid"
] | org.apache.druid; | 2,721,148 |
public GetQueueUrlResult getQueueUrl(String queueName, String queueOwnerAccountId) throws JMSException {
return getQueueUrl(new GetQueueUrlRequest(queueName).withQueueOwnerAWSAccountId(queueOwnerAccountId));
} | GetQueueUrlResult function(String queueName, String queueOwnerAccountId) throws JMSException { return getQueueUrl(new GetQueueUrlRequest(queueName).withQueueOwnerAWSAccountId(queueOwnerAccountId)); } | /**
* Gets the queueUrl of a queue given a queue name owned by the provided accountId.
*
* @param queueName
* @param queueOwnerAccountId The AWS accountId of the account that created the queue
* @return The response from the GetQueueUrl service method, as returned by
* AmazonSQS, which will include queue`s URL
* @throws JMSException
*/ | Gets the queueUrl of a queue given a queue name owned by the provided accountId | getQueueUrl | {
"repo_name": "awslabs/amazon-sqs-java-messaging-lib",
"path": "src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java",
"license": "apache-2.0",
"size": 19435
} | [
"com.amazonaws.services.sqs.model.GetQueueUrlRequest",
"com.amazonaws.services.sqs.model.GetQueueUrlResult",
"javax.jms.JMSException"
] | import com.amazonaws.services.sqs.model.GetQueueUrlRequest; import com.amazonaws.services.sqs.model.GetQueueUrlResult; import javax.jms.JMSException; | import com.amazonaws.services.sqs.model.*; import javax.jms.*; | [
"com.amazonaws.services",
"javax.jms"
] | com.amazonaws.services; javax.jms; | 713,640 |
public static IData format(IData document, String inPattern, TimeZone inTimeZone, String outPattern, TimeZone outTimeZone) {
return Transformer.transform(document, new DateTimeFormatter(inPattern, inTimeZone, outPattern, outTimeZone));
} | static IData function(IData document, String inPattern, TimeZone inTimeZone, String outPattern, TimeZone outTimeZone) { return Transformer.transform(document, new DateTimeFormatter(inPattern, inTimeZone, outPattern, outTimeZone)); } | /**
* Reformats the datetime strings in the given IData document according to the desired pattern.
*
* @param document The IData document containing strings to be reformatted.
* @param inPattern The pattern the given input datetime strings adhere to.
* @param outTimeZone The time zone the returned datetime string should be in.
* @param inTimeZone The time zone the given datetime string should be parsed in.
* @param outPattern The pattern the datetime string should be reformatted as.
* @return The given datetime strings reformatted according to the given outPattern.
*/ | Reformats the datetime strings in the given IData document according to the desired pattern | format | {
"repo_name": "Permafrost/Tundra.java",
"path": "src/main/java/permafrost/tundra/time/DateTimeHelper.java",
"license": "mit",
"size": 53382
} | [
"com.wm.data.IData",
"java.util.TimeZone"
] | import com.wm.data.IData; import java.util.TimeZone; | import com.wm.data.*; import java.util.*; | [
"com.wm.data",
"java.util"
] | com.wm.data; java.util; | 649,012 |
protected void initMap() {
if (LOG.isDebugEnabled()) {
LOG.debug("initMap");
}
final MappingComponent mappingComponent = new MappingComponent();
final Dimension d = new Dimension(300, 300);
mappingComponent.setPreferredSize(d);
mappingComponent.setSize(d);
mapPanel.add(mappingComponent, BorderLayout.CENTER);
final ActiveLayerModel mappingModel = new ActiveLayerModel();
mappingModel.addHome(new XBoundingBox(6.7d, 49.1, 7.1d, 49.33d, SRS, false));
mappingModel.setSrs(SRS);
final SimpleWMS swms = new SimpleWMS(new SimpleWmsGetMapUrl(WMS_CALL));
mappingModel.addLayer(swms);
mappingComponent.setInteractionMode(MappingComponent.SELECT);
mappingComponent.setMappingModel(mappingModel);
mappingComponent.gotoInitialBoundingBox();
mappingComponent.unlock();
CismapBroker.getInstance().setMappingComponent(mappingComponent);
} | void function() { if (LOG.isDebugEnabled()) { LOG.debug(STR); } final MappingComponent mappingComponent = new MappingComponent(); final Dimension d = new Dimension(300, 300); mappingComponent.setPreferredSize(d); mappingComponent.setSize(d); mapPanel.add(mappingComponent, BorderLayout.CENTER); final ActiveLayerModel mappingModel = new ActiveLayerModel(); mappingModel.addHome(new XBoundingBox(6.7d, 49.1, 7.1d, 49.33d, SRS, false)); mappingModel.setSrs(SRS); final SimpleWMS swms = new SimpleWMS(new SimpleWmsGetMapUrl(WMS_CALL)); mappingModel.addLayer(swms); mappingComponent.setInteractionMode(MappingComponent.SELECT); mappingComponent.setMappingModel(mappingModel); mappingComponent.gotoInitialBoundingBox(); mappingComponent.unlock(); CismapBroker.getInstance().setMappingComponent(mappingComponent); } | /**
* DOCUMENT ME!
*/ | DOCUMENT ME | initMap | {
"repo_name": "cismet/cids-navigator",
"path": "src/main/java/de/cismet/cids/custom/objecteditors/EditorTester.java",
"license": "gpl-3.0",
"size": 12752
} | [
"de.cismet.cismap.commons.XBoundingBox",
"de.cismet.cismap.commons.gui.MappingComponent",
"de.cismet.cismap.commons.gui.layerwidget.ActiveLayerModel",
"de.cismet.cismap.commons.interaction.CismapBroker",
"de.cismet.cismap.commons.raster.wms.simple.SimpleWMS",
"de.cismet.cismap.commons.raster.wms.simple.Si... | import de.cismet.cismap.commons.XBoundingBox; import de.cismet.cismap.commons.gui.MappingComponent; import de.cismet.cismap.commons.gui.layerwidget.ActiveLayerModel; import de.cismet.cismap.commons.interaction.CismapBroker; import de.cismet.cismap.commons.raster.wms.simple.SimpleWMS; import de.cismet.cismap.commons.raster.wms.simple.SimpleWmsGetMapUrl; import java.awt.BorderLayout; import java.awt.Dimension; | import de.cismet.cismap.commons.*; import de.cismet.cismap.commons.gui.*; import de.cismet.cismap.commons.gui.layerwidget.*; import de.cismet.cismap.commons.interaction.*; import de.cismet.cismap.commons.raster.wms.simple.*; import java.awt.*; | [
"de.cismet.cismap",
"java.awt"
] | de.cismet.cismap; java.awt; | 895,436 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<StorageAccountListKeysResultInner> listKeysAsync(
String resourceGroupName, String accountName, ListKeyExpand expand) {
return listKeysWithResponseAsync(resourceGroupName, accountName, expand)
.flatMap(
(Response<StorageAccountListKeysResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<StorageAccountListKeysResultInner> function( String resourceGroupName, String accountName, ListKeyExpand expand) { return listKeysWithResponseAsync(resourceGroupName, accountName, expand) .flatMap( (Response<StorageAccountListKeysResultInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } | /**
* Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case
* insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names
* must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @param expand Specifies type of the key to be listed. Possible value is kerb.
* @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 the response from the ListKeys operation.
*/ | Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account | listKeysAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/implementation/StorageAccountsClientImpl.java",
"license": "mit",
"size": 168198
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.resourcemanager.storage.fluent.models.StorageAccountListKeysResultInner",
"com.azure.resourcemanager.storage.models.ListKeyExpand"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.storage.fluent.models.StorageAccountListKeysResultInner; import com.azure.resourcemanager.storage.models.ListKeyExpand; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.storage.fluent.models.*; import com.azure.resourcemanager.storage.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,805,426 |
public ContentPreviewerFactoryBuilder defaultCharset(Charset defaultCharset) {
this.defaultCharset = requireNonNull(defaultCharset, "defaultCharset");
return this;
} | ContentPreviewerFactoryBuilder function(Charset defaultCharset) { this.defaultCharset = requireNonNull(defaultCharset, STR); return this; } | /**
* Sets the default {@link Charset} used to produce the text preview when a charset is not specified in the
* {@code "content-type"} header. {@link StandardCharsets#UTF_8} is used by default.
*
* <p>Note that this charset is only for the text preview, not for the binary preview.</p>
*/ | Sets the default <code>Charset</code> used to produce the text preview when a charset is not specified in the "content-type" header. <code>StandardCharsets#UTF_8</code> is used by default. Note that this charset is only for the text preview, not for the binary preview | defaultCharset | {
"repo_name": "line/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/logging/ContentPreviewerFactoryBuilder.java",
"license": "apache-2.0",
"size": 9131
} | [
"java.nio.charset.Charset",
"java.util.Objects"
] | import java.nio.charset.Charset; import java.util.Objects; | import java.nio.charset.*; import java.util.*; | [
"java.nio",
"java.util"
] | java.nio; java.util; | 665,037 |
@Test
public void testNotifyListener() throws Exception {
final StringListener listener = Mockito.mock(StringListener.class);
this.store.add(StringListener.class, listener);
this.store.remove(StringListener.class, listener);
final StringEvent e = new StringEvent(this.subject, "");
this.subject.dispatch(e, StringListener::onStringEvent);
Mockito.verify(listener, Mockito.never()).onStringEvent(Mockito.any());
Mockito.verify(listener).onRegister(Mockito.any());
Mockito.verify(listener).onUnregister(Mockito.any());
} | void function() throws Exception { final StringListener listener = Mockito.mock(StringListener.class); this.store.add(StringListener.class, listener); this.store.remove(StringListener.class, listener); final StringEvent e = new StringEvent(this.subject, ""); this.subject.dispatch(e, StringListener::onStringEvent); Mockito.verify(listener, Mockito.never()).onStringEvent(Mockito.any()); Mockito.verify(listener).onRegister(Mockito.any()); Mockito.verify(listener).onUnregister(Mockito.any()); } | /**
* Tests whether notifying a listener about registration and removal works.
*
* @throws Exception If an exception occurs during testing.
*/ | Tests whether notifying a listener about registration and removal works | testNotifyListener | {
"repo_name": "skuzzle/jeve",
"path": "jeve/src/it/java/de/skuzzle/jeve/EventProviderTestBase.java",
"license": "mit",
"size": 20410
} | [
"de.skuzzle.jeve.util.StringEvent",
"de.skuzzle.jeve.util.StringListener",
"org.mockito.Mockito"
] | import de.skuzzle.jeve.util.StringEvent; import de.skuzzle.jeve.util.StringListener; import org.mockito.Mockito; | import de.skuzzle.jeve.util.*; import org.mockito.*; | [
"de.skuzzle.jeve",
"org.mockito"
] | de.skuzzle.jeve; org.mockito; | 2,574,633 |
public final void info(final Serializable message)
{
addFeedbackMessage(message, FeedbackMessage.INFO);
} | final void function(final Serializable message) { addFeedbackMessage(message, FeedbackMessage.INFO); } | /**
* Registers an informational feedback message for this session
*
* @param message
* The feedback message
*/ | Registers an informational feedback message for this session | info | {
"repo_name": "afiantara/apache-wicket-1.5.7",
"path": "src/wicket-core/src/main/java/org/apache/wicket/Session.java",
"license": "apache-2.0",
"size": 24590
} | [
"java.io.Serializable",
"org.apache.wicket.feedback.FeedbackMessage"
] | import java.io.Serializable; import org.apache.wicket.feedback.FeedbackMessage; | import java.io.*; import org.apache.wicket.feedback.*; | [
"java.io",
"org.apache.wicket"
] | java.io; org.apache.wicket; | 284,413 |
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtils.writePaint(this.labelPaint, stream);
SerialUtils.writeStroke(this.dividerStroke, stream);
SerialUtils.writePaint(this.dividerPaint, stream);
}
| void function(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtils.writePaint(this.labelPaint, stream); SerialUtils.writeStroke(this.dividerStroke, stream); SerialUtils.writePaint(this.dividerPaint, stream); } | /**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/ | Provides serialization support | writeObject | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/axis/PeriodAxisLabelInfo.java",
"license": "lgpl-2.1",
"size": 12179
} | [
"java.io.IOException",
"java.io.ObjectOutputStream",
"org.jfree.chart.util.SerialUtils"
] | import java.io.IOException; import java.io.ObjectOutputStream; import org.jfree.chart.util.SerialUtils; | import java.io.*; import org.jfree.chart.util.*; | [
"java.io",
"org.jfree.chart"
] | java.io; org.jfree.chart; | 2,825,681 |
@GET("/users/{id}/playlists")
Pager<PlaylistSimple> getPlaylists(@Path("id") String userId, @QueryMap Map<String, Object> options); | @GET(STR) Pager<PlaylistSimple> getPlaylists(@Path("id") String userId, @QueryMap Map<String, Object> options); | /**
* Get a list of the playlists owned or followed by a Spotify user.
*
* @param userId The user's Spotify user ID.
* @param options Optional parameters. For list of supported parameters see
* <a href="https://developer.spotify.com/web-api/get-list-users-playlists/">endpoint documentation</a>
* @return List of user's playlists wrapped in a {@code Pager} object
* @see <a href="https://developer.spotify.com/web-api/get-list-users-playlists/">Get a List of a User’s Playlists</a>
*/ | Get a list of the playlists owned or followed by a Spotify user | getPlaylists | {
"repo_name": "mattiamaestrini/spotify-web-api-android",
"path": "spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyService.java",
"license": "mit",
"size": 84772
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 342,121 |
public List<Sort> getInput() {
return item.getInput();
}
// getters giving HLAPI object | List<Sort> function() { return item.getInput(); } | /**
* Return the encapsulate Low Level API object.
*/ | Return the encapsulate Low Level API object | getInput | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/ModuloHLAPI.java",
"license": "epl-1.0",
"size": 69704
} | [
"fr.lip6.move.pnml.pthlpng.terms.Sort",
"java.util.List"
] | import fr.lip6.move.pnml.pthlpng.terms.Sort; import java.util.List; | import fr.lip6.move.pnml.pthlpng.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 78,663 |
@ApiOperation(value = "Get specific SDK profile",
notes = "Returns the SDK profile by its identifier. (Requires TENANT_DEVELOPER or TENANT_USER to request this information).")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid sdkProfileId supplied"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "The SDK profile with the specified ID does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "sdkProfile/{sdkProfileId}")
@ResponseBody
public SdkProfileDto getSdkProfile(
@ApiParam(name = "sdkProfileId", value = "A unique SDK profile identifier", required = true)
@PathVariable String sdkProfileId) throws KaaAdminServiceException {
return sdkService.getSdkProfile(sdkProfileId);
} | @ApiOperation(value = STR, notes = STR) @ApiResponses(value = { @ApiResponse(code = 400, message = STR), @ApiResponse(code = 401, message = STR), @ApiResponse(code = 403, message = STR + STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR)}) @RequestMapping(value = STR) SdkProfileDto function( @ApiParam(name = STR, value = STR, required = true) @PathVariable String sdkProfileId) throws KaaAdminServiceException { return sdkService.getSdkProfile(sdkProfileId); } | /**
* Returns an SDK profile by its identifier.
*
* @param sdkProfileId the sdk profile id
* @return the sdk profile dto
* @throws KaaAdminServiceException the kaa admin service exception
*/ | Returns an SDK profile by its identifier | getSdkProfile | {
"repo_name": "Oleh-Kravchenko/kaa",
"path": "server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/SdkController.java",
"license": "apache-2.0",
"size": 11867
} | [
"io.swagger.annotations.ApiOperation",
"io.swagger.annotations.ApiParam",
"io.swagger.annotations.ApiResponse",
"io.swagger.annotations.ApiResponses",
"org.kaaproject.kaa.common.dto.admin.SdkProfileDto",
"org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException",
"org.springframework.web... | import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.kaaproject.kaa.common.dto.admin.SdkProfileDto; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; | import io.swagger.annotations.*; import org.kaaproject.kaa.common.dto.admin.*; import org.kaaproject.kaa.server.admin.shared.services.*; import org.springframework.web.bind.annotation.*; | [
"io.swagger.annotations",
"org.kaaproject.kaa",
"org.springframework.web"
] | io.swagger.annotations; org.kaaproject.kaa; org.springframework.web; | 2,711,593 |
@Override
protected Date convertNotNull(Timestamp data) {
return new Date(data.getTime());
} | Date function(Timestamp data) { return new Date(data.getTime()); } | /**
* Converts <code>Timestamp</code> to <code>Date</code>.
*/ | Converts <code>Timestamp</code> to <code>Date</code> | convertNotNull | {
"repo_name": "nortal/araneaframework",
"path": "src/org/araneaframework/uilib/form/converter/TimestampToDateConverter.java",
"license": "apache-2.0",
"size": 1518
} | [
"java.sql.Timestamp",
"java.util.Date"
] | import java.sql.Timestamp; import java.util.Date; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 951,567 |
void throwIfCurrentThreadHadExpiredLease() throws LeaseExpiredException {
if (this.expiredLeases == null) {
return;
}
if (this.expiredLeases.containsKey(Thread.currentThread())) {
this.expiredLeases.remove(Thread.currentThread());
throw new LeaseExpiredException(
LocalizedStrings.DLockToken_THIS_THREADS_LEASE_EXPIRED_FOR_THIS_LOCK.toLocalizedString());
}
} | void throwIfCurrentThreadHadExpiredLease() throws LeaseExpiredException { if (this.expiredLeases == null) { return; } if (this.expiredLeases.containsKey(Thread.currentThread())) { this.expiredLeases.remove(Thread.currentThread()); throw new LeaseExpiredException( LocalizedStrings.DLockToken_THIS_THREADS_LEASE_EXPIRED_FOR_THIS_LOCK.toLocalizedString()); } } | /**
* Throws LeaseExpiredException if the calling thread's lease on this lock previously expired. The
* expired lease will no longer be tracked after throwing LeaseExpiredException. Caller must
* synchronize on this lock token.
*
* @throws LeaseExpiredException if calling thread's lease expired
*/ | Throws LeaseExpiredException if the calling thread's lease on this lock previously expired. The expired lease will no longer be tracked after throwing LeaseExpiredException. Caller must synchronize on this lock token | throwIfCurrentThreadHadExpiredLease | {
"repo_name": "shankarh/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockToken.java",
"license": "apache-2.0",
"size": 17751
} | [
"org.apache.geode.distributed.LeaseExpiredException",
"org.apache.geode.internal.i18n.LocalizedStrings"
] | import org.apache.geode.distributed.LeaseExpiredException; import org.apache.geode.internal.i18n.LocalizedStrings; | import org.apache.geode.distributed.*; import org.apache.geode.internal.i18n.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,085,914 |
File sourceFile = new File(getCSVPath(fileName));
CSVLoader csvLoader = new CSVLoader();
csvLoader.setSource(sourceFile);
//Get the instances from this data-set.
Instances instances = csvLoader.getDataSet();
File destinationFile = new File(getARFFPath(fileName));
ArffSaver arffSaver = new ArffSaver();
arffSaver.setInstances(instances);
arffSaver.setFile(destinationFile);
arffSaver.writeBatch();
return destinationFile.getPath();
}
| File sourceFile = new File(getCSVPath(fileName)); CSVLoader csvLoader = new CSVLoader(); csvLoader.setSource(sourceFile); Instances instances = csvLoader.getDataSet(); File destinationFile = new File(getARFFPath(fileName)); ArffSaver arffSaver = new ArffSaver(); arffSaver.setInstances(instances); arffSaver.setFile(destinationFile); arffSaver.writeBatch(); return destinationFile.getPath(); } | /**
* The method takes in the CSV file name and creates the arff file.
* The CSV file is expected to be present in data/csv/ directory. The ARFF file is expected to be present in data/arff/ directory.
*
* @param fileName The CSV file name.
* @return filePath The ARFF file path.
* @throws IOException If no file with the specified name is found in the expected directories
*/ | The method takes in the CSV file name and creates the arff file. The CSV file is expected to be present in data/csv/ directory. The ARFF file is expected to be present in data/arff/ directory | saveAsARFF | {
"repo_name": "armanSingh/kaggle",
"path": "titanic/src/com/armsingh/titanic/data/handler/CSVHandler.java",
"license": "apache-2.0",
"size": 1625
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 67,317 |
public Result testListBindingsString() {
return verify("listBindings", new Class[] { String.class },
new Object[] { compNameStr }, null);
} | Result function() { return verify(STR, new Class[] { String.class }, new Object[] { compNameStr }, null); } | /**
* Test for the method listBindings(java.lang.String)
*
* @see javax.naming#listBindings(java.lang.String)
*/ | Test for the method listBindings(java.lang.String) | testListBindingsString | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/buildtest/tests/functional/src/test/functional/org/apache/harmony/test/func/api/javax/naming/provider/rmi/FederationSupportRefTest.java",
"license": "apache-2.0",
"size": 13276
} | [
"org.apache.harmony.share.Result"
] | import org.apache.harmony.share.Result; | import org.apache.harmony.share.*; | [
"org.apache.harmony"
] | org.apache.harmony; | 1,027,800 |
public static KualiDecimal getNumericAmount(KualiDecimal amount, String currentDebitCreditCode) {
KualiDecimal actualAmount = amount;
if (amount == null) {
actualAmount = KualiDecimal.ZERO;
}
else if (KFSConstants.GL_CREDIT_CODE.equals(currentDebitCreditCode)) {
actualAmount = actualAmount.multiply(new KualiDecimal(-1));
}
return actualAmount;
} | static KualiDecimal function(KualiDecimal amount, String currentDebitCreditCode) { KualiDecimal actualAmount = amount; if (amount == null) { actualAmount = KualiDecimal.ZERO; } else if (KFSConstants.GL_CREDIT_CODE.equals(currentDebitCreditCode)) { actualAmount = actualAmount.multiply(new KualiDecimal(-1)); } return actualAmount; } | /**
* Determine the actual amount based on Debit Credit code. If the code is credit code, then change the sign of the given amount;
* otherwise, do nothing
*
* @param amount the given amount, which can be either negative or positive number.
* @param currentDebitCreditCode the current debit credit code
* @return the actual numeric amount of the given amount
*/ | Determine the actual amount based on Debit Credit code. If the code is credit code, then change the sign of the given amount; otherwise, do nothing | getNumericAmount | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/ld/util/DebitCreditUtil.java",
"license": "apache-2.0",
"size": 6364
} | [
"org.kuali.kfs.sys.KFSConstants",
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.kfs.sys.KFSConstants; import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.kfs.sys.*; import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.kfs",
"org.kuali.rice"
] | org.kuali.kfs; org.kuali.rice; | 2,610,370 |
boolean removeAttributeWithoutCheck(PerunSession sess, Group group, AttributeDefinition attribute) throws WrongAttributeAssignmentException; | boolean removeAttributeWithoutCheck(PerunSession sess, Group group, AttributeDefinition attribute) throws WrongAttributeAssignmentException; | /**
* Unset all attributes for the group without check of value.
*
* @param sess
* @param group
* @param attribute
* @return {@code true} if attribute was changed (deleted) or {@code false} if attribute was not present in a first place
* @throws WrongAttributeAssignmentException if attribute isn't group attribute or if it is core attribute
* @throws InternalErrorException if an exception raise in concrete implementation, the exception is wrapped in InternalErrorException
*/ | Unset all attributes for the group without check of value | removeAttributeWithoutCheck | {
"repo_name": "zlamalp/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java",
"license": "bsd-2-clause",
"size": 244560
} | [
"cz.metacentrum.perun.core.api.AttributeDefinition",
"cz.metacentrum.perun.core.api.Group",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException"
] | import cz.metacentrum.perun.core.api.AttributeDefinition; import cz.metacentrum.perun.core.api.Group; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,814,197 |
public boolean visitUnionPattern(ExpressionOwner owner, UnionPattern pattern)
{
return true;
}
| boolean function(ExpressionOwner owner, UnionPattern pattern) { return true; } | /**
* Visit a union pattern.
* @param owner The owner of the expression, to which the expression can
* be reset if rewriting takes place.
* @param pattern The union pattern object.
* @return true if the sub expressions should be traversed.
*/ | Visit a union pattern | visitUnionPattern | {
"repo_name": "kcsl/immutability-benchmark",
"path": "benchmark-applications/reiminfer-oopsla-2012/source/Xalan/src/org/apache/xpath/XPathVisitor.java",
"license": "mit",
"size": 6965
} | [
"org.apache.xpath.patterns.UnionPattern"
] | import org.apache.xpath.patterns.UnionPattern; | import org.apache.xpath.patterns.*; | [
"org.apache.xpath"
] | org.apache.xpath; | 2,884,871 |
public int readPid(final long timeout, final TimeUnit unit) throws IOException, InterruptedException, TimeoutException {
IllegalArgumentException iae = null;
IOException ioe = null;
int pid = 0;
final long timeoutMillis = unit.toMillis(timeout);
final StopWatch stopWatch = new StopWatch(true);
while (pid <= 0) {
try {
pid = readPid();
} catch (IllegalArgumentException e) {
iae = e;
} catch (IOException e) {
ioe = e;
}
if (stopWatch.elapsedTimeMillis() > timeoutMillis) {
if (iae != null) {
throw new TimeoutException(iae.getMessage());
}
if (ioe != null) {
throw new TimeoutException(ioe.getMessage());
}
} else {
try {
Thread.sleep(SLEEP_INTERVAL_MILLIS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (iae != null) {
throw new InterruptedException(iae.getMessage());
}
if (ioe != null) {
throw new InterruptedException(ioe.getMessage());
}
throw e;
}
}
}
return pid;
} | int function(final long timeout, final TimeUnit unit) throws IOException, InterruptedException, TimeoutException { IllegalArgumentException iae = null; IOException ioe = null; int pid = 0; final long timeoutMillis = unit.toMillis(timeout); final StopWatch stopWatch = new StopWatch(true); while (pid <= 0) { try { pid = readPid(); } catch (IllegalArgumentException e) { iae = e; } catch (IOException e) { ioe = e; } if (stopWatch.elapsedTimeMillis() > timeoutMillis) { if (iae != null) { throw new TimeoutException(iae.getMessage()); } if (ioe != null) { throw new TimeoutException(ioe.getMessage()); } } else { try { Thread.sleep(SLEEP_INTERVAL_MILLIS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (iae != null) { throw new InterruptedException(iae.getMessage()); } if (ioe != null) { throw new InterruptedException(ioe.getMessage()); } throw e; } } } return pid; } | /**
* Reads in the pid from the specified file, retrying until the specified timeout.
*
* @param timeout the maximum time to spend trying to read the pidFile
* @param unit the unit of timeout
*
* @return the process id (pid) contained within the pidFile
*
* @throws IllegalArgumentException if the pid in the pidFile is not a positive integer
* @throws IOException if unable to read from the specified file
* @throws InterruptedException if interrupted
* @throws TimeoutException if operation times out
*/ | Reads in the pid from the specified file, retrying until the specified timeout | readPid | {
"repo_name": "ysung-pivotal/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/PidFile.java",
"license": "apache-2.0",
"size": 4828
} | [
"com.gemstone.gemfire.internal.util.StopWatch",
"java.io.IOException",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.TimeoutException"
] | import com.gemstone.gemfire.internal.util.StopWatch; import java.io.IOException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; | import com.gemstone.gemfire.internal.util.*; import java.io.*; import java.util.concurrent.*; | [
"com.gemstone.gemfire",
"java.io",
"java.util"
] | com.gemstone.gemfire; java.io; java.util; | 1,492,009 |
public Iterator sortedKeys() {
return new TreeSet(this.map.keySet()).iterator();
} | Iterator function() { return new TreeSet(this.map.keySet()).iterator(); } | /**
* Get an enumeration of the keys of the JSONObject.
* The keys will be sorted alphabetically.
*
* @return An iterator of the keys.
*/ | Get an enumeration of the keys of the JSONObject. The keys will be sorted alphabetically | sortedKeys | {
"repo_name": "dotCMS/core-2.x",
"path": "src/com/dotmarketing/util/json/JSONObject.java",
"license": "gpl-3.0",
"size": 52111
} | [
"java.util.Iterator",
"java.util.TreeSet"
] | import java.util.Iterator; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 863,347 |
public void enableHopsBetweenSelectedEntries( boolean enabled ) {
List<JobEntryCopy> list = jobMeta.getSelectedEntries();
for ( int i = 0; i < jobMeta.nrJobHops(); i++ ) {
JobHopMeta hop = jobMeta.getJobHop( i );
if ( list.contains( hop.getFromEntry() ) && list.contains( hop.getToEntry() ) ) {
JobHopMeta before = (JobHopMeta) hop.clone();
hop.setEnabled( enabled );
JobHopMeta after = (JobHopMeta) hop.clone();
spoon.addUndoChange( jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta
.indexOfJobHop( hop ) } );
}
}
spoon.refreshGraph();
} | void function( boolean enabled ) { List<JobEntryCopy> list = jobMeta.getSelectedEntries(); for ( int i = 0; i < jobMeta.nrJobHops(); i++ ) { JobHopMeta hop = jobMeta.getJobHop( i ); if ( list.contains( hop.getFromEntry() ) && list.contains( hop.getToEntry() ) ) { JobHopMeta before = (JobHopMeta) hop.clone(); hop.setEnabled( enabled ); JobHopMeta after = (JobHopMeta) hop.clone(); spoon.addUndoChange( jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta .indexOfJobHop( hop ) } ); } } spoon.refreshGraph(); } | /**
* This method enables or disables all the hops between the selected Entries.
*
**/ | This method enables or disables all the hops between the selected Entries | enableHopsBetweenSelectedEntries | {
"repo_name": "andrei-viaryshka/pentaho-kettle",
"path": "ui/src/org/pentaho/di/ui/spoon/job/JobGraph.java",
"license": "apache-2.0",
"size": 132086
} | [
"java.util.List",
"org.pentaho.di.job.JobHopMeta",
"org.pentaho.di.job.entry.JobEntryCopy"
] | import java.util.List; import org.pentaho.di.job.JobHopMeta; import org.pentaho.di.job.entry.JobEntryCopy; | import java.util.*; import org.pentaho.di.job.*; import org.pentaho.di.job.entry.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 56,148 |
public List<DeviceCommonInfo> getDeviceByType(String deviceType);
| List<DeviceCommonInfo> function(String deviceType); | /**
* This method is used to search for a device by its type
* @param deviceType
* @return a list of devices with a type 'deviceType' if any else null
*/ | This method is used to search for a device by its type | getDeviceByType | {
"repo_name": "EPapadopoulou/PersoNIS",
"path": "api/java/internal/src/main/java/org/societies/api/internal/css/devicemgmt/IDeviceLister.java",
"license": "bsd-2-clause",
"size": 5150
} | [
"java.util.List",
"org.societies.api.internal.css.devicemgmt.model.DeviceCommonInfo"
] | import java.util.List; import org.societies.api.internal.css.devicemgmt.model.DeviceCommonInfo; | import java.util.*; import org.societies.api.internal.css.devicemgmt.model.*; | [
"java.util",
"org.societies.api"
] | java.util; org.societies.api; | 1,351,935 |
NullFlavor getNullFlavor();
| NullFlavor getNullFlavor(); | /**
* Returns the value of the '<em><b>Null Flavor</b></em>' attribute.
* The literals are from the enumeration {@link org.openhealthtools.mdht.uml.hl7.vocab.NullFlavor}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Null Flavor</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Null Flavor</em>' attribute.
* @see org.openhealthtools.mdht.uml.hl7.vocab.NullFlavor
* @see #isSetNullFlavor()
* @see #unsetNullFlavor()
* @see #setNullFlavor(NullFlavor)
* @see org.openhealthtools.mdht.uml.cda.CDAPackage#getRelatedEntity_NullFlavor()
* @model unsettable="true" ordered="false"
* extendedMetaData="name='nullFlavor' kind='attribute'"
* @generated
*/ | Returns the value of the 'Null Flavor' attribute. The literals are from the enumeration <code>org.openhealthtools.mdht.uml.hl7.vocab.NullFlavor</code>. If the meaning of the 'Null Flavor' attribute isn't clear, there really should be more of a description here... | getNullFlavor | {
"repo_name": "mdht/mdht",
"path": "cda/plugins/org.openhealthtools.mdht.uml.cda/src/org/openhealthtools/mdht/uml/cda/RelatedEntity.java",
"license": "epl-1.0",
"size": 15317
} | [
"org.openhealthtools.mdht.uml.hl7.vocab.NullFlavor"
] | import org.openhealthtools.mdht.uml.hl7.vocab.NullFlavor; | import org.openhealthtools.mdht.uml.hl7.vocab.*; | [
"org.openhealthtools.mdht"
] | org.openhealthtools.mdht; | 558,244 |
public void setNodeID(String nodeID) {
synchronized (nodeIDGuard) {
this.nodeID = new SimpleString(nodeID);
this.uuid = new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(nodeID));
}
} | void function(String nodeID) { synchronized (nodeIDGuard) { this.nodeID = new SimpleString(nodeID); this.uuid = new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(nodeID)); } } | /**
* Sets the nodeID.
* <p>
* Only used by replicating backups.
*
* @param nodeID
*/ | Sets the nodeID. Only used by replicating backups | setNodeID | {
"repo_name": "tabish121/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java",
"license": "apache-2.0",
"size": 6221
} | [
"org.apache.activemq.artemis.api.core.SimpleString",
"org.apache.activemq.artemis.utils.UUID"
] | import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.utils.UUID; | import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.utils.*; | [
"org.apache.activemq"
] | org.apache.activemq; | 1,819,423 |
@Override
public void hide() {
// Clear the stage. This will remove ALL actors from the stage and it is faster than
// removing every single actor one by one. This is not shown in the video but it is
// an improvement.
stage.clear();
// Detach every entity from the world they have been living in.
player.detach();
for (FloorEntity floor : floorList)
floor.detach();
for (SpikeEntity spike : spikeList)
spike.detach();
// Clear the lists.
floorList.clear();
spikeList.clear();
} | void function() { stage.clear(); player.detach(); for (FloorEntity floor : floorList) floor.detach(); for (SpikeEntity spike : spikeList) spike.detach(); floorList.clear(); spikeList.clear(); } | /**
* This method will be executed when this screen is no more the active screen.
* I use this method to destroy all the things that have been used in the stage.
*/ | This method will be executed when this screen is no more the active screen. I use this method to destroy all the things that have been used in the stage | hide | {
"repo_name": "danirod/JumpDontDie",
"path": "core/src/es/danirod/jddprototype/game/GameScreen.java",
"license": "gpl-3.0",
"size": 12217
} | [
"es.danirod.jddprototype.game.entities.FloorEntity",
"es.danirod.jddprototype.game.entities.SpikeEntity"
] | import es.danirod.jddprototype.game.entities.FloorEntity; import es.danirod.jddprototype.game.entities.SpikeEntity; | import es.danirod.jddprototype.game.entities.*; | [
"es.danirod.jddprototype"
] | es.danirod.jddprototype; | 2,650,613 |
Map<String, List<String>> getResponseHeaders(); | Map<String, List<String>> getResponseHeaders(); | /**
* Gets the headers provided in the response.
*
* @return The response headers, or {@code null} if response headers are unavailable.
*/ | Gets the headers provided in the response | getResponseHeaders | {
"repo_name": "malizadehq/MyTelegram",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/exoplayer/upstream/HttpDataSource.java",
"license": "gpl-2.0",
"size": 4841
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 693,045 |
void setLocalSafeZoneOfNode(String nodeId, long localSafeZone) throws AndesException; | void setLocalSafeZoneOfNode(String nodeId, long localSafeZone) throws AndesException; | /**
* Set local safe zone of of a node to database
*
* @param nodeId id of node
* @param localSafeZone local safe zone of node (minimum ID deemed safe to delete within that node across all its
* JMS destinations.)
*/ | Set local safe zone of of a node to database | setLocalSafeZoneOfNode | {
"repo_name": "prabathariyaratna/andes",
"path": "modules/andes-core/broker/src/main/java/org/wso2/andes/server/cluster/coordination/SlotAgent.java",
"license": "apache-2.0",
"size": 7245
} | [
"org.wso2.andes.kernel.AndesException"
] | import org.wso2.andes.kernel.AndesException; | import org.wso2.andes.kernel.*; | [
"org.wso2.andes"
] | org.wso2.andes; | 1,718,896 |
void setFileOverviewJSDocInfo(JSDocInfo fileOverviewJSDocInfo) {
this.fileOverviewJSDocInfo = fileOverviewJSDocInfo;
}
private enum State {
SEARCHING_ANNOTATION,
SEARCHING_NEWLINE,
NEXT_IS_ANNOTATION
}
JsDocInfoParser(JsDocTokenStream stream,
Comment commentNode,
String sourceName,
Config config,
ErrorReporter errorReporter) {
this.stream = stream;
this.sourceName = sourceName;
this.jsdocBuilder = new JSDocInfoBuilder(config.parseJsDocDocumentation);
if (commentNode != null) {
this.jsdocBuilder.recordOriginalCommentString(commentNode.getValue());
}
this.annotationNames = config.annotationNames;
this.suppressionNames = config.suppressionNames;
this.errorReporter = errorReporter;
this.templateNode = this.createTemplateNode();
} | void setFileOverviewJSDocInfo(JSDocInfo fileOverviewJSDocInfo) { this.fileOverviewJSDocInfo = fileOverviewJSDocInfo; } private enum State { SEARCHING_ANNOTATION, SEARCHING_NEWLINE, NEXT_IS_ANNOTATION } JsDocInfoParser(JsDocTokenStream stream, Comment commentNode, String sourceName, Config config, ErrorReporter errorReporter) { this.stream = stream; this.sourceName = sourceName; this.jsdocBuilder = new JSDocInfoBuilder(config.parseJsDocDocumentation); if (commentNode != null) { this.jsdocBuilder.recordOriginalCommentString(commentNode.getValue()); } this.annotationNames = config.annotationNames; this.suppressionNames = config.suppressionNames; this.errorReporter = errorReporter; this.templateNode = this.createTemplateNode(); } | /**
* Sets the file overview JSDocInfo, in order to warn about multiple uses of
* the @fileoverview tag in a file.
*/ | Sets the file overview JSDocInfo, in order to warn about multiple uses of the @fileoverview tag in a file | setFileOverviewJSDocInfo | {
"repo_name": "nuxleus/closure-compiler",
"path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java",
"license": "apache-2.0",
"size": 72918
} | [
"com.google.javascript.jscomp.mozilla.rhino.ErrorReporter",
"com.google.javascript.jscomp.mozilla.rhino.ast.Comment",
"com.google.javascript.rhino.JSDocInfo",
"com.google.javascript.rhino.JSDocInfoBuilder"
] | import com.google.javascript.jscomp.mozilla.rhino.ErrorReporter; import com.google.javascript.jscomp.mozilla.rhino.ast.Comment; import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.JSDocInfoBuilder; | import com.google.javascript.jscomp.mozilla.rhino.*; import com.google.javascript.jscomp.mozilla.rhino.ast.*; import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 647,685 |
@Override
public FileName getRoot() {
FileName root = this;
while (root.getParent() != null) {
root = root.getParent();
}
return root;
} | FileName function() { FileName root = this; while (root.getParent() != null) { root = root.getParent(); } return root; } | /**
* find the root of the file system.
*
* @return The root FileName.
*/ | find the root of the file system | getRoot | {
"repo_name": "apache/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java",
"license": "apache-2.0",
"size": 16494
} | [
"org.apache.commons.vfs2.FileName"
] | import org.apache.commons.vfs2.FileName; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,066,699 |
public static CompletableFuture<Void> zkAsyncCreateFullPathOptimisticAndSetData(
final ZooKeeperClient zkc,
final String pathToCreate,
final byte[] data,
final List<ACL> acl,
final CreateMode createMode) {
final CompletableFuture<Void> result = new CompletableFuture<Void>(); | static CompletableFuture<Void> function( final ZooKeeperClient zkc, final String pathToCreate, final byte[] data, final List<ACL> acl, final CreateMode createMode) { final CompletableFuture<Void> result = new CompletableFuture<Void>(); | /**
* Asynchronously create zookeeper path recursively and optimistically.
*
* @param zkc Zookeeper client
* @param pathToCreate Zookeeper full path
* @param data Zookeeper data
* @param acl Acl of the zk path
* @param createMode Create mode of zk path
*/ | Asynchronously create zookeeper path recursively and optimistically | zkAsyncCreateFullPathOptimisticAndSetData | {
"repo_name": "sijie/incubator-distributedlog",
"path": "distributedlog-core/src/main/java/org/apache/distributedlog/util/Utils.java",
"license": "apache-2.0",
"size": 30041
} | [
"java.util.List",
"java.util.concurrent.CompletableFuture",
"org.apache.distributedlog.ZooKeeperClient",
"org.apache.zookeeper.CreateMode"
] | import java.util.List; import java.util.concurrent.CompletableFuture; import org.apache.distributedlog.ZooKeeperClient; import org.apache.zookeeper.CreateMode; | import java.util.*; import java.util.concurrent.*; import org.apache.distributedlog.*; import org.apache.zookeeper.*; | [
"java.util",
"org.apache.distributedlog",
"org.apache.zookeeper"
] | java.util; org.apache.distributedlog; org.apache.zookeeper; | 2,328,750 |
public static void addClassConstantsToRequest(Class<?> clazz, WebRequest request, boolean includeClassNamePrefix) {
Map<String, String> constants = registerAndRetrieveClassConstants(clazz);
for (Map.Entry<String, String> entry : constants.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
if (includeClassNamePrefix) {
String classNamePrefix = getClassNamePrefix(clazz);
name = classNamePrefix + name;
}
request.setAttribute(name, value, WebRequest.SCOPE_REQUEST);
}
} | static void function(Class<?> clazz, WebRequest request, boolean includeClassNamePrefix) { Map<String, String> constants = registerAndRetrieveClassConstants(clazz); for (Map.Entry<String, String> entry : constants.entrySet()) { String name = entry.getKey(); String value = entry.getValue(); if (includeClassNamePrefix) { String classNamePrefix = getClassNamePrefix(clazz); name = classNamePrefix + name; } request.setAttribute(name, value, WebRequest.SCOPE_REQUEST); } } | /**
* Adds all public static final String fields in the specified class to the
* specified request as attributes.
*
* @param clazz
* @param request
*/ | Adds all public static final String fields in the specified class to the specified request as attributes | addClassConstantsToRequest | {
"repo_name": "bocogop/main",
"path": "webreport/trunk/core/src/main/java/org/bocogop/shared/util/WebUtil.java",
"license": "unlicense",
"size": 6449
} | [
"java.util.Map",
"org.springframework.web.context.request.WebRequest"
] | import java.util.Map; import org.springframework.web.context.request.WebRequest; | import java.util.*; import org.springframework.web.context.request.*; | [
"java.util",
"org.springframework.web"
] | java.util; org.springframework.web; | 2,614,963 |
@Override
public String toString() {
String ivString = Base64.encodeToString(iv, BASE64_FLAGS);
String cipherTextString = Base64.encodeToString(cipherText, BASE64_FLAGS);
String macString = Base64.encodeToString(mac, BASE64_FLAGS);
return String.format(ivString + ":" + macString + ":" + cipherTextString);
} | String function() { String ivString = Base64.encodeToString(iv, BASE64_FLAGS); String cipherTextString = Base64.encodeToString(cipherText, BASE64_FLAGS); String macString = Base64.encodeToString(mac, BASE64_FLAGS); return String.format(ivString + ":" + macString + ":" + cipherTextString); } | /**
* Encodes this ciphertext, IV, mac as a string.
*
* @return base64(iv) : base64(mac) : base64(ciphertext).
* The iv and mac go first because they're fixed length.
*/ | Encodes this ciphertext, IV, mac as a string | toString | {
"repo_name": "orhanobut/java-aes-crypto",
"path": "AesCbcWithIntegrity.java",
"license": "mit",
"size": 35974
} | [
"android.util.Base64"
] | import android.util.Base64; | import android.util.*; | [
"android.util"
] | android.util; | 376,708 |
public static RubyFixnum pigToRuby(Ruby ruby, Integer object) {
return RubyFixnum.newFixnum(ruby, object.longValue());
} | static RubyFixnum function(Ruby ruby, Integer object) { return RubyFixnum.newFixnum(ruby, object.longValue()); } | /**
* A type specific conversion routine.
*
* @param ruby the Ruby runtime to create objects in
* @param object object to convert
* @return analogous Ruby type
*/ | A type specific conversion routine | pigToRuby | {
"repo_name": "ljl1988com/pig",
"path": "src/org/apache/pig/scripting/jruby/PigJrubyLibrary.java",
"license": "apache-2.0",
"size": 17340
} | [
"org.jruby.Ruby",
"org.jruby.RubyFixnum"
] | import org.jruby.Ruby; import org.jruby.RubyFixnum; | import org.jruby.*; | [
"org.jruby"
] | org.jruby; | 1,315,173 |
public Promise<StompFrameContext> transmitFrameAndAwait(
@NonNull final StompFrameContext context,
@NonNull final BooleanSupplier condition,
final StompFrameContextHandler handler
) {
final Deferred<StompFrameContext> result = stompContext.getDeferred().defer();
try {
if (handler != null) {
awaitFrame(handler).apply(result);
final Deferred<StompFrameContext> transmit = stompContext.getDeferred().defer();
transmit.getPromise().fail(result);
this.transmitJobs.add(new StompFrameTransmitJob(context, condition, transmit));
} else {
this.transmitJobs.add(new StompFrameTransmitJob(context, condition, result));
}
} catch (final Exception ex) {
result.reject(ex);
} finally {
this.stompContext.getSelector().wakeup();
}
return result.getPromise();
} | Promise<StompFrameContext> function( @NonNull final StompFrameContext context, @NonNull final BooleanSupplier condition, final StompFrameContextHandler handler ) { final Deferred<StompFrameContext> result = stompContext.getDeferred().defer(); try { if (handler != null) { awaitFrame(handler).apply(result); final Deferred<StompFrameContext> transmit = stompContext.getDeferred().defer(); transmit.getPromise().fail(result); this.transmitJobs.add(new StompFrameTransmitJob(context, condition, transmit)); } else { this.transmitJobs.add(new StompFrameTransmitJob(context, condition, result)); } } catch (final Exception ex) { result.reject(ex); } finally { this.stompContext.getSelector().wakeup(); } return result.getPromise(); } | /**
* Transmit frame and await response.
*
* @param context frame context
* @param handler frame handler
* @param condition transmit condition
* @return promise
*/ | Transmit frame and await response | transmitFrameAndAwait | {
"repo_name": "lancomsystems/stomp",
"path": "stomp-core/src/main/java/de/lancom/systems/stomp/core/connection/StompConnection.java",
"license": "apache-2.0",
"size": 22915
} | [
"de.lancom.systems.defer.Deferred",
"de.lancom.systems.defer.Promise",
"java.util.function.BooleanSupplier"
] | import de.lancom.systems.defer.Deferred; import de.lancom.systems.defer.Promise; import java.util.function.BooleanSupplier; | import de.lancom.systems.defer.*; import java.util.function.*; | [
"de.lancom.systems",
"java.util"
] | de.lancom.systems; java.util; | 924,328 |
public PactDslJsonArray decimalType() {
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomDecimalGenerator(10));
return decimalType(new BigDecimal("100"));
} | PactDslJsonArray function() { generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomDecimalGenerator(10)); return decimalType(new BigDecimal("100")); } | /**
* Element that must be a decimal value
*/ | Element that must be a decimal value | decimalType | {
"repo_name": "Fitzoh/pact-jvm",
"path": "pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java",
"license": "apache-2.0",
"size": 35404
} | [
"au.com.dius.pact.model.generators.Category",
"au.com.dius.pact.model.generators.RandomDecimalGenerator",
"java.math.BigDecimal"
] | import au.com.dius.pact.model.generators.Category; import au.com.dius.pact.model.generators.RandomDecimalGenerator; import java.math.BigDecimal; | import au.com.dius.pact.model.generators.*; import java.math.*; | [
"au.com.dius",
"java.math"
] | au.com.dius; java.math; | 1,111,038 |
@Override
public void removeSuper(Session session) {
super.remove (session);
} | void function(Session session) { super.remove (session); } | /**
* Remove this Session from the active Sessions for this Manager,
* but not from the Store. (Used by the PersistentValve)
*
* @param session Session to be removed
*/ | Remove this Session from the active Sessions for this Manager, but not from the Store. (Used by the PersistentValve) | removeSuper | {
"repo_name": "byronka/xenos",
"path": "lib/lib_src/apache-tomcat-8.0.14-src/java/org/apache/catalina/session/PersistentManagerBase.java",
"license": "mit",
"size": 32739
} | [
"org.apache.catalina.Session"
] | import org.apache.catalina.Session; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 739,899 |
@Test
public void testSetNourishment() {
final GiantModel model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
assertEquals(Nourishment.SATURATED, model.getNourishment());
for (final Nourishment nourishment : Nourishment.values()) {
model.setNourishment(nourishment);
assertEquals(nourishment, model.getNourishment());
assertEquals("The giant looks healthy, alert and " + nourishment.toString() + ".", model.toString());
}
} | void function() { final GiantModel model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED); assertEquals(Nourishment.SATURATED, model.getNourishment()); for (final Nourishment nourishment : Nourishment.values()) { model.setNourishment(nourishment); assertEquals(nourishment, model.getNourishment()); assertEquals(STR + nourishment.toString() + ".", model.toString()); } } | /**
* Verify if the nourishment level is set properly though the constructor and setter
*/ | Verify if the nourishment level is set properly though the constructor and setter | testSetNourishment | {
"repo_name": "Sumu-Ning/java-design-patterns",
"path": "model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java",
"license": "mit",
"size": 3020
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 212,867 |
public void initSuggestionMarkers() {
_markersByCategory = new HashMap<>();
_markersByCategory.put("attractions", new ArrayList<Marker>());
_markersByCategory.put("dining", new ArrayList<Marker>());
_markersByCategory.put("accommodation", new ArrayList<Marker>());
} | void function() { _markersByCategory = new HashMap<>(); _markersByCategory.put(STR, new ArrayList<Marker>()); _markersByCategory.put(STR, new ArrayList<Marker>()); _markersByCategory.put(STR, new ArrayList<Marker>()); } | /**
* Initialises hashmap for suggestion markers - allows them to be reset when markers are cleared.
*/ | Initialises hashmap for suggestion markers - allows them to be reset when markers are cleared | initSuggestionMarkers | {
"repo_name": "harrietrc/Mapster",
"path": "app/src/main/java/com/mapster/activities/MainActivity.java",
"license": "mit",
"size": 53475
} | [
"com.google.android.gms.maps.model.Marker",
"java.util.ArrayList",
"java.util.HashMap"
] | import com.google.android.gms.maps.model.Marker; import java.util.ArrayList; import java.util.HashMap; | import com.google.android.gms.maps.model.*; import java.util.*; | [
"com.google.android",
"java.util"
] | com.google.android; java.util; | 252,233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.