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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
boolean isExpired(ReferenceEntry<K, V> entry, long now) {
checkNotNull(entry);
if (expiresAfterAccess()
&& (now - entry.getAccessTime() >= expireAfterAccessNanos)) {
return true;
}
if (expiresAfterWrite()
&& (now - entry.getWriteTime() >= expireAfterWriteNanos)) {
return true;
}
return false;
}
// queues | boolean isExpired(ReferenceEntry<K, V> entry, long now) { checkNotNull(entry); if (expiresAfterAccess() && (now - entry.getAccessTime() >= expireAfterAccessNanos)) { return true; } if (expiresAfterWrite() && (now - entry.getWriteTime() >= expireAfterWriteNanos)) { return true; } return false; } | /**
* Returns true if the entry has expired.
*/ | Returns true if the entry has expired | isExpired | {
"repo_name": "privatemousse/guava",
"path": "guava/src/com/google/common/cache/LocalCache.java",
"license": "mit",
"size": 146604
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,792,616 |
public interface SwaggerPetstore {
AutoRestBaseUrl getBaseUrl(); | interface SwaggerPetstore { AutoRestBaseUrl function(); | /**
* Gets the URL used as the base for all cloud service requests.
*
* @return the BaseUrl object.
*/ | Gets the URL used as the base for all cloud service requests | getBaseUrl | {
"repo_name": "xingwu1/autorest",
"path": "Samples/petstore/Java/SwaggerPetstore.java",
"license": "mit",
"size": 35698
} | [
"com.microsoft.rest.AutoRestBaseUrl"
] | import com.microsoft.rest.AutoRestBaseUrl; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,510,948 |
public void dropIndex(final String schemaName, String idxName, boolean ifExists)
throws IgniteCheckedException{
String sql = H2Utils.indexDropSql(schemaName, idxName, ifExists);
connMgr.executeStatement(schemaName, sql);
} | void function(final String schemaName, String idxName, boolean ifExists) throws IgniteCheckedException{ String sql = H2Utils.indexDropSql(schemaName, idxName, ifExists); connMgr.executeStatement(schemaName, sql); } | /**
* Drop index.
*
* @param schemaName Schema name.
* @param idxName Index name.
* @param ifExists If exists.
* @throws IgniteCheckedException If failed.
*/ | Drop index | dropIndex | {
"repo_name": "BiryukovVA/ignite",
"path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java",
"license": "apache-2.0",
"size": 24360
} | [
"org.apache.ignite.IgniteCheckedException"
] | import org.apache.ignite.IgniteCheckedException; | import org.apache.ignite.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,231,553 |
@ApiModelProperty(
value = "The run status of the RemotePort.",
allowableValues = "TRANSMITTING, STOPPED"
)
public String getState() {
return super.getState();
} | @ApiModelProperty( value = STR, allowableValues = STR ) String function() { return super.getState(); } | /**
* Run status for this RemotePort.
* @return The run status
*/ | Run status for this RemotePort | getState | {
"repo_name": "mcgilman/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemotePortRunStatusEntity.java",
"license": "apache-2.0",
"size": 1567
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 169,778 |
public Map<String, Object> getDefaultOptions(Reader readerToAnalyze) throws IOException {
OpenedInputStream openedStream = fileAnalyzer.extractMIFileTypeAndCopiedInputStream(readerToAnalyze);
return getDefaultFileOptions(openedStream.getSource(), openedStream.getReader());
} | Map<String, Object> function(Reader readerToAnalyze) throws IOException { OpenedInputStream openedStream = fileAnalyzer.extractMIFileTypeAndCopiedInputStream(readerToAnalyze); return getDefaultFileOptions(openedStream.getSource(), openedStream.getReader()); } | /**
* Create a map with the default options to retrieve the default MI datasource that will read the reader content.
*
* @param readerToAnalyze : reader to be used to analyze the MIFileType
* @return the default options for the MI datasource corresponding to this source reader
* @throws java.io.IOException if any.
*/ | Create a map with the default options to retrieve the default MI datasource that will read the reader content | getDefaultOptions | {
"repo_name": "MICommunity/psi-jami",
"path": "jami-commons/src/main/java/psidev/psi/mi/jami/commons/MIDataSourceOptionFactory.java",
"license": "apache-2.0",
"size": 14278
} | [
"java.io.IOException",
"java.io.Reader",
"java.util.Map"
] | import java.io.IOException; import java.io.Reader; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 300,107 |
public void rellenaTabla() {
for (int i = 0; i < vista.getjTableUsuariosClientes().getRowCount(); i++) {
miTableModel.removeRow(i);
i -= 1;
}
try {
usuarioDAO.cargaUsuarios();
} catch (SQLException e) {
JOptionPane.showMessageDialog(vista, "Error al cargar la lista de usuarios en la tabla", "Error al cargar los usuarios", JOptionPane.ERROR_MESSAGE);
}
Object[] datos = new Object[6];
for (Usuario u : usuarioDAO.getListaUsuarios()) {
datos[0] = u.getNombre();
datos[1] = u.isAdmin();
datos[2] = u.isVistaClientes();
datos[3] = u.isVistaProductos();
datos[4] = u.isVistaProveedores();
datos[5] = u.isVistaUsuarios();
miTableModel.addRow(datos);
}
}
| void function() { for (int i = 0; i < vista.getjTableUsuariosClientes().getRowCount(); i++) { miTableModel.removeRow(i); i -= 1; } try { usuarioDAO.cargaUsuarios(); } catch (SQLException e) { JOptionPane.showMessageDialog(vista, STR, STR, JOptionPane.ERROR_MESSAGE); } Object[] datos = new Object[6]; for (Usuario u : usuarioDAO.getListaUsuarios()) { datos[0] = u.getNombre(); datos[1] = u.isAdmin(); datos[2] = u.isVistaClientes(); datos[3] = u.isVistaProductos(); datos[4] = u.isVistaProveedores(); datos[5] = u.isVistaUsuarios(); miTableModel.addRow(datos); } } | /**
* Metodo para rellenar la tabla creada
*/ | Metodo para rellenar la tabla creada | rellenaTabla | {
"repo_name": "grupoProyecto1/gestionTienda",
"path": "src/Controlador/ControladorJDTablaUsuarios.java",
"license": "agpl-3.0",
"size": 7101
} | [
"java.sql.SQLException",
"javax.swing.JOptionPane"
] | import java.sql.SQLException; import javax.swing.JOptionPane; | import java.sql.*; import javax.swing.*; | [
"java.sql",
"javax.swing"
] | java.sql; javax.swing; | 1,134,871 |
Validate.notNull(array, "The Array must not be null");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
// Finds and returns min
double min = array[0];
for (int i = 1; i < array.length; i++) {
min = min(array[i], min);
}
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws NullPointerException if {@code array} is {@code null} | Validate.notNull(array, STR); Validate.isTrue(array.length != 0, STR); double min = array[0]; for (int i = 1; i < array.length; i++) { min = min(array[i], min); } return min; } /** * <p>Returns the minimum value in an array.</p> * * @param array an array, must not be null or empty * @return the minimum value in the array * @throws NullPointerException if {@code array} is {@code null} | /**
* <p>Returns the minimum value in an array.</p>
*
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws NullPointerException if {@code array} is {@code null}
* @throws IllegalArgumentException if {@code array} is empty
* @since 3.4 Changed signature from min(double[]) to min(double...)
*/ | Returns the minimum value in an array | min | {
"repo_name": "MarkDacek/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java",
"license": "apache-2.0",
"size": 7826
} | [
"org.apache.commons.lang3.Validate"
] | import org.apache.commons.lang3.Validate; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,632,038 |
private Function<Runnable, WrappedRunnable> exceptionalWrapper() {
return (runnable) -> new SettableTimedRunnable(TimeUnit.NANOSECONDS.toNanos(-1), true);
} | Function<Runnable, WrappedRunnable> function() { return (runnable) -> new SettableTimedRunnable(TimeUnit.NANOSECONDS.toNanos(-1), true); } | /**
* The returned function outputs a WrappedRunnabled that simulates the case
* where {@link TimedRunnable#getTotalExecutionNanos()} returns -1 because
* the job failed or was rejected before it finished.
*/ | The returned function outputs a WrappedRunnabled that simulates the case where <code>TimedRunnable#getTotalExecutionNanos()</code> returns -1 because the job failed or was rejected before it finished | exceptionalWrapper | {
"repo_name": "robin13/elasticsearch",
"path": "server/src/test/java/org/elasticsearch/common/util/concurrent/EWMATrackingEsThreadPoolExecutorTests.java",
"license": "apache-2.0",
"size": 4797
} | [
"java.util.concurrent.TimeUnit",
"java.util.function.Function"
] | import java.util.concurrent.TimeUnit; import java.util.function.Function; | import java.util.concurrent.*; import java.util.function.*; | [
"java.util"
] | java.util; | 2,461,378 |
public SessionAcknowledgementType getAcknowledgementMode() {
return acknowledgementMode;
} | SessionAcknowledgementType function() { return acknowledgementMode; } | /**
* Returns the configured acknowledgementMode.
*
* @return the acknowledgementMode
*/ | Returns the configured acknowledgementMode | getAcknowledgementMode | {
"repo_name": "logzio/camel",
"path": "components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java",
"license": "apache-2.0",
"size": 15013
} | [
"org.apache.camel.component.sjms.jms.SessionAcknowledgementType"
] | import org.apache.camel.component.sjms.jms.SessionAcknowledgementType; | import org.apache.camel.component.sjms.jms.*; | [
"org.apache.camel"
] | org.apache.camel; | 613,476 |
private List<TestElement> createListOfTestElement() {
// Initialization
final List<TestElement> list = new ArrayList<>();
// Alimentation
TestElement testElement;
testElement = new TestElement();
testElement.setProperty1("100");
testElement.setProperty2("2");
list.add(testElement);
testElement = new TestElement();
testElement.setProperty1("110");
testElement.setProperty2("2");
list.add(testElement);
testElement = new TestElement();
testElement.setProperty1(null);
testElement.setProperty2("3");
list.add(testElement);
testElement = new TestElement();
testElement.setProperty1("120");
testElement.setProperty2(null);
list.add(testElement);
// Returning the result
return list;
} | List<TestElement> function() { final List<TestElement> list = new ArrayList<>(); TestElement testElement; testElement = new TestElement(); testElement.setProperty1("100"); testElement.setProperty2("2"); list.add(testElement); testElement = new TestElement(); testElement.setProperty1("110"); testElement.setProperty2("2"); list.add(testElement); testElement = new TestElement(); testElement.setProperty1(null); testElement.setProperty2("3"); list.add(testElement); testElement = new TestElement(); testElement.setProperty1("120"); testElement.setProperty2(null); list.add(testElement); return list; } | /**
* Creating an list of TestElement.
* @throws Exception
*/ | Creating an list of TestElement | createListOfTestElement | {
"repo_name": "ebonnet/Silverpeas-Core",
"path": "core-library/src/test/java/org/silverpeas/core/util/CollectionUtilTest.java",
"license": "agpl-3.0",
"size": 4130
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,491,884 |
public static SwaptionDataLattice convertMapOfTablesToLattice(final Map<Integer, DataTable> tables, final QuotingConvention quotingConvention, final LocalDate referenceDate,
final String discountCurveName, final String forwardCurveName, final SchedulePrototype fixMetaSchedule, final SchedulePrototype floatMetaSchedule) {
final List<Integer> moneynesss = new ArrayList<>();
final List<Integer> maturities = new ArrayList<>();
final List<Integer> tenors = new ArrayList<>();
final List<Double> values = new ArrayList<>();
for(final int moneyness : tables.keySet()) {
final DataTable table = tables.get(moneyness);
if(table.getConvention() != TableConvention.MONTHS) {
throw new IllegalArgumentException("This method is only set up to handle tables with convention 'inMONTHS'.");
}
for(final int maturity : table.getMaturities()) {
for(final int termination : table.getTerminationsForMaturity(maturity)) {
moneynesss.add(moneyness);
maturities.add(maturity);
tenors.add(termination);
values.add(table.getValue(maturity, termination));
}
}
}
return new SwaptionDataLattice(referenceDate, quotingConvention, 0, forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule,
maturities.stream().mapToInt(Integer::intValue).toArray(),
tenors.stream().mapToInt(Integer::intValue).toArray(),
moneynesss.stream().mapToInt(Integer::intValue).toArray(),
values.stream().mapToDouble(Double::doubleValue).toArray());
} | static SwaptionDataLattice function(final Map<Integer, DataTable> tables, final QuotingConvention quotingConvention, final LocalDate referenceDate, final String discountCurveName, final String forwardCurveName, final SchedulePrototype fixMetaSchedule, final SchedulePrototype floatMetaSchedule) { final List<Integer> moneynesss = new ArrayList<>(); final List<Integer> maturities = new ArrayList<>(); final List<Integer> tenors = new ArrayList<>(); final List<Double> values = new ArrayList<>(); for(final int moneyness : tables.keySet()) { final DataTable table = tables.get(moneyness); if(table.getConvention() != TableConvention.MONTHS) { throw new IllegalArgumentException(STR); } for(final int maturity : table.getMaturities()) { for(final int termination : table.getTerminationsForMaturity(maturity)) { moneynesss.add(moneyness); maturities.add(maturity); tenors.add(termination); values.add(table.getValue(maturity, termination)); } } } return new SwaptionDataLattice(referenceDate, quotingConvention, 0, forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule, maturities.stream().mapToInt(Integer::intValue).toArray(), tenors.stream().mapToInt(Integer::intValue).toArray(), moneynesss.stream().mapToInt(Integer::intValue).toArray(), values.stream().mapToDouble(Double::doubleValue).toArray()); } | /**
* Convert a map of {@link DataTable} containing swaption data to a {@link SwaptionDataLattice}.
* The data of the swaptions is arranged in tables by moneyness, which is used as key in the map.
* The tables need to be in {@link TableConvention#MONTHS}.
*
* @param tables A map of tables, containing swaption data in convention {@link TableConvention#MONTHS}, per moneyness.
* @param quotingConvention The quoting convention of the data.
* @param referenceDate The reference date associated with the swaptions.
* @param discountCurveName The name of the discount curve to be used for the swaptions.
* @param forwardCurveName The name of the forward curve to be used for the swaptions.
* @param fixMetaSchedule The ScheduleMetaData to be used for the fix schedules of the swaptions.
* @param floatMetaSchedule The ScheduleMetaData to be used for the float schedules of the swaptions.
* @return SwaptionDataLattice containing the swaptions of the tables.
*/ | Convert a map of <code>DataTable</code> containing swaption data to a <code>SwaptionDataLattice</code>. The data of the swaptions is arranged in tables by moneyness, which is used as key in the map. The tables need to be in <code>TableConvention#MONTHS</code> | convertMapOfTablesToLattice | {
"repo_name": "finmath/finmath-lib",
"path": "src/main/java8/net/finmath/singleswaprate/Utils.java",
"license": "apache-2.0",
"size": 11202
} | [
"java.time.LocalDate",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"net.finmath.marketdata.model.volatilities.SwaptionDataLattice",
"net.finmath.singleswaprate.data.DataTable",
"net.finmath.time.SchedulePrototype"
] | import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; import net.finmath.marketdata.model.volatilities.SwaptionDataLattice; import net.finmath.singleswaprate.data.DataTable; import net.finmath.time.SchedulePrototype; | import java.time.*; import java.util.*; import net.finmath.marketdata.model.volatilities.*; import net.finmath.singleswaprate.data.*; import net.finmath.time.*; | [
"java.time",
"java.util",
"net.finmath.marketdata",
"net.finmath.singleswaprate",
"net.finmath.time"
] | java.time; java.util; net.finmath.marketdata; net.finmath.singleswaprate; net.finmath.time; | 1,830,664 |
@Override public void visitErrorNode(ErrorNode node) { } | @Override public void visitErrorNode(ErrorNode node) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | visitTerminal | {
"repo_name": "trex-nw/simple-expression-calculator",
"path": "src/main/java/com/acme/calculator/antlr4/BasicCalculatorBaseListener.java",
"license": "mit",
"size": 2411
} | [
"org.antlr.v4.runtime.tree.ErrorNode"
] | import org.antlr.v4.runtime.tree.ErrorNode; | import org.antlr.v4.runtime.tree.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,301,175 |
public static List<LogoutRequest> getLogoutRequests(final RequestContext context) {
return (List<LogoutRequest>) context.getFlowScope().get(PARAMETER_LOGOUT_REQUESTS);
} | static List<LogoutRequest> function(final RequestContext context) { return (List<LogoutRequest>) context.getFlowScope().get(PARAMETER_LOGOUT_REQUESTS); } | /**
* Gets the logout requests from flow scope.
*
* @param context the context
* @return the logout requests
*/ | Gets the logout requests from flow scope | getLogoutRequests | {
"repo_name": "doodelicious/cas",
"path": "core/cas-server-core-web/src/main/java/org/apereo/cas/web/support/WebUtils.java",
"license": "apache-2.0",
"size": 32168
} | [
"java.util.List",
"org.apereo.cas.logout.LogoutRequest",
"org.springframework.webflow.execution.RequestContext"
] | import java.util.List; import org.apereo.cas.logout.LogoutRequest; import org.springframework.webflow.execution.RequestContext; | import java.util.*; import org.apereo.cas.logout.*; import org.springframework.webflow.execution.*; | [
"java.util",
"org.apereo.cas",
"org.springframework.webflow"
] | java.util; org.apereo.cas; org.springframework.webflow; | 368,278 |
public void clearTransactionCount()
{
Arrays.fill(transactionCount, 0);
} | void function() { Arrays.fill(transactionCount, 0); } | /**
* Reset the transaction counts to zero.
*/ | Reset the transaction counts to zero | clearTransactionCount | {
"repo_name": "lpxz/grail-derby104",
"path": "java/testing/org/apache/derbyTesting/system/oe/client/Submitter.java",
"license": "apache-2.0",
"size": 16172
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,566,282 |
@Override
protected void onPostExecute(String result) {
Log.i(TAG, "authToken = " + result);
authToken = result;
Toast.makeText(activity, "Finished authentication", Toast.LENGTH_SHORT).show();
// Send any pending messages
processPendingQueue();
}
}
class AsyncSendMessage extends AsyncTask<String, Void, String> { | void function(String result) { Log.i(TAG, STR + result); authToken = result; Toast.makeText(activity, STR, Toast.LENGTH_SHORT).show(); processPendingQueue(); } } class AsyncSendMessage extends AsyncTask<String, Void, String> { | /**
* Sets the authToken instance variable and sends a message if one is waiting.
*/ | Sets the authToken instance variable and sends a message if one is waiting | onPostExecute | {
"repo_name": "warren922/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Texting.java",
"license": "apache-2.0",
"size": 45293
} | [
"android.os.AsyncTask",
"android.util.Log",
"android.widget.Toast"
] | import android.os.AsyncTask; import android.util.Log; import android.widget.Toast; | import android.os.*; import android.util.*; import android.widget.*; | [
"android.os",
"android.util",
"android.widget"
] | android.os; android.util; android.widget; | 1,557,653 |
@Override
public void clear() {
final OAtomicOperation atomicOperation;
try {
atomicOperation = startAtomicOperation();
} catch (IOException e) {
throw new OSBTreeException("Error during sbtree entrie clear.", e);
}
final Lock lock = fileLockManager.acquireExclusiveLock(fileId);
try {
final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<OBonsaiBucketPointer>();
OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, rootBucketPointer.getPageIndex(), false);
cacheEntry.acquireExclusiveLock();
try {
OSBTreeBonsaiBucket<K, V> rootBucket = new OSBTreeBonsaiBucket<K, V>(cacheEntry, rootBucketPointer.getPageOffset(),
keySerializer, valueSerializer, getChangesTree(atomicOperation, cacheEntry));
addChildrenToQueue(subTreesToDelete, rootBucket);
rootBucket.shrink(0);
rootBucket = new OSBTreeBonsaiBucket<K, V>(cacheEntry, rootBucketPointer.getPageOffset(), true, keySerializer,
valueSerializer, getChangesTree(atomicOperation, cacheEntry));
rootBucket.setTreeSize(0);
} finally {
cacheEntry.releaseExclusiveLock();
releasePage(atomicOperation, cacheEntry);
}
recycleSubTrees(subTreesToDelete, atomicOperation);
endAtomicOperation(false);
} catch (Throwable e) {
rollback();
throw new OSBTreeException("Error during clear of sbtree with name " + getName(), e);
} finally {
lock.unlock();
}
} | void function() { final OAtomicOperation atomicOperation; try { atomicOperation = startAtomicOperation(); } catch (IOException e) { throw new OSBTreeException(STR, e); } final Lock lock = fileLockManager.acquireExclusiveLock(fileId); try { final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<OBonsaiBucketPointer>(); OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, rootBucketPointer.getPageIndex(), false); cacheEntry.acquireExclusiveLock(); try { OSBTreeBonsaiBucket<K, V> rootBucket = new OSBTreeBonsaiBucket<K, V>(cacheEntry, rootBucketPointer.getPageOffset(), keySerializer, valueSerializer, getChangesTree(atomicOperation, cacheEntry)); addChildrenToQueue(subTreesToDelete, rootBucket); rootBucket.shrink(0); rootBucket = new OSBTreeBonsaiBucket<K, V>(cacheEntry, rootBucketPointer.getPageOffset(), true, keySerializer, valueSerializer, getChangesTree(atomicOperation, cacheEntry)); rootBucket.setTreeSize(0); } finally { cacheEntry.releaseExclusiveLock(); releasePage(atomicOperation, cacheEntry); } recycleSubTrees(subTreesToDelete, atomicOperation); endAtomicOperation(false); } catch (Throwable e) { rollback(); throw new OSBTreeException(STR + getName(), e); } finally { lock.unlock(); } } | /**
* Removes all entries from bonsai tree. Put all but the root page to free list for further reuse.
*/ | Removes all entries from bonsai tree. Put all but the root page to free list for further reuse | clear | {
"repo_name": "cstamas/orientdb",
"path": "core/src/main/java/com/orientechnologies/orient/core/index/sbtreebonsai/local/OSBTreeBonsaiLocal.java",
"license": "apache-2.0",
"size": 55835
} | [
"com.orientechnologies.orient.core.index.hashindex.local.cache.OCacheEntry",
"com.orientechnologies.orient.core.index.sbtree.local.OSBTreeException",
"com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation",
"java.io.IOException",
"java.util.LinkedList",
"java.util.Queue",
"java.util.concurrent.locks.Lock"
] | import com.orientechnologies.orient.core.index.hashindex.local.cache.OCacheEntry; import com.orientechnologies.orient.core.index.sbtree.local.OSBTreeException; import com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation; import java.io.IOException; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.locks.Lock; | import com.orientechnologies.orient.core.index.hashindex.local.cache.*; import com.orientechnologies.orient.core.index.sbtree.local.*; import com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.*; import java.io.*; import java.util.*; import java.util.concurrent.locks.*; | [
"com.orientechnologies.orient",
"java.io",
"java.util"
] | com.orientechnologies.orient; java.io; java.util; | 1,936,781 |
private static void processDirectory( final File dir,
final ResourceManager resourceManager ) {
try {
final File[] dirs = dir.listFiles( DIRECTORY_FILTER );
if ( dirs == null ) {
return;
}
for ( final File f : dirs ) {
processDirectory( f, resourceManager );
}
final File[] templatesArray = dir.listFiles( TEMPLATE_FILES_FILTER );
if ( templatesArray == null ) {
return;
}
Arrays.sort( templatesArray );
for ( final File f : templatesArray ) {
final String absolutePath = f.getAbsolutePath();
try {
// TODO: the plugin ID should be preserved even if the template name changes.. not the case today.
// Ta;kl with Instaview team and Matt C. regarding best place to impose a template ID
final InputStream in = new BufferedInputStream( new FileInputStream( f ) );
try {
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
IOUtils.getInstance().copyStreams( in, bout );
final String possiblePluginId = absolutePath.substring(
absolutePath.indexOf( DATASOURCE_DIRECTORY ),
absolutePath.length() );
DataFactoryRegistry.getInstance().register( new EmbeddedKettleDataFactoryMetaData
( possiblePluginId, f.getName().replace( ".ktr", "" ), bout.toByteArray() ) );
if ( logger.isDebugEnabled() ) {
logger.debug( "Datasource metadata successfully registered: ".concat( absolutePath ) );
}
} finally {
in.close();
}
} catch ( IOException ioe ) {
logger.warn( "Error reading template file: " + absolutePath, ioe );
}
}
} catch ( Exception se ) {
logger.error( "Cannot access datasource template directory", se );// NON-NLS
}
} | static void function( final File dir, final ResourceManager resourceManager ) { try { final File[] dirs = dir.listFiles( DIRECTORY_FILTER ); if ( dirs == null ) { return; } for ( final File f : dirs ) { processDirectory( f, resourceManager ); } final File[] templatesArray = dir.listFiles( TEMPLATE_FILES_FILTER ); if ( templatesArray == null ) { return; } Arrays.sort( templatesArray ); for ( final File f : templatesArray ) { final String absolutePath = f.getAbsolutePath(); try { final InputStream in = new BufferedInputStream( new FileInputStream( f ) ); try { final ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.getInstance().copyStreams( in, bout ); final String possiblePluginId = absolutePath.substring( absolutePath.indexOf( DATASOURCE_DIRECTORY ), absolutePath.length() ); DataFactoryRegistry.getInstance().register( new EmbeddedKettleDataFactoryMetaData ( possiblePluginId, f.getName().replace( ".ktr", STRDatasource metadata successfully registered: STRError reading template file: STRCannot access datasource template directory", se ); } } | /**
* Creates a list of datasources from the templates located in the /datasources directory.
*/ | Creates a list of datasources from the templates located in the /datasources directory | processDirectory | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/extensions-kettle/src/main/java/org/pentaho/reporting/engine/classic/extensions/datasources/kettle/TransformationDatasourceMetadata.java",
"license": "lgpl-2.1",
"size": 5472
} | [
"java.io.BufferedInputStream",
"java.io.ByteArrayOutputStream",
"java.io.File",
"java.io.FileInputStream",
"java.io.InputStream",
"java.util.Arrays",
"org.pentaho.reporting.engine.classic.core.metadata.DataFactoryRegistry",
"org.pentaho.reporting.libraries.base.util.IOUtils",
"org.pentaho.reporting.libraries.resourceloader.ResourceManager"
] | import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Arrays; import org.pentaho.reporting.engine.classic.core.metadata.DataFactoryRegistry; import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; | import java.io.*; import java.util.*; import org.pentaho.reporting.engine.classic.core.metadata.*; import org.pentaho.reporting.libraries.base.util.*; import org.pentaho.reporting.libraries.resourceloader.*; | [
"java.io",
"java.util",
"org.pentaho.reporting"
] | java.io; java.util; org.pentaho.reporting; | 962,636 |
protected void initErrorReporter() {
if (fErrorReporter == null) {
fErrorReporter = new XMLErrorReporter();
}
if (fErrorHandler == null) {
fErrorHandler = new XPointerErrorHandler();
}
fErrorReporter.putMessageFormatter(
XPointerMessageFormatter.XPOINTER_DOMAIN,
new XPointerMessageFormatter());
} | void function() { if (fErrorReporter == null) { fErrorReporter = new XMLErrorReporter(); } if (fErrorHandler == null) { fErrorHandler = new XPointerErrorHandler(); } fErrorReporter.putMessageFormatter( XPointerMessageFormatter.XPOINTER_DOMAIN, new XPointerMessageFormatter()); } | /**
* Initializes error handling objects
*/ | Initializes error handling objects | initErrorReporter | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/xerces/src/org/apache/xerces/xpointer/ElementSchemePointer.java",
"license": "gpl-2.0",
"size": 30582
} | [
"org.apache.xerces.impl.XMLErrorReporter"
] | import org.apache.xerces.impl.XMLErrorReporter; | import org.apache.xerces.impl.*; | [
"org.apache.xerces"
] | org.apache.xerces; | 3,306 |
@Override
public boolean equals(final Object object) {
if (object == this) {
// Slight optimization
return true;
}
if (super.equals(object)) {
final GeocentricTransform that = (GeocentricTransform) object;
return Double.doubleToLongBits(this. a ) == Double.doubleToLongBits(that. a ) &&
Double.doubleToLongBits(this. b ) == Double.doubleToLongBits(that. b ) &&
Double.doubleToLongBits(this. a2) == Double.doubleToLongBits(that. a2) &&
Double.doubleToLongBits(this. b2) == Double.doubleToLongBits(that. b2) &&
Double.doubleToLongBits(this. e2) == Double.doubleToLongBits(that. e2) &&
Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) &&
this.hasHeight == that.hasHeight;
}
return false;
}
private final class Inverse extends AbstractMathTransform.Inverse implements Serializable {
private static final long serialVersionUID = 6942084702259211803L;
public Inverse() {
GeocentricTransform.this.super();
}
// @Override
// public ParameterDescriptorGroup getParameterDescriptors() {
// return ProviderInverse.PARAMETERS;
// }
// @Override
// public ParameterValueGroup getParameterValues() {
// return GeocentricTransform.this.getParameterValues(getParameterDescriptors());
// } | boolean function(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this. a ) == Double.doubleToLongBits(that. a ) && Double.doubleToLongBits(this. b ) == Double.doubleToLongBits(that. b ) && Double.doubleToLongBits(this. a2) == Double.doubleToLongBits(that. a2) && Double.doubleToLongBits(this. b2) == Double.doubleToLongBits(that. b2) && Double.doubleToLongBits(this. e2) == Double.doubleToLongBits(that. e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; } private final class Inverse extends AbstractMathTransform.Inverse implements Serializable { private static final long serialVersionUID = 6942084702259211803L; public Inverse() { GeocentricTransform.this.super(); } | /**
* Compares the specified object with this math transform for equality.
*/ | Compares the specified object with this math transform for equality | equals | {
"repo_name": "iCarto/siga",
"path": "libTopology/src/org/geotools/referencefork/referencing/operation/transform/GeocentricTransform.java",
"license": "gpl-3.0",
"size": 31594
} | [
"java.io.Serializable"
] | import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 1,216,067 |
predicate = Val.chkStr(predicate);
value = Val.chkStr(value);
if ((predicate.length() > 0) && (value.length() > 0)) {
RDFPair pair = this.get(predicate);
if (pair == null) {
pair = new RDFPair();
pair.setPredicate(predicate);
pair.getValues().add(value);
this.put(pair.getPredicate(),pair);
//System.err.println("******* "+predicate+"="+value);
} else {
pair.getValues().add(value);
}
}
}
| predicate = Val.chkStr(predicate); value = Val.chkStr(value); if ((predicate.length() > 0) && (value.length() > 0)) { RDFPair pair = this.get(predicate); if (pair == null) { pair = new RDFPair(); pair.setPredicate(predicate); pair.getValues().add(value); this.put(pair.getPredicate(),pair); } else { pair.getValues().add(value); } } } | /**
* Adds a predicate/value pair to the collection.
* @param predicate the predicate URI
* @param the literal value
*/ | Adds a predicate/value pair to the collection | addValue | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/catalog/arcgis/metadata/RDFPairs.java",
"license": "apache-2.0",
"size": 2012
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 1,052,038 |
@FIXVersion(introduced="4.1")
@TagNumRef(tagNum=TagNum.OrdStatus)
public OrdStatus getOrdStatus() {
return ordStatus;
} | @FIXVersion(introduced="4.1") @TagNumRef(tagNum=TagNum.OrdStatus) OrdStatus function() { return ordStatus; } | /**
* Message field getter.
* @return field value
*/ | Message field getter | getOrdStatus | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/OrderCancelRejectMsg.java",
"license": "gpl-3.0",
"size": 30445
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.OrdStatus",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.OrdStatus; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 1,095,810 |
public void restoreLineColPos(final int endLine, final int endColumn) {
final int initialBufPos = bufpos;
final int currLine = getEndLine();
if (currLine < endLine) {
//note: we could do it, but it's not what we want!
Log.log("Cannot backtrack to a later position -- current line: " + getEndLine() + " requested line:"
+ endLine);
return;
} else if (currLine == endLine && getEndColumn() < endColumn) {
Log.log("Cannot backtrack to a later position -- current col: " + getEndColumn() + " requested col:"
+ endColumn);
return;
}
while ((getEndLine() != endLine || getEndColumn() != endColumn) && bufpos >= 0) {
bufpos--;
}
if (bufpos < 0 || getEndLine() != endLine) {
//we couldn't find it. Let's restore the position when we started it.
bufpos = initialBufPos;
Log.log("Couldn't backtrack to position: line" + endLine + " -- col:" + endColumn);
}
} | void function(final int endLine, final int endColumn) { final int initialBufPos = bufpos; final int currLine = getEndLine(); if (currLine < endLine) { Log.log(STR + getEndLine() + STR + endLine); return; } else if (currLine == endLine && getEndColumn() < endColumn) { Log.log(STR + getEndColumn() + STR + endColumn); return; } while ((getEndLine() != endLine getEndColumn() != endColumn) && bufpos >= 0) { bufpos--; } if (bufpos < 0 getEndLine() != endLine) { bufpos = initialBufPos; Log.log(STR + endLine + STR + endColumn); } } | /**
* Restores a previous position.
* Don't forget to restore the level if eof was already found!
*/ | Restores a previous position. Don't forget to restore the level if eof was already found | restoreLineColPos | {
"repo_name": "rajul/Pydev",
"path": "plugins/org.python.pydev.parser/src/org/python/pydev/parser/jython/FastCharStream.java",
"license": "epl-1.0",
"size": 7669
} | [
"org.python.pydev.core.log.Log"
] | import org.python.pydev.core.log.Log; | import org.python.pydev.core.log.*; | [
"org.python.pydev"
] | org.python.pydev; | 2,637,453 |
public void initializeDatabase() throws CantInitializeCashMoneyWalletDatabaseException {
try {
database = this.pluginDatabaseSystem.openDatabase(pluginId, pluginId.toString());
} catch (CantOpenDatabaseException cantOpenDatabaseException) {
throw new CantInitializeCashMoneyWalletDatabaseException(cantOpenDatabaseException.getMessage());
} catch (DatabaseNotFoundException e) {
CashMoneyWalletDatabaseFactory cashMoneyWalletDatabaseFactory = new CashMoneyWalletDatabaseFactory(pluginDatabaseSystem);
try {
database = cashMoneyWalletDatabaseFactory.createDatabase(pluginId, pluginId.toString());
} catch (CantCreateDatabaseException cantCreateDatabaseException) {
throw new CantInitializeCashMoneyWalletDatabaseException(cantCreateDatabaseException.getMessage());
}
}
} | void function() throws CantInitializeCashMoneyWalletDatabaseException { try { database = this.pluginDatabaseSystem.openDatabase(pluginId, pluginId.toString()); } catch (CantOpenDatabaseException cantOpenDatabaseException) { throw new CantInitializeCashMoneyWalletDatabaseException(cantOpenDatabaseException.getMessage()); } catch (DatabaseNotFoundException e) { CashMoneyWalletDatabaseFactory cashMoneyWalletDatabaseFactory = new CashMoneyWalletDatabaseFactory(pluginDatabaseSystem); try { database = cashMoneyWalletDatabaseFactory.createDatabase(pluginId, pluginId.toString()); } catch (CantCreateDatabaseException cantCreateDatabaseException) { throw new CantInitializeCashMoneyWalletDatabaseException(cantCreateDatabaseException.getMessage()); } } } | /**
* This method open or creates the database i'll be working with
*
* @throws CantInitializeCashMoneyWalletDatabaseException
*/ | This method open or creates the database i'll be working with | initializeDatabase | {
"repo_name": "fvasquezjatar/fermat-unused",
"path": "CSH/plugin/wallet/fermat-csh-plugin-wallet-cash-money-bitdubai/src/main/java/com/bitdubai/fermat_csh_plugin/layer/wallet/cash_money/developer/bitdubai/version_1/database/CashMoneyWalletDeveloperDatabaseFactory.java",
"license": "mit",
"size": 8688
} | [
"com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantCreateDatabaseException",
"com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantOpenDatabaseException",
"com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.DatabaseNotFoundException",
"com.bitdubai.fermat_csh_plugin.layer.wallet.cash_money.developer.bitdubai.version_1.exceptions.CantInitializeCashMoneyWalletDatabaseException"
] | import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantCreateDatabaseException; import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantOpenDatabaseException; import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.DatabaseNotFoundException; import com.bitdubai.fermat_csh_plugin.layer.wallet.cash_money.developer.bitdubai.version_1.exceptions.CantInitializeCashMoneyWalletDatabaseException; | import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.*; import com.bitdubai.fermat_csh_plugin.layer.wallet.cash_money.developer.bitdubai.version_1.exceptions.*; | [
"com.bitdubai.fermat_api",
"com.bitdubai.fermat_csh_plugin"
] | com.bitdubai.fermat_api; com.bitdubai.fermat_csh_plugin; | 2,065,872 |
public TextField addTextField(StyleData rStyle, String sText)
{
TextField aComponent = new TextField();
addComponent(aComponent, rStyle, sText, null);
return aComponent;
} | TextField function(StyleData rStyle, String sText) { TextField aComponent = new TextField(); addComponent(aComponent, rStyle, sText, null); return aComponent; } | /***************************************
* Creates a new {@link TextField}.
*
* @param rStyle The style data
* @param sText The initial text
*
* @return The new component
*/ | Creates a new <code>TextField</code> | addTextField | {
"repo_name": "esoco/gewt",
"path": "src/main/java/de/esoco/ewt/build/ContainerBuilder.java",
"license": "apache-2.0",
"size": 19744
} | [
"de.esoco.ewt.component.TextField",
"de.esoco.ewt.style.StyleData"
] | import de.esoco.ewt.component.TextField; import de.esoco.ewt.style.StyleData; | import de.esoco.ewt.component.*; import de.esoco.ewt.style.*; | [
"de.esoco.ewt"
] | de.esoco.ewt; | 1,143,735 |
@Autowired
public void setBaseConfig(OpenSDIManagerConfig baseConfig){
this.setRuntimeDir(baseConfig.getBaseFolder());
} | void function(OpenSDIManagerConfig baseConfig){ this.setRuntimeDir(baseConfig.getBaseFolder()); } | /**
* Set the configuration to set up the base directory
* @param config
*/ | Set the configuration to set up the base directory | setBaseConfig | {
"repo_name": "offtherailz/OpenSDI-Manager2",
"path": "src/modules/geocollect/src/main/java/it/geosolutions/opensdi2/mvc/GeoCollectDataController.java",
"license": "gpl-3.0",
"size": 8926
} | [
"it.geosolutions.opensdi2.config.OpenSDIManagerConfig"
] | import it.geosolutions.opensdi2.config.OpenSDIManagerConfig; | import it.geosolutions.opensdi2.config.*; | [
"it.geosolutions.opensdi2"
] | it.geosolutions.opensdi2; | 1,184,124 |
public synchronized void open() throws IOException {
scanner = new Scanner(input);
logger.open();
} | synchronized void function() throws IOException { scanner = new Scanner(input); logger.open(); } | /**
* Open TLogger instance
*
* @throws IOException
* when IO error occurs
*/ | Open TLogger instance | open | {
"repo_name": "Nastel/TNT4J",
"path": "tnt4j-core/src/main/java/com/jkoolcloud/tnt4j/utils/TLog.java",
"license": "apache-2.0",
"size": 5749
} | [
"java.io.IOException",
"java.util.Scanner"
] | import java.io.IOException; import java.util.Scanner; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,793,486 |
public synchronized void appendGroupNodeComment(
final INaviGroupNode node, final Integer commentId) throws CouldntLoadDataException {
Preconditions.checkNotNull(node, "IE02556: node argument can not be null");
appendComment(new GroupNodeCommentingStrategy(node), commentId);
} | synchronized void function( final INaviGroupNode node, final Integer commentId) throws CouldntLoadDataException { Preconditions.checkNotNull(node, STR); appendComment(new GroupNodeCommentingStrategy(node), commentId); } | /**
* Appends a new group node comment to the list of group node comments associated with the given
* group node by using the comment id supplied the caller to fetch the comment from the database.
*
* @param node The {@link INaviGroupNode} to which the appended comment will be associated.
* @param commentId The comment id of the comment which has been appended.
*
* @throws CouldntLoadDataException if the appended comment could not be loaded from the database.
*/ | Appends a new group node comment to the list of group node comments associated with the given group node by using the comment id supplied the caller to fetch the comment from the database | appendGroupNodeComment | {
"repo_name": "aeppert/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CommentManager.java",
"license": "apache-2.0",
"size": 127063
} | [
"com.google.common.base.Preconditions",
"com.google.security.zynamics.binnavi.Database"
] | import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.Database; | import com.google.common.base.*; import com.google.security.zynamics.binnavi.*; | [
"com.google.common",
"com.google.security"
] | com.google.common; com.google.security; | 2,333,473 |
@Test
public final void testIsUniqueSuccess() {
newCloseoutItem.setCloseoutReportCode(CLOSE_OUT_REPORT_CODE_B);
newCloseoutItem.setCloseoutReportName(CLOSE_OUT_REPORT_NAME);
Assert.assertTrue(awardCloseoutRuleImpl.isUnique(closeoutItems, newCloseoutItem));
} | final void function() { newCloseoutItem.setCloseoutReportCode(CLOSE_OUT_REPORT_CODE_B); newCloseoutItem.setCloseoutReportName(CLOSE_OUT_REPORT_NAME); Assert.assertTrue(awardCloseoutRuleImpl.isUnique(closeoutItems, newCloseoutItem)); } | /**
*
* This method tests the isUnique method.
*
*/ | This method tests the isUnique method | testIsUniqueSuccess | {
"repo_name": "sanjupolus/KC6.oLatest",
"path": "coeus-impl/src/test/java/org/kuali/kra/award/paymentreports/closeout/AwardCloseoutRuleImplTest.java",
"license": "agpl-3.0",
"size": 3988
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 167,621 |
public static String getOrderWithTokensOnly(String urlToBeGet)
throws Exception
{
// utilize accessToken to access protected resource in DEAL
HttpRequestFactory factory = TRANSPORT
.createRequestFactory(getParameters());
GenericUrl url = new GenericUrl(urlToBeGet);
HttpRequest req = factory.buildGetRequest(url);
HttpResponse resp = req.execute();
req.getContent().writeTo(System.out);
String responseString = resp.parseAsString();
// Log
if (LOG.isInfoEnabled())
{
LOG.info("Response Status Code: " + resp.getStatusCode());
LOG.info("Response body:" + responseString);
}
return responseString;
} | static String function(String urlToBeGet) throws Exception { HttpRequestFactory factory = TRANSPORT .createRequestFactory(getParameters()); GenericUrl url = new GenericUrl(urlToBeGet); HttpRequest req = factory.buildGetRequest(url); HttpResponse resp = req.execute(); req.getContent().writeTo(System.out); String responseString = resp.parseAsString(); if (LOG.isInfoEnabled()) { LOG.info(STR + resp.getStatusCode()); LOG.info(STR + responseString); } return responseString; } | /**
* get a message using the token and secret token to authenticate in DEAL.
* To demonstrate successfull authentication a POST request is executed.
*
* @throws Exception on an exception occuring
*/ | get a message using the token and secret token to authenticate in DEAL. To demonstrate successfull authentication a POST request is executed | getOrderWithTokensOnly | {
"repo_name": "krevelen/coala",
"path": "coala-examples/src/test/java/io/coala/example/deliver/DealOAuth1Util.java",
"license": "apache-2.0",
"size": 12611
} | [
"com.google.api.client.http.GenericUrl",
"com.google.api.client.http.HttpRequest",
"com.google.api.client.http.HttpRequestFactory",
"com.google.api.client.http.HttpResponse"
] | import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpResponse; | import com.google.api.client.http.*; | [
"com.google.api"
] | com.google.api; | 1,525,256 |
public static POICapabilitiesType fromValue(String v) {
return Arrays.stream(values()).
filter(s -> s.value.equals(v)).
findFirst().orElseThrow(() -> new IllegalArgumentException(v));
} | static POICapabilitiesType function(String v) { return Arrays.stream(values()). filter(s -> s.value.equals(v)). findFirst().orElseThrow(() -> new IllegalArgumentException(v)); } | /**
* From value poi capabilities type.
*
* @param v the v
* @return the poi capabilities type
*/ | From value poi capabilities type | fromValue | {
"repo_name": "Adyen/adyen-java-api-library",
"path": "src/main/java/com/adyen/model/nexo/POICapabilitiesType.java",
"license": "mit",
"size": 5922
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,946,868 |
public AssetLinkPersistence getAssetLinkPersistence() {
return assetLinkPersistence;
} | AssetLinkPersistence function() { return assetLinkPersistence; } | /**
* Returns the asset link persistence.
*
* @return the asset link persistence
*/ | Returns the asset link persistence | getAssetLinkPersistence | {
"repo_name": "juliocamarero/jukebox",
"path": "sdk/portlets/jukebox-portlet/docroot/WEB-INF/src/org/liferay/jukebox/service/base/AlbumServiceBaseImpl.java",
"license": "gpl-2.0",
"size": 28302
} | [
"com.liferay.portlet.asset.service.persistence.AssetLinkPersistence"
] | import com.liferay.portlet.asset.service.persistence.AssetLinkPersistence; | import com.liferay.portlet.asset.service.persistence.*; | [
"com.liferay.portlet"
] | com.liferay.portlet; | 1,017,520 |
@Nullable public Label getLegacyFailureReason() {
if (rootCauses.isEmpty()) {
return null;
}
return rootCauses.toList().get(0).getLabel();
} | @Nullable Label function() { if (rootCauses.isEmpty()) { return null; } return rootCauses.toList().get(0).getLabel(); } | /**
* Returns the label of a single root cause. Use {@link #getRootCauses} to report all root causes.
*/ | Returns the label of a single root cause. Use <code>#getRootCauses</code> to report all root causes | getLegacyFailureReason | {
"repo_name": "perezd/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/AnalysisFailureEvent.java",
"license": "apache-2.0",
"size": 5152
} | [
"com.google.devtools.build.lib.cmdline.Label",
"javax.annotation.Nullable"
] | import com.google.devtools.build.lib.cmdline.Label; import javax.annotation.Nullable; | import com.google.devtools.build.lib.cmdline.*; import javax.annotation.*; | [
"com.google.devtools",
"javax.annotation"
] | com.google.devtools; javax.annotation; | 1,305,476 |
@NonNull
public static Builder builder()
{
return new Builder();
}
public static class Builder
{
private Duration samplingInterval;
private String name;
private MBeanServer server;
public Builder()
{
name = "vibe";
server = ManagementFactory.getPlatformMBeanServer();
samplingInterval = Duration.ofSeconds(10);
} | static Builder function() { return new Builder(); } public static class Builder { private Duration samplingInterval; private String name; private MBeanServer server; public Builder() { name = "vibe"; server = ManagementFactory.getPlatformMBeanServer(); samplingInterval = Duration.ofSeconds(10); } | /**
* Start building a new JMX backend.
*
* @return
*/ | Start building a new JMX backend | builder | {
"repo_name": "LevelFourAB/vibe",
"path": "vibe-api/src/main/java/se/l4/vibe/JmxBackend.java",
"license": "apache-2.0",
"size": 4991
} | [
"java.lang.management.ManagementFactory",
"java.time.Duration",
"javax.management.MBeanServer"
] | import java.lang.management.ManagementFactory; import java.time.Duration; import javax.management.MBeanServer; | import java.lang.management.*; import java.time.*; import javax.management.*; | [
"java.lang",
"java.time",
"javax.management"
] | java.lang; java.time; javax.management; | 377,719 |
public int getInteger(String name, FastpathArg[] args) throws SQLException
{
Integer i = (Integer)fastpath(name, true, args);
if (i == null)
throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
PSQLState.NO_DATA);
return i.intValue();
} | int function(String name, FastpathArg[] args) throws SQLException { Integer i = (Integer)fastpath(name, true, args); if (i == null) throw new PSQLException(GT.tr(STR, name), PSQLState.NO_DATA); return i.intValue(); } | /**
* This convenience method assumes that the return value is an Integer
* @param name Function name
* @param args Function arguments
* @return integer result
* @exception SQLException if a database-access error occurs or no result
*/ | This convenience method assumes that the return value is an Integer | getInteger | {
"repo_name": "easel/postgresql-jdbc",
"path": "org/postgresql/fastpath/Fastpath.java",
"license": "bsd-3-clause",
"size": 9472
} | [
"java.sql.SQLException",
"org.postgresql.util.GT",
"org.postgresql.util.PSQLException",
"org.postgresql.util.PSQLState"
] | import java.sql.SQLException; import org.postgresql.util.GT; import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLState; | import java.sql.*; import org.postgresql.util.*; | [
"java.sql",
"org.postgresql.util"
] | java.sql; org.postgresql.util; | 1,753,301 |
@Override
public String[] getOptions() {
ArrayList<String> options = new ArrayList<String>();
options.add("-F");
options.add("" + getLossFunction().getSelectedTag().getID());
options.add("-L");
options.add("" + getLearningRate());
options.add("-R");
options.add("" + getLambda());
options.add("-E");
options.add("" + getEpochs());
options.add("-C");
options.add("" + getEpsilon());
if (getDontNormalize()) {
options.add("-N");
}
if (getDontReplaceMissing()) {
options.add("-M");
}
Collections.addAll(options, super.getOptions());
return options.toArray(new String[1]);
} | String[] function() { ArrayList<String> options = new ArrayList<String>(); options.add("-F"); options.add(STR-LSTRSTR-RSTRSTR-ESTRSTR-CSTRSTR-NSTR-M"); } Collections.addAll(options, super.getOptions()); return options.toArray(new String[1]); } | /**
* Gets the current settings of the classifier.
*
* @return an array of strings suitable for passing to setOptions
*/ | Gets the current settings of the classifier | getOptions | {
"repo_name": "mydzigear/weka.kmeanspp.silhouette_score",
"path": "src/weka/classifiers/functions/SGD.java",
"license": "gpl-3.0",
"size": 29572
} | [
"java.util.ArrayList",
"java.util.Collections"
] | import java.util.ArrayList; import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 2,286,243 |
public Result<Template> publish(String name) {
return getClient().execute(Template.class, TEMPLATE_PUBLISH,
mapParams("name", name));
}
| Result<Template> function(String name) { return getClient().execute(Template.class, TEMPLATE_PUBLISH, mapParams("name", name)); } | /**
* Publish the content for the template. Any new messages sent using
* this template will start using the content that was previously in draft.
* @param name
* @return
*/ | Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft | publish | {
"repo_name": "JobHive/saki-monkey",
"path": "src/main/java/com/jobhive/sakimonkey/api/TemplateApi.java",
"license": "apache-2.0",
"size": 4518
} | [
"com.jobhive.sakimonkey.data.Result",
"com.jobhive.sakimonkey.data.response.Template"
] | import com.jobhive.sakimonkey.data.Result; import com.jobhive.sakimonkey.data.response.Template; | import com.jobhive.sakimonkey.data.*; import com.jobhive.sakimonkey.data.response.*; | [
"com.jobhive.sakimonkey"
] | com.jobhive.sakimonkey; | 193,716 |
if (src.equals(target)) {
addWarn("Source and target files are the same [" + src + "]. Skipping.");
return;
}
File srcFile = new File(src);
if (srcFile.exists()) {
File targetFile = new File(target);
createMissingTargetDirsIfNecessary(targetFile);
addInfo("Renaming file [" + srcFile + "] to [" + targetFile + "]");
boolean result = srcFile.renameTo(targetFile);
if (!result) {
addWarn("Failed to rename file [" + srcFile + "] as [" + targetFile + "].");
if (areOnDifferentVolumes(srcFile, targetFile)) {
addWarn("Detected different file systems for source [" + src + "] and target [" + target + "]. Attempting rename by copying.");
renameByCopying(src, target);
return;
} else {
addWarn("Please consider leaving the [file] option of " + RollingFileAppender.class.getSimpleName() + " empty.");
addWarn("See also " + RENAMING_ERROR_URL);
}
}
} else {
throw new RolloverFailure("File [" + src + "] does not exist.");
}
} | if (src.equals(target)) { addWarn(STR + src + STR); return; } File srcFile = new File(src); if (srcFile.exists()) { File targetFile = new File(target); createMissingTargetDirsIfNecessary(targetFile); addInfo(STR + srcFile + STR + targetFile + "]"); boolean result = srcFile.renameTo(targetFile); if (!result) { addWarn(STR + srcFile + STR + targetFile + "]."); if (areOnDifferentVolumes(srcFile, targetFile)) { addWarn(STR + src + STR + target + STR); renameByCopying(src, target); return; } else { addWarn(STR + RollingFileAppender.class.getSimpleName() + STR); addWarn(STR + RENAMING_ERROR_URL); } } } else { throw new RolloverFailure(STR + src + STR); } } | /**
* A relatively robust file renaming method which in case of failure due to
* src and target being on different volumes, falls back onto
* renaming by copying.
*
* @param src
* @param target
* @throws RolloverFailure
*/ | A relatively robust file renaming method which in case of failure due to src and target being on different volumes, falls back onto renaming by copying | rename | {
"repo_name": "OuZhencong/logback",
"path": "logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RenameUtil.java",
"license": "mit",
"size": 4247
} | [
"ch.qos.logback.core.rolling.RollingFileAppender",
"ch.qos.logback.core.rolling.RolloverFailure",
"java.io.File"
] | import ch.qos.logback.core.rolling.RollingFileAppender; import ch.qos.logback.core.rolling.RolloverFailure; import java.io.File; | import ch.qos.logback.core.rolling.*; import java.io.*; | [
"ch.qos.logback",
"java.io"
] | ch.qos.logback; java.io; | 2,809,671 |
public static void validate_distributed_mode(Map<?, ?> conf) {
if (StormConfig.local_mode(conf)) {
throw new IllegalArgumentException(
"Cannot start server in local mode!");
}
}
| static void function(Map<?, ?> conf) { if (StormConfig.local_mode(conf)) { throw new IllegalArgumentException( STR); } } | /**
* validate whether the mode is distributed
*
* @param conf
*/ | validate whether the mode is distributed | validate_distributed_mode | {
"repo_name": "zhangjunfang/jstorm-0.9.6.3-",
"path": "jstorm-server/src/main/java/com/alibaba/jstorm/cluster/StormConfig.java",
"license": "apache-2.0",
"size": 13015
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,332,717 |
EReference getSPC_Q(); | EReference getSPC_Q(); | /**
* Returns the meta object for the reference '{@link gluemodel.substationStandard.Dataclasses.SPC#getQ <em>Q</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Q</em>'.
* @see gluemodel.substationStandard.Dataclasses.SPC#getQ()
* @see #getSPC()
* @generated
*/ | Returns the meta object for the reference '<code>gluemodel.substationStandard.Dataclasses.SPC#getQ Q</code>'. | getSPC_Q | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/substationStandard/Dataclasses/DataclassesPackage.java",
"license": "mit",
"size": 381891
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,297,799 |
public Map[] zoneCampaignStatistics(Integer id, Date startDate)
throws XmlRpcException {
return objectToArrayMaps(execute(ZONE_CAMPAIGN_STATISTICS_METHOD, id,
startDate));
} | Map[] function(Integer id, Date startDate) throws XmlRpcException { return objectToArrayMaps(execute(ZONE_CAMPAIGN_STATISTICS_METHOD, id, startDate)); } | /**
* Zone campaign statistics.
*
* @param id the id
* @param startDate the start date
*
* @return the Map[]
*
* @throws XmlRpcException the xml rpc exception
*/ | Zone campaign statistics | zoneCampaignStatistics | {
"repo_name": "xvip87/a45435345345",
"path": "lib/xmlrpc/java/openx-api-v2/ApacheLib3/org/openads/proxy/ZoneService.java",
"license": "gpl-2.0",
"size": 10677
} | [
"java.util.Date",
"java.util.Map",
"org.apache.xmlrpc.XmlRpcException"
] | import java.util.Date; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; | import java.util.*; import org.apache.xmlrpc.*; | [
"java.util",
"org.apache.xmlrpc"
] | java.util; org.apache.xmlrpc; | 2,339,421 |
public static <S1, I1, T1, S2, I2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(TSTraversalMethod method,
TransitionSystem<S1, ? super I1, T1> in,
int limit,
Collection<? extends I1> inputs,
MutableAutomaton<S2, I2, T2, ? super SP2, ? super TP2> out,
Function<? super I1, ? extends I2> inputsMapping,
Function<? super S1, ? extends SP2> spMapping,
Function<? super T1, ? extends TP2> tpMapping) {
return rawCopy(method,
in,
limit,
inputs,
out,
inputsMapping,
spMapping,
tpMapping,
x -> true,
TransitionPredicates.alwaysTrue());
} | static <S1, I1, T1, S2, I2, T2, SP2, TP2> Mapping<S1, S2> function(TSTraversalMethod method, TransitionSystem<S1, ? super I1, T1> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP2, ? super TP2> out, Function<? super I1, ? extends I2> inputsMapping, Function<? super S1, ? extends SP2> spMapping, Function<? super T1, ? extends TP2> tpMapping) { return rawCopy(method, in, limit, inputs, out, inputsMapping, spMapping, tpMapping, x -> true, TransitionPredicates.alwaysTrue()); } | /**
* Copies an {@link Automaton} to a {@link MutableAutomaton} with possibly heterogeneous input alphabets and state
* and transition properties. State and transitions will not be filtered.
*
* @param method
* the traversal method to use
* @param in
* the input transition system
* @param limit
* the traversal limit, a value less than 0 means no limit
* @param inputs
* the inputs to consider
* @param out
* the output automaton
* @param inputsMapping
* the transformation for input symbols
* @param spMapping
* the function for obtaining state properties
* @param tpMapping
* the function for obtaining transition properties
*
* @return a mapping from old to new states
*/ | Copies an <code>Automaton</code> to a <code>MutableAutomaton</code> with possibly heterogeneous input alphabets and state and transition properties. State and transitions will not be filtered | rawCopy | {
"repo_name": "misberner/automatalib",
"path": "util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java",
"license": "apache-2.0",
"size": 25892
} | [
"java.util.Collection",
"java.util.function.Function",
"net.automatalib.automata.MutableAutomaton",
"net.automatalib.commons.util.mappings.Mapping",
"net.automatalib.ts.TransitionSystem",
"net.automatalib.util.automata.predicates.TransitionPredicates",
"net.automatalib.util.ts.traversal.TSTraversalMethod"
] | import java.util.Collection; import java.util.function.Function; import net.automatalib.automata.MutableAutomaton; import net.automatalib.commons.util.mappings.Mapping; import net.automatalib.ts.TransitionSystem; import net.automatalib.util.automata.predicates.TransitionPredicates; import net.automatalib.util.ts.traversal.TSTraversalMethod; | import java.util.*; import java.util.function.*; import net.automatalib.automata.*; import net.automatalib.commons.util.mappings.*; import net.automatalib.ts.*; import net.automatalib.util.automata.predicates.*; import net.automatalib.util.ts.traversal.*; | [
"java.util",
"net.automatalib.automata",
"net.automatalib.commons",
"net.automatalib.ts",
"net.automatalib.util"
] | java.util; net.automatalib.automata; net.automatalib.commons; net.automatalib.ts; net.automatalib.util; | 88,030 |
public static void readFile(File file, HashMap<String,String> destination) {
Properties props = new Properties();
try {
props.load(new FileInputStream(file));
} catch (Exception e) {
System.err.println("error with file");
}
Enumeration<Object> enume = props.keys();
while(enume.hasMoreElements())
{
String s = (String) enume.nextElement();
destination.put(s, props.getProperty(s));
}
}
| static void function(File file, HashMap<String,String> destination) { Properties props = new Properties(); try { props.load(new FileInputStream(file)); } catch (Exception e) { System.err.println(STR); } Enumeration<Object> enume = props.keys(); while(enume.hasMoreElements()) { String s = (String) enume.nextElement(); destination.put(s, props.getProperty(s)); } } | /**
* Reads a file into the Destination
*
* @param file
* @param destination
*/ | Reads a file into the Destination | readFile | {
"repo_name": "joshuairl/toothchat-client",
"path": "target/classes/i18n/CompareLocales.java",
"license": "apache-2.0",
"size": 2036
} | [
"java.io.File",
"java.io.FileInputStream",
"java.util.Enumeration",
"java.util.HashMap",
"java.util.Properties"
] | import java.io.File; import java.io.FileInputStream; import java.util.Enumeration; import java.util.HashMap; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,581,924 |
void paint(Graphics g) {
Color c = g.getColor();
if (color != null) {
g.setColor(color);
}
double angle = 0.0;
double horizontalReference = 0.0;
double verticalReference = 0.0;
double[] coord = null;
if (points.size() > 1) {
double[] x1 = points.get(0);
for (int i = 1; i < points.size(); i++) {
double[] x2 = points.get(i);
g.drawLine(x1, x2);
x1 = x2;
if (label == null) {
if (i == points.size() / 2) {
coord = x1;
int k = i + 1;
if (k >= points.size()) {
k = i;
}
// compute label angle
angle = Math.PI / 2;
double dxx = points.get(k)[0] - points.get(i)[0];
double dyy = points.get(k)[1] - points.get(i)[1];
if (dyy < 0.0) {
angle = -Math.PI / 2;
}
if (dxx != 0.0) {
angle = Math.atan(dyy / dxx) + Math.PI / 2;
}
}
}
}
} else if (points.size() == 1) {
double[] x1 = points.get(0);
g.drawPoint('@', x1);
coord = x1;
horizontalReference = 0.0;
}
if (label == null) {
double[] lb = g.getLowerBound();
double[] ub = g.getUpperBound();
double xrange = ub[0] - lb[0];
double yrange = ub[1] - lb[1];
if (ub[0] - coord[0] < xrange / 10) {
horizontalReference = 1.0;
}
if (ub[1] - coord[1] < yrange / 10) {
horizontalReference = 1.0;
}
if (coord[1] - lb[1] < yrange / 10) {
horizontalReference = 0.0;
}
label = new Label(String.format("%.2G", level), horizontalReference, verticalReference, angle, coord);
}
if (showLevelValue && label != null) {
label.paint(g);
}
if (color != null) {
g.setColor(c);
}
}
}
public Contour(double[][] z) {
this.z = z;
init();
}
public Contour(double[][] z, int numLevels) {
this.z = z;
this.numLevels = numLevels;
init();
}
public Contour(double[][] z, int numLevels, boolean logScale) {
this.z = z;
this.numLevels = numLevels;
this.logScale = logScale;
init();
}
public Contour(double[][] z, double[] levels) {
this.z = z;
this.levels = levels;
init();
}
public Contour(double[][] z, double[] levels, Color[] colors) {
this.z = z;
this.levels = levels;
this.colors = colors;
showLevelValue = false;
init();
}
public Contour(double[] x, double[] y, double[][] z) {
if (x.length != z[0].length) {
throw new IllegalArgumentException("The dimensions of x and z don't match.");
}
if (y.length != z.length) {
throw new IllegalArgumentException("The dimensions of y and z don't match.");
}
this.x = x;
this.y = y;
this.z = z;
init();
}
public Contour(double[] x, double[] y, double[][] z, int numLevels) {
if (x.length != z[0].length) {
throw new IllegalArgumentException("The dimensions of x and z don't match.");
}
if (y.length != z.length) {
throw new IllegalArgumentException("The dimensions of y and z don't match.");
}
this.x = x;
this.y = y;
this.z = z;
this.numLevels = numLevels;
init();
}
public Contour(double[] x, double[] y, double[][] z, int numLevels, boolean logScale) {
if (x.length != z[0].length) {
throw new IllegalArgumentException("The dimensions of x and z don't match.");
}
if (y.length != z.length) {
throw new IllegalArgumentException("The dimensions of y and z don't match.");
}
this.x = x;
this.y = y;
this.z = z;
this.numLevels = numLevels;
this.logScale = logScale;
init();
}
public Contour(double[] x, double[] y, double[][] z, double[] levels) {
if (x.length != z[0].length) {
throw new IllegalArgumentException("The dimensions of x and z don't match.");
}
if (y.length != z.length) {
throw new IllegalArgumentException("The dimensions of y and z don't match.");
}
this.x = x;
this.y = y;
this.z = z;
this.levels = levels;
init();
}
public Contour(double[] x, double[] y, double[][] z, double[] levels, Color[] colors) {
if (x.length != z[0].length) {
throw new IllegalArgumentException("The dimensions of x and z don't match.");
}
if (y.length != z.length) {
throw new IllegalArgumentException("The dimensions of y and z don't match.");
}
if (levels.length != colors.length) {
throw new IllegalArgumentException("The number of levels and colors don't match.");
}
this.x = x;
this.y = y;
this.z = z;
this.levels = levels;
this.colors = colors;
showLevelValue = false;
init();
}
class Segment {
double x0;
double y0;
double x1;
double y1;
Segment next;
Segment(double x0, double y0, double x1, double y1, Segment next) {
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
this.next = next;
} | void paint(Graphics g) { Color c = g.getColor(); if (color != null) { g.setColor(color); } double angle = 0.0; double horizontalReference = 0.0; double verticalReference = 0.0; double[] coord = null; if (points.size() > 1) { double[] x1 = points.get(0); for (int i = 1; i < points.size(); i++) { double[] x2 = points.get(i); g.drawLine(x1, x2); x1 = x2; if (label == null) { if (i == points.size() / 2) { coord = x1; int k = i + 1; if (k >= points.size()) { k = i; } angle = Math.PI / 2; double dxx = points.get(k)[0] - points.get(i)[0]; double dyy = points.get(k)[1] - points.get(i)[1]; if (dyy < 0.0) { angle = -Math.PI / 2; } if (dxx != 0.0) { angle = Math.atan(dyy / dxx) + Math.PI / 2; } } } } } else if (points.size() == 1) { double[] x1 = points.get(0); g.drawPoint('@', x1); coord = x1; horizontalReference = 0.0; } if (label == null) { double[] lb = g.getLowerBound(); double[] ub = g.getUpperBound(); double xrange = ub[0] - lb[0]; double yrange = ub[1] - lb[1]; if (ub[0] - coord[0] < xrange / 10) { horizontalReference = 1.0; } if (ub[1] - coord[1] < yrange / 10) { horizontalReference = 1.0; } if (coord[1] - lb[1] < yrange / 10) { horizontalReference = 0.0; } label = new Label(String.format("%.2G", level), horizontalReference, verticalReference, angle, coord); } if (showLevelValue && label != null) { label.paint(g); } if (color != null) { g.setColor(c); } } } public Contour(double[][] z) { this.z = z; init(); } public Contour(double[][] z, int numLevels) { this.z = z; this.numLevels = numLevels; init(); } public Contour(double[][] z, int numLevels, boolean logScale) { this.z = z; this.numLevels = numLevels; this.logScale = logScale; init(); } public Contour(double[][] z, double[] levels) { this.z = z; this.levels = levels; init(); } public Contour(double[][] z, double[] levels, Color[] colors) { this.z = z; this.levels = levels; this.colors = colors; showLevelValue = false; init(); } public Contour(double[] x, double[] y, double[][] z) { if (x.length != z[0].length) { throw new IllegalArgumentException(STR); } if (y.length != z.length) { throw new IllegalArgumentException(STR); } this.x = x; this.y = y; this.z = z; init(); } public Contour(double[] x, double[] y, double[][] z, int numLevels) { if (x.length != z[0].length) { throw new IllegalArgumentException(STR); } if (y.length != z.length) { throw new IllegalArgumentException(STR); } this.x = x; this.y = y; this.z = z; this.numLevels = numLevels; init(); } public Contour(double[] x, double[] y, double[][] z, int numLevels, boolean logScale) { if (x.length != z[0].length) { throw new IllegalArgumentException(STR); } if (y.length != z.length) { throw new IllegalArgumentException(STR); } this.x = x; this.y = y; this.z = z; this.numLevels = numLevels; this.logScale = logScale; init(); } public Contour(double[] x, double[] y, double[][] z, double[] levels) { if (x.length != z[0].length) { throw new IllegalArgumentException(STR); } if (y.length != z.length) { throw new IllegalArgumentException(STR); } this.x = x; this.y = y; this.z = z; this.levels = levels; init(); } public Contour(double[] x, double[] y, double[][] z, double[] levels, Color[] colors) { if (x.length != z[0].length) { throw new IllegalArgumentException(STR); } if (y.length != z.length) { throw new IllegalArgumentException(STR); } if (levels.length != colors.length) { throw new IllegalArgumentException(STR); } this.x = x; this.y = y; this.z = z; this.levels = levels; this.colors = colors; showLevelValue = false; init(); } class Segment { double x0; double y0; double x1; double y1; Segment next; Segment(double x0, double y0, double x1, double y1, Segment next) { this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; this.next = next; } | /**
* Paint the contour line. If the color attribute is null, the level
* value of contour line will be shown along the line.
*/ | Paint the contour line. If the color attribute is null, the level value of contour line will be shown along the line | paint | {
"repo_name": "wavelets/smile",
"path": "SmilePlot/src/smile/plot/Contour.java",
"license": "apache-2.0",
"size": 33932
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,457,938 |
public static boolean isOdkCollectInstalled(Context context) {
try {
context.getPackageManager().getApplicationInfo(ODK_COLLECT_PACKAGE_NAME, PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
return false;
}
return true;
} | static boolean function(Context context) { try { context.getPackageManager().getApplicationInfo(ODK_COLLECT_PACKAGE_NAME, PackageManager.GET_META_DATA); } catch (NameNotFoundException e) { return false; } return true; } | /**
* check to see if the ODK Collect package is installed
* @param context a context object used to gain access to system resources
* @return true if the ODK Collect software is installed
*/ | check to see if the ODK Collect package is installed | isOdkCollectInstalled | {
"repo_name": "magdaaproject/magdaa-library",
"path": "src/org/magdaaproject/utils/OpenDataKitUtils.java",
"license": "gpl-3.0",
"size": 3421
} | [
"android.content.Context",
"android.content.pm.PackageManager"
] | import android.content.Context; import android.content.pm.PackageManager; | import android.content.*; import android.content.pm.*; | [
"android.content"
] | android.content; | 197,267 |
public Location getLocationForErrorReporting() {
return location;
} | Location function() { return location; } | /**
* Returns the location of the Starlark code responsible for determining the transition's changed
* settings for purposes of error reporting.
*/ | Returns the location of the Starlark code responsible for determining the transition's changed settings for purposes of error reporting | getLocationForErrorReporting | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/config/StarlarkDefinedConfigTransition.java",
"license": "apache-2.0",
"size": 12384
} | [
"com.google.devtools.build.lib.events.Location"
] | import com.google.devtools.build.lib.events.Location; | import com.google.devtools.build.lib.events.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,339,536 |
public Map<PathFragment, Artifact> getRootSymlinksAsMap(@Nullable ConflictChecker checker) {
return entriesToMap(rootSymlinks, checker);
} | Map<PathFragment, Artifact> function(@Nullable ConflictChecker checker) { return entriesToMap(rootSymlinks, checker); } | /**
* Returns the root symlinks as a map from path fragment to artifact.
*
* @param checker If not null, check for conflicts using this checker.
*/ | Returns the root symlinks as a map from path fragment to artifact | getRootSymlinksAsMap | {
"repo_name": "twitter-forks/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java",
"license": "apache-2.0",
"size": 45422
} | [
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.vfs.PathFragment",
"java.util.Map",
"javax.annotation.Nullable"
] | import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.Map; import javax.annotation.Nullable; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.vfs.*; import java.util.*; import javax.annotation.*; | [
"com.google.devtools",
"java.util",
"javax.annotation"
] | com.google.devtools; java.util; javax.annotation; | 595,764 |
@ApiModelProperty(example = "http://localhost:8280", value = "HTTP environment URL")
public String getHttp() {
return http;
} | @ApiModelProperty(example = "http: String function() { return http; } | /**
* HTTP environment URL
* @return http
**/ | HTTP environment URL | getHttp | {
"repo_name": "jaadds/product-apim",
"path": "modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/EnvironmentEndpointsDTO.java",
"license": "apache-2.0",
"size": 4152
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 895,826 |
public boolean canConvert(TypeInfo typeInfo) {
return false; // always returns false, so it can not be discovered via field mapping process
} | boolean function(TypeInfo typeInfo) { return false; } | /**
* Designed to only be used manually, not via class/field introspection
* @param typeInfo The type to check.
* @return Always returns false, so it can not be discovered via field mapping process
*/ | Designed to only be used manually, not via class/field introspection | canConvert | {
"repo_name": "PeterKnego/rethinkdb-java-orm",
"path": "src/main/java/com/rethinkdb/orm/converters/PassThroughConverter.java",
"license": "apache-2.0",
"size": 821
} | [
"com.rethinkdb.orm.TypeInfo"
] | import com.rethinkdb.orm.TypeInfo; | import com.rethinkdb.orm.*; | [
"com.rethinkdb.orm"
] | com.rethinkdb.orm; | 1,978,799 |
private static Object locateBrowser() {
if (browser != null) {
return browser;
}
switch (jvm) {
case MRJ_2_0:
try {
Integer finderCreatorCode = (Integer) makeOSType.invoke(null, FINDER_CREATOR);
Object aeTarget = aeTargetConstructor.newInstance(finderCreatorCode);
Integer gurlType = (Integer) makeOSType.invoke(null, GURL_EVENT);
Object appleEvent = appleEventConstructor.newInstance(gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID);
// Don't set browser = appleEvent because then the next time we call
// locateBrowser(), we'll get the same AppleEvent, to which we'll already have
// added the relevant parameter. Instead, regenerate the AppleEvent every time.
// There's probably a way to do this better; if any has any ideas, please let
// me know.
return appleEvent;
} catch (IllegalAccessException iae) {
browser = null;
errorMessage = iae.getMessage();
return browser;
} catch (InstantiationException ie) {
browser = null;
errorMessage = ie.getMessage();
return browser;
} catch (InvocationTargetException ite) {
browser = null;
errorMessage = ite.getMessage();
return browser;
}
case MRJ_2_1:
File systemFolder;
try {
systemFolder = (File) findFolder.invoke(null, kSystemFolderType);
} catch (IllegalArgumentException iare) {
browser = null;
errorMessage = iare.getMessage();
return browser;
} catch (IllegalAccessException iae) {
browser = null;
errorMessage = iae.getMessage();
return browser;
} catch (InvocationTargetException ite) {
browser = null;
errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
return browser;
}
String[] systemFolderFiles = systemFolder.list();
// Avoid a FilenameFilter because that can't be stopped mid-list
for (String systemFolderFile : systemFolderFiles)
{
try
{
File file = new File(systemFolder, systemFolderFile);
if (!file.isFile())
{
continue;
}
// We're looking for a file with a creator code of 'MACS' and
// a type of 'FNDR'. Only requiring the type results in non-Finder
// applications being picked up on certain Mac OS 9 systems,
// especially German ones, and sending a GURL event to those
// applications results in a logout under Multiple Users.
Object fileType = getFileType.invoke(null, file);
if (FINDER_TYPE.equals(fileType.toString()))
{
Object fileCreator = getFileCreator.invoke(null, file);
if (FINDER_CREATOR.equals(fileCreator.toString()))
{
browser = file.toString(); // Actually the Finder, but that's OK
return browser;
}
}
}
catch (IllegalArgumentException iare)
{
browser = browser;
errorMessage = iare.getMessage();
return null;
}
catch (IllegalAccessException iae)
{
browser = null;
errorMessage = iae.getMessage();
return browser;
}
catch (InvocationTargetException ite)
{
browser = null;
errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
return browser;
}
}
browser = null;
break;
case MRJ_3_0:
case MRJ_3_1:
browser = ""; // Return something non-null
break;
case WINDOWS_NT:
browser = "cmd.exe";
break;
case WINDOWS_9x:
browser = "command.com";
break;
case OTHER:
default:
browser = "firefox";
break;
}
return browser;
} | static Object function() { if (browser != null) { return browser; } switch (jvm) { case MRJ_2_0: try { Integer finderCreatorCode = (Integer) makeOSType.invoke(null, FINDER_CREATOR); Object aeTarget = aeTargetConstructor.newInstance(finderCreatorCode); Integer gurlType = (Integer) makeOSType.invoke(null, GURL_EVENT); Object appleEvent = appleEventConstructor.newInstance(gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID); return appleEvent; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InstantiationException ie) { browser = null; errorMessage = ie.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getMessage(); return browser; } case MRJ_2_1: File systemFolder; try { systemFolder = (File) findFolder.invoke(null, kSystemFolderType); } catch (IllegalArgumentException iare) { browser = null; errorMessage = iare.getMessage(); return browser; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getTargetException().getClass() + STR + ite.getTargetException().getMessage(); return browser; } String[] systemFolderFiles = systemFolder.list(); for (String systemFolderFile : systemFolderFiles) { try { File file = new File(systemFolder, systemFolderFile); if (!file.isFile()) { continue; } Object fileType = getFileType.invoke(null, file); if (FINDER_TYPE.equals(fileType.toString())) { Object fileCreator = getFileCreator.invoke(null, file); if (FINDER_CREATOR.equals(fileCreator.toString())) { browser = file.toString(); return browser; } } } catch (IllegalArgumentException iare) { browser = browser; errorMessage = iare.getMessage(); return null; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getTargetException().getClass() + STR + ite.getTargetException().getMessage(); return browser; } } browser = null; break; case MRJ_3_0: case MRJ_3_1: browser = STRcmd.exeSTRcommand.comSTRfirefox"; break; } return browser; } | /**
* Attempts to locate the default web browser on the local system. Caches results so it
* only locates the browser once for each use of this class per JVM instance.
* @return The browser for the system. Note that this may not be what you would consider
* to be a standard web browser; instead, it's the application that gets called to
* open the default web browser. In some cases, this will be a non-String object
* that provides the means of calling the default browser.
*/ | Attempts to locate the default web browser on the local system. Caches results so it only locates the browser once for each use of this class per JVM instance | locateBrowser | {
"repo_name": "neilireson/luke",
"path": "src/main/java/org/getopt/luke/BrowserLauncher.java",
"license": "apache-2.0",
"size": 23492
} | [
"java.io.File",
"java.lang.reflect.InvocationTargetException"
] | import java.io.File; import java.lang.reflect.InvocationTargetException; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 1,170,105 |
private ComponentListPropertyType createComponents(final List<SmlComponent> sosComponents)
throws OwsExceptionReport {
ComponentListPropertyType clpt = ComponentListPropertyType.Factory.newInstance(getOptions());
final ComponentListType clt = clpt.addNewComponentList();
for (final SmlComponent sosSMLComponent : sosComponents) {
final Component component = clt.addNewComponent();
if (sosSMLComponent.getName() != null) {
component.setName(sosSMLComponent.getName());
}
if (sosSMLComponent.getTitle() != null) {
component.setTitle(sosSMLComponent.getTitle());
}
if (sosSMLComponent.getHref() != null) {
component.setHref(sosSMLComponent.getHref());
}
if (sosSMLComponent.getProcess() != null) {
Map<HelperValues, String> additionalValues = Maps.newHashMap();
additionalValues.put(HelperValues.TYPE, null);
XmlObject xmlObject = encode(sosSMLComponent.getProcess(), additionalValues);
// if
// (sosSMLComponent.getProcess().getSensorDescriptionXmlString()
// != null
// &&
// !sosSMLComponent.getProcess().getSensorDescriptionXmlString().isEmpty())
// {
// try {
// xmlObject =
// XmlObject.Factory.parse(sosSMLComponent.getProcess().getSensorDescriptionXmlString());
//
// } catch (final XmlException xmle) {
// throw new
// NoApplicableCodeException().causedBy(xmle).withMessage(
// "Error while encoding SensorML child procedure description "
// +
// "from stored SensorML encoded sensor description with XMLBeans");
// }
// } else {
// xmlObject = encode(sosSMLComponent.getProcess());
// }
if (xmlObject != null) {
// AbstractProcessType xbProcess = null;
// if (xmlObject instanceof AbstractProcessType) {
// xbProcess = (AbstractProcessType) xmlObject;
// } else {
// throw new NoApplicableCodeException()
// .withMessage("The sensor type is not supported by this SOS");
// }
// TODO add feature/parentProcs/childProcs to component - is
// this already done?
XmlObject substituteElement =
XmlHelper.substituteElement(component.addNewAbstractProcess(), xmlObject);
substituteElement.set(xmlObject);
}
}
}
return clpt;
} | ComponentListPropertyType function(final List<SmlComponent> sosComponents) throws OwsExceptionReport { ComponentListPropertyType clpt = ComponentListPropertyType.Factory.newInstance(getOptions()); final ComponentListType clt = clpt.addNewComponentList(); for (final SmlComponent sosSMLComponent : sosComponents) { final Component component = clt.addNewComponent(); if (sosSMLComponent.getName() != null) { component.setName(sosSMLComponent.getName()); } if (sosSMLComponent.getTitle() != null) { component.setTitle(sosSMLComponent.getTitle()); } if (sosSMLComponent.getHref() != null) { component.setHref(sosSMLComponent.getHref()); } if (sosSMLComponent.getProcess() != null) { Map<HelperValues, String> additionalValues = Maps.newHashMap(); additionalValues.put(HelperValues.TYPE, null); XmlObject xmlObject = encode(sosSMLComponent.getProcess(), additionalValues); if (xmlObject != null) { XmlObject substituteElement = XmlHelper.substituteElement(component.addNewAbstractProcess(), xmlObject); substituteElement.set(xmlObject); } } } return clpt; } | /**
* Creates the components section of the SensorML description.
*
* @param sosComponents
* SOS SWE representation.
* @return encoded sml:components
* @throws OwsExceptionReport
*/ | Creates the components section of the SensorML description | createComponents | {
"repo_name": "shane-axiom/SOS",
"path": "coding/sensorML-v20/src/main/java/org/n52/sos/encode/SensorMLEncoderv20.java",
"license": "gpl-2.0",
"size": 68226
} | [
"com.google.common.collect.Maps",
"java.util.List",
"java.util.Map",
"net.opengis.sensorml.x20.ComponentListPropertyType",
"net.opengis.sensorml.x20.ComponentListType",
"org.apache.xmlbeans.XmlObject",
"org.n52.sos.ogc.ows.OwsExceptionReport",
"org.n52.sos.ogc.sensorML.elements.SmlComponent",
"org.n52.sos.ogc.sos.SosConstants",
"org.n52.sos.util.XmlHelper"
] | import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import net.opengis.sensorml.x20.ComponentListPropertyType; import net.opengis.sensorml.x20.ComponentListType; import org.apache.xmlbeans.XmlObject; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.ogc.sensorML.elements.SmlComponent; import org.n52.sos.ogc.sos.SosConstants; import org.n52.sos.util.XmlHelper; | import com.google.common.collect.*; import java.util.*; import net.opengis.sensorml.x20.*; import org.apache.xmlbeans.*; import org.n52.sos.ogc.*; import org.n52.sos.ogc.ows.*; import org.n52.sos.ogc.sos.*; import org.n52.sos.util.*; | [
"com.google.common",
"java.util",
"net.opengis.sensorml",
"org.apache.xmlbeans",
"org.n52.sos"
] | com.google.common; java.util; net.opengis.sensorml; org.apache.xmlbeans; org.n52.sos; | 2,137,132 |
@JsonProperty("novel_isoforms")
public NovelIsoformParams getNovelIsoforms() {
return novelIsoforms;
} | @JsonProperty(STR) NovelIsoformParams function() { return novelIsoforms; } | /**
* <p>Original spec-file type: NovelIsoformParams</p>
* <pre>
* stringtie_genome_name: name for the new genome including novel transcripts
* transcript_label: prefix for the name of the output transcripts
* </pre>
*
*/ | Original spec-file type: NovelIsoformParams <code> stringtie_genome_name: name for the new genome including novel transcripts transcript_label: prefix for the name of the output transcripts </code> | getNovelIsoforms | {
"repo_name": "Tianhao-Gu/kb_stringtie",
"path": "lib/src/us/kbase/kbstringtie/StringTieInput.java",
"license": "mit",
"size": 12038
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,090,008 |
@Override
public void onWebsocketPong( WebSocket conn, Framedata f ) {
} | void function( WebSocket conn, Framedata f ) { } | /**
* This default implementation does not do anything. Go ahead and overwrite it.
*
* @see @see org.java_websocket.WebSocketListener#onWebsocketPong(WebSocket, Framedata)
*/ | This default implementation does not do anything. Go ahead and overwrite it | onWebsocketPong | {
"repo_name": "nekitus/helper-2",
"path": "src/org/java_websocket/WebSocketAdapter.java",
"license": "mit",
"size": 4118
} | [
"org.java_websocket.framing.Framedata"
] | import org.java_websocket.framing.Framedata; | import org.java_websocket.framing.*; | [
"org.java_websocket.framing"
] | org.java_websocket.framing; | 1,836,276 |
EAttribute getMappingCondition_LeftFunction();
| EAttribute getMappingCondition_LeftFunction(); | /**
* Returns the meta object for the attribute '{@link com.openMap1.mapper.MappingCondition#getLeftFunction <em>Left Function</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Left Function</em>'.
* @see com.openMap1.mapper.MappingCondition#getLeftFunction()
* @see #getMappingCondition()
* @generated
*/ | Returns the meta object for the attribute '<code>com.openMap1.mapper.MappingCondition#getLeftFunction Left Function</code>'. | getMappingCondition_LeftFunction | {
"repo_name": "openmapsoftware/mappingtools",
"path": "openmap-mapper-lib/src/main/java/com/openMap1/mapper/MapperPackage.java",
"license": "epl-1.0",
"size": 172715
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,184,748 |
protected void addExpressionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PRestriction_expression_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PRestriction_expression_feature", "_UI_PRestriction_type"),
PatternPackage.Literals.PRESTRICTION__EXPRESSION,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), PatternPackage.Literals.PRESTRICTION__EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Expression feature. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/ | This adds a property descriptor for the Expression feature. | addExpressionPropertyDescriptor | {
"repo_name": "BaSys-PC1/models",
"path": "de.dfki.iui.basys.model.base.edit/src/de/dfki/iui/basys/model/pattern/provider/PStringRestrictionItemProvider.java",
"license": "epl-1.0",
"size": 7586
} | [
"de.dfki.iui.basys.model.pattern.PatternPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import de.dfki.iui.basys.model.pattern.PatternPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import de.dfki.iui.basys.model.pattern.*; import org.eclipse.emf.edit.provider.*; | [
"de.dfki.iui",
"org.eclipse.emf"
] | de.dfki.iui; org.eclipse.emf; | 468,675 |
@Override
public boolean requestWindowFeature(long featureId) {
if (!IS_HONEYCOMB) {
switch ((int)featureId) {
case (int)Window.FEATURE_ACTION_BAR:
case (int)Window.FEATURE_ACTION_BAR_OVERLAY:
case (int)Window.FEATURE_ACTION_MODE_OVERLAY:
case (int)Window.FEATURE_INDETERMINATE_PROGRESS:
mWindowFlags |= (1 << featureId);
return true;
}
}
return super.requestWindowFeature((int)featureId);
}
| boolean function(long featureId) { if (!IS_HONEYCOMB) { switch ((int)featureId) { case (int)Window.FEATURE_ACTION_BAR: case (int)Window.FEATURE_ACTION_BAR_OVERLAY: case (int)Window.FEATURE_ACTION_MODE_OVERLAY: case (int)Window.FEATURE_INDETERMINATE_PROGRESS: mWindowFlags = (1 << featureId); return true; } } return super.requestWindowFeature((int)featureId); } | /**
* Enable extended window features.
*
* @param featureId The desired feature as defined in
* {@link android.support.v4.view.Window}.
* @return Returns {@code true} if the requested feature is supported and
* now enabled.
*/ | Enable extended window features | requestWindowFeature | {
"repo_name": "beshkenadze/ActionBarSherlock",
"path": "plugins/maps/src/android/support/v4/app/FragmentMapActivity.java",
"license": "apache-2.0",
"size": 48877
} | [
"android.support.v4.view.Window"
] | import android.support.v4.view.Window; | import android.support.v4.view.*; | [
"android.support"
] | android.support; | 246,878 |
public boolean removeExactly(@Nullable Object element, int occurrences) {
if (occurrences == 0) {
return true;
}
checkArgument(occurrences > 0, "Invalid occurrences: %s", occurrences);
AtomicInteger existingCounter = safeGet(element);
if (existingCounter == null) {
return false;
}
while (true) {
int oldValue = existingCounter.get();
if (oldValue < occurrences) {
return false;
}
int newValue = oldValue - occurrences;
if (existingCounter.compareAndSet(oldValue, newValue)) {
if (newValue == 0) {
// Just CASed to 0; remove the entry to clean up the map. If the removal fails,
// another thread has already replaced it with a new counter, which is fine.
countMap.remove(element, existingCounter);
}
return true;
}
}
} | boolean function(@Nullable Object element, int occurrences) { if (occurrences == 0) { return true; } checkArgument(occurrences > 0, STR, occurrences); AtomicInteger existingCounter = safeGet(element); if (existingCounter == null) { return false; } while (true) { int oldValue = existingCounter.get(); if (oldValue < occurrences) { return false; } int newValue = oldValue - occurrences; if (existingCounter.compareAndSet(oldValue, newValue)) { if (newValue == 0) { countMap.remove(element, existingCounter); } return true; } } } | /**
* Removes exactly the specified number of occurrences of {@code element}, or makes no
* change if this is not possible.
*
* <p>This method, in contrast to {@link #remove(Object, int)}, has no effect when the
* element count is smaller than {@code occurrences}.
*
* @param element the element to remove
* @param occurrences the number of occurrences of {@code element} to remove
* @return {@code true} if the removal was possible (including if {@code occurrences} is zero)
*/ | Removes exactly the specified number of occurrences of element, or makes no change if this is not possible. This method, in contrast to <code>#remove(Object, int)</code>, has no effect when the element count is smaller than occurrences | removeExactly | {
"repo_name": "mkeesey/guava-for-small-classpaths",
"path": "guava/src/com/google/common/collect/ConcurrentHashMultiset.java",
"license": "apache-2.0",
"size": 21489
} | [
"com.google.common.base.Preconditions",
"java.util.concurrent.atomic.AtomicInteger",
"javax.annotation.Nullable"
] | import com.google.common.base.Preconditions; import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Nullable; | import com.google.common.base.*; import java.util.concurrent.atomic.*; import javax.annotation.*; | [
"com.google.common",
"java.util",
"javax.annotation"
] | com.google.common; java.util; javax.annotation; | 954,808 |
for (Map.Entry<String, String> entry : in.entrySet()) {
out.put(entry.getKey(), new StringByteIterator(entry.getValue()));
}
} | for (Map.Entry<String, String> entry : in.entrySet()) { out.put(entry.getKey(), new StringByteIterator(entry.getValue())); } } | /**
* Put all of the entries of one map into the other, converting
* String values into ByteIterators.
*/ | Put all of the entries of one map into the other, converting String values into ByteIterators | putAllAsByteIterators | {
"repo_name": "manolama/YCSB",
"path": "core/src/main/java/com/yahoo/ycsb/StringByteIterator.java",
"license": "apache-2.0",
"size": 3293
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,179,429 |
public String[] getTriggerGroupNames(SchedulingContext ctxt)
throws SchedulerException {
validateState();
return resources.getJobStore().getTriggerGroupNames(ctxt);
} | String[] function(SchedulingContext ctxt) throws SchedulerException { validateState(); return resources.getJobStore().getTriggerGroupNames(ctxt); } | /**
* <p>
* Get the names of all known <code>{@link org.quartz.Trigger}</code>
* groups.
* </p>
*/ | Get the names of all known <code><code>org.quartz.Trigger</code></code> groups. | getTriggerGroupNames | {
"repo_name": "optivo-org/quartz-1.8.3-optivo",
"path": "quartz/src/main/java/org/quartz/core/QuartzScheduler.java",
"license": "apache-2.0",
"size": 78832
} | [
"org.quartz.SchedulerException"
] | import org.quartz.SchedulerException; | import org.quartz.*; | [
"org.quartz"
] | org.quartz; | 248,338 |
public Map<String, String[]> getMultipartParameters() {
return multipartParameters;
}
} | Map<String, String[]> function() { return multipartParameters; } } | /**
* Return the multipart parameters as Map of field name to form field String value.
*/ | Return the multipart parameters as Map of field name to form field String value | getMultipartParameters | {
"repo_name": "jvasileff/aos-servlet",
"path": "src.java/org/anodyneos/servlet/multipart/commons/CommonsFileUploadSupport.java",
"license": "mit",
"size": 13292
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,313,059 |
@Test
public void setUserRolesTest() throws ApiException {
Integer userId = null;
List<String> rolesList = null;
UserResource response = api.setUserRoles(userId, rolesList);
// TODO: test validations
} | void function() throws ApiException { Integer userId = null; List<String> rolesList = null; UserResource response = api.setUserRoles(userId, rolesList); } | /**
* Set roles for a user
*
* <b>Permissions Needed:</b> ROLES_ADMIN
*
* @throws ApiException
* if the Api call fails
*/ | Set roles for a user <b>Permissions Needed:</b> ROLES_ADMIN | setUserRolesTest | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/test/java/com/knetikcloud/api/AuthRolesApiTest.java",
"license": "apache-2.0",
"size": 5252
} | [
"com.knetikcloud.client.ApiException",
"com.knetikcloud.model.UserResource",
"java.util.List"
] | import com.knetikcloud.client.ApiException; import com.knetikcloud.model.UserResource; import java.util.List; | import com.knetikcloud.client.*; import com.knetikcloud.model.*; import java.util.*; | [
"com.knetikcloud.client",
"com.knetikcloud.model",
"java.util"
] | com.knetikcloud.client; com.knetikcloud.model; java.util; | 1,908,910 |
@Override
public ItemStack removeItem(int slot, int amount) {
ItemStack itemStack = getItem(slot);
if (!itemStack.isEmpty()) {
if (itemStack.getCount() <= amount) {
setItem(slot, ItemStack.EMPTY);
} else {
itemStack = itemStack.split(amount);
if (itemStack.getCount() == 0) {
setItem(slot, ItemStack.EMPTY);
}
}
}
return itemStack;
} | ItemStack function(int slot, int amount) { ItemStack itemStack = getItem(slot); if (!itemStack.isEmpty()) { if (itemStack.getCount() <= amount) { setItem(slot, ItemStack.EMPTY); } else { itemStack = itemStack.split(amount); if (itemStack.getCount() == 0) { setItem(slot, ItemStack.EMPTY); } } } return itemStack; } | /**
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.
*
* @param slot
* @param amount
*/ | Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack | removeItem | {
"repo_name": "Qmunity/BluePower",
"path": "src/main/java/com/bluepowermod/tile/tier1/TileEjector.java",
"license": "gpl-3.0",
"size": 6810
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,694,602 |
@LargeTest
public void testPerformanceVideoItemProperties() throws Exception {
final String videoItemFileName1 = INPUT_FILE_PATH +
"H264_BP_1080x720_30fps_800kbps_1_17.mp4";
final int videoItemStartTime1 = 0;
final int videoItemEndTime1 = 10100;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int fileType = MediaProperties.FILE_MP4;
final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77366;
final int videoBitrate = 3169971;
final int fps = 30;
final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 1080;
final int height = MediaProperties.HEIGHT_720;
int timeTaken = 0;
final String[] loggingInfo = new String[1];
final MediaVideoItem mediaVideoItem = new MediaVideoItem(mVideoEditor,
"m0", videoItemFileName1, renderingMode);
mediaVideoItem.setExtractBoundaries(videoItemStartTime1,
videoItemEndTime1);
long beginTime = SystemClock.uptimeMillis();
for (int i = 0; i < (NUM_OF_ITERATIONS*10); i++) {
try {
assertEquals("Aspect Ratio Mismatch",
aspectRatio, mediaVideoItem.getAspectRatio());
assertEquals("File Type Mismatch",
fileType, mediaVideoItem.getFileType());
assertEquals("VideoCodec Mismatch",
videoCodecType, mediaVideoItem.getVideoType());
assertEquals("duration Mismatch",
duration, mediaVideoItem.getDuration());
assertEquals("Video Profile ",
videoProfile, mediaVideoItem.getVideoProfile());
assertEquals("Video Level ",
videoLevel, mediaVideoItem.getVideoLevel());
assertEquals("Video height ",
height, mediaVideoItem.getHeight());
assertEquals("Video width ",
width, mediaVideoItem.getWidth());
} catch (Exception e1) {
assertTrue("Can not create Video Item with file name = "
+ e1.toString(), false);
}
}
timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS*10));
loggingInfo[0] = "Time taken to get Media Properties :"
+ timeTaken;
writeTimingInfo("testPerformanceVideoItemProperties:", loggingInfo);
} | void function() throws Exception { final String videoItemFileName1 = INPUT_FILE_PATH + STR; final int videoItemStartTime1 = 0; final int videoItemEndTime1 = 10100; final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER; final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2; final int fileType = MediaProperties.FILE_MP4; final int videoCodecType = MediaProperties.VCODEC_H264; final int duration = 77366; final int videoBitrate = 3169971; final int fps = 30; final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline; final int videoLevel = MediaProperties.H264Level.H264Level13; final int width = 1080; final int height = MediaProperties.HEIGHT_720; int timeTaken = 0; final String[] loggingInfo = new String[1]; final MediaVideoItem mediaVideoItem = new MediaVideoItem(mVideoEditor, "m0", videoItemFileName1, renderingMode); mediaVideoItem.setExtractBoundaries(videoItemStartTime1, videoItemEndTime1); long beginTime = SystemClock.uptimeMillis(); for (int i = 0; i < (NUM_OF_ITERATIONS*10); i++) { try { assertEquals(STR, aspectRatio, mediaVideoItem.getAspectRatio()); assertEquals(STR, fileType, mediaVideoItem.getFileType()); assertEquals(STR, videoCodecType, mediaVideoItem.getVideoType()); assertEquals(STR, duration, mediaVideoItem.getDuration()); assertEquals(STR, videoProfile, mediaVideoItem.getVideoProfile()); assertEquals(STR, videoLevel, mediaVideoItem.getVideoLevel()); assertEquals(STR, height, mediaVideoItem.getHeight()); assertEquals(STR, width, mediaVideoItem.getWidth()); } catch (Exception e1) { assertTrue(STR + e1.toString(), false); } } timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS*10)); loggingInfo[0] = STR + timeTaken; writeTimingInfo(STR, loggingInfo); } | /**
* To test the performance of get properties of a Video media item
*
* @throws Exception
*/ | To test the performance of get properties of a Video media item | testPerformanceVideoItemProperties | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java",
"license": "apache-2.0",
"size": 46584
} | [
"android.media.videoeditor.MediaItem",
"android.media.videoeditor.MediaProperties",
"android.media.videoeditor.MediaVideoItem",
"android.os.SystemClock"
] | import android.media.videoeditor.MediaItem; import android.media.videoeditor.MediaProperties; import android.media.videoeditor.MediaVideoItem; import android.os.SystemClock; | import android.media.videoeditor.*; import android.os.*; | [
"android.media",
"android.os"
] | android.media; android.os; | 2,565,312 |
@Override public void enterDirective_double(@NotNull UFHtmlParser.Directive_doubleContext ctx) { } | @Override public void enterDirective_double(@NotNull UFHtmlParser.Directive_doubleContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitDirective_single | {
"repo_name": "UniversalFuture/uf-html",
"path": "com/uf_html/src/com/uf_html/UFHtmlBaseListener.java",
"license": "gpl-2.0",
"size": 5301
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,085,862 |
public void highlightValue(int xIndex, int dataSetIndex) {
if (xIndex < 0 || dataSetIndex < 0 || xIndex >= mOriginalData.getXValCount()
|| dataSetIndex >= mOriginalData.getDataSetCount()) {
highlightValues(null);
} else {
highlightValues(new Highlight[]{
new Highlight(xIndex, dataSetIndex)
});
}
} | void function(int xIndex, int dataSetIndex) { if (xIndex < 0 dataSetIndex < 0 xIndex >= mOriginalData.getXValCount() dataSetIndex >= mOriginalData.getDataSetCount()) { highlightValues(null); } else { highlightValues(new Highlight[]{ new Highlight(xIndex, dataSetIndex) }); } } | /**
* Highlights the value at the given x-index in the given DataSet. Provide
* -1 as the x-index to undo all highlighting.
*
* @param xIndex
* @param dataSetIndex
*/ | Highlights the value at the given x-index in the given DataSet. Provide -1 as the x-index to undo all highlighting | highlightValue | {
"repo_name": "PeoceWang/WeatherAPP",
"path": "app/src/main/java/com/github/mikephil/chartLibrary/charts/Chart.java",
"license": "apache-2.0",
"size": 72381
} | [
"com.github.mikephil.chartLibrary.utils.Highlight"
] | import com.github.mikephil.chartLibrary.utils.Highlight; | import com.github.mikephil.*; | [
"com.github.mikephil"
] | com.github.mikephil; | 1,785,748 |
public void flush() throws IOException
{
final byte[] content = bos.toByteArray();
logMessage( new String( content ) );
bos.reset();
} | void function() throws IOException { final byte[] content = bos.toByteArray(); logMessage( new String( content ) ); bos.reset(); } | /**
* Flushes this output stream, writing any buffered content to the log
*
* @throws IOException on error
* @see java.io.OutputStream#flush()
*/ | Flushes this output stream, writing any buffered content to the log | flush | {
"repo_name": "eva-xuyen/excalibur",
"path": "framework/impl/src/main/java/org/apache/avalon/framework/logger/LoggerAwareOutputStream.java",
"license": "apache-2.0",
"size": 3564
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,591,535 |
protected ProgressObserver getMonitor() {
return this.monitor;
}
| ProgressObserver function() { return this.monitor; } | /**
* Returns the monitor that will be updated by intercepted information.
* @return monitor The ProgressObserver.
*/ | Returns the monitor that will be updated by intercepted information | getMonitor | {
"repo_name": "QualiMaster/QM-IConf",
"path": "ManifestUtils/src/eu/qualimaster/manifestUtils/AbstractIntercepter.java",
"license": "apache-2.0",
"size": 3997
} | [
"net.ssehub.easy.basics.progress.ProgressObserver"
] | import net.ssehub.easy.basics.progress.ProgressObserver; | import net.ssehub.easy.basics.progress.*; | [
"net.ssehub.easy"
] | net.ssehub.easy; | 2,169,773 |
interface UpdateStages {
interface WithTags {
Update withTags(Map<String, String> tags);
} | interface UpdateStages { interface WithTags { Update withTags(Map<String, String> tags); } | /**
* Specifies the tags property: Resource tags..
*
* @param tags Resource tags.
* @return the next definition stage.
*/ | Specifies the tags property: Resource tags. | withTags | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/relay/azure-resourcemanager-relay/src/main/java/com/azure/resourcemanager/relay/models/RelayNamespace.java",
"license": "mit",
"size": 7698
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 921,239 |
private static Test semanticSuite(String framework)
{
TestSuite noauthSuite = new TestSuite(
"suite: security level=noSqlAuthorization");
noauthSuite.addTest(new RolesTest("testSemantics",
NO_SQLAUTHORIZATION,
null,
null));
TestSuite suite = new TestSuite("roles:"+framework);
suite.addTest(noauthSuite);
suite.addTest(wrapInAuthorization("testSemantics"));
return suite;
} | static Test function(String framework) { TestSuite noauthSuite = new TestSuite( STR); noauthSuite.addTest(new RolesTest(STR, NO_SQLAUTHORIZATION, null, null)); TestSuite suite = new TestSuite(STR+framework); suite.addTest(noauthSuite); suite.addTest(wrapInAuthorization(STR)); return suite; } | /**
*
* Construct suite of semantic tests
*
* @param framework Derby framework indication
*
* @return A suite containing the semantic test cases incarnated only
* for security level sqlAuthorization.
*
* It has one instance for dbo, and one for an ordinary user, so there
* are in all three incarnations of tests.
*/ | Construct suite of semantic tests | semanticSuite | {
"repo_name": "splicemachine/spliceengine",
"path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/RolesTest.java",
"license": "agpl-3.0",
"size": 49259
} | [
"junit.framework.Test",
"junit.framework.TestSuite"
] | import junit.framework.Test; import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 1,866,522 |
public void setRoot(IParsedItem newRoot) {
// We'll try to do the 'least flicker replace'
// compare the two root structures, and tell outline what to refresh
onModelChanged.call(this);
try {
if (root != null) {
ArrayList<IParsedItem> itemsToRefresh = new ArrayList<IParsedItem>();
ArrayList<IParsedItem> itemsToUpdate = new ArrayList<IParsedItem>();
patchRootHelper(root, newRoot, itemsToRefresh, itemsToUpdate);
if (outlinePageRef != null) {
BaseOutlinePage outlinePage = outlinePageRef.get();
if (outlinePage == null) {
return;
}
if (outlinePage.isDisconnectedFromTree()) {
return;
}
//to update
int itemsToUpdateSize = itemsToUpdate.size();
if (itemsToUpdateSize > 0) {
outlinePage.updateItems(itemsToUpdate.toArray(new IParsedItem[itemsToUpdateSize]));
}
//to refresh
int itemsToRefreshSize = itemsToRefresh.size();
if (itemsToRefreshSize > 0) {
outlinePage.refreshItems(itemsToRefresh.toArray(new IParsedItem[itemsToRefreshSize]));
}
}
} else {
Log.log("No old model root?");
}
} catch (Throwable e) {
Log.log(e);
}
} | void function(IParsedItem newRoot) { onModelChanged.call(this); try { if (root != null) { ArrayList<IParsedItem> itemsToRefresh = new ArrayList<IParsedItem>(); ArrayList<IParsedItem> itemsToUpdate = new ArrayList<IParsedItem>(); patchRootHelper(root, newRoot, itemsToRefresh, itemsToUpdate); if (outlinePageRef != null) { BaseOutlinePage outlinePage = outlinePageRef.get(); if (outlinePage == null) { return; } if (outlinePage.isDisconnectedFromTree()) { return; } int itemsToUpdateSize = itemsToUpdate.size(); if (itemsToUpdateSize > 0) { outlinePage.updateItems(itemsToUpdate.toArray(new IParsedItem[itemsToUpdateSize])); } int itemsToRefreshSize = itemsToRefresh.size(); if (itemsToRefreshSize > 0) { outlinePage.refreshItems(itemsToRefresh.toArray(new IParsedItem[itemsToRefreshSize])); } } } else { Log.log(STR); } } catch (Throwable e) { Log.log(e); } } | /**
* Replaces current root
*/ | Replaces current root | setRoot | {
"repo_name": "siddhika1889/Pydev-Dependencies_2",
"path": "src/org/python/pydev/shared_ui/outline/BaseModel.java",
"license": "epl-1.0",
"size": 6636
} | [
"java.util.ArrayList",
"org.python.pydev.shared_core.log.Log"
] | import java.util.ArrayList; import org.python.pydev.shared_core.log.Log; | import java.util.*; import org.python.pydev.shared_core.log.*; | [
"java.util",
"org.python.pydev"
] | java.util; org.python.pydev; | 1,235,742 |
public List<String> partitions() {
return partitions;
} | List<String> function() { return partitions; } | /**
* Returns a predefined list of partitions this query can be executed on
* instead of the entire partition set.
*
* If the list is empty no prefiltering can be done.
*
* Note that the NO_MATCH case has to be tested separately.
*
*/ | Returns a predefined list of partitions this query can be executed on instead of the entire partition set. If the list is empty no prefiltering can be done. Note that the NO_MATCH case has to be tested separately | partitions | {
"repo_name": "gmrodrigues/crate",
"path": "sql/src/main/java/io/crate/analyze/WhereClause.java",
"license": "apache-2.0",
"size": 7044
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 378,241 |
String getFullyQualifiedName() {
Validate.validState(this.compilationUnit != null, "getFullyQualifiedName may only be called after getAst was!");
// Compilation Units that don’t have exactly one type declaration at the root
// level are not supported. The author knows of no compilable example of such a
// compilation unit.
final TypeDeclaration rootType = (TypeDeclaration) this.compilationUnit.types().get(0);
if (rootType == null) {
return null;
}
final PackageDeclaration cuPackage = this.compilationUnit.getPackage();
final String packageName;
if (cuPackage == null) {
packageName = "";
} else {
packageName = cuPackage.getName() + ".";
}
return packageName + rootType.getName();
} | String getFullyQualifiedName() { Validate.validState(this.compilationUnit != null, STR); final TypeDeclaration rootType = (TypeDeclaration) this.compilationUnit.types().get(0); if (rootType == null) { return null; } final PackageDeclaration cuPackage = this.compilationUnit.getPackage(); final String packageName; if (cuPackage == null) { packageName = STR."; } return packageName + rootType.getName(); } | /**
* Queries the fully qualified name of type defined by the source code file this
* bridge was created for.
*
* @return The fully qualified name of the type defined by the source code file this
* bridge was created for. {@code null} if there is nothing in the file this
* desription applies to.
*/ | Queries the fully qualified name of type defined by the source code file this bridge was created for | getFullyQualifiedName | {
"repo_name": "Beagle-PSE/Beagle",
"path": "Kieker Measurement Tool/src/main/java/de/uka/ipd/sdq/beagle/measurement/kieker/instrumentation/EclipseAstBridge.java",
"license": "epl-1.0",
"size": 4902
} | [
"org.apache.commons.lang3.Validate",
"org.eclipse.jdt.core.dom.PackageDeclaration",
"org.eclipse.jdt.core.dom.TypeDeclaration"
] | import org.apache.commons.lang3.Validate; import org.eclipse.jdt.core.dom.PackageDeclaration; import org.eclipse.jdt.core.dom.TypeDeclaration; | import org.apache.commons.lang3.*; import org.eclipse.jdt.core.dom.*; | [
"org.apache.commons",
"org.eclipse.jdt"
] | org.apache.commons; org.eclipse.jdt; | 1,355,648 |
boolean accept(Method method); | boolean accept(Method method); | /**
* return true if the given method is accepted
* @param method method to test acceptance
* @return true if the given method is accepted
*/ | return true if the given method is accepted | accept | {
"repo_name": "thevpc/upa",
"path": "upa-api/src/main/java/net/thevpc/upa/MethodFilter.java",
"license": "gpl-3.0",
"size": 2166
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,136,048 |
String getAriaRelevantProperty(Element element); | String getAriaRelevantProperty(Element element); | /**
* Returns the value of the <a
* href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant">aria-relevant</a>
* attribute for the {@code element} or "" if no such attribute is present.
*/ | Returns the value of the aria-relevant attribute for the element or "" if no such attribute is present | getAriaRelevantProperty | {
"repo_name": "gwtproject/gwt-aria",
"path": "gwt-aria/src/main/java/org/gwtproject/aria/client/Role.java",
"license": "apache-2.0",
"size": 14634
} | [
"org.gwtproject.dom.client.Element"
] | import org.gwtproject.dom.client.Element; | import org.gwtproject.dom.client.*; | [
"org.gwtproject.dom"
] | org.gwtproject.dom; | 209,142 |
//Modified by Rob Klein 4/29/07
private table fillTable (MobileSessionCtx wsc, String columnName, int fieldRefId,
String action,String targetBase, boolean addStart, int page, String where)
{
table table = new table("1"); // Border 1
table.setClass("itable");
table.setID("WLookupT");
table.addElement("<thead>");
tr line = new tr();
line.setClass("header");
// Set Headers
//line.addElement(new th(" ")).
// addElement(new th(Msg.translate(wsc.ctx, "Key Name")).setClass("table-filterable table-filtered table-sortable:default"));
line = fillTable_Lookup_Headers(columnName, fieldRefId, line, targetBase, true, true, true, false, true);
tr line2 = new tr();
//line2.addElement(new th(" ")).addElement(new th(" "));
line2 = fillTable_Lookup_Headers( columnName, fieldRefId, line2, targetBase, true, true, true, false, false);
table.addElement(line);
table.addElement("</thead>");
table.addElement("<tbody>");
// Fillout rows
table = fillTable_Lookup_Rows(wsc, columnName, fieldRefId, table, targetBase, true, true, true, false, page, where);
table.addElement("</tbody>");
// Restore
return table;
} // fillTable
| table function (MobileSessionCtx wsc, String columnName, int fieldRefId, String action,String targetBase, boolean addStart, int page, String where) { table table = new table("1"); table.setClass(STR); table.setID(STR); table.addElement(STR); tr line = new tr(); line.setClass(STR); line = fillTable_Lookup_Headers(columnName, fieldRefId, line, targetBase, true, true, true, false, true); tr line2 = new tr(); line2 = fillTable_Lookup_Headers( columnName, fieldRefId, line2, targetBase, true, true, true, false, false); table.addElement(line); table.addElement(STR); table.addElement(STR); table = fillTable_Lookup_Rows(wsc, columnName, fieldRefId, table, targetBase, true, true, true, false, page, where); table.addElement(STR); return table; } | /**************************************************************************
* Fill Table (Generic)
*
* @param ws WindowStatus
* @param mField the Field
* @param targetBase target field string - add field Type
* @param addStart add startUpdate
* @param where
* @return Table with selection
*/ | Fill Table (Generic) | fillTable | {
"repo_name": "erpcya/adempierePOS",
"path": "mobile/WEB-INF/src/org/compiere/mobile/WLookup.java",
"license": "gpl-2.0",
"size": 19448
} | [
"org.apache.ecs.xhtml.table",
"org.apache.ecs.xhtml.tr",
"org.compiere.mobile.MobileSessionCtx"
] | import org.apache.ecs.xhtml.table; import org.apache.ecs.xhtml.tr; import org.compiere.mobile.MobileSessionCtx; | import org.apache.ecs.xhtml.table.*; import org.apache.ecs.xhtml.tr.*; import org.compiere.mobile.*; | [
"org.apache.ecs",
"org.compiere.mobile"
] | org.apache.ecs; org.compiere.mobile; | 2,112,257 |
@Test
public void listDataConfigurator() throws Exception {
LoadClient loader = new LoadClient(AGENT1_ADDRESS);
loader.setThreadingPattern(new AllAtOncePattern(USER_TOKENS.length, true));
// set as many as needed data configurators
loader.addParameterDataConfigurator(new ListDataConfig(PARAMETRIZED_USER, USER_TOKENS));
loader.startQueueing("FTP transfers");
FileTransferActions ftActions = new FileTransferActions();
// user name is changing
ftActions.connect(TRANSFER_PROTOCOL, SERVER_PORT, SERVER_IP, PARAMETRIZED_USER, USER_PASSWORD);
// the file is the same each time
ftActions.upload(RESOURCES_ROOT_DIR + "file1.txt");
ftActions.disconnect();
loader.executeQueuedActions();
} | void function() throws Exception { LoadClient loader = new LoadClient(AGENT1_ADDRESS); loader.setThreadingPattern(new AllAtOncePattern(USER_TOKENS.length, true)); loader.addParameterDataConfigurator(new ListDataConfig(PARAMETRIZED_USER, USER_TOKENS)); loader.startQueueing(STR); FileTransferActions ftActions = new FileTransferActions(); ftActions.connect(TRANSFER_PROTOCOL, SERVER_PORT, SERVER_IP, PARAMETRIZED_USER, USER_PASSWORD); ftActions.upload(RESOURCES_ROOT_DIR + STR); ftActions.disconnect(); loader.executeQueuedActions(); } | /**
* The actual values are taken from a provided list
*
* So the user is coming as the next value of the USER_TOKENS list
*/ | The actual values are taken from a provided list So the user is coming as the next value of the USER_TOKENS list | listDataConfigurator | {
"repo_name": "Axway/ats-framework",
"path": "examples/vm-tests/src/test/java/com/axway/ats/examples/performance/ParametrizationTests.java",
"license": "apache-2.0",
"size": 7057
} | [
"com.axway.ats.agent.core.threading.data.config.ListDataConfig",
"com.axway.ats.agent.core.threading.patterns.AllAtOncePattern",
"com.axway.ats.agent.webapp.client.LoadClient",
"com.axway.ats.framework.examples.vm.actions.clients.FileTransferActions"
] | import com.axway.ats.agent.core.threading.data.config.ListDataConfig; import com.axway.ats.agent.core.threading.patterns.AllAtOncePattern; import com.axway.ats.agent.webapp.client.LoadClient; import com.axway.ats.framework.examples.vm.actions.clients.FileTransferActions; | import com.axway.ats.agent.core.threading.data.config.*; import com.axway.ats.agent.core.threading.patterns.*; import com.axway.ats.agent.webapp.client.*; import com.axway.ats.framework.examples.vm.actions.clients.*; | [
"com.axway.ats"
] | com.axway.ats; | 478,657 |
public static Configuration getPeerClusterConfiguration(Configuration conf,
ReplicationPeerDescription peer) throws IOException {
ReplicationPeerConfig peerConfig = peer.getPeerConfig();
Configuration otherConf;
try {
otherConf = HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey());
} catch (IOException e) {
throw new IOException("Can't get peer configuration for peerId=" + peer.getPeerId(), e);
}
if (!peerConfig.getConfiguration().isEmpty()) {
CompoundConfiguration compound = new CompoundConfiguration();
compound.add(otherConf);
compound.addStringMap(peerConfig.getConfiguration());
return compound;
}
return otherConf;
} | static Configuration function(Configuration conf, ReplicationPeerDescription peer) throws IOException { ReplicationPeerConfig peerConfig = peer.getPeerConfig(); Configuration otherConf; try { otherConf = HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey()); } catch (IOException e) { throw new IOException(STR + peer.getPeerId(), e); } if (!peerConfig.getConfiguration().isEmpty()) { CompoundConfiguration compound = new CompoundConfiguration(); compound.add(otherConf); compound.addStringMap(peerConfig.getConfiguration()); return compound; } return otherConf; } | /**
* Returns the configuration needed to talk to the remote slave cluster.
* @param conf the base configuration
* @param peer the description of replication peer
* @return the configuration for the peer cluster, null if it was unable to get the configuration
* @throws IOException when create peer cluster configuration failed
*/ | Returns the configuration needed to talk to the remote slave cluster | getPeerClusterConfiguration | {
"repo_name": "ndimiduk/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java",
"license": "apache-2.0",
"size": 27056
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.CompoundConfiguration",
"org.apache.hadoop.hbase.HBaseConfiguration",
"org.apache.hadoop.hbase.replication.ReplicationPeerConfig",
"org.apache.hadoop.hbase.replication.ReplicationPeerDescription"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CompoundConfiguration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; import org.apache.hadoop.hbase.replication.ReplicationPeerDescription; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.replication.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,253,956 |
upperThumbRect = new Rectangle();
super.installUI(c);
} | upperThumbRect = new Rectangle(); super.installUI(c); } | /**
* Installs this UI delegate on the specified component.
*/ | Installs this UI delegate on the specified component | installUI | {
"repo_name": "ernieyu/Swing-range-slider",
"path": "src/slider/RangeSliderUI.java",
"license": "mit",
"size": 20530
} | [
"java.awt.Rectangle"
] | import java.awt.Rectangle; | import java.awt.*; | [
"java.awt"
] | java.awt; | 640,409 |
ObjectMap<String> raw = new ObjectMap<String>();
raw = new ObjectMap<String>();
raw.set("name", player.getName());
raw.set("id", player.getUniqueId());
raw.set("address", player.getAddress().getAddress().getHostAddress() + ':' + player.getAddress().getPort());
if (player.getServer() != null) raw.set("server", player.getServer().getInfo().getName());
if (SubAPI.getInstance().getName() != null) raw.set("proxy", SubAPI.getInstance().getName());
return raw;
}
public CachedPlayer(ProxiedPlayer player) {
this(translate(player));
}
public CachedPlayer(ObjectMap<String> raw) {
this(null, raw);
}
CachedPlayer(DataClient client, ObjectMap<String> raw) {
super(client, raw);
} | ObjectMap<String> raw = new ObjectMap<String>(); raw = new ObjectMap<String>(); raw.set("name", player.getName()); raw.set("id", player.getUniqueId()); raw.set(STR, player.getAddress().getAddress().getHostAddress() + ':' + player.getAddress().getPort()); if (player.getServer() != null) raw.set(STR, player.getServer().getInfo().getName()); if (SubAPI.getInstance().getName() != null) raw.set("proxy", SubAPI.getInstance().getName()); return raw; } public CachedPlayer(ProxiedPlayer player) { this(translate(player)); } public CachedPlayer(ObjectMap<String> raw) { this(null, raw); } CachedPlayer(DataClient client, ObjectMap<String> raw) { super(client, raw); } | /**
* Convert a Local Player to a Cached Remote Player
*
* @param player Local Player
* @return Raw representation of the Remote Player
*/ | Convert a Local Player to a Cached Remote Player | translate | {
"repo_name": "ME1312/SubServers-2",
"path": "SubServers.Sync/src/net/ME1312/SubServers/Sync/Server/CachedPlayer.java",
"license": "apache-2.0",
"size": 10759
} | [
"net.md_5.bungee.api.connection.ProxiedPlayer"
] | import net.md_5.bungee.api.connection.ProxiedPlayer; | import net.md_5.bungee.api.connection.*; | [
"net.md_5.bungee"
] | net.md_5.bungee; | 1,390,757 |
public static void main(String[] args) {
Objects.requireNonNull(args);
Main instance = new Main();
System.out.println(instance.run(args));
} | static void function(String[] args) { Objects.requireNonNull(args); Main instance = new Main(); System.out.println(instance.run(args)); } | /**
* Starts the application from the command line, and outputs the result, if
* there is any result.
*
* @param args
* parameters
*/ | Starts the application from the command line, and outputs the result, if there is any result | main | {
"repo_name": "julianmendez/born",
"path": "born-gui/src/main/java/de/tudresden/inf/lat/born/main/Main.java",
"license": "apache-2.0",
"size": 1515
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 1,933,585 |
@Deprecated
public static Boolean getSimulationMode(Class<?> implementingClass, Configuration conf) {
return org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator.getSimulationMode(implementingClass, conf);
} | static Boolean function(Class<?> implementingClass, Configuration conf) { return org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator.getSimulationMode(implementingClass, conf); } | /**
* Determines whether this feature is enabled.
*
* @param implementingClass
* the class whose name will be used as a prefix for the property configuration key
* @param conf
* the Hadoop configuration object to configure
* @return true if the feature is enabled, false otherwise
* @deprecated since 1.6.0; Configure your job with the appropriate InputFormat or OutputFormat.
* @since 1.5.0
* @see #setSimulationMode(Class, Configuration, boolean)
*/ | Determines whether this feature is enabled | getSimulationMode | {
"repo_name": "dhutchis/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/OutputConfigurator.java",
"license": "apache-2.0",
"size": 8286
} | [
"org.apache.hadoop.conf.Configuration"
] | import org.apache.hadoop.conf.Configuration; | import org.apache.hadoop.conf.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,886,422 |
Assert.hasLength(input, "Input required");
try {
return input.getBytes("UTF-8");
} catch (UnsupportedEncodingException fallbackToDefault) {
return input.getBytes();
}
} | Assert.hasLength(input, STR); try { return input.getBytes("UTF-8"); } catch (UnsupportedEncodingException fallbackToDefault) { return input.getBytes(); } } | /**
* Converts a String into a byte array using UTF-8, falling back to the
* platform's default character set if UTF-8 fails.
*
* @param input the input (required)
* @return a byte array representation of the input string
*/ | Converts a String into a byte array using UTF-8, falling back to the platform's default character set if UTF-8 fails | stringToByteArray | {
"repo_name": "mrjabba/spring-security",
"path": "core/src/main/java/org/springframework/security/util/EncryptionUtils.java",
"license": "apache-2.0",
"size": 6337
} | [
"java.io.UnsupportedEncodingException",
"org.springframework.util.Assert"
] | import java.io.UnsupportedEncodingException; import org.springframework.util.Assert; | import java.io.*; import org.springframework.util.*; | [
"java.io",
"org.springframework.util"
] | java.io; org.springframework.util; | 19,995 |
@Nullable
public InputStream get() throws ClientException {
return send();
} | InputStream function() throws ClientException { return send(); } | /**
* Gets the contents of this stream
*
* @return the stream that the caller needs to close
* @throws ClientException an exception occurs if there was an error while the request was sent
*/ | Gets the contents of this stream | get | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/MessageStreamRequest.java",
"license": "mit",
"size": 3410
} | [
"com.microsoft.graph.core.ClientException",
"java.io.InputStream"
] | import com.microsoft.graph.core.ClientException; import java.io.InputStream; | import com.microsoft.graph.core.*; import java.io.*; | [
"com.microsoft.graph",
"java.io"
] | com.microsoft.graph; java.io; | 1,880,257 |
private void mergeStatus(final MultiStatus status, final IStatus toMerge) {
if (!toMerge.isOK()) {
status.merge(toMerge);
}
} | void function(final MultiStatus status, final IStatus toMerge) { if (!toMerge.isOK()) { status.merge(toMerge); } } | /**
* Adds the given status to the list of problems. Discards OK statuses. If the status is a multi-status, only its
* children are added.
*/ | Adds the given status to the list of problems. Discards OK statuses. If the status is a multi-status, only its children are added | mergeStatus | {
"repo_name": "hqnghi88/gamaClone",
"path": "ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/NavigatorResourceDropAssistant.java",
"license": "gpl-3.0",
"size": 23422
} | [
"org.eclipse.core.runtime.IStatus",
"org.eclipse.core.runtime.MultiStatus"
] | import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 446,140 |
PackageScanResourceResolver getPackageScanResourceResolver(); | PackageScanResourceResolver getPackageScanResourceResolver(); | /**
* Returns the package scanning resource resolver
*
* @return the resolver
*/ | Returns the package scanning resource resolver | getPackageScanResourceResolver | {
"repo_name": "gnodet/camel",
"path": "core/camel-api/src/main/java/org/apache/camel/ExtendedCamelContext.java",
"license": "apache-2.0",
"size": 24074
} | [
"org.apache.camel.spi.PackageScanResourceResolver"
] | import org.apache.camel.spi.PackageScanResourceResolver; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 877,036 |
public SplitDefinition onPrepare(Processor onPrepare) {
setOnPrepare(onPrepare);
return this;
}
/**
* Uses the {@link Processor} when preparing the
* {@link org.apache.camel.Exchange} to be send. This can be used to
* deep-clone messages that should be send, or any custom logic needed
* before the exchange is send.
*
* @param onPrepareRef reference to the processor to lookup in the
* {@link org.apache.camel.spi.Registry} | SplitDefinition function(Processor onPrepare) { setOnPrepare(onPrepare); return this; } /** * Uses the {@link Processor} when preparing the * {@link org.apache.camel.Exchange} to be send. This can be used to * deep-clone messages that should be send, or any custom logic needed * before the exchange is send. * * @param onPrepareRef reference to the processor to lookup in the * {@link org.apache.camel.spi.Registry} | /**
* Uses the {@link Processor} when preparing the
* {@link org.apache.camel.Exchange} to be send. This can be used to
* deep-clone messages that should be send, or any custom logic needed
* before the exchange is send.
*
* @param onPrepare the processor
* @return the builder
*/ | Uses the <code>Processor</code> when preparing the <code>org.apache.camel.Exchange</code> to be send. This can be used to deep-clone messages that should be send, or any custom logic needed before the exchange is send | onPrepare | {
"repo_name": "ullgren/camel",
"path": "core/camel-core-engine/src/main/java/org/apache/camel/model/SplitDefinition.java",
"license": "apache-2.0",
"size": 27474
} | [
"org.apache.camel.Processor"
] | import org.apache.camel.Processor; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 387,441 |
@Test
public void testFindByClusterAndHost() {
Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host1").size());
Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host2").size());
Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host3").size());
addMoreVersions();
Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host1").size());
Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host2").size());
Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost("test_cluster1", "test_host3").size());
} | void function() { Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost(STR, STR).size()); Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost(STR, STR).size()); Assert.assertEquals(1, hostVersionDAO.findByClusterAndHost(STR, STR).size()); addMoreVersions(); Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost(STR, STR).size()); Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost(STR, STR).size()); Assert.assertEquals(3, hostVersionDAO.findByClusterAndHost(STR, STR).size()); } | /**
* Test the {@link HostVersionDAO#findByClusterAndHost(String, String)} method.
*/ | Test the <code>HostVersionDAO#findByClusterAndHost(String, String)</code> method | testFindByClusterAndHost | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java",
"license": "apache-2.0",
"size": 16690
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,664,612 |
void onAnnotated(List<DataObject> containers, int count)
{
Browser browser = model.getSelectedBrowser();
if (containers != null && containers.size() > 0) {
NodesFinder finder = new NodesFinder(containers);
if (browser != null) browser.accept(finder);
Set<TreeImageDisplay> nodes = finder.getNodes();
//mark
if (browser != null && nodes != null && nodes.size() > 0) {
Iterator<TreeImageDisplay> i = nodes.iterator();
while (i.hasNext()) {
i.next().setAnnotationCount(count);
}
browser.getUI().repaint();
}
}
}
| void onAnnotated(List<DataObject> containers, int count) { Browser browser = model.getSelectedBrowser(); if (containers != null && containers.size() > 0) { NodesFinder finder = new NodesFinder(containers); if (browser != null) browser.accept(finder); Set<TreeImageDisplay> nodes = finder.getNodes(); if (browser != null && nodes != null && nodes.size() > 0) { Iterator<TreeImageDisplay> i = nodes.iterator(); while (i.hasNext()) { i.next().setAnnotationCount(count); } browser.getUI().repaint(); } } } | /**
* Notifies the model that the user has annotated data.
*
* @param containers The objects to handle.
* @param count A positive value if annotations are added, a negative value
* if annotations are removed.
*/ | Notifies the model that the user has annotated data | onAnnotated | {
"repo_name": "jballanc/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java",
"license": "gpl-2.0",
"size": 155452
} | [
"java.util.Iterator",
"java.util.List",
"java.util.Set",
"org.openmicroscopy.shoola.agents.treeviewer.browser.Browser",
"org.openmicroscopy.shoola.agents.util.browser.NodesFinder",
"org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay"
] | import java.util.Iterator; import java.util.List; import java.util.Set; import org.openmicroscopy.shoola.agents.treeviewer.browser.Browser; import org.openmicroscopy.shoola.agents.util.browser.NodesFinder; import org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay; | import java.util.*; import org.openmicroscopy.shoola.agents.treeviewer.browser.*; import org.openmicroscopy.shoola.agents.util.browser.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 702,665 |
private StringBuffer byteArrayToString(Charset charset, byte[] minified)
throws IOException {
// Write the data into a string
ReadableByteChannel chan = Channels.newChannel(new ByteArrayInputStream(minified));
Reader rd = Channels.newReader(chan,charset.newDecoder(),-1);
StringWriter writer = new StringWriter();
IOUtils.copy(rd, writer, true);
return writer.getBuffer();
} | StringBuffer function(Charset charset, byte[] minified) throws IOException { ReadableByteChannel chan = Channels.newChannel(new ByteArrayInputStream(minified)); Reader rd = Channels.newReader(chan,charset.newDecoder(),-1); StringWriter writer = new StringWriter(); IOUtils.copy(rd, writer, true); return writer.getBuffer(); } | /**
* Convert a byte array to a String buffer taking into account the charset
* @param charset the charset
* @param minified the byte array
* @return the string buffer
* @throws IOException if an IO exception occurs
*/ | Convert a byte array to a String buffer taking into account the charset | byteArrayToString | {
"repo_name": "diorcety/jawr",
"path": "jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java",
"license": "apache-2.0",
"size": 6032
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.io.Reader",
"java.io.StringWriter",
"java.nio.channels.Channels",
"java.nio.channels.ReadableByteChannel",
"java.nio.charset.Charset",
"net.jawr.web.resource.bundle.IOUtils"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.Reader; import java.io.StringWriter; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.charset.Charset; import net.jawr.web.resource.bundle.IOUtils; | import java.io.*; import java.nio.channels.*; import java.nio.charset.*; import net.jawr.web.resource.bundle.*; | [
"java.io",
"java.nio",
"net.jawr.web"
] | java.io; java.nio; net.jawr.web; | 1,774,474 |
Zhang99ParamAll param = GenericCalibrationGrid.createStandardParam(false, 2, true, 3, rand);
double array[] = new double[ param.numParameters() ];
param.convertToParam(array);
List<Point2D_F64> gridPts = GenericCalibrationGrid.standardLayout();
List<List<Point2D_F64>> observations = new ArrayList<List<Point2D_F64>>();
for( int i = 0; i < param.views.length; i++ ) {
observations.add( estimate(param,param.views[i],gridPts));
}
Zhang99OptimizationFunction alg =
new Zhang99OptimizationFunction( new Zhang99ParamAll(false,2,true,3),gridPts,observations );
double residuals[] = new double[ alg.getNumOfOutputsM()];
for( int i = 0; i < residuals.length; i++ )
residuals[i] = 1;
alg.process(array,residuals);
for( double r : residuals ) {
assertEquals(0,r,1e-8);
}
}
| Zhang99ParamAll param = GenericCalibrationGrid.createStandardParam(false, 2, true, 3, rand); double array[] = new double[ param.numParameters() ]; param.convertToParam(array); List<Point2D_F64> gridPts = GenericCalibrationGrid.standardLayout(); List<List<Point2D_F64>> observations = new ArrayList<List<Point2D_F64>>(); for( int i = 0; i < param.views.length; i++ ) { observations.add( estimate(param,param.views[i],gridPts)); } Zhang99OptimizationFunction alg = new Zhang99OptimizationFunction( new Zhang99ParamAll(false,2,true,3),gridPts,observations ); double residuals[] = new double[ alg.getNumOfOutputsM()]; for( int i = 0; i < residuals.length; i++ ) residuals[i] = 1; alg.process(array,residuals); for( double r : residuals ) { assertEquals(0,r,1e-8); } } | /**
* Give it perfect observations and see if the residuals are all zero
*/ | Give it perfect observations and see if the residuals are all zero | computeResidualsPerfect | {
"repo_name": "pacozaa/BoofCV",
"path": "main/calibration/test/boofcv/alg/geo/calibration/TestZhang99OptimizationFunction.java",
"license": "apache-2.0",
"size": 3271
} | [
"java.util.ArrayList",
"java.util.List",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.List; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 1,177,083 |
public BigDecimal getSizeX();
public static final String COLUMNNAME_SizeY = "SizeY"; | BigDecimal function(); public static final String COLUMNNAME_SizeY = "SizeY"; | /** Get Size X.
* X (horizontal) dimension size
*/ | Get Size X. X (horizontal) dimension size | getSizeX | {
"repo_name": "pplatek/adempiere",
"path": "base/src/org/compiere/model/I_AD_PrintPaper.java",
"license": "gpl-2.0",
"size": 7598
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 87,115 |
default void setTimeout(long timeout, @Nonnull TimeUnit timeUnit) {
setTimeout(timeUnit.toMillis(timeout));
} | default void setTimeout(long timeout, @Nonnull TimeUnit timeUnit) { setTimeout(timeUnit.toMillis(timeout)); } | /**
* Set PingPong group timeout
*
* @param timeout timeout
* @param timeUnit timeout time unit(>= {@link TimeUnit#MILLISECONDS})
*/ | Set PingPong group timeout | setTimeout | {
"repo_name": "alesharik/AlesharikWebServer",
"path": "api/src/com/alesharik/webserver/api/utils/ping/PingPong.java",
"license": "gpl-3.0",
"size": 1836
} | [
"java.util.concurrent.TimeUnit",
"javax.annotation.Nonnull"
] | import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; | import java.util.concurrent.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 969,638 |
@Override
public ZajavkiOtPostavwikov remove(Serializable primaryKey)
throws NoSuchZajavkiOtPostavwikovException {
Session session = null;
try {
session = openSession();
ZajavkiOtPostavwikov zajavkiOtPostavwikov = (ZajavkiOtPostavwikov)session.get(ZajavkiOtPostavwikovImpl.class,
primaryKey);
if (zajavkiOtPostavwikov == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchZajavkiOtPostavwikovException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(zajavkiOtPostavwikov);
}
catch (NoSuchZajavkiOtPostavwikovException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} | ZajavkiOtPostavwikov function(Serializable primaryKey) throws NoSuchZajavkiOtPostavwikovException { Session session = null; try { session = openSession(); ZajavkiOtPostavwikov zajavkiOtPostavwikov = (ZajavkiOtPostavwikov)session.get(ZajavkiOtPostavwikovImpl.class, primaryKey); if (zajavkiOtPostavwikov == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchZajavkiOtPostavwikovException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(zajavkiOtPostavwikov); } catch (NoSuchZajavkiOtPostavwikovException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } | /**
* Removes the zajavki ot postavwikov with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param primaryKey the primary key of the zajavki ot postavwikov
* @return the zajavki ot postavwikov that was removed
* @throws NoSuchZajavkiOtPostavwikovException if a zajavki ot postavwikov with the primary key could not be found
*/ | Removes the zajavki ot postavwikov with the primary key from the database. Also notifies the appropriate model listeners | remove | {
"repo_name": "falko0000/moduleEProc",
"path": "ZajavkiOtPostavwikov/ZajavkiOtPostavwikov-service/src/main/java/tj/zajavki/ot/postavwikov/service/persistence/impl/ZajavkiOtPostavwikovPersistenceImpl.java",
"license": "lgpl-2.1",
"size": 94832
} | [
"com.liferay.portal.kernel.dao.orm.Session",
"java.io.Serializable"
] | import com.liferay.portal.kernel.dao.orm.Session; import java.io.Serializable; | import com.liferay.portal.kernel.dao.orm.*; import java.io.*; | [
"com.liferay.portal",
"java.io"
] | com.liferay.portal; java.io; | 19,226 |
protected void doCheckinConfirm(final boolean closeAfter) {
final CheckinPopup pop = new CheckinPopup( constants.CheckInChanges() );
pop.setCommand( new Command() { | void function(final boolean closeAfter) { final CheckinPopup pop = new CheckinPopup( constants.CheckInChanges() ); pop.setCommand( new Command() { | /**
* Called when user wants to checkin. set closeAfter to true if it should
* close this whole thing after saving it.
*/ | Called when user wants to checkin. set closeAfter to true if it should close this whole thing after saving it | doCheckinConfirm | {
"repo_name": "Rikkola/guvnor",
"path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/ruleeditor/RuleViewer.java",
"license": "apache-2.0",
"size": 29272
} | [
"com.google.gwt.user.client.Command"
] | import com.google.gwt.user.client.Command; | import com.google.gwt.user.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,417,270 |
private void initEmbeddedDb() throws DatabaseConfigException {
String db = _odeConfig.getDbEmbeddedName();
String url = "jdbc:derby:" + _workRoot + "/" + db ;
__log.info("Using Embedded Derby: " + url);
_derbyUrl = url;
initInternalDb(url, org.apache.derby.jdbc.EmbeddedDriver.class.getName(),"sa",null);
} | void function() throws DatabaseConfigException { String db = _odeConfig.getDbEmbeddedName(); String url = STR + _workRoot + "/" + db ; __log.info(STR + url); _derbyUrl = url; initInternalDb(url, org.apache.derby.jdbc.EmbeddedDriver.class.getName(),"sa",null); } | /**
* Initialize embedded (DERBY) database.
*/ | Initialize embedded (DERBY) database | initEmbeddedDb | {
"repo_name": "dinkelaker/hbs4ode",
"path": "bpel-epr/src/main/java/org/apache/ode/il/dbutil/Database.java",
"license": "apache-2.0",
"size": 9966
} | [
"org.apache.derby.jdbc.EmbeddedDriver"
] | import org.apache.derby.jdbc.EmbeddedDriver; | import org.apache.derby.jdbc.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,206,589 |
public static void deleteRecursively(Path path) throws IOException {
try {
MoreFiles.deleteRecursively(path);
} catch (InsecureRecursiveDeleteException ignore) {
logger.atWarning().log("Secure delete not supported. Deleting '%s' insecurely.", path);
MoreFiles.deleteRecursively(path, RecursiveDeleteOption.ALLOW_INSECURE);
}
} | static void function(Path path) throws IOException { try { MoreFiles.deleteRecursively(path); } catch (InsecureRecursiveDeleteException ignore) { logger.atWarning().log(STR, path); MoreFiles.deleteRecursively(path, RecursiveDeleteOption.ALLOW_INSECURE); } } | /**
* Delete all the contents of a path recursively.
*
* <p>First we try to delete securely. In case the FileSystem doesn't support it,
* delete it insecurely.
*/ | Delete all the contents of a path recursively. First we try to delete securely. In case the FileSystem doesn't support it, delete it insecurely | deleteRecursively | {
"repo_name": "google/copybara",
"path": "java/com/google/copybara/util/FileUtil.java",
"license": "apache-2.0",
"size": 18631
} | [
"com.google.common.io.InsecureRecursiveDeleteException",
"com.google.common.io.MoreFiles",
"com.google.common.io.RecursiveDeleteOption",
"java.io.IOException",
"java.nio.file.Path"
] | import com.google.common.io.InsecureRecursiveDeleteException; import com.google.common.io.MoreFiles; import com.google.common.io.RecursiveDeleteOption; import java.io.IOException; import java.nio.file.Path; | import com.google.common.io.*; import java.io.*; import java.nio.file.*; | [
"com.google.common",
"java.io",
"java.nio"
] | com.google.common; java.io; java.nio; | 1,363,858 |
public SubsequenceStrategyBuilder subsequence(InputTypeStrategy inputTypeStrategy) {
Preconditions.checkArgument(
inputTypeStrategy.getArgumentCount() instanceof ConstantArgumentCount);
Optional<Integer> maxCount = inputTypeStrategy.getArgumentCount().getMaxCount();
Optional<Integer> minCount = inputTypeStrategy.getArgumentCount().getMinCount();
if (!maxCount.isPresent()
|| !minCount.isPresent()
|| !maxCount.get().equals(minCount.get())) {
throw new IllegalArgumentException(
"Both the minimum and maximum number of expected arguments must"
+ " be defined and equal to each other.");
}
argumentsSplits.add(
new ArgumentsSplit(currentPos, currentPos + maxCount.get(), inputTypeStrategy));
currentPos += maxCount.get();
return this;
} | SubsequenceStrategyBuilder function(InputTypeStrategy inputTypeStrategy) { Preconditions.checkArgument( inputTypeStrategy.getArgumentCount() instanceof ConstantArgumentCount); Optional<Integer> maxCount = inputTypeStrategy.getArgumentCount().getMaxCount(); Optional<Integer> minCount = inputTypeStrategy.getArgumentCount().getMinCount(); if (!maxCount.isPresent() !minCount.isPresent() !maxCount.get().equals(minCount.get())) { throw new IllegalArgumentException( STR + STR); } argumentsSplits.add( new ArgumentsSplit(currentPos, currentPos + maxCount.get(), inputTypeStrategy)); currentPos += maxCount.get(); return this; } | /**
* Defines a common {@link InputTypeStrategy} for the next arguments. Given input strategy
* must expect a constant number of arguments. That means that both the minimum and maximum
* number of arguments must be defined and equal to each other.
*
* <p>If you need a varying logic use {@link #finishWithVarying(InputTypeStrategy)}.
*/ | Defines a common <code>InputTypeStrategy</code> for the next arguments. Given input strategy must expect a constant number of arguments. That means that both the minimum and maximum number of arguments must be defined and equal to each other. If you need a varying logic use <code>#finishWithVarying(InputTypeStrategy)</code> | subsequence | {
"repo_name": "aljoscha/flink",
"path": "flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/SubsequenceInputTypeStrategy.java",
"license": "apache-2.0",
"size": 11105
} | [
"java.util.Optional",
"org.apache.flink.table.types.inference.ConstantArgumentCount",
"org.apache.flink.table.types.inference.InputTypeStrategy",
"org.apache.flink.util.Preconditions"
] | import java.util.Optional; import org.apache.flink.table.types.inference.ConstantArgumentCount; import org.apache.flink.table.types.inference.InputTypeStrategy; import org.apache.flink.util.Preconditions; | import java.util.*; import org.apache.flink.table.types.inference.*; import org.apache.flink.util.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 1,023,802 |
private void handleBrowse() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
"Select new file container");
if (dialog.open() == ContainerSelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
containerSourceText.setText(((Path) result[0]).toString());
}
}
} | void function() { ContainerSelectionDialog dialog = new ContainerSelectionDialog( getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, STR); if (dialog.open() == ContainerSelectionDialog.OK) { Object[] result = dialog.getResult(); if (result.length == 1) { containerSourceText.setText(((Path) result[0]).toString()); } } } | /**
* Uses the standard container selection dialog to choose the new value for
* the container field.
*/ | Uses the standard container selection dialog to choose the new value for the container field | handleBrowse | {
"repo_name": "VisuFlow/visuflow-plugin",
"path": "src/de/unipaderborn/visuflow/debug/handlers/TargetHandlerDialog.java",
"license": "apache-2.0",
"size": 8899
} | [
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.Path",
"org.eclipse.ui.dialogs.ContainerSelectionDialog"
] | import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.ui.dialogs.ContainerSelectionDialog; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.ui.dialogs.*; | [
"org.eclipse.core",
"org.eclipse.ui"
] | org.eclipse.core; org.eclipse.ui; | 2,076,620 |
private void reportStatus(int status, int win32ExitCode, int waitHint) {
SERVICE_STATUS serviceStatus = new SERVICE_STATUS();
serviceStatus.dwServiceType = WinNT.SERVICE_WIN32_OWN_PROCESS;
serviceStatus.dwControlsAccepted = Winsvc.SERVICE_ACCEPT_STOP | Winsvc.SERVICE_ACCEPT_SHUTDOWN;
serviceStatus.dwWin32ExitCode = win32ExitCode;
serviceStatus.dwWaitHint = waitHint;
serviceStatus.dwCurrentState = status;
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
} | void function(int status, int win32ExitCode, int waitHint) { SERVICE_STATUS serviceStatus = new SERVICE_STATUS(); serviceStatus.dwServiceType = WinNT.SERVICE_WIN32_OWN_PROCESS; serviceStatus.dwControlsAccepted = Winsvc.SERVICE_ACCEPT_STOP Winsvc.SERVICE_ACCEPT_SHUTDOWN; serviceStatus.dwWin32ExitCode = win32ExitCode; serviceStatus.dwWaitHint = waitHint; serviceStatus.dwCurrentState = status; advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus); } | /**
* Report service status to the ServiceControlManager.
*
* @param status status
* @param win32ExitCode exit code
* @param waitHint time to wait
*/ | Report service status to the ServiceControlManager | reportStatus | {
"repo_name": "trejkaz/jna",
"path": "contrib/ntservice/src/jnacontrib/win32/Win32Service.java",
"license": "lgpl-2.1",
"size": 10607
} | [
"com.sun.jna.platform.win32.WinNT",
"com.sun.jna.platform.win32.Winsvc"
] | import com.sun.jna.platform.win32.WinNT; import com.sun.jna.platform.win32.Winsvc; | import com.sun.jna.platform.win32.*; | [
"com.sun.jna"
] | com.sun.jna; | 2,273,239 |
public final Collection<Integer> getAnimalsAtLocationInState(final String location, final String state) {
final Collection<Integer> agentsAtLocation = new ArrayList<>();
for (SIRAgent agent : agents) {
if (agent.getCurrentLocation().equals(location) && agent.getState().equals(state)) {
agentsAtLocation.add(Integer.parseInt(agent.getId()));
}
}
return agentsAtLocation;
} | final Collection<Integer> function(final String location, final String state) { final Collection<Integer> agentsAtLocation = new ArrayList<>(); for (SIRAgent agent : agents) { if (agent.getCurrentLocation().equals(location) && agent.getState().equals(state)) { agentsAtLocation.add(Integer.parseInt(agent.getId())); } } return agentsAtLocation; } | /**
* Get a list of animals at a specified location in a given state
*
* @param location The location of interest
* @param state The disease state of interest
* @return A collection of animals at the location given in a specified
* state
*/ | Get a list of animals at a specified location in a given state | getAnimalsAtLocationInState | {
"repo_name": "EPICScotland/BroadwickTutorial",
"path": "StochasticSIR/src/main/java/gla/ac/uk/sir/StochasticSIRAmountManager.java",
"license": "apache-2.0",
"size": 14990
} | [
"java.util.ArrayList",
"java.util.Collection"
] | import java.util.ArrayList; import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,134,631 |
public void setLegendLine(Shape line) {
if (line == null) {
throw new IllegalArgumentException("Null 'line' argument.");
}
this.legendLine = line;
notifyListeners(new RendererChangeEvent(this));
}
// SHAPES VISIBLE | void function(Shape line) { if (line == null) { throw new IllegalArgumentException(STR); } this.legendLine = line; notifyListeners(new RendererChangeEvent(this)); } | /**
* Sets the shape used as a line in each legend item and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param line the line (<code>null</code> not permitted).
*
* @see #getLegendLine()
*/ | Sets the shape used as a line in each legend item and sends a <code>RendererChangeEvent</code> to all registered listeners | setLegendLine | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/jfreechart-1.0.5/source/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java",
"license": "lgpl-3.0",
"size": 44950
} | [
"java.awt.Shape",
"org.jfree.chart.event.RendererChangeEvent"
] | import java.awt.Shape; import org.jfree.chart.event.RendererChangeEvent; | import java.awt.*; import org.jfree.chart.event.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 501,316 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.