method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private void unwrapResponse(State state) { if (state.wrapResponse == null) return; if (state.outerRequest.isAsyncStarted()) { if (!state.outerRequest.getAsyncContext().hasOriginalRequestAndResponse()) { return; } } ServletResponse previous = null; ServletResponse current = state.outerResponse; while (current != null) { // If we run into the container response we are done if ((current instanceof Response) || (current instanceof ResponseFacade)) break; // Remove the current response if it is our wrapper if (current == state.wrapResponse) { ServletResponse next = ((ServletResponseWrapper) current).getResponse(); if (previous == null) state.outerResponse = next; else ((ServletResponseWrapper) previous).setResponse(next); break; } // Advance to the next response in the chain previous = current; current = ((ServletResponseWrapper) current).getResponse(); } }
void function(State state) { if (state.wrapResponse == null) return; if (state.outerRequest.isAsyncStarted()) { if (!state.outerRequest.getAsyncContext().hasOriginalRequestAndResponse()) { return; } } ServletResponse previous = null; ServletResponse current = state.outerResponse; while (current != null) { if ((current instanceof Response) (current instanceof ResponseFacade)) break; if (current == state.wrapResponse) { ServletResponse next = ((ServletResponseWrapper) current).getResponse(); if (previous == null) state.outerResponse = next; else ((ServletResponseWrapper) previous).setResponse(next); break; } previous = current; current = ((ServletResponseWrapper) current).getResponse(); } }
/** * Unwrap the response if we have wrapped it. */
Unwrap the response if we have wrapped it
unwrapResponse
{ "repo_name": "IAMTJW/Tomcat-8.5.20", "path": "tomcat-8.5.20/java/org/apache/catalina/core/ApplicationDispatcher.java", "license": "apache-2.0", "size": 40681 }
[ "javax.servlet.ServletResponse", "javax.servlet.ServletResponseWrapper", "org.apache.catalina.connector.Response", "org.apache.catalina.connector.ResponseFacade" ]
import javax.servlet.ServletResponse; import javax.servlet.ServletResponseWrapper; import org.apache.catalina.connector.Response; import org.apache.catalina.connector.ResponseFacade;
import javax.servlet.*; import org.apache.catalina.connector.*;
[ "javax.servlet", "org.apache.catalina" ]
javax.servlet; org.apache.catalina;
808,103
@RetrySemantics.ReadOnly public GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInfo( GetLatestCommittedCompactionInfoRequest rqst) throws MetaException { GetLatestCommittedCompactionInfoResponse response = new GetLatestCommittedCompactionInfoResponse(new ArrayList<>()); Connection dbConn = null; PreparedStatement pst = null; ResultSet rs = null; try { try { dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); List<String> params = new ArrayList<>(); // This query combines the result sets of SUCCEEDED compactions and READY_FOR_CLEANING compactions // We also sort the result by CC_ID in descending order so that we can keep only the latest record // according to the order in result set StringBuilder sb = new StringBuilder() .append("SELECT * FROM (") .append(" SELECT") .append(" \"CC_ID\", \"CC_DATABASE\", \"CC_TABLE\", \"CC_PARTITION\", \"CC_TYPE\"") .append(" FROM \"COMPLETED_COMPACTIONS\"") .append(" WHERE \"CC_STATE\" = " + quoteChar(SUCCEEDED_STATE)) .append(" UNION ALL") .append(" SELECT") .append(" \"CQ_ID\" AS \"CC_ID\", \"CQ_DATABASE\" AS \"CC_DATABASE\"") .append(" ,\"CQ_TABLE\" AS \"CC_TABLE\", \"CQ_PARTITION\" AS \"CC_PARTITION\"") .append(" ,\"CQ_TYPE\" AS \"CC_TYPE\"") .append(" FROM \"COMPACTION_QUEUE\"") .append(" WHERE \"CQ_STATE\" = " + quoteChar(READY_FOR_CLEANING)) .append(") AS compactions ") .append(" WHERE \"CC_DATABASE\" = ? AND \"CC_TABLE\" = ?"); params.add(rqst.getDbname()); params.add(rqst.getTablename()); if (rqst.getPartitionnamesSize() > 0) { sb.append(" AND \"CC_PARTITION\" IN ("); sb.append(String.join(",", Collections.nCopies(rqst.getPartitionnamesSize(), "?"))); sb.append(")"); params.addAll(rqst.getPartitionnames()); } if (rqst.isSetLastCompactionId()) { sb.append(" AND \"CC_ID\" > ?"); params.add(String.valueOf(rqst.getLastCompactionId())); } sb.append(" ORDER BY \"CC_ID\" DESC"); pst = sqlGenerator.prepareStmtWithParameters(dbConn, sb.toString(), params); LOG.debug("Going to execute query <" + sb.toString() + ">"); rs = pst.executeQuery(); Set<String> partitionSet = new HashSet<>(); while (rs.next()) { CompactionInfoStruct lci = new CompactionInfoStruct(); lci.setId(rs.getLong(1)); lci.setDbname(rs.getString(2)); lci.setTablename(rs.getString(3)); String partition = rs.getString(4); if (!rs.wasNull()) { lci.setPartitionname(partition); } lci.setType(dbCompactionType2ThriftType(rs.getString(5).charAt(0))); // Only put the latest record of each partition into response if (!partitionSet.contains(partition)) { response.addToCompactions(lci); partitionSet.add(partition); } } } catch (SQLException e) { LOG.error("Unable to execute query " + e.getMessage()); checkRetryable(e, "getLatestCommittedCompactionInfo"); } finally { close(rs, pst, dbConn); } return response; } catch (RetryException e) { return getLatestCommittedCompactionInfo(rqst); } }
@RetrySemantics.ReadOnly GetLatestCommittedCompactionInfoResponse function( GetLatestCommittedCompactionInfoRequest rqst) throws MetaException { GetLatestCommittedCompactionInfoResponse response = new GetLatestCommittedCompactionInfoResponse(new ArrayList<>()); Connection dbConn = null; PreparedStatement pst = null; ResultSet rs = null; try { try { dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); List<String> params = new ArrayList<>(); StringBuilder sb = new StringBuilder() .append(STR) .append(STR) .append(STRCC_ID\STRCC_DATABASE\STRCC_TABLE\STRCC_PARTITION\STRCC_TYPE\STR FROM \"COMPLETED_COMPACTIONS\STR WHERE \STR = STR UNION ALL") .append(STR) .append(STRCQ_ID\" AS \"CC_ID\STRCQ_DATABASE\" AS \"CC_DATABASE\STR ,\STR AS \"CC_TABLE\STRCQ_PARTITION\" AS \"CC_PARTITION\STR ,\STR AS \"CC_TYPE\STR FROM \"COMPACTION_QUEUE\STR WHERE \STR = STR) AS compactions STR WHERE \STR = ? AND \STR = ?STR AND \STR IN (STR,STR?STR)STR AND \STR > ?STR ORDER BY \STR DESCSTRGoing to execute query <STR>STRUnable to execute query STRgetLatestCommittedCompactionInfo"); } finally { close(rs, pst, dbConn); } return response; } catch (RetryException e) { return getLatestCommittedCompactionInfo(rqst); } }
/** * We assume this is only called by metadata cache server to know if there are new base/delta files should be read. * The query filters compactions by state and only returns SUCCEEDED or READY_FOR_CLEANING compactions because * only these two states means there are new files ready to be read. */
We assume this is only called by metadata cache server to know if there are new base/delta files should be read. The query filters compactions by state and only returns SUCCEEDED or READY_FOR_CLEANING compactions because only these two states means there are new files ready to be read
getLatestCommittedCompactionInfo
{ "repo_name": "sankarh/hive", "path": "standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java", "license": "apache-2.0", "size": 278625 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hive.common.classification.RetrySemantics", "org.apache.hadoop.hive.metastore.api.GetLatestCommittedCompactionInfoRequest", "org.apache.hadoop.hive.metastore.api.GetLatestCommittedCompactionInfoResponse", "org.apache.hadoop.hive.metastore.api.MetaException" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hive.common.classification.RetrySemantics; import org.apache.hadoop.hive.metastore.api.GetLatestCommittedCompactionInfoRequest; import org.apache.hadoop.hive.metastore.api.GetLatestCommittedCompactionInfoResponse; import org.apache.hadoop.hive.metastore.api.MetaException;
import java.sql.*; import java.util.*; import org.apache.hadoop.hive.common.classification.*; import org.apache.hadoop.hive.metastore.api.*;
[ "java.sql", "java.util", "org.apache.hadoop" ]
java.sql; java.util; org.apache.hadoop;
1,765,997
QueryResult queryResult ; TupleQueryResult results = null ; try { queryResult = anzo.getModelService().executeQuery(allNamedGraphs, EMPTY_SET, query) ; results = queryResult.getSelectResult() ; } catch (Exception e) { throw new QueryExecutionException("Error obtaining query result from Anzo.", e) ; } try { while (results.hasNext()) { handler.handleBindings(new BindingSetAdapter(results.next())) ; } } catch (Exception e) { throw new QueryExecutionException("Error iterating result bindings.", e) ; } finally { if (results != null) { try { results.close() ; } catch (Exception e) { logger.warn("Exception while closing query results: {}", e.getMessage()) ; } } } }
QueryResult queryResult ; TupleQueryResult results = null ; try { queryResult = anzo.getModelService().executeQuery(allNamedGraphs, EMPTY_SET, query) ; results = queryResult.getSelectResult() ; } catch (Exception e) { throw new QueryExecutionException(STR, e) ; } try { while (results.hasNext()) { handler.handleBindings(new BindingSetAdapter(results.next())) ; } } catch (Exception e) { throw new QueryExecutionException(STR, e) ; } finally { if (results != null) { try { results.close() ; } catch (Exception e) { logger.warn(STR, e.getMessage()) ; } } } }
/** * This method will execute the passed in select query against all named graphs in * Anzo and calls the passed in BindingsHandler with each result binding. * @param query The query to execute * @param handler Handler for results * @throws QueryExecutionException On any error during query execution/result iteration */
This method will execute the passed in select query against all named graphs in Anzo and calls the passed in BindingsHandler with each result binding
executeQuery
{ "repo_name": "NCIP/digital-model-repository", "path": "dmr-core/src/org/cvit/cabig/dmr/anzo/Anzo.java", "license": "bsd-3-clause", "size": 8331 }
[ "com.infotechsoft.rdf.mapping.QueryExecutionException", "com.infotechsoft.rdf.sesame.BindingSetAdapter" ]
import com.infotechsoft.rdf.mapping.QueryExecutionException; import com.infotechsoft.rdf.sesame.BindingSetAdapter;
import com.infotechsoft.rdf.mapping.*; import com.infotechsoft.rdf.sesame.*;
[ "com.infotechsoft.rdf" ]
com.infotechsoft.rdf;
1,170,684
public RelNode peek(int inputCount, int inputOrdinal) { return peek_(inputCount, inputOrdinal).rel; }
RelNode function(int inputCount, int inputOrdinal) { return peek_(inputCount, inputOrdinal).rel; }
/** Returns the relational expression {@code n} positions from the top of the * stack, but does not remove it. */
Returns the relational expression n positions from the top of the
peek
{ "repo_name": "sreev/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/tools/RelBuilder.java", "license": "apache-2.0", "size": 64409 }
[ "org.apache.calcite.rel.RelNode" ]
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.*;
[ "org.apache.calcite" ]
org.apache.calcite;
387,097
private static void extractAssets(ContextWrapper context, boolean worldReadable, boolean replaceIfNewer) { try { Runtime runtime = Runtime.getRuntime(); String appRoot = getAppRoot(context); File zipFile = new File(context.getPackageCodePath()); long zipLastModified = zipFile.lastModified(); ZipFile zip = new ZipFile(context.getPackageCodePath()); Vector<ZipEntry> files = osvrFilesFromZip(zip); int zipFilterLength = ZIP_FILTER.length(); Enumeration entries = files.elements(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); String path = entry.getName().substring(zipFilterLength); File outputFile = new File(appRoot, path); outputFile.getParentFile().mkdirs(); if (outputFile.exists() && (!replaceIfNewer || (entry.getSize() == outputFile.length() && zipLastModified < outputFile.lastModified()))) { Log(outputFile.getName() + " already extracted."); } else { FileOutputStream fos = new FileOutputStream(outputFile); Log("Copied " + entry + " to " + appRoot + "/" + path); copyStreams(zip.getInputStream(entry), fos); String curPath = outputFile.getAbsolutePath(); if (worldReadable) { do { runtime.exec("chmod 755 " + curPath); curPath = new File(curPath).getParent(); } while (!curPath.equals(appRoot)); } } } } catch (IOException e) { Log("Error: " + e.getMessage()); } }
static void function(ContextWrapper context, boolean worldReadable, boolean replaceIfNewer) { try { Runtime runtime = Runtime.getRuntime(); String appRoot = getAppRoot(context); File zipFile = new File(context.getPackageCodePath()); long zipLastModified = zipFile.lastModified(); ZipFile zip = new ZipFile(context.getPackageCodePath()); Vector<ZipEntry> files = osvrFilesFromZip(zip); int zipFilterLength = ZIP_FILTER.length(); Enumeration entries = files.elements(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); String path = entry.getName().substring(zipFilterLength); File outputFile = new File(appRoot, path); outputFile.getParentFile().mkdirs(); if (outputFile.exists() && (!replaceIfNewer (entry.getSize() == outputFile.length() && zipLastModified < outputFile.lastModified()))) { Log(outputFile.getName() + STR); } else { FileOutputStream fos = new FileOutputStream(outputFile); Log(STR + entry + STR + appRoot + "/" + path); copyStreams(zip.getInputStream(entry), fos); String curPath = outputFile.getAbsolutePath(); if (worldReadable) { do { runtime.exec(STR + curPath); curPath = new File(curPath).getParent(); } while (!curPath.equals(appRoot)); } } } } catch (IOException e) { Log(STR + e.getMessage()); } }
/** * Extract assets from the apk zip file to the installed app directory. * Copies plugins, the config file, and displays. * @param context Typically an Activity instance. * @param worldReadable deprecated. Always use false. */
Extract assets from the apk zip file to the installed app directory. Copies plugins, the config file, and displays
extractAssets
{ "repo_name": "OSVR/OSVR-Android-Samples", "path": "OSVROpenGL/osvrcommon/src/main/java/com/osvr/common/util/OSVRFileExtractor.java", "license": "apache-2.0", "size": 6298 }
[ "android.content.ContextWrapper", "android.util.Log", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.util.Enumeration", "java.util.Vector", "java.util.zip.ZipEntry", "java.util.zip.ZipFile" ]
import android.content.ContextWrapper; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Vector; import java.util.zip.ZipEntry; import java.util.zip.ZipFile;
import android.content.*; import android.util.*; import java.io.*; import java.util.*; import java.util.zip.*;
[ "android.content", "android.util", "java.io", "java.util" ]
android.content; android.util; java.io; java.util;
2,354,586
void loadIcon(ImageView imageView, boolean grayOut);
void loadIcon(ImageView imageView, boolean grayOut);
/** * Load this resolver's icon into the given ImageView */
Load this resolver's icon into the given ImageView
loadIcon
{ "repo_name": "ajju4455/tomahawk-android", "path": "src/org/tomahawk/libtomahawk/resolver/Resolver.java", "license": "gpl-3.0", "size": 2174 }
[ "android.widget.ImageView" ]
import android.widget.ImageView;
import android.widget.*;
[ "android.widget" ]
android.widget;
1,263,718
private HRegionInfo[] cloneHdfsRegions(final List<HRegionInfo> regions) throws IOException { if (regions == null || regions.size() == 0) return null; final Map<String, HRegionInfo> snapshotRegions = new HashMap<String, HRegionInfo>(regions.size()); // clone region info (change embedded tableName with the new one) HRegionInfo[] clonedRegionsInfo = new HRegionInfo[regions.size()]; for (int i = 0; i < clonedRegionsInfo.length; ++i) { // clone the region info from the snapshot region info HRegionInfo snapshotRegionInfo = regions.get(i); clonedRegionsInfo[i] = cloneRegionInfo(snapshotRegionInfo); // add the region name mapping between snapshot and cloned String snapshotRegionName = snapshotRegionInfo.getEncodedName(); String clonedRegionName = clonedRegionsInfo[i].getEncodedName(); regionsMap.put(Bytes.toBytes(snapshotRegionName), Bytes.toBytes(clonedRegionName)); LOG.info("clone region=" + snapshotRegionName + " as " + clonedRegionName); // Add mapping between cloned region name and snapshot region info snapshotRegions.put(clonedRegionName, snapshotRegionInfo); }
HRegionInfo[] function(final List<HRegionInfo> regions) throws IOException { if (regions == null regions.size() == 0) return null; final Map<String, HRegionInfo> snapshotRegions = new HashMap<String, HRegionInfo>(regions.size()); HRegionInfo[] clonedRegionsInfo = new HRegionInfo[regions.size()]; for (int i = 0; i < clonedRegionsInfo.length; ++i) { HRegionInfo snapshotRegionInfo = regions.get(i); clonedRegionsInfo[i] = cloneRegionInfo(snapshotRegionInfo); String snapshotRegionName = snapshotRegionInfo.getEncodedName(); String clonedRegionName = clonedRegionsInfo[i].getEncodedName(); regionsMap.put(Bytes.toBytes(snapshotRegionName), Bytes.toBytes(clonedRegionName)); LOG.info(STR + snapshotRegionName + STR + clonedRegionName); snapshotRegions.put(clonedRegionName, snapshotRegionInfo); }
/** * Clone specified regions. For each region create a new region * and create a HFileLink for each hfile. */
Clone specified regions. For each region create a new region and create a HFileLink for each hfile
cloneHdfsRegions
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java", "license": "apache-2.0", "size": 26981 }
[ "java.io.IOException", "java.util.HashMap", "java.util.List", "java.util.Map", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,680,108
public final List < SimpleValue > getAttributes() { return this.attributes; }
final List < SimpleValue > function() { return this.attributes; }
/** * Getter for attributes. * * @return the attributes to get. */
Getter for attributes
getAttributes
{ "repo_name": "GIP-RECIA/esco-grouper-ui", "path": "metier/esco-core/src/main/java/org/esco/grouperui/domaine/beans/Subject.java", "license": "apache-2.0", "size": 6147 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,559,945
NoPutResultSet getLastIndexKeyResultSet ( Activation activation, int resultSetNumber, GeneratedMethod resultRowAllocator, long conglomId, String tableName, String userSuppliedOptimizerOverrides, String indexName, int colRefItem, int lockMode, boolean tableLocked, int isolationLevel, double optimizerEstimatedRowCount, double optimizerEstimatedCost ) throws StandardException; /** A Dependent table scan result set forms a result set on a scan of a dependent table for the rows that got materilized on the scan of its parent table and if the row being deleted on parent table has a reference in the dependent table. @param activation the activation for this result set, which provides the context for the row allocation operation. @param conglomId the conglomerate of the table to be scanned. @param scociItem The saved item for the static conglomerate info. @param resultRowAllocator a reference to a method in the activation that creates a holder for the result row of the scan. May be a partial row. <verbatim> ExecRow rowAllocator() throws StandardException; </verbatim> @param resultSetNumber The resultSetNumber for the ResultSet @param startKeyGetter a reference to a method in the activation that gets the start key indexable row for the scan. Null means there is no start key. <verbatim> ExecIndexRow startKeyGetter() throws StandardException; </verbatim> @param startSearchOperator The start search operator for opening the scan @param stopKeyGetter a reference to a method in the activation that gets the stop key indexable row for the scan. Null means there is no stop key. <verbatim> ExecIndexRow stopKeyGetter() throws StandardException; </verbatim> @param stopSearchOperator The stop search operator for opening the scan @param sameStartStopPosition Re-use the startKeyGetter for the stopKeyGetter (Exact match search.) @param qualifiers the array of Qualifiers for the scan. Null or an array length of zero means there are no qualifiers. @param tableName The full name of the table @param userSuppliedOptimizerOverrides Overrides specified by the user on the sql @param indexName The name of the index, if one used to access table. @param isConstraint If index, if used, is a backing index for a constraint. @param forUpdate True means open for update @param colRefItem An saved item for a bitSet of columns that are referenced in the underlying table. -1 if no item. @param lockMode The lock granularity to use (see TransactionController in access) @param tableLocked Whether or not the table is marked as using table locking (in sys.systables) @param isolationLevel Isolation level (specified or not) to use on scans @param oneRowScan Whether or not this is a 1 row scan. @param optimizerEstimatedRowCount Estimated total # of rows by optimizer @param optimizerEstimatedCost Estimated total cost by optimizer @param parentResultSetId Id to access the materlized temporary result set from the refence stored in the activation. @param fkIndexConglomId foreign key index conglomerate id. @param fkColArrayItem saved column array object that matches the foreign key index columns and the resultset from the parent table. @param rltItem row location template
NoPutResultSet getLastIndexKeyResultSet ( Activation activation, int resultSetNumber, GeneratedMethod resultRowAllocator, long conglomId, String tableName, String userSuppliedOptimizerOverrides, String indexName, int colRefItem, int lockMode, boolean tableLocked, int isolationLevel, double optimizerEstimatedRowCount, double optimizerEstimatedCost ) throws StandardException; /** A Dependent table scan result set forms a result set on a scan of a dependent table for the rows that got materilized on the scan of its parent table and if the row being deleted on parent table has a reference in the dependent table. @param activation the activation for this result set, which provides the context for the row allocation operation. @param conglomId the conglomerate of the table to be scanned. @param scociItem The saved item for the static conglomerate info. @param resultRowAllocator a reference to a method in the activation that creates a holder for the result row of the scan. May be a partial row. <verbatim> ExecRow rowAllocator() throws StandardException; </verbatim> @param resultSetNumber The resultSetNumber for the ResultSet @param startKeyGetter a reference to a method in the activation that gets the start key indexable row for the scan. Null means there is no start key. <verbatim> ExecIndexRow startKeyGetter() throws StandardException; </verbatim> @param startSearchOperator The start search operator for opening the scan @param stopKeyGetter a reference to a method in the activation that gets the stop key indexable row for the scan. Null means there is no stop key. <verbatim> ExecIndexRow stopKeyGetter() throws StandardException; </verbatim> @param stopSearchOperator The stop search operator for opening the scan @param sameStartStopPosition Re-use the startKeyGetter for the stopKeyGetter (Exact match search.) @param qualifiers the array of Qualifiers for the scan. Null or an array length of zero means there are no qualifiers. @param tableName The full name of the table @param userSuppliedOptimizerOverrides Overrides specified by the user on the sql @param indexName The name of the index, if one used to access table. @param isConstraint If index, if used, is a backing index for a constraint. @param forUpdate True means open for update @param colRefItem An saved item for a bitSet of columns that are referenced in the underlying table. -1 if no item. @param lockMode The lock granularity to use (see TransactionController in access) @param tableLocked Whether or not the table is marked as using table locking (in sys.systables) @param isolationLevel Isolation level (specified or not) to use on scans @param oneRowScan Whether or not this is a 1 row scan. @param optimizerEstimatedRowCount Estimated total # of rows by optimizer @param optimizerEstimatedCost Estimated total cost by optimizer @param parentResultSetId Id to access the materlized temporary result set from the refence stored in the activation. @param fkIndexConglomId foreign key index conglomerate id. @param fkColArrayItem saved column array object that matches the foreign key index columns and the resultset from the parent table. @param rltItem row location template
/** * A last index key result set returns the last row from * the index in question. It is used as an ajunct to max(). * * @param activation the activation for this result set, * which provides the context for the row allocation operation. * @param resultSetNumber The resultSetNumber for the ResultSet * @param resultRowAllocator a reference to a method in the activation * that creates a holder for the result row of the scan. May * be a partial row. <verbatim> * ExecRow rowAllocator() throws StandardException; </verbatim> * @param conglomId the conglomerate of the table to be scanned. * @param tableName The full name of the table * @param userSuppliedOptimizerOverrides Overrides specified by the user on the sql * @param indexName The name of the index, if one used to access table. * @param colRefItem An saved item for a bitSet of columns that * are referenced in the underlying table. -1 if * no item. * @param lockMode The lock granularity to use (see * TransactionController in access) * @param tableLocked Whether or not the table is marked as using table locking * (in sys.systables) * @param isolationLevel Isolation level (specified or not) to use on scans * @param optimizerEstimatedRowCount Estimated total # of rows by * optimizer * @param optimizerEstimatedCost Estimated total cost by optimizer * * @return the scan operation as a result set. * * @exception StandardException thrown when unable to create the * result set */
A last index key result set returns the last row from the index in question. It is used as an ajunct to max()
getLastIndexKeyResultSet
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java", "license": "apache-2.0", "size": 65629 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.services.loader.GeneratedMethod", "org.apache.derby.iapi.sql.Activation", "org.apache.derby.iapi.sql.ResultSet" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.loader.GeneratedMethod; import org.apache.derby.iapi.sql.Activation; import org.apache.derby.iapi.sql.ResultSet;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.services.loader.*; import org.apache.derby.iapi.sql.*;
[ "org.apache.derby" ]
org.apache.derby;
2,016,126
public static <T> T checkNotNull(T obj, @Nullable String errorMessageTemplate, int p1) { if (obj == null) { throw new NullPointerException(format(errorMessageTemplate, p1)); } return obj; }
static <T> T function(T obj, @Nullable String errorMessageTemplate, int p1) { if (obj == null) { throw new NullPointerException(format(errorMessageTemplate, p1)); } return obj; }
/** * Ensures that an object reference passed as a parameter to the calling method is not null. * <p/> * <p>See {@link #checkNotNull(Object, String, Object...)} for details. */
Ensures that an object reference passed as a parameter to the calling method is not null. See <code>#checkNotNull(Object, String, Object...)</code> for details
checkNotNull
{ "repo_name": "cymcsg/UltimateAndroid", "path": "UltimateAndroid/ultimateandroid/src/main/java/com/marshalchen/ua/common/commonUtils/basicUtils/Preconditions.java", "license": "apache-2.0", "size": 52256 }
[ "android.support.annotation.Nullable" ]
import android.support.annotation.Nullable;
import android.support.annotation.*;
[ "android.support" ]
android.support;
1,040,397
public TermsAggregationBuilder collectMode(SubAggCollectionMode collectMode) { if (collectMode == null) { throw new IllegalArgumentException("[collectMode] must not be null: [" + name + "]"); } this.collectMode = collectMode; return this; }
TermsAggregationBuilder function(SubAggCollectionMode collectMode) { if (collectMode == null) { throw new IllegalArgumentException(STR + name + "]"); } this.collectMode = collectMode; return this; }
/** * Expert: set the collection mode. */
Expert: set the collection mode
collectMode
{ "repo_name": "coding0011/elasticsearch", "path": "server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java", "license": "apache-2.0", "size": 16225 }
[ "org.elasticsearch.search.aggregations.Aggregator" ]
import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.*;
[ "org.elasticsearch.search" ]
org.elasticsearch.search;
1,761,150
public ImmuSet range() { SetAccumulator acc; acc = SetAccumulator.make(); Stepper stomper = stepper(); for (; stomper.hasValue(); stomper.step()) { Heaper obj = (Heaper) stomper.fetch(); if (obj == null) { continue ; } acc.step(obj); } stomper.destroy(); return (ImmuSet) acc.value(); }
ImmuSet function() { SetAccumulator acc; acc = SetAccumulator.make(); Stepper stomper = stepper(); for (; stomper.hasValue(); stomper.step()) { Heaper obj = (Heaper) stomper.fetch(); if (obj == null) { continue ; } acc.step(obj); } stomper.destroy(); return (ImmuSet) acc.value(); }
/** * A snapshot of the current range elements of the table collected together into * an ImmuSet. */
A snapshot of the current range elements of the table collected together into an ImmuSet
range
{ "repo_name": "jonesd/udanax-gold2java", "path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/collection/tables/ScruTable.java", "license": "mit", "size": 30731 }
[ "info.dgjones.abora.gold.collection.sets.ImmuSet", "info.dgjones.abora.gold.collection.sets.SetAccumulator", "info.dgjones.abora.gold.collection.steppers.Stepper", "info.dgjones.abora.gold.xpp.basic.Heaper" ]
import info.dgjones.abora.gold.collection.sets.ImmuSet; import info.dgjones.abora.gold.collection.sets.SetAccumulator; import info.dgjones.abora.gold.collection.steppers.Stepper; import info.dgjones.abora.gold.xpp.basic.Heaper;
import info.dgjones.abora.gold.collection.sets.*; import info.dgjones.abora.gold.collection.steppers.*; import info.dgjones.abora.gold.xpp.basic.*;
[ "info.dgjones.abora" ]
info.dgjones.abora;
1,195,359
protected void initialize() { commentToken = newToken(TextStyle.COMMENT); }
void function() { commentToken = newToken(TextStyle.COMMENT); }
/** * Initialize the scanner. This method is also called whenever {@link TextAttribute} get modified. */
Initialize the scanner. This method is also called whenever <code>TextAttribute</code> get modified
initialize
{ "repo_name": "Arnauld/jbehave-eclipse-plugin", "path": "src/org/technbolts/jbehave/eclipse/editors/story/scanner/AbstractStoryPartBasedScanner.java", "license": "mit", "size": 14873 }
[ "org.technbolts.jbehave.eclipse.textstyle.TextStyle" ]
import org.technbolts.jbehave.eclipse.textstyle.TextStyle;
import org.technbolts.jbehave.eclipse.textstyle.*;
[ "org.technbolts.jbehave" ]
org.technbolts.jbehave;
980,466
@Override public void restorePythonPath(boolean force) { if (DEBUG_TESTS_BASE) { System.out.println("-------------- Restoring system pythonpath"); } restoreSystemPythonPath(force, TestDependent.PYTHON_LIB); if (DEBUG_TESTS_BASE) { System.out.println("-------------- Restoring project pythonpath for refactoring nature"); } restoreProjectPythonPathRefactoring(force, TestDependent.TEST_COM_REFACTORING_PYSRC_LOC); if (DEBUG_TESTS_BASE) { System.out.println("-------------- Checking size (for projrefactoring)"); } checkSize(); }
void function(boolean force) { if (DEBUG_TESTS_BASE) { System.out.println(STR); } restoreSystemPythonPath(force, TestDependent.PYTHON_LIB); if (DEBUG_TESTS_BASE) { System.out.println(STR); } restoreProjectPythonPathRefactoring(force, TestDependent.TEST_COM_REFACTORING_PYSRC_LOC); if (DEBUG_TESTS_BASE) { System.out.println(STR); } checkSize(); }
/** * Overriden so that the pythonpath is only restored for the system and the refactoring nature * * @param force whether this should be forced, even if it was previously created for this class */
Overriden so that the pythonpath is only restored for the system and the refactoring nature
restorePythonPath
{ "repo_name": "smkr/pyclipse", "path": "plugins/com.python.pydev.refactoring/tests/com/python/pydev/refactoring/refactorer/refactorings/rename/RefactoringRenameTestBase.java", "license": "epl-1.0", "size": 13802 }
[ "org.python.pydev.core.TestDependent" ]
import org.python.pydev.core.TestDependent;
import org.python.pydev.core.*;
[ "org.python.pydev" ]
org.python.pydev;
2,156,316
public static Response processCitationPatentPDF(final InputStream inputStream, final boolean consolidate) { LOGGER.debug(methodLogIn()); Response response = null; String retVal; boolean isparallelExec = GrobidServiceProperties.isParallelExec(); File originFile = null; Engine engine = null; try { originFile = GrobidRestUtils.writeInputFile(inputStream); if (originFile == null) { response = Response.status(Status.INTERNAL_SERVER_ERROR).build(); } else { // starts conversion process engine = GrobidRestUtils.getEngine(isparallelExec); List<PatentItem> patents = new ArrayList<PatentItem>(); List<BibDataSet> articles = new ArrayList<BibDataSet>(); if (isparallelExec) { retVal = engine.processAllCitationsInPDFPatent(originFile.getAbsolutePath(), articles, patents, consolidate); GrobidPoolingFactory.returnEngine(engine); engine = null; } else { synchronized (engine) { retVal = engine.processAllCitationsInPDFPatent(originFile.getAbsolutePath(), articles, patents, consolidate); } } GrobidRestUtils.removeTempFile(originFile); if (!GrobidRestUtils.isResultOK(retVal)) { response = Response.status(Status.NO_CONTENT).build(); } else { response = Response.status(Status.OK).entity(retVal).type(MediaType.APPLICATION_XML).build(); } } } catch (NoSuchElementException nseExp) { LOGGER.error("Could not get an engine from the pool within configured time. Sending service unavailable."); response = Response.status(Status.SERVICE_UNAVAILABLE).build(); } catch (Exception exp) { LOGGER.error("An unexpected exception occurs. ", exp); response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(exp.getCause().getMessage()).build(); } finally { GrobidRestUtils.removeTempFile(originFile); if (isparallelExec && engine != null) { GrobidPoolingFactory.returnEngine(engine); } } LOGGER.debug(methodLogOut()); return response; }
static Response function(final InputStream inputStream, final boolean consolidate) { LOGGER.debug(methodLogIn()); Response response = null; String retVal; boolean isparallelExec = GrobidServiceProperties.isParallelExec(); File originFile = null; Engine engine = null; try { originFile = GrobidRestUtils.writeInputFile(inputStream); if (originFile == null) { response = Response.status(Status.INTERNAL_SERVER_ERROR).build(); } else { engine = GrobidRestUtils.getEngine(isparallelExec); List<PatentItem> patents = new ArrayList<PatentItem>(); List<BibDataSet> articles = new ArrayList<BibDataSet>(); if (isparallelExec) { retVal = engine.processAllCitationsInPDFPatent(originFile.getAbsolutePath(), articles, patents, consolidate); GrobidPoolingFactory.returnEngine(engine); engine = null; } else { synchronized (engine) { retVal = engine.processAllCitationsInPDFPatent(originFile.getAbsolutePath(), articles, patents, consolidate); } } GrobidRestUtils.removeTempFile(originFile); if (!GrobidRestUtils.isResultOK(retVal)) { response = Response.status(Status.NO_CONTENT).build(); } else { response = Response.status(Status.OK).entity(retVal).type(MediaType.APPLICATION_XML).build(); } } } catch (NoSuchElementException nseExp) { LOGGER.error(STR); response = Response.status(Status.SERVICE_UNAVAILABLE).build(); } catch (Exception exp) { LOGGER.error(STR, exp); response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(exp.getCause().getMessage()).build(); } finally { GrobidRestUtils.removeTempFile(originFile); if (isparallelExec && engine != null) { GrobidPoolingFactory.returnEngine(engine); } } LOGGER.debug(methodLogOut()); return response; }
/** * Process a patent document in PDF for extracting and parsing citations in the description body. * * @param inputStream the data of origin document * @return a response object mainly containing the TEI representation of the * citation */
Process a patent document in PDF for extracting and parsing citations in the description body
processCitationPatentPDF
{ "repo_name": "TitasNandi/Summer_Project", "path": "Grobid/grobid-main/grobid-service/src/main/java/org/grobid/service/process/GrobidRestProcessFiles.java", "license": "apache-2.0", "size": 32633 }
[ "java.io.File", "java.io.InputStream", "java.util.ArrayList", "java.util.List", "java.util.NoSuchElementException", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.grobid.core.data.BibDataSet", "org.grobid.core.data.PatentItem", "org.grobid.core.engines.Engine", "org.grobid.core.factory.GrobidPoolingFactory", "org.grobid.service.util.GrobidRestUtils", "org.grobid.service.util.GrobidServiceProperties" ]
import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.grobid.core.data.BibDataSet; import org.grobid.core.data.PatentItem; import org.grobid.core.engines.Engine; import org.grobid.core.factory.GrobidPoolingFactory; import org.grobid.service.util.GrobidRestUtils; import org.grobid.service.util.GrobidServiceProperties;
import java.io.*; import java.util.*; import javax.ws.rs.core.*; import org.grobid.core.data.*; import org.grobid.core.engines.*; import org.grobid.core.factory.*; import org.grobid.service.util.*;
[ "java.io", "java.util", "javax.ws", "org.grobid.core", "org.grobid.service" ]
java.io; java.util; javax.ws; org.grobid.core; org.grobid.service;
2,033,069
public static reportingIntervalType fromPerUnaligned(byte[] encodedBytes) { reportingIntervalType result = new reportingIntervalType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
static reportingIntervalType function(byte[] encodedBytes) { reportingIntervalType result = new reportingIntervalType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
/** * Creates a new reportingIntervalType from encoded stream. */
Creates a new reportingIntervalType from encoded stream
fromPerUnaligned
{ "repo_name": "google/supl-client", "path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/PeriodicalReportingCriteria.java", "license": "apache-2.0", "size": 16815 }
[ "com.google.location.suplclient.asn1.base.BitStreamReader" ]
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.*;
[ "com.google.location" ]
com.google.location;
1,612,047
public void testGetWhitespaceDefault() throws QuickFixException { WhitespaceBehavior defaultWhitespaceBehavior = define(baseTag, "", "").getWhitespaceBehavior(); assertEquals("By default, whitespace optimize should be true.", BaseComponentDef.DefaultWhitespaceBehavior, defaultWhitespaceBehavior); }
void function() throws QuickFixException { WhitespaceBehavior defaultWhitespaceBehavior = define(baseTag, STRSTRBy default, whitespace optimize should be true.", BaseComponentDef.DefaultWhitespaceBehavior, defaultWhitespaceBehavior); }
/** * Verify the whitespace attribute specified on a component tag. By default the whitespace logic is optimize, which * removes all non-necessary whitespace. Test method for * {@link org.auraframework.def.BaseComponentDef#getWhitespaceBehavior()}. */
Verify the whitespace attribute specified on a component tag. By default the whitespace logic is optimize, which removes all non-necessary whitespace. Test method for <code>org.auraframework.def.BaseComponentDef#getWhitespaceBehavior()</code>
testGetWhitespaceDefault
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-impl/src/test/java/org/auraframework/impl/root/component/BaseComponentDefTest.java", "license": "apache-2.0", "size": 99025 }
[ "org.auraframework.def.BaseComponentDef", "org.auraframework.throwable.quickfix.QuickFixException" ]
import org.auraframework.def.BaseComponentDef; import org.auraframework.throwable.quickfix.QuickFixException;
import org.auraframework.def.*; import org.auraframework.throwable.quickfix.*;
[ "org.auraframework.def", "org.auraframework.throwable" ]
org.auraframework.def; org.auraframework.throwable;
1,618,612
this.setLayout(new CardLayout()); this.setName(Constant.messages.getString("session.general")); this.add(getPanelSession(), getPanelSession().getName()); }
this.setLayout(new CardLayout()); this.setName(Constant.messages.getString(STR)); this.add(getPanelSession(), getPanelSession().getName()); }
/** * This method initializes this */
This method initializes this
initialize
{ "repo_name": "GillesMoris/OSS", "path": "src/org/parosproxy/paros/view/SessionGeneralPanel.java", "license": "apache-2.0", "size": 5932 }
[ "java.awt.CardLayout", "org.parosproxy.paros.Constant" ]
import java.awt.CardLayout; import org.parosproxy.paros.Constant;
import java.awt.*; import org.parosproxy.paros.*;
[ "java.awt", "org.parosproxy.paros" ]
java.awt; org.parosproxy.paros;
2,838,566
@Nonnull private static byte[] mnemonicToBytesWithMultiplication(@Nonnull Dictionary dictionary, @Nonnull List<String> mnemonicWordList) { Converter<String, Integer> reverseConverter = dictionary.reverse(); BigInteger total = BigInteger.ZERO; BigInteger multiplier = BigInteger.valueOf(dictionary.getSize()); for (String word : Lists.reverse(mnemonicWordList)) { //noinspection ConstantConditions int index = reverseConverter.convert(word); total = total.multiply(multiplier).add(BigInteger.valueOf(index)); } byte[] result = total.toByteArray(); if (result[0] == 0) { byte[] tmp = new byte[result.length - 1]; System.arraycopy(result, 1, tmp, 0, tmp.length); result = tmp; } return result; }
static byte[] function(@Nonnull Dictionary dictionary, @Nonnull List<String> mnemonicWordList) { Converter<String, Integer> reverseConverter = dictionary.reverse(); BigInteger total = BigInteger.ZERO; BigInteger multiplier = BigInteger.valueOf(dictionary.getSize()); for (String word : Lists.reverse(mnemonicWordList)) { int index = reverseConverter.convert(word); total = total.multiply(multiplier).add(BigInteger.valueOf(index)); } byte[] result = total.toByteArray(); if (result[0] == 0) { byte[] tmp = new byte[result.length - 1]; System.arraycopy(result, 1, tmp, 0, tmp.length); result = tmp; } return result; }
/** * Convert a sequence of mnemonic word into a byte array for validation and usage. * * @param dictionary * instance to check for the presence of all words. * @param mnemonicWordList * sequence of mnemonic words to map against a dictionary for bit values. * * @return sequence of bytes based on word list. */
Convert a sequence of mnemonic word into a byte array for validation and usage
mnemonicToBytesWithMultiplication
{ "repo_name": "harningt/atomun-mnemonic", "path": "src/main/java/us/eharning/atomun/mnemonic/spi/electrum/v2/MnemonicUnitSpiImpl.java", "license": "apache-2.0", "size": 10336 }
[ "com.google.common.base.Converter", "com.google.common.collect.Lists", "java.math.BigInteger", "java.util.List", "javax.annotation.Nonnull", "us.eharning.atomun.mnemonic.utility.dictionary.Dictionary" ]
import com.google.common.base.Converter; import com.google.common.collect.Lists; import java.math.BigInteger; import java.util.List; import javax.annotation.Nonnull; import us.eharning.atomun.mnemonic.utility.dictionary.Dictionary;
import com.google.common.base.*; import com.google.common.collect.*; import java.math.*; import java.util.*; import javax.annotation.*; import us.eharning.atomun.mnemonic.utility.dictionary.*;
[ "com.google.common", "java.math", "java.util", "javax.annotation", "us.eharning.atomun" ]
com.google.common; java.math; java.util; javax.annotation; us.eharning.atomun;
110,234
float[] r_value; final float[] w_value = smoke_value; final int w_size = w_value.length; switch ( access ) { case X3DFieldTypes.INPUT_ONLY: case X3DFieldTypes.INITIALIZE_ONLY: field.setValue( w_size/4, w_value ); break; case X3DFieldTypes.OUTPUT_ONLY: r_value = new float[field.size( )*4]; field.getValue( r_value ); break; case X3DFieldTypes.INPUT_OUTPUT: // control.bufferUpdate( ); field.setValue( w_size/4, w_value ); control.flushUpdate( ); // final int r_size = field.size( ); if ( r_size != w_size ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, "\twrite size = " + w_size, "\tread size = " + r_size } ); return( FAIL ); } r_value = new float[r_size*4]; field.getValue( r_value ); for ( int i = 0; i < r_value.length; i++ ) { if ( w_value[i] != r_value[i] ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, "\tdata mismatch at array index: " + i, "\twrote [ " + w_value[i] +" ]", "\tread [ " + r_value[i] +" ]" } ); return( FAIL ); } } break; default: control.logMessage( tMessageType.ERROR, nodeName +":"+ fieldName + " invalid access type: " + access ); return( FAIL ); } control.logMessage( tMessageType.SUCCESS, nodeName +":"+ fieldName ); return( SUCCESS ); }
float[] r_value; final float[] w_value = smoke_value; final int w_size = w_value.length; switch ( access ) { case X3DFieldTypes.INPUT_ONLY: case X3DFieldTypes.INITIALIZE_ONLY: field.setValue( w_size/4, w_value ); break; case X3DFieldTypes.OUTPUT_ONLY: r_value = new float[field.size( )*4]; field.getValue( r_value ); break; case X3DFieldTypes.INPUT_OUTPUT: field.setValue( w_size/4, w_value ); control.flushUpdate( ); if ( r_size != w_size ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, STR + w_size, STR + r_size } ); return( FAIL ); } r_value = new float[r_size*4]; field.getValue( r_value ); for ( int i = 0; i < r_value.length; i++ ) { if ( w_value[i] != r_value[i] ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, STR + i, STR + w_value[i] +STR, STR + r_value[i] +STR } ); return( FAIL ); } } break; default: control.logMessage( tMessageType.ERROR, nodeName +":"+ fieldName + STR + access ); return( FAIL ); } control.logMessage( tMessageType.SUCCESS, nodeName +":"+ fieldName ); return( SUCCESS ); }
/** * Execute a 'smoke' test. * @return results, <code>true</code> for pass, <code>false</code> for fail */
Execute a 'smoke' test
smoke
{ "repo_name": "Norkart/NK-VirtualGlobe", "path": "Xj3D/parsetest/sai/external/nodetest/tMFRotation.java", "license": "gpl-2.0", "size": 4195 }
[ "org.web3d.x3d.sai.X3DFieldTypes" ]
import org.web3d.x3d.sai.X3DFieldTypes;
import org.web3d.x3d.sai.*;
[ "org.web3d.x3d" ]
org.web3d.x3d;
563,572
synchronized void checkDatanodeUuid() throws IOException { if (storage.getDatanodeUuid() == null) { storage.setDatanodeUuid(generateUuid()); storage.writeAll(); LOG.info("Generated and persisted new Datanode UUID " + storage.getDatanodeUuid()); } }
synchronized void checkDatanodeUuid() throws IOException { if (storage.getDatanodeUuid() == null) { storage.setDatanodeUuid(generateUuid()); storage.writeAll(); LOG.info(STR + storage.getDatanodeUuid()); } }
/** * Verify that the DatanodeUuid has been initialized. If this is a new * datanode then we generate a new Datanode Uuid and persist it to disk. * * @throws IOException */
Verify that the DatanodeUuid has been initialized. If this is a new datanode then we generate a new Datanode Uuid and persist it to disk
checkDatanodeUuid
{ "repo_name": "busbey/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java", "license": "apache-2.0", "size": 120360 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,261,906
private static Map<Integer, Set<CTag>> getNodeTags(final CConnection connection, final INaviProject project, final ITagManager nodeTagManager) throws SQLException { final Map<Integer, Set<CTag>> tagMap = new HashMap<Integer, Set<CTag>>(); final String query = " SELECT * FROM load_project_node_tags(?) "; final PreparedStatement statement = connection.getConnection().prepareStatement(query); statement.setInt(1, project.getConfiguration().getId()); final ResultSet resultSet = statement.executeQuery(); try { while (resultSet.next()) { final int viewId = resultSet.getInt("view_id"); final int tagId = resultSet.getInt("tag_id"); if (!tagMap.containsKey(viewId)) { tagMap.put(viewId, new HashSet<CTag>()); } final CTag tag = CTagHelpers.findTag(nodeTagManager.getRootTag(), tagId); if (tag != null) { tagMap.get(viewId).add(tag); } } } finally { resultSet.close(); } return tagMap; }
static Map<Integer, Set<CTag>> function(final CConnection connection, final INaviProject project, final ITagManager nodeTagManager) throws SQLException { final Map<Integer, Set<CTag>> tagMap = new HashMap<Integer, Set<CTag>>(); final String query = STR; final PreparedStatement statement = connection.getConnection().prepareStatement(query); statement.setInt(1, project.getConfiguration().getId()); final ResultSet resultSet = statement.executeQuery(); try { while (resultSet.next()) { final int viewId = resultSet.getInt(STR); final int tagId = resultSet.getInt(STR); if (!tagMap.containsKey(viewId)) { tagMap.put(viewId, new HashSet<CTag>()); } final CTag tag = CTagHelpers.findTag(nodeTagManager.getRootTag(), tagId); if (tag != null) { tagMap.get(viewId).add(tag); } } } finally { resultSet.close(); } return tagMap; }
/** * Loads the node tags of the views of a project. * * @param connection Provides the connection to the database. * @param project The project whose node-tagged views are determined. * @param nodeTagManager Provides the available node tags. * * @return Maps view ID -> node tags used in the view. * * @throws SQLException Thrown if the data could not be loaded. */
Loads the node tags of the views of a project
getNodeTags
{ "repo_name": "mayl8822/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Database/PostgreSQL/Loaders/PostgreSQLViewsLoader.java", "license": "apache-2.0", "size": 15302 }
[ "com.google.security.zynamics.binnavi.Database", "com.google.security.zynamics.binnavi.Tagging", "com.google.security.zynamics.binnavi.disassembly.INaviProject", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.HashMap", "java.util.HashSet", "java.util.Map", "java.util.Set" ]
import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Tagging; import com.google.security.zynamics.binnavi.disassembly.INaviProject; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set;
import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.binnavi.disassembly.*; import java.sql.*; import java.util.*;
[ "com.google.security", "java.sql", "java.util" ]
com.google.security; java.sql; java.util;
1,735,396
public void endDocument () throws SAXException { write('\n'); super.endDocument(); try { flush(); } catch (IOException e) { throw new SAXException(e); } }
void function () throws SAXException { write('\n'); super.endDocument(); try { flush(); } catch (IOException e) { throw new SAXException(e); } }
/** * Write a newline at the end of the document. * * Pass the event on down the filter chain for further processing. * * @exception org.xml.sax.SAXException If there is an error * writing the newline, or if a handler further down * the filter chain raises an exception. * @see org.xml.sax.ContentHandler#endDocument */
Write a newline at the end of the document. Pass the event on down the filter chain for further processing
endDocument
{ "repo_name": "kluivers/plist4j", "path": "src/com/megginson/sax/XMLWriter.java", "license": "bsd-3-clause", "size": 38199 }
[ "java.io.IOException", "org.xml.sax.SAXException" ]
import java.io.IOException; import org.xml.sax.SAXException;
import java.io.*; import org.xml.sax.*;
[ "java.io", "org.xml.sax" ]
java.io; org.xml.sax;
2,357,555
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
/** * This continuously tries to reconnect in a separate thread and will only stop if the connection was established * successfully or the server gets shutdown. If there is currently a reconnect task active the connection paramaters * and callback will get updated. * * @param reconnectUri the updated connection uri * @param authKey the updated authentication key * @param callback the current callback */
This continuously tries to reconnect in a separate thread and will only stop if the connection was established successfully or the server gets shutdown. If there is currently a reconnect task active the connection paramaters and callback will get updated
asyncReconnect
{ "repo_name": "yersan/wildfly-core", "path": "server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java", "license": "lgpl-2.1", "size": 18636 }
[ "org.jboss.as.protocol.ProtocolConnectionConfiguration" ]
import org.jboss.as.protocol.ProtocolConnectionConfiguration;
import org.jboss.as.protocol.*;
[ "org.jboss.as" ]
org.jboss.as;
2,768,461
public static IgniteUuid randomTrashId() { return TRASH_IDS[ThreadLocalRandom.current().nextInt(TRASH_CONCURRENCY)]; }
static IgniteUuid function() { return TRASH_IDS[ThreadLocalRandom.current().nextInt(TRASH_CONCURRENCY)]; }
/** * Get random trash ID. * * @return Trash ID. */
Get random trash ID
randomTrashId
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java", "license": "apache-2.0", "size": 23100 }
[ "java.util.concurrent.ThreadLocalRandom", "org.apache.ignite.lang.IgniteUuid" ]
import java.util.concurrent.ThreadLocalRandom; import org.apache.ignite.lang.IgniteUuid;
import java.util.concurrent.*; import org.apache.ignite.lang.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
510,527
public void generateUpdateWhere(CharBuffer cb) { generateInternalWhere(cb, false); } // // private/protected
void function(CharBuffer cb) { generateInternalWhere(cb, false); }
/** * Generates the (update) where expression. */
Generates the (update) where expression
generateUpdateWhere
{ "repo_name": "WelcomeHUME/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/amber/expr/fun/AbsFunExpr.java", "license": "gpl-2.0", "size": 2520 }
[ "com.caucho.util.CharBuffer" ]
import com.caucho.util.CharBuffer;
import com.caucho.util.*;
[ "com.caucho.util" ]
com.caucho.util;
1,244,288
protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
boolean function(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) GeneralPreferenceFragment.class.getName().equals(fragmentName) DataSyncPreferenceFragment.class.getName().equals(fragmentName) NotificationPreferenceFragment.class.getName().equals(fragmentName); }
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */
This method stops fragment injection in malicious applications. Make sure to deny any unknown fragments here
isValidFragment
{ "repo_name": "yeoupooh/subak", "path": "client/android/subak/app/src/main/java/com/subakstudio/subak/android/SettingsActivity.java", "license": "gpl-2.0", "size": 10165 }
[ "android.preference.PreferenceFragment" ]
import android.preference.PreferenceFragment;
import android.preference.*;
[ "android.preference" ]
android.preference;
1,608,768
if (f==null) { return false; } if(f.isDirectory()) { return true; } if (extensions!=null) { String extension = VideoIO.getExtension(f); if (extension!=null) { for (String next: extensions) { if (extension.toLowerCase().equals(next.toLowerCase())) return true; } } } else for (FileFilter next: VideoIO.singleVideoTypeFilters) { if (next.accept(f)) return true; } return false; }
if (f==null) { return false; } if(f.isDirectory()) { return true; } if (extensions!=null) { String extension = VideoIO.getExtension(f); if (extension!=null) { for (String next: extensions) { if (extension.toLowerCase().equals(next.toLowerCase())) return true; } } } else for (FileFilter next: VideoIO.singleVideoTypeFilters) { if (next.accept(f)) return true; } return false; }
/** * Accepts directories and files with extensions specified in constructor, * or (no-arg constructor) with any extension in VideoIO.singleVideoTypeFilters. * * @param f the file * @return true if accepted */
Accepts directories and files with extensions specified in constructor, or (no-arg constructor) with any extension in VideoIO.singleVideoTypeFilters
accept
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/media/core/VideoFileFilter.java", "license": "gpl-3.0", "size": 6329 }
[ "javax.swing.filechooser.FileFilter" ]
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.*;
[ "javax.swing" ]
javax.swing;
2,057,252
public Object parseAs(Type dataType) throws IOException { if (!hasMessageBody()) { return null; } return request.getParser().parseAndClose(getContent(), getContentCharset(), dataType); }
Object function(Type dataType) throws IOException { if (!hasMessageBody()) { return null; } return request.getParser().parseAndClose(getContent(), getContentCharset(), dataType); }
/** * Parses the content of the HTTP response from {@link #getContent()} and reads it into a data * type of key/value pairs using the parser returned by {@link HttpRequest#getParser()}. * * @return parsed data type instance or {@code null} for no content * @since 1.10 */
Parses the content of the HTTP response from <code>#getContent()</code> and reads it into a data type of key/value pairs using the parser returned by <code>HttpRequest#getParser()</code>
parseAs
{ "repo_name": "wgpshashank/google-http-java-client", "path": "google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java", "license": "apache-2.0", "size": 15282 }
[ "java.io.IOException", "java.lang.reflect.Type" ]
import java.io.IOException; import java.lang.reflect.Type;
import java.io.*; import java.lang.reflect.*;
[ "java.io", "java.lang" ]
java.io; java.lang;
52,817
private void step_1() { SpeakerNPC npc = npcs.get(QUEST_NPC); // quest can be given npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new OrCondition( new QuestNotStartedCondition(QUEST_SLOT), new AndCondition( new QuestCompletedCondition(QUEST_SLOT), new TimePassedCondition(QUEST_SLOT, 1, delay))), ConversationStates.ATTENDING, null, new GiveQuestAction()); // time is not over npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new QuestCompletedCondition(QUEST_SLOT), new NotCondition( new TimePassedCondition(QUEST_SLOT, 1, delay))), ConversationStates.ATTENDING, null, new SayTimeRemainingAction(QUEST_SLOT, 1, delay, "You have to check again in"));
void function() { SpeakerNPC npc = npcs.get(QUEST_NPC); npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new OrCondition( new QuestNotStartedCondition(QUEST_SLOT), new AndCondition( new QuestCompletedCondition(QUEST_SLOT), new TimePassedCondition(QUEST_SLOT, 1, delay))), ConversationStates.ATTENDING, null, new GiveQuestAction()); npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new QuestCompletedCondition(QUEST_SLOT), new NotCondition( new TimePassedCondition(QUEST_SLOT, 1, delay))), ConversationStates.ATTENDING, null, new SayTimeRemainingAction(QUEST_SLOT, 1, delay, STR));
/** * add quest state to npc's fsm. */
add quest state to npc's fsm
step_1
{ "repo_name": "dkfellows/stendhal", "path": "src/games/stendhal/server/maps/quests/KillEnemyArmy.java", "license": "gpl-2.0", "size": 19318 }
[ "games.stendhal.server.entity.npc.ConversationPhrases", "games.stendhal.server.entity.npc.ConversationStates", "games.stendhal.server.entity.npc.SpeakerNPC", "games.stendhal.server.entity.npc.action.SayTimeRemainingAction", "games.stendhal.server.entity.npc.condition.AndCondition", "games.stendhal.server.entity.npc.condition.NotCondition", "games.stendhal.server.entity.npc.condition.OrCondition", "games.stendhal.server.entity.npc.condition.QuestCompletedCondition", "games.stendhal.server.entity.npc.condition.QuestNotStartedCondition", "games.stendhal.server.entity.npc.condition.TimePassedCondition" ]
import games.stendhal.server.entity.npc.ConversationPhrases; import games.stendhal.server.entity.npc.ConversationStates; import games.stendhal.server.entity.npc.SpeakerNPC; import games.stendhal.server.entity.npc.action.SayTimeRemainingAction; import games.stendhal.server.entity.npc.condition.AndCondition; import games.stendhal.server.entity.npc.condition.NotCondition; import games.stendhal.server.entity.npc.condition.OrCondition; import games.stendhal.server.entity.npc.condition.QuestCompletedCondition; import games.stendhal.server.entity.npc.condition.QuestNotStartedCondition; import games.stendhal.server.entity.npc.condition.TimePassedCondition;
import games.stendhal.server.entity.npc.*; import games.stendhal.server.entity.npc.action.*; import games.stendhal.server.entity.npc.condition.*;
[ "games.stendhal.server" ]
games.stendhal.server;
1,249,533
@ServiceMethod(returns = ReturnType.SINGLE) public SendChatMessageResult sendChatMessage(String chatThreadId, SendChatMessageOptions body) { return sendChatMessageAsync(chatThreadId, body).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) SendChatMessageResult function(String chatThreadId, SendChatMessageOptions body) { return sendChatMessageAsync(chatThreadId, body).block(); }
/** * Sends a message to a thread. * * @param chatThreadId The thread id to send the message to. * @param body Details of the message to send. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of the send message operation. */
Sends a message to a thread
sendChatMessage
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/implementation/AzureCommunicationChatServiceImpl.java", "license": "mit", "size": 111033 }
[ "com.azure.communication.chat.models.SendChatMessageOptions", "com.azure.communication.chat.models.SendChatMessageResult", "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.communication.chat.models.SendChatMessageOptions; import com.azure.communication.chat.models.SendChatMessageResult; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.communication.chat.models.*; import com.azure.core.annotation.*;
[ "com.azure.communication", "com.azure.core" ]
com.azure.communication; com.azure.core;
2,282,154
@Test public void testCreateSetIteratableWithEmptyInput() { assertEquals(String.format("Should return empty set for no input."), new HashSet<String>(), CollectionsUtil.createSet()); assertNull(String.format("Should return null for null input."), CollectionsUtil.createSet((Object[]) null)); }
void function() { assertEquals(String.format(STR), new HashSet<String>(), CollectionsUtil.createSet()); assertNull(String.format(STR), CollectionsUtil.createSet((Object[]) null)); }
/** * Tests the createSet()_Iteratable method using empty/null input */
Tests the createSet()_Iteratable method using empty/null input
testCreateSetIteratableWithEmptyInput
{ "repo_name": "UCDenver-ccp/common", "path": "src/test/java/edu/ucdenver/ccp/common/collections/CollectionsUtilTest.java", "license": "bsd-3-clause", "size": 27803 }
[ "java.util.HashSet", "org.junit.Assert" ]
import java.util.HashSet; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,278,968
public void testProjectNoImage() throws Exception { // Create test data Project p = new ProjectI(); p.setName(omero.rtypes.rstring("name")); Dataset d = new DatasetI(); d.setName(p.getName()); p.linkDataset(d); p = (Project) iUpdate.saveAndReturnObject(p); final long id = p.getId().getValue(); // Do Delete final Delete2 dc = Requests.delete("Project", id); callback(true, client, dc); // Check that data is gone List<?> ids; ids = iQuery.projection("select p.id from Project p where p.id = " + id, null); Assert.assertTrue(ids.isEmpty()); ids = iQuery.projection("select d.id from Dataset d where d.id = " + id, null); Assert.assertTrue(ids.isEmpty()); }
void function() throws Exception { Project p = new ProjectI(); p.setName(omero.rtypes.rstring("name")); Dataset d = new DatasetI(); d.setName(p.getName()); p.linkDataset(d); p = (Project) iUpdate.saveAndReturnObject(p); final long id = p.getId().getValue(); final Delete2 dc = Requests.delete(STR, id); callback(true, client, dc); List<?> ids; ids = iQuery.projection(STR + id, null); Assert.assertTrue(ids.isEmpty()); ids = iQuery.projection(STR + id, null); Assert.assertTrue(ids.isEmpty()); }
/** * Deletes a project and all its datasets though no images are created. */
Deletes a project and all its datasets though no images are created
testProjectNoImage
{ "repo_name": "tp81/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/delete/AdditionalDeleteTest.java", "license": "gpl-2.0", "size": 23641 }
[ "java.util.List", "org.testng.Assert" ]
import java.util.List; import org.testng.Assert;
import java.util.*; import org.testng.*;
[ "java.util", "org.testng" ]
java.util; org.testng;
1,352,022
public static double avgDoubleList(List<Double> list) { double sum = sumDoubleList(list); return list.size() == 0 ? 0.0 : sum / list.size(); }
static double function(List<Double> list) { double sum = sumDoubleList(list); return list.size() == 0 ? 0.0 : sum / list.size(); }
/** * Compute the average of a {@link java.lang.Double} list * * @param list * @return */
Compute the average of a <code>java.lang.Double</code> list
avgDoubleList
{ "repo_name": "cshaxu/voldemort", "path": "src/java/voldemort/utils/Utils.java", "license": "apache-2.0", "size": 27990 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
283,423
public void instanceLoad(String xmlstr, Appia appia) throws SAXException, IOException { if (appia == null) if (config == null) config = new Configuration(); else if (config == null) try { config = new Configuration(appia); } catch (AppiaXMLException e) { throw new SAXException(e); } handler = new XMLFileHandler(config); log.info("Loading XML configuration from a char stream..."); parser.parse(new InputSource(new StringReader(xmlstr)),handler); }
void function(String xmlstr, Appia appia) throws SAXException, IOException { if (appia == null) if (config == null) config = new Configuration(); else if (config == null) try { config = new Configuration(appia); } catch (AppiaXMLException e) { throw new SAXException(e); } handler = new XMLFileHandler(config); log.info(STR); parser.parse(new InputSource(new StringReader(xmlstr)),handler); }
/** * Auxiliary method. * <p> * <b>INTERNAL USE ONLY!</b> * * @param xmlstr * @throws IOException * @throws SAXException */
Auxiliary method. INTERNAL USE ONLY
instanceLoad
{ "repo_name": "aparra/appia", "path": "src/core/net/sf/appia/xml/AppiaXML.java", "license": "apache-2.0", "size": 15063 }
[ "java.io.IOException", "java.io.StringReader", "net.sf.appia.core.Appia", "org.xml.sax.InputSource", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.io.StringReader; import net.sf.appia.core.Appia; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
import java.io.*; import net.sf.appia.core.*; import org.xml.sax.*;
[ "java.io", "net.sf.appia", "org.xml.sax" ]
java.io; net.sf.appia; org.xml.sax;
1,948,915
@Test public void testCycleDateStartTimerEvent() throws Exception { Clock previousClock = processEngineConfiguration.getClock(); Clock testClock = new DefaultClockImpl(); processEngineConfiguration.setClock(testClock); Calendar calendar = Calendar.getInstance(); calendar.set(2025, Calendar.DECEMBER, 10, 0, 0, 0); testClock.setCurrentTime(calendar.getTime()); // deploy the process repositoryService.createDeployment().addClasspathResource("org/flowable/engine/test/bpmn/event/timer/StartTimerEventRepeatWithoutEndDateTest.testCycleDateStartTimerEvent.bpmn20.xml").deploy(); assertEquals(1, repositoryService.createProcessDefinitionQuery().count()); // AFTER DEPLOYMENT // when the process is deployed there will be created a timerStartEvent // job which will wait to be executed. List<Job> jobs = managementService.createTimerJobQuery().list(); assertEquals(1, jobs.size()); // dueDate should be after 24 hours from the process deployment Calendar dueDateCalendar = Calendar.getInstance(); dueDateCalendar.set(2025, Calendar.DECEMBER, 11, 0, 0, 0); // check the due date is inside the 2 seconds range assertTrue(Math.abs(dueDateCalendar.getTime().getTime() - jobs.get(0).getDuedate().getTime()) < 2000); // No process instances List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(0, processInstances.size()); // No tasks List<org.flowable.task.api.Task> tasks = taskService.createTaskQuery().list(); assertEquals(0, tasks.size()); // ADVANCE THE CLOCK // advance the clock after 9 days from starting the process -> // the system will execute the pending job and will create a new one (day by day) moveByMinutes((9 * 60 * 24)); executeJobExecutorForTime(10000, 200); // there must be a pending job because the endDate is not reached yet assertEquals(1, managementService.createTimerJobQuery().count()); // After time advanced 9 days there should be 9 process instance started processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(9, processInstances.size()); // 9 task to be executed (the userTask "Task A") tasks = taskService.createTaskQuery().list(); assertEquals(9, tasks.size()); // one new job will be created (and the old one will be deleted after execution) jobs = managementService.createTimerJobQuery().list(); assertEquals(1, jobs.size()); // check if the last job to be executed has the dueDate set correctly // (10'th repeat after 10 dec. => dueDate must have DueDate = 20 dec.) dueDateCalendar = Calendar.getInstance(); dueDateCalendar.set(2025, Calendar.DECEMBER, 20, 0, 0, 0); assertTrue(Math.abs(dueDateCalendar.getTime().getTime() - jobs.get(0).getDuedate().getTime()) < 2000); // ADVANCE THE CLOCK SO that all 10 repeats to be executed // (last execution) moveByMinutes(60 * 24); try { waitForJobExecutorToProcessAllJobsAndExecutableTimerJobs(2000, 200); } catch (Exception e) { fail("Because the maximum number of repeats is reached no other jobs are created"); } // After the 10nth startEvent Execution should have 10 process instances started // (since the first one was not completed) processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(10, processInstances.size()); // the current job will be deleted after execution and a new one will // not be created. (all 10 has already executed) jobs = managementService.createTimerJobQuery().list(); assertEquals(0, jobs.size()); jobs = managementService.createJobQuery().list(); assertEquals(0, jobs.size()); // 10 tasks to be executed (the userTask "Task A") // one task for each process instance tasks = taskService.createTaskQuery().list(); assertEquals(10, tasks.size()); // FINAL CHECK // count "timer fired" events int timerFiredCount = 0; List<FlowableEvent> eventsReceived = listener.getEventsReceived(); for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.TIMER_FIRED == eventReceived.getType()) { timerFiredCount++; } } // count "entity created" events int eventCreatedCount = 0; for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.ENTITY_CREATED == eventReceived.getType()) { eventCreatedCount++; } } // count "entity deleted" events int eventDeletedCount = 0; for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.ENTITY_DELETED == eventReceived.getType()) { eventDeletedCount++; } } assertEquals(10, timerFiredCount); // 10 timers fired assertEquals(20, eventCreatedCount); // 20 jobs created, 2 per timer job assertEquals(20, eventDeletedCount); // 20 jobs deleted, 2 per timer job // for each processInstance // let's complete the userTasks where the process is hanging in order to // complete the processes. for (ProcessInstance processInstance : processInstances) { tasks = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).list(); org.flowable.task.api.Task task = tasks.get(0); assertEquals("Task A", task.getName()); assertEquals(1, tasks.size()); taskService.complete(task.getId()); } // now All the process instances should be completed processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(0, processInstances.size()); // no jobs jobs = managementService.createTimerJobQuery().list(); assertEquals(0, jobs.size()); jobs = managementService.createJobQuery().list(); assertEquals(0, jobs.size()); // no tasks tasks = taskService.createTaskQuery().list(); assertEquals(0, tasks.size()); listener.clearEventsReceived(); processEngineConfiguration.setClock(previousClock); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); }
void function() throws Exception { Clock previousClock = processEngineConfiguration.getClock(); Clock testClock = new DefaultClockImpl(); processEngineConfiguration.setClock(testClock); Calendar calendar = Calendar.getInstance(); calendar.set(2025, Calendar.DECEMBER, 10, 0, 0, 0); testClock.setCurrentTime(calendar.getTime()); repositoryService.createDeployment().addClasspathResource(STR).deploy(); assertEquals(1, repositoryService.createProcessDefinitionQuery().count()); List<Job> jobs = managementService.createTimerJobQuery().list(); assertEquals(1, jobs.size()); Calendar dueDateCalendar = Calendar.getInstance(); dueDateCalendar.set(2025, Calendar.DECEMBER, 11, 0, 0, 0); assertTrue(Math.abs(dueDateCalendar.getTime().getTime() - jobs.get(0).getDuedate().getTime()) < 2000); List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(0, processInstances.size()); List<org.flowable.task.api.Task> tasks = taskService.createTaskQuery().list(); assertEquals(0, tasks.size()); moveByMinutes((9 * 60 * 24)); executeJobExecutorForTime(10000, 200); assertEquals(1, managementService.createTimerJobQuery().count()); processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(9, processInstances.size()); tasks = taskService.createTaskQuery().list(); assertEquals(9, tasks.size()); jobs = managementService.createTimerJobQuery().list(); assertEquals(1, jobs.size()); dueDateCalendar = Calendar.getInstance(); dueDateCalendar.set(2025, Calendar.DECEMBER, 20, 0, 0, 0); assertTrue(Math.abs(dueDateCalendar.getTime().getTime() - jobs.get(0).getDuedate().getTime()) < 2000); moveByMinutes(60 * 24); try { waitForJobExecutorToProcessAllJobsAndExecutableTimerJobs(2000, 200); } catch (Exception e) { fail(STR); } processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(10, processInstances.size()); jobs = managementService.createTimerJobQuery().list(); assertEquals(0, jobs.size()); jobs = managementService.createJobQuery().list(); assertEquals(0, jobs.size()); tasks = taskService.createTaskQuery().list(); assertEquals(10, tasks.size()); int timerFiredCount = 0; List<FlowableEvent> eventsReceived = listener.getEventsReceived(); for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.TIMER_FIRED == eventReceived.getType()) { timerFiredCount++; } } int eventCreatedCount = 0; for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.ENTITY_CREATED == eventReceived.getType()) { eventCreatedCount++; } } int eventDeletedCount = 0; for (FlowableEvent eventReceived : eventsReceived) { if (FlowableEngineEventType.ENTITY_DELETED == eventReceived.getType()) { eventDeletedCount++; } } assertEquals(10, timerFiredCount); assertEquals(20, eventCreatedCount); assertEquals(20, eventDeletedCount); for (ProcessInstance processInstance : processInstances) { tasks = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).list(); org.flowable.task.api.Task task = tasks.get(0); assertEquals(STR, task.getName()); assertEquals(1, tasks.size()); taskService.complete(task.getId()); } processInstances = runtimeService.createProcessInstanceQuery().list(); assertEquals(0, processInstances.size()); jobs = managementService.createTimerJobQuery().list(); assertEquals(0, jobs.size()); jobs = managementService.createJobQuery().list(); assertEquals(0, jobs.size()); tasks = taskService.createTaskQuery().list(); assertEquals(0, tasks.size()); listener.clearEventsReceived(); processEngineConfiguration.setClock(previousClock); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); }
/** * Timer repetition */
Timer repetition
testCycleDateStartTimerEvent
{ "repo_name": "lsmall/flowable-engine", "path": "modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/timer/StartTimerEventRepeatWithoutEndDateTest.java", "license": "apache-2.0", "size": 8865 }
[ "java.util.Calendar", "java.util.List", "org.flowable.common.engine.api.delegate.event.FlowableEngineEventType", "org.flowable.common.engine.api.delegate.event.FlowableEvent", "org.flowable.common.engine.impl.runtime.Clock", "org.flowable.common.engine.impl.util.DefaultClockImpl", "org.flowable.engine.runtime.ProcessInstance", "org.flowable.job.api.Job" ]
import java.util.Calendar; import java.util.List; import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType; import org.flowable.common.engine.api.delegate.event.FlowableEvent; import org.flowable.common.engine.impl.runtime.Clock; import org.flowable.common.engine.impl.util.DefaultClockImpl; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.job.api.Job;
import java.util.*; import org.flowable.common.engine.api.delegate.event.*; import org.flowable.common.engine.impl.runtime.*; import org.flowable.common.engine.impl.util.*; import org.flowable.engine.runtime.*; import org.flowable.job.api.*;
[ "java.util", "org.flowable.common", "org.flowable.engine", "org.flowable.job" ]
java.util; org.flowable.common; org.flowable.engine; org.flowable.job;
1,758,299
public static String format(Context c, int id, Object...objects) { String f = c.getString(id); return String.format(f, objects); }
static String function(Context c, int id, Object...objects) { String f = c.getString(id); return String.format(f, objects); }
/** * Format the given string using the passed paraeters. */
Format the given string using the passed paraeters
format
{ "repo_name": "Grunthos/Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/utils/Utils.java", "license": "gpl-3.0", "size": 70195 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,883,154
public Plugin[] loadPlugins(File directory) { Validate.notNull(directory, "Directory cannot be null"); Validate.isTrue(directory.isDirectory(), "Directory must be a directory"); List<Plugin> result = new ArrayList<Plugin>(); Set<Pattern> filters = fileAssociations.keySet(); if (!(server.getUpdateFolder().equals(""))) { updateDirectory = new File(directory, server.getUpdateFolder()); } Map<String, File> plugins = new HashMap<String, File>(); Set<String> loadedPlugins = new HashSet<String>(); Map<String, Collection<String>> dependencies = new HashMap<String, Collection<String>>(); Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>(); // This is where it figures out all possible plugins for (File file : directory.listFiles()) { PluginLoader loader = null; for (Pattern filter : filters) { Matcher match = filter.matcher(file.getName()); if (match.find()) { loader = fileAssociations.get(filter); } } if (loader == null) continue; PluginDescriptionFile description = null; try { description = loader.getPluginDescription(file); String name = description.getName(); if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name"); continue; } else if (description.rawName.indexOf(' ') != -1) { server.getLogger().warning(String.format( "Plugin `%s' uses the space-character (0x20) in its name `%s' - this is discouraged", description.getFullName(), description.rawName )); } } catch (InvalidDescriptionException ex) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); continue; } File replacedFile = plugins.put(description.getName(), file); if (replacedFile != null) { server.getLogger().severe(String.format( "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'", description.getName(), file.getPath(), replacedFile.getPath(), directory.getPath() )); } Collection<String> softDependencySet = description.getSoftDepend(); if (softDependencySet != null && !softDependencySet.isEmpty()) { if (softDependencies.containsKey(description.getName())) { // Duplicates do not matter, they will be removed together if applicable softDependencies.get(description.getName()).addAll(softDependencySet); } else { softDependencies.put(description.getName(), new LinkedList<String>(softDependencySet)); } } Collection<String> dependencySet = description.getDepend(); if (dependencySet != null && !dependencySet.isEmpty()) { dependencies.put(description.getName(), new LinkedList<String>(dependencySet)); } Collection<String> loadBeforeSet = description.getLoadBefore(); if (loadBeforeSet != null && !loadBeforeSet.isEmpty()) { for (String loadBeforeTarget : loadBeforeSet) { if (softDependencies.containsKey(loadBeforeTarget)) { softDependencies.get(loadBeforeTarget).add(description.getName()); } else { // softDependencies is never iterated, so 'ghost' plugins aren't an issue Collection<String> shortSoftDependency = new LinkedList<String>(); shortSoftDependency.add(description.getName()); softDependencies.put(loadBeforeTarget, shortSoftDependency); } } } } while (!plugins.isEmpty()) { boolean missingDependency = true; Iterator<String> pluginIterator = plugins.keySet().iterator(); while (pluginIterator.hasNext()) { String plugin = pluginIterator.next(); if (dependencies.containsKey(plugin)) { Iterator<String> dependencyIterator = dependencies.get(plugin).iterator(); while (dependencyIterator.hasNext()) { String dependency = dependencyIterator.next(); // Dependency loaded if (loadedPlugins.contains(dependency)) { dependencyIterator.remove(); // We have a dependency not found } else if (!plugins.containsKey(dependency)) { missingDependency = false; File file = plugins.get(plugin); pluginIterator.remove(); softDependencies.remove(plugin); dependencies.remove(plugin); server.getLogger().log( Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", new UnknownDependencyException(dependency)); break; } } if (dependencies.containsKey(plugin) && dependencies.get(plugin).isEmpty()) { dependencies.remove(plugin); } } if (softDependencies.containsKey(plugin)) { Iterator<String> softDependencyIterator = softDependencies.get(plugin).iterator(); while (softDependencyIterator.hasNext()) { String softDependency = softDependencyIterator.next(); // Soft depend is no longer around if (!plugins.containsKey(softDependency)) { softDependencyIterator.remove(); } } if (softDependencies.get(plugin).isEmpty()) { softDependencies.remove(plugin); } } if (!(dependencies.containsKey(plugin) || softDependencies.containsKey(plugin)) && plugins.containsKey(plugin)) { // We're clear to load, no more soft or hard dependencies left File file = plugins.get(plugin); pluginIterator.remove(); missingDependency = false; try { result.add(loadPlugin(file)); loadedPlugins.add(plugin); continue; } catch (InvalidPluginException ex) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); } } } if (missingDependency) { // We now iterate over plugins until something loads // This loop will ignore soft dependencies pluginIterator = plugins.keySet().iterator(); while (pluginIterator.hasNext()) { String plugin = pluginIterator.next(); if (!dependencies.containsKey(plugin)) { softDependencies.remove(plugin); missingDependency = false; File file = plugins.get(plugin); pluginIterator.remove(); try { result.add(loadPlugin(file)); loadedPlugins.add(plugin); break; } catch (InvalidPluginException ex) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); } } } // We have no plugins left without a depend if (missingDependency) { softDependencies.clear(); dependencies.clear(); Iterator<File> failedPluginIterator = plugins.values().iterator(); while (failedPluginIterator.hasNext()) { File file = failedPluginIterator.next(); failedPluginIterator.remove(); server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected"); } } } } return result.toArray(new Plugin[result.size()]); }
Plugin[] function(File directory) { Validate.notNull(directory, STR); Validate.isTrue(directory.isDirectory(), STR); List<Plugin> result = new ArrayList<Plugin>(); Set<Pattern> filters = fileAssociations.keySet(); if (!(server.getUpdateFolder().equals(STRbukkitSTRminecraftSTRmojangSTRCould not load 'STR' in folder 'STR': Restricted NameSTRPlugin `%s' uses the space-character (0x20) in its name `%s' - this is discouragedSTRCould not load 'STR' in folder 'STR'STRAmbiguous plugin name `%s' for files `%s' and `%s' in `%s'STRCould not load 'STR' in folder 'STR'STRCould not load 'STR' in folder 'STR'STRCould not load 'STR' in folder 'STR'STRCould not load 'STR' in folder 'STR': circular dependency detected"); } } } } return result.toArray(new Plugin[result.size()]); }
/** * Loads the plugins contained within the specified directory * * @param directory Directory to check for plugins * @return A list of all plugins loaded */
Loads the plugins contained within the specified directory
loadPlugins
{ "repo_name": "TacoSpigot/Bukkit", "path": "src/main/java/org/bukkit/plugin/SimplePluginManager.java", "license": "gpl-3.0", "size": 28823 }
[ "java.io.File", "java.util.ArrayList", "java.util.List", "java.util.Set", "java.util.regex.Pattern", "org.apache.commons.lang.Validate" ]
import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import org.apache.commons.lang.Validate;
import java.io.*; import java.util.*; import java.util.regex.*; import org.apache.commons.lang.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
2,760,550
// Get point after nodelet Point<Node> point = nodelet.getParentNode() != null ? Point.inElement(nodelet.getParentNode(), nodelet.getNextSibling()) : null; // Attach nodelet to document body Document.get().getBody().appendChild(nodelet); return point; }
Point<Node> point = nodelet.getParentNode() != null ? Point.inElement(nodelet.getParentNode(), nodelet.getNextSibling()) : null; Document.get().getBody().appendChild(nodelet); return point; }
/** * Some IE element classes require their html nodelets be attached to * somewhere under the body of html document in order for implementation to * work. See, e.g., {@link ParagraphHelperIE#onEmpty(Element)} */
Some IE element classes require their html nodelets be attached to somewhere under the body of html document in order for implementation to work. See, e.g., <code>ParagraphHelperIE#onEmpty(Element)</code>
beforeImplementation
{ "repo_name": "gburd/wave", "path": "src/org/waveprotocol/wave/client/editor/content/paragraph/IeNodeletHelper.java", "license": "apache-2.0", "size": 1916 }
[ "com.google.gwt.dom.client.Document", "com.google.gwt.dom.client.Node", "org.waveprotocol.wave.model.document.util.Point" ]
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Node; import org.waveprotocol.wave.model.document.util.Point;
import com.google.gwt.dom.client.*; import org.waveprotocol.wave.model.document.util.*;
[ "com.google.gwt", "org.waveprotocol.wave" ]
com.google.gwt; org.waveprotocol.wave;
2,735,281
public void testModifyResolution() { try { // increase and test long resolution = 20 * TimerThread.DEFAULT_RESOLUTION; //400 counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); // decrease much and test resolution = 5; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); // return to default and test resolution = TimerThread.DEFAULT_RESOLUTION; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); } finally { counterThread.setResolution(TimerThread.DEFAULT_RESOLUTION); } }
void function() { try { long resolution = 20 * TimerThread.DEFAULT_RESOLUTION; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); resolution = 5; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); resolution = TimerThread.DEFAULT_RESOLUTION; counterThread.setResolution(resolution); assertEquals(resolution, counterThread.getResolution()); doTestTimeout(false,true); } finally { counterThread.setResolution(TimerThread.DEFAULT_RESOLUTION); } }
/** * Test timeout behavior when resolution is modified. */
Test timeout behavior when resolution is modified
testModifyResolution
{ "repo_name": "fnp/pylucene", "path": "lucene-java-3.5.0/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java", "license": "apache-2.0", "size": 11971 }
[ "org.apache.lucene.search.TimeLimitingCollector" ]
import org.apache.lucene.search.TimeLimitingCollector;
import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
513,377
public void plotChanged(PlotChangeEvent event) { notifyListeners(event); }
void function(PlotChangeEvent event) { notifyListeners(event); }
/** * Receives a {@link PlotChangeEvent} and responds by notifying all * listeners. * * @param event the event. */
Receives a <code>PlotChangeEvent</code> and responds by notifying all listeners
plotChanged
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/chart/plot/CombinedRangeXYPlot.java", "license": "gpl-2.0", "size": 26854 }
[ "org.jfree.chart.event.PlotChangeEvent" ]
import org.jfree.chart.event.PlotChangeEvent;
import org.jfree.chart.event.*;
[ "org.jfree.chart" ]
org.jfree.chart;
629,805
@Test public void testDeleteImage() throws Exception { Image img = mmFactory.createImage(); img = (Image) iUpdate.saveAndReturnObject(img); Pixels pixels = img.getPrimaryPixels(); long pixId = pixels.getId().getValue(); // method already tested in PixelsServiceTest // make sure objects are loaded. pixels = factory.getPixelsService().retrievePixDescription(pixId); // channels. long id = img.getId().getValue(); List<Long> channels = new ArrayList<Long>(); List<Long> logicalChannels = new ArrayList<Long>(); List<Long> infos = new ArrayList<Long>(); Channel channel; LogicalChannel lc; StatsInfo info; for (int i = 0; i < pixels.getSizeC().getValue(); i++) { channel = pixels.getChannel(i); Assert.assertNotNull(channel); channels.add(channel.getId().getValue()); lc = channel.getLogicalChannel(); Assert.assertNotNull(lc); logicalChannels.add(lc.getId().getValue()); info = channel.getStatsInfo(); Assert.assertNotNull(info); infos.add(info.getId().getValue()); } Delete2 dc = Requests.delete().target(img).build(); callback(true, client, dc); ParametersI param = new ParametersI(); param.addId(id); StringBuilder sb = new StringBuilder(); sb.append("select i from Image i "); sb.append("where i.id = :id"); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); sb = new StringBuilder(); param = new ParametersI(); param.addId(pixId); sb.append("select i from Pixels i "); sb.append("where i.id = :id"); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); Iterator<Long> i = channels.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append("select i from Channel i "); sb.append("where i.id = :id"); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } i = infos.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append("select i from StatsInfo i "); sb.append("where i.id = :id"); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } i = logicalChannels.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append("select i from LogicalChannel i "); sb.append("where i.id = :id"); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } }
void function() throws Exception { Image img = mmFactory.createImage(); img = (Image) iUpdate.saveAndReturnObject(img); Pixels pixels = img.getPrimaryPixels(); long pixId = pixels.getId().getValue(); pixels = factory.getPixelsService().retrievePixDescription(pixId); long id = img.getId().getValue(); List<Long> channels = new ArrayList<Long>(); List<Long> logicalChannels = new ArrayList<Long>(); List<Long> infos = new ArrayList<Long>(); Channel channel; LogicalChannel lc; StatsInfo info; for (int i = 0; i < pixels.getSizeC().getValue(); i++) { channel = pixels.getChannel(i); Assert.assertNotNull(channel); channels.add(channel.getId().getValue()); lc = channel.getLogicalChannel(); Assert.assertNotNull(lc); logicalChannels.add(lc.getId().getValue()); info = channel.getStatsInfo(); Assert.assertNotNull(info); infos.add(info.getId().getValue()); } Delete2 dc = Requests.delete().target(img).build(); callback(true, client, dc); ParametersI param = new ParametersI(); param.addId(id); StringBuilder sb = new StringBuilder(); sb.append(STR); sb.append(STR); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); sb = new StringBuilder(); param = new ParametersI(); param.addId(pixId); sb.append(STR); sb.append(STR); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); Iterator<Long> i = channels.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append(STR); sb.append(STR); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } i = infos.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append(STR); sb.append(STR); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } i = logicalChannels.iterator(); while (i.hasNext()) { id = i.next(); param = new ParametersI(); param.addId(id); sb = new StringBuilder(); sb.append(STR); sb.append(STR); Assert.assertNull(iQuery.findByQuery(sb.toString(), param)); } }
/** * Test to delete an image with pixels, channels, logical channels and * statistics. * * @throws Exception * Thrown if an error occurred. */
Test to delete an image with pixels, channels, logical channels and statistics
testDeleteImage
{ "repo_name": "MontpellierRessourcesImagerie/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/DeleteServiceTest.java", "license": "gpl-2.0", "size": 157647 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.testng.Assert" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.testng.Assert;
import java.util.*; import org.testng.*;
[ "java.util", "org.testng" ]
java.util; org.testng;
1,677,282
protected void addNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_DataServiceParameter_name_feature"), getString("_UI_PropertyDescriptor_description", "_UI_DataServiceParameter_name_feature", "_UI_DataServiceParameter_type"), DsPackage.Literals.DATA_SERVICE_PARAMETER__NAME, 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), DsPackage.Literals.DATA_SERVICE_PARAMETER__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Name feature.
addNamePropertyDescriptor
{ "repo_name": "nwnpallewela/developer-studio", "path": "data-services/plugins/org.wso2.developerstudio.eclipse.ds.edit/src/org/wso2/developerstudio/eclipse/ds/provider/DataServiceParameterItemProvider.java", "license": "apache-2.0", "size": 5544 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.wso2.developerstudio.eclipse.ds.DsPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.ds.DsPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.ds.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
161,089
private void flushLeft() throws IOException { appendNewlineIfNecessary(leftBuf, leftColumn); while (leftBuf.length() != 0) { rightColumn.write('\n'); outputFullLines(); } }
void function() throws IOException { appendNewlineIfNecessary(leftBuf, leftColumn); while (leftBuf.length() != 0) { rightColumn.write('\n'); outputFullLines(); } }
/** * Flushes the left column buffer, printing it and clearing the buffer. * If the buffer is already empty, this does nothing. */
Flushes the left column buffer, printing it and clearing the buffer. If the buffer is already empty, this does nothing
flushLeft
{ "repo_name": "RyanTech/DexHunter", "path": "dalvik/dexgen/src/com/android/dexgen/util/TwoColumnOutput.java", "license": "apache-2.0", "size": 8156 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
656,033
private void notifyChangeListeners() { ChangeEvent ce = new ChangeEvent(this); for (ChangeListener mChangeListener : mChangeListeners) { mChangeListener.stateChanged(ce); } }
void function() { ChangeEvent ce = new ChangeEvent(this); for (ChangeListener mChangeListener : mChangeListeners) { mChangeListener.stateChanged(ce); } }
/** * Notify all registered change listeners that the text in the text field * has changed. */
Notify all registered change listeners that the text in the text field has changed
notifyChangeListeners
{ "repo_name": "hizhangqi/jmeter-1", "path": "src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java", "license": "apache-2.0", "size": 9175 }
[ "javax.swing.event.ChangeEvent", "javax.swing.event.ChangeListener" ]
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener;
import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
404,537
private void drawItemStack(ItemStack stack, int x, int y, String altText) { GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; FontRenderer font = null; if (stack != null) font = stack.getItem().getFontRenderer(stack); if (font == null) font = fontRendererObj; this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; } protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {}
void function(ItemStack stack, int x, int y, String altText) { GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; FontRenderer font = null; if (stack != null) font = stack.getItem().getFontRenderer(stack); if (font == null) font = fontRendererObj; this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; } protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {}
/** * Render an ItemStack. Args : stack, x, y, format */
Render an ItemStack. Args : stack, x, y, format
drawItemStack
{ "repo_name": "kelthalorn/ConquestCraft", "path": "build/tmp/recompSrc/net/minecraft/client/gui/inventory/GuiContainer.java", "license": "lgpl-2.1", "size": 28781 }
[ "net.minecraft.client.gui.FontRenderer", "net.minecraft.client.renderer.GlStateManager", "net.minecraft.item.ItemStack" ]
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack;
import net.minecraft.client.gui.*; import net.minecraft.client.renderer.*; import net.minecraft.item.*;
[ "net.minecraft.client", "net.minecraft.item" ]
net.minecraft.client; net.minecraft.item;
2,226,245
private Database initEnvAndDb(boolean isTransactional) throws DatabaseException { EnvironmentConfig envConfig = TestUtils.initEnvConfig(); envConfig.setTransactional(isTransactional); envConfig.setConfigParam (EnvironmentParams.ENV_CHECK_LEAKS.getName(), "false"); envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "6"); envConfig.setAllowCreate(true); env = create(envHome, envConfig); DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(isTransactional); dbConfig.setSortedDuplicates(true); dbConfig.setAllowCreate(true); Database myDb = env.openDatabase(null, DB_NAME, dbConfig); return myDb; }
Database function(boolean isTransactional) throws DatabaseException { EnvironmentConfig envConfig = TestUtils.initEnvConfig(); envConfig.setTransactional(isTransactional); envConfig.setConfigParam (EnvironmentParams.ENV_CHECK_LEAKS.getName(), "false"); envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "6"); envConfig.setAllowCreate(true); env = create(envHome, envConfig); DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(isTransactional); dbConfig.setSortedDuplicates(true); dbConfig.setAllowCreate(true); Database myDb = env.openDatabase(null, DB_NAME, dbConfig); return myDb; }
/** * Set up the environment and db. */
Set up the environment and db
initEnvAndDb
{ "repo_name": "bjorndm/prebake", "path": "code/third_party/bdb/test/com/sleepycat/je/TruncateTest.java", "license": "apache-2.0", "size": 17754 }
[ "com.sleepycat.je.config.EnvironmentParams", "com.sleepycat.je.util.TestUtils" ]
import com.sleepycat.je.config.EnvironmentParams; import com.sleepycat.je.util.TestUtils;
import com.sleepycat.je.config.*; import com.sleepycat.je.util.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
1,525,401
@Test public void testTextAlign() throws Exception { TimedTextObject tto = StlTestUtil.buildTto( "10:00:00:00", "10:00:05:00", "text1", "10:00:05:00", "10:00:10:12", "text2", "10:04:59:00", "23:59:59:24", "text3" ); // set styles Style style1 = new Style("1"); style1.setTextAlign("top-left"); Style style2 = new Style("2"); style2.setTextAlign("bottom-right"); Style style3 = new Style("3"); style3.setTextAlign("center"); tto.getCaptions().get(0).setStyle(style1); tto.getCaptions().get(1).setStyle(style2); tto.getCaptions().get(2).setStyle(style3); byte[][] stl = StlTestUtil.build(tto, StlTestUtil.getMetadataXml()); byte[] tti = stl[1]; int offset = 128; // subtitle zero assertEquals(0x01, tti[offset + 14]); // 01 - left assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x31}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); offset += 128; assertEquals(0x03, tti[offset + 14]); // 03 - right assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x32}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); offset += 128; assertEquals(0x02, tti[offset + 14]); // 02 - center assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x33}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); }
void function() throws Exception { TimedTextObject tto = StlTestUtil.buildTto( STR, STR, "text1", STR, STR, "text2", STR, STR, "text3" ); Style style1 = new Style("1"); style1.setTextAlign(STR); Style style2 = new Style("2"); style2.setTextAlign(STR); Style style3 = new Style("3"); style3.setTextAlign(STR); tto.getCaptions().get(0).setStyle(style1); tto.getCaptions().get(1).setStyle(style2); tto.getCaptions().get(2).setStyle(style3); byte[][] stl = StlTestUtil.build(tto, StlTestUtil.getMetadataXml()); byte[] tti = stl[1]; int offset = 128; assertEquals(0x01, tti[offset + 14]); assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x31}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); offset += 128; assertEquals(0x03, tti[offset + 14]); assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x32}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); offset += 128; assertEquals(0x02, tti[offset + 14]); assertArrayEquals( fillExpectedText(new byte[]{0x74, 0x65, 0x78, 0x74, 0x33}), Arrays.copyOfRange(tti, offset + 16, offset + 128)); }
/** * Checks that text is aligned correctly * * @throws Exception */
Checks that text is aligned correctly
testTextAlign
{ "repo_name": "DSRCorporation/imf-conversion", "path": "ttml-to-stl/src/test/java/com/netflix/imfutility/ttmltostl/stl/StlTtiTest.java", "license": "gpl-3.0", "size": 38742 }
[ "com.netflix.imfutility.ttmltostl.ttml.Style", "com.netflix.imfutility.ttmltostl.ttml.TimedTextObject", "com.netflix.imfutility.ttmltostl.util.StlTestUtil", "java.util.Arrays", "junit.framework.TestCase", "org.junit.Assert" ]
import com.netflix.imfutility.ttmltostl.ttml.Style; import com.netflix.imfutility.ttmltostl.ttml.TimedTextObject; import com.netflix.imfutility.ttmltostl.util.StlTestUtil; import java.util.Arrays; import junit.framework.TestCase; import org.junit.Assert;
import com.netflix.imfutility.ttmltostl.ttml.*; import com.netflix.imfutility.ttmltostl.util.*; import java.util.*; import junit.framework.*; import org.junit.*;
[ "com.netflix.imfutility", "java.util", "junit.framework", "org.junit" ]
com.netflix.imfutility; java.util; junit.framework; org.junit;
511,643
public static MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection> getProductReservationsClient(com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.ProductReservationUrl.getProductReservationsUrl(filter, pageSize, responseFields, sortBy, startIndex); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.ProductReservationCollection.class; MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; }
static MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection> function(com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.ProductReservationUrl.getProductReservationsUrl(filter, pageSize, responseFields, sortBy, startIndex); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.ProductReservationCollection.class; MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; }
/** * Retrieves a list of product reservations according to any specified filter criteria and sort options. * <p><pre><code> * MozuClient<com.mozu.api.contracts.productadmin.ProductReservationCollection> mozuClient=GetProductReservationsClient(dataViewMode, startIndex, pageSize, sortBy, filter, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * ProductReservationCollection productReservationCollection = client.Result(); * </code></pre></p> * @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true" * @param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200. * @param responseFields Use this field to include those fields which are not included by default. * @param sortBy * @param startIndex * @param dataViewMode DataViewMode * @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.ProductReservationCollection> * @see com.mozu.api.contracts.productadmin.ProductReservationCollection */
Retrieves a list of product reservations according to any specified filter criteria and sort options. <code><code> MozuClient mozuClient=GetProductReservationsClient(dataViewMode, startIndex, pageSize, sortBy, filter, responseFields); client.setBaseAddress(url); client.executeRequest(); ProductReservationCollection productReservationCollection = client.Result(); </code></code>
getProductReservationsClient
{ "repo_name": "sanjaymandadi/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/ProductReservationClient.java", "license": "mit", "size": 15331 }
[ "com.mozu.api.DataViewMode", "com.mozu.api.Headers", "com.mozu.api.MozuClient", "com.mozu.api.MozuClientFactory", "com.mozu.api.MozuUrl" ]
import com.mozu.api.DataViewMode; import com.mozu.api.Headers; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
114,073
@Test public void testSerializationPM_Type() { try { TestTools.defineSchema(PersRefToPM.class); fail(); } catch (JDOUserException e) { //good. defining classes with PM attributes should not be allowed } }
void function() { try { TestTools.defineSchema(PersRefToPM.class); fail(); } catch (JDOUserException e) { } }
/** * Test serialisation of classes with obvious PM attributes. * * This used to fail because of NPE in OGT (see next test) and then because of StackOverflow. */
Test serialisation of classes with obvious PM attributes. This used to fail because of NPE in OGT (see next test) and then because of StackOverflow
testSerializationPM_Type
{ "repo_name": "NickCharsley/zoodb", "path": "tst/org/zoodb/test/jdo/Test_084_SerailizationBugRefToPM.java", "license": "gpl-3.0", "size": 5831 }
[ "javax.jdo.JDOUserException", "org.junit.Assert", "org.zoodb.test.testutil.TestTools" ]
import javax.jdo.JDOUserException; import org.junit.Assert; import org.zoodb.test.testutil.TestTools;
import javax.jdo.*; import org.junit.*; import org.zoodb.test.testutil.*;
[ "javax.jdo", "org.junit", "org.zoodb.test" ]
javax.jdo; org.junit; org.zoodb.test;
2,325,285
private static void escribirFutbolistas() { Writer output = null; try { output = new BufferedWriter(new FileWriter(nombrefichero2)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { for (int i = 0; i < futbolistas.length; i++) { output.write(futbolistas[i] + "\n"); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { output.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
static void function() { Writer output = null; try { output = new BufferedWriter(new FileWriter(nombrefichero2)); } catch (IOException e) { e.printStackTrace(); } try { for (int i = 0; i < futbolistas.length; i++) { output.write(futbolistas[i] + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } }
/** * Metodo que Escribe los Futbolistas en el Archivo */
Metodo que Escribe los Futbolistas en el Archivo
escribirFutbolistas
{ "repo_name": "davidhmhernandez/AcesoDatos", "path": "Act4.4/src/Main.java", "license": "epl-1.0", "size": 1742 }
[ "java.io.BufferedWriter", "java.io.FileWriter", "java.io.IOException", "java.io.Writer" ]
import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
726,553
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<RouteFilterInner> listByResourceGroup(String resourceGroupName);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<RouteFilterInner> listByResourceGroup(String resourceGroupName);
/** * Gets all route filters in a resource group. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all route filters in a resource group as paginated response with {@link PagedIterable}. */
Gets all route filters in a resource group
listByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/RouteFiltersClient.java", "license": "mit", "size": 23978 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.network.fluent.models.RouteFilterInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.fluent.models.RouteFilterInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,399,702
@Override public Set<Short> getBroadcastPorts(long targetSw, long src, short srcPort, boolean tunnelEnabled) { TopologyInstance ti = getCurrentInstance(tunnelEnabled); return ti.getBroadcastPorts(targetSw, src, srcPort); }
Set<Short> function(long targetSw, long src, short srcPort, boolean tunnelEnabled) { TopologyInstance ti = getCurrentInstance(tunnelEnabled); return ti.getBroadcastPorts(targetSw, src, srcPort); }
/** Get all the ports on the target switch (targetSw) on which a * broadcast packet must be sent from a host whose attachment point * is on switch port (src, srcPort). */
Get all the ports on the target switch (targetSw) on which a broadcast packet must be sent from a host whose attachment point is on switch port (src, srcPort)
getBroadcastPorts
{ "repo_name": "jmiserez/floodlight", "path": "src/main/java/net/floodlightcontroller/topology/TopologyManager.java", "license": "apache-2.0", "size": 56464 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,053,139
@Override public SailImplConfig getConfig() { return new HBaseSailConfig(); }
SailImplConfig function() { return new HBaseSailConfig(); }
/** * Factory method for instantiating an HBaseSailConfig * @return new HBaseSailConfig instance */
Factory method for instantiating an HBaseSailConfig
getConfig
{ "repo_name": "Merck/Halyard", "path": "sail/src/main/java/com/msd/gin/halyard/sail/HBaseSailFactory.java", "license": "apache-2.0", "size": 2279 }
[ "org.eclipse.rdf4j.sail.config.SailImplConfig" ]
import org.eclipse.rdf4j.sail.config.SailImplConfig;
import org.eclipse.rdf4j.sail.config.*;
[ "org.eclipse.rdf4j" ]
org.eclipse.rdf4j;
1,458,888
public void fromMap(Map map) { setSegNo(StringUtils.defaultIfEmpty(((String)map.get("segNo")), segNo)); setPreBillId(StringUtils.defaultIfEmpty(((String)map.get("preBillId")), preBillId)); setPreBillSubid(StringUtils.defaultIfEmpty(((String)map.get("preBillSubid")), preBillSubid)); setContractId(StringUtils.defaultIfEmpty(((String)map.get("contractId")), contractId)); setContractSubid(StringUtils.defaultIfEmpty(((String)map.get("contractSubid")), contractSubid)); setS_resourceId(StringUtils.defaultIfEmpty(((String)map.get("s_resourceId")), s_resourceId)); setGoodSegNo(StringUtils.defaultIfEmpty(((String)map.get("goodSegNo")), goodSegNo)); setGoodId(StringUtils.defaultIfEmpty(((String)map.get("goodId")), goodId)); setProductId(StringUtils.defaultIfEmpty(((String)map.get("productId")), productId)); setFactoryProductId(StringUtils.defaultIfEmpty(((String)map.get("factoryProductId")), factoryProductId)); setPlanWeight(NumberUtils.toBigDecimal(((String)map.get("planWeight")), planWeight)); setPlanQty(NumberUtils.toBigDecimal(((String)map.get("planQty")), planQty)); setWeightUnit(StringUtils.defaultIfEmpty(((String)map.get("weightUnit")), weightUnit)); setQuantityUnit(StringUtils.defaultIfEmpty(((String)map.get("quantityUnit")), quantityUnit)); setUnitConversion(NumberUtils.toDouble(((String)map.get("unitConversion")), unitConversion)); setSalePriceNotax(NumberUtils.toBigDecimal(((String)map.get("salePriceNotax")), salePriceNotax)); setTaxRate(NumberUtils.toFloat(((String)map.get("taxRate")), taxRate)); setFreightPrice(NumberUtils.toBigDecimal(((String)map.get("freightPrice")), freightPrice)); setOutPrice(NumberUtils.toBigDecimal(((String)map.get("outPrice")), outPrice)); setOtherAmount(NumberUtils.toDouble(((String)map.get("otherAmount")), otherAmount)); setTransChargeCode(StringUtils.defaultIfEmpty(((String)map.get("transChargeCode")), transChargeCode)); setStoreChargeCode(StringUtils.defaultIfEmpty(((String)map.get("storeChargeCode")), storeChargeCode)); setBillSubstatus(StringUtils.defaultIfEmpty(((String)map.get("billSubstatus")), billSubstatus)); setSalePriceAt(NumberUtils.toBigDecimal(((String)map.get("salePriceAt")), salePriceAt)); setIfFinishConsign(StringUtils.defaultIfEmpty(((String)map.get("ifFinishConsign")), ifFinishConsign)); setBillExpiateQty(NumberUtils.toBigDecimal(((String)map.get("billExpiateQty")), billExpiateQty)); setSubRemark(StringUtils.defaultIfEmpty(((String)map.get("subRemark")), subRemark)); setBillId(StringUtils.defaultIfEmpty(((String)map.get("billId")), billId)); setBillSubid(StringUtils.defaultIfEmpty(((String)map.get("billSubid")), billSubid)); setInstructionId(StringUtils.defaultIfEmpty(((String)map.get("instructionId")), instructionId)); setInstructionSubid(StringUtils.defaultIfEmpty(((String)map.get("instructionSubid")), instructionSubid)); setProductTypeId(StringUtils.defaultIfEmpty(((String)map.get("productTypeId")), productTypeId)); setShopsign(StringUtils.defaultIfEmpty(((String)map.get("shopsign")), shopsign)); setTechStandard(StringUtils.defaultIfEmpty(((String)map.get("techStandard")), techStandard)); setProducingAreaCode(StringUtils.defaultIfEmpty(((String)map.get("producingAreaCode")), producingAreaCode)); setQualityGrade(StringUtils.defaultIfEmpty(((String)map.get("qualityGrade")), qualityGrade)); setSpec(StringUtils.defaultIfEmpty(((String)map.get("spec")), spec)); }
void function(Map map) { setSegNo(StringUtils.defaultIfEmpty(((String)map.get("segNo")), segNo)); setPreBillId(StringUtils.defaultIfEmpty(((String)map.get(STR)), preBillId)); setPreBillSubid(StringUtils.defaultIfEmpty(((String)map.get(STR)), preBillSubid)); setContractId(StringUtils.defaultIfEmpty(((String)map.get(STR)), contractId)); setContractSubid(StringUtils.defaultIfEmpty(((String)map.get(STR)), contractSubid)); setS_resourceId(StringUtils.defaultIfEmpty(((String)map.get(STR)), s_resourceId)); setGoodSegNo(StringUtils.defaultIfEmpty(((String)map.get(STR)), goodSegNo)); setGoodId(StringUtils.defaultIfEmpty(((String)map.get(STR)), goodId)); setProductId(StringUtils.defaultIfEmpty(((String)map.get(STR)), productId)); setFactoryProductId(StringUtils.defaultIfEmpty(((String)map.get(STR)), factoryProductId)); setPlanWeight(NumberUtils.toBigDecimal(((String)map.get(STR)), planWeight)); setPlanQty(NumberUtils.toBigDecimal(((String)map.get(STR)), planQty)); setWeightUnit(StringUtils.defaultIfEmpty(((String)map.get(STR)), weightUnit)); setQuantityUnit(StringUtils.defaultIfEmpty(((String)map.get(STR)), quantityUnit)); setUnitConversion(NumberUtils.toDouble(((String)map.get(STR)), unitConversion)); setSalePriceNotax(NumberUtils.toBigDecimal(((String)map.get(STR)), salePriceNotax)); setTaxRate(NumberUtils.toFloat(((String)map.get(STR)), taxRate)); setFreightPrice(NumberUtils.toBigDecimal(((String)map.get(STR)), freightPrice)); setOutPrice(NumberUtils.toBigDecimal(((String)map.get(STR)), outPrice)); setOtherAmount(NumberUtils.toDouble(((String)map.get(STR)), otherAmount)); setTransChargeCode(StringUtils.defaultIfEmpty(((String)map.get(STR)), transChargeCode)); setStoreChargeCode(StringUtils.defaultIfEmpty(((String)map.get(STR)), storeChargeCode)); setBillSubstatus(StringUtils.defaultIfEmpty(((String)map.get(STR)), billSubstatus)); setSalePriceAt(NumberUtils.toBigDecimal(((String)map.get(STR)), salePriceAt)); setIfFinishConsign(StringUtils.defaultIfEmpty(((String)map.get(STR)), ifFinishConsign)); setBillExpiateQty(NumberUtils.toBigDecimal(((String)map.get(STR)), billExpiateQty)); setSubRemark(StringUtils.defaultIfEmpty(((String)map.get(STR)), subRemark)); setBillId(StringUtils.defaultIfEmpty(((String)map.get(STR)), billId)); setBillSubid(StringUtils.defaultIfEmpty(((String)map.get(STR)), billSubid)); setInstructionId(StringUtils.defaultIfEmpty(((String)map.get(STR)), instructionId)); setInstructionSubid(StringUtils.defaultIfEmpty(((String)map.get(STR)), instructionSubid)); setProductTypeId(StringUtils.defaultIfEmpty(((String)map.get(STR)), productTypeId)); setShopsign(StringUtils.defaultIfEmpty(((String)map.get(STR)), shopsign)); setTechStandard(StringUtils.defaultIfEmpty(((String)map.get(STR)), techStandard)); setProducingAreaCode(StringUtils.defaultIfEmpty(((String)map.get(STR)), producingAreaCode)); setQualityGrade(StringUtils.defaultIfEmpty(((String)map.get(STR)), qualityGrade)); setSpec(StringUtils.defaultIfEmpty(((String)map.get("spec")), spec)); }
/** * get the value from Map */
get the value from Map
fromMap
{ "repo_name": "stserp/erp1", "path": "source/src/com/baosight/sts/st/xs/domain/STXS1801D.java", "license": "apache-2.0", "size": 33286 }
[ "com.baosight.iplat4j.util.NumberUtils", "com.baosight.iplat4j.util.StringUtils", "java.util.Map" ]
import com.baosight.iplat4j.util.NumberUtils; import com.baosight.iplat4j.util.StringUtils; import java.util.Map;
import com.baosight.iplat4j.util.*; import java.util.*;
[ "com.baosight.iplat4j", "java.util" ]
com.baosight.iplat4j; java.util;
702,385
void searchForScenarios(Queue<Map<String, String>> queue, AtomicBoolean flag) throws IOException;
void searchForScenarios(Queue<Map<String, String>> queue, AtomicBoolean flag) throws IOException;
/** * Fills the queue with Maps of variable assignments produced by a DFS strategy; * the DFS is performed on a possible state bound up inside the Frontier and will * stop early if flag is set to true * * @param queue the queue * @param flag the exit flag * @throws IOException io exception */
Fills the queue with Maps of variable assignments produced by a DFS strategy; the DFS is performed on a possible state bound up inside the Frontier and will stop early if flag is set to true
searchForScenarios
{ "repo_name": "shraddha-patel/DGWithSpark", "path": "dg-core/src/main/java/org/finra/datagenerator/engine/Frontier.java", "license": "apache-2.0", "size": 2060 }
[ "java.io.IOException", "java.util.Map", "java.util.Queue", "java.util.concurrent.atomic.AtomicBoolean" ]
import java.io.IOException; import java.util.Map; import java.util.Queue; import java.util.concurrent.atomic.AtomicBoolean;
import java.io.*; import java.util.*; import java.util.concurrent.atomic.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,485,903
public static void localManagementReconfigure(Connection c, String iface) throws Types.BadServerResponse, XmlRpcException { String method_call = "host.local_management_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(iface)}; Map response = c.dispatch(method_call, method_params); if(response.get("Status").equals("Success")) { Object result = response.get("Value"); return; } throw new Types.BadServerResponse(response); }
static void function(Connection c, String iface) throws Types.BadServerResponse, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(iface)}; Map response = c.dispatch(method_call, method_params); if(response.get(STR).equals(STR)) { Object result = response.get("Value"); return; } throw new Types.BadServerResponse(response); }
/** * Reconfigure the management network interface. Should only be used if Host.management_reconfigure is impossible because the network configuration is broken. * * @param iface name of the interface to use as a management interface */
Reconfigure the management network interface. Should only be used if Host.management_reconfigure is impossible because the network configuration is broken
localManagementReconfigure
{ "repo_name": "cc14514/hq6", "path": "hq-plugin/xen-plugin/src/main/java/com/xensource/xenapi/Host.java", "license": "unlicense", "size": 71202 }
[ "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
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;
1,299,875
public void extractArchive(Path archived, Path extractDirectory) throws IOException, ArchiveException;
void function(Path archived, Path extractDirectory) throws IOException, ArchiveException;
/** * Extracts an archive to the given directory. * @param archived The archived file. * @param extractDirectory The directory to which we will extracts the contents of the archive. * @throws IOException * @throws ArchiveException */
Extracts an archive to the given directory
extractArchive
{ "repo_name": "donaldmcdougal/compression", "path": "src/main/java/com/schneider/utils/archiving/Archiver.java", "license": "apache-2.0", "size": 941 }
[ "java.io.IOException", "java.nio.file.Path", "org.apache.commons.compress.archivers.ArchiveException" ]
import java.io.IOException; import java.nio.file.Path; import org.apache.commons.compress.archivers.ArchiveException;
import java.io.*; import java.nio.file.*; import org.apache.commons.compress.archivers.*;
[ "java.io", "java.nio", "org.apache.commons" ]
java.io; java.nio; org.apache.commons;
678,499
public MetaProperty<ObservableId> rateId() { return rateId; }
MetaProperty<ObservableId> function() { return rateId; }
/** * The meta-property for the {@code rateId} property. * @return the meta-property, not null */
The meta-property for the rateId property
rateId
{ "repo_name": "OpenGamma/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/curve/node/FixedInflationSwapCurveNode.java", "license": "apache-2.0", "size": 28897 }
[ "com.opengamma.strata.data.ObservableId", "org.joda.beans.MetaProperty" ]
import com.opengamma.strata.data.ObservableId; import org.joda.beans.MetaProperty;
import com.opengamma.strata.data.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
1,486,356
public Locale getLocale() { return m_locale; }
Locale function() { return m_locale; }
/** * Returns the language locale of this index.<p> * * @return the language locale of this index, for example "en" */
Returns the language locale of this index
getLocale
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/search/CmsSearchIndex.java", "license": "lgpl-2.1", "size": 93424 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,821,448
public static int[] shape(INDArrayIndex... indices) { int[] ret = new int[indices.length]; for (int i = 0; i < ret.length; i++) { ret[i] = indices[i].length(); } List<Integer> nonZeros = new ArrayList<>(); for (int i = 0; i < ret.length; i++) { if (ret[i] > 0) nonZeros.add(ret[i]); } return ArrayUtil.toArray(nonZeros); }
static int[] function(INDArrayIndex... indices) { int[] ret = new int[indices.length]; for (int i = 0; i < ret.length; i++) { ret[i] = indices[i].length(); } List<Integer> nonZeros = new ArrayList<>(); for (int i = 0; i < ret.length; i++) { if (ret[i] > 0) nonZeros.add(ret[i]); } return ArrayUtil.toArray(nonZeros); }
/** * Calculate the shape for the given set of indices. * <p/> * The shape is defined as (for each dimension) * the difference between the end index + 1 and * the begin index * * @param indices the indices to calculate the shape for * @return the shape for the given indices */
Calculate the shape for the given set of indices. The shape is defined as (for each dimension) the difference between the end index + 1 and the begin index
shape
{ "repo_name": "ZenDevelopmentSystems/nd4j", "path": "nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java", "license": "apache-2.0", "size": 17761 }
[ "java.util.ArrayList", "java.util.List", "org.nd4j.linalg.util.ArrayUtil" ]
import java.util.ArrayList; import java.util.List; import org.nd4j.linalg.util.ArrayUtil;
import java.util.*; import org.nd4j.linalg.util.*;
[ "java.util", "org.nd4j.linalg" ]
java.util; org.nd4j.linalg;
2,041,770
public Set<Long> search(String key, String query);
Set<Long> function(String key, String query);
/** * Search {@code key} for {@code query}. * <p> * This method performs a fulltext search for {@code query} in all data * <em>currently</em> mapped from {@code key}. * </p> * * @param key * @param query * @return the Set of primary keys identifying the records matching the * search */
Search key for query. This method performs a fulltext search for query in all data currently mapped from key.
search
{ "repo_name": "JerJohn15/concourse", "path": "concourse-server/src/main/java/com/cinchapi/concourse/server/storage/Store.java", "license": "apache-2.0", "size": 10638 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
488,705
public HeartbeatResponse heartbeat(TaskTrackerStatus status, boolean restarted, boolean initialContact, boolean acceptNewTasks, short responseId) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Got heartbeat from: " + status.getTrackerName() + " (restarted: " + restarted + " initialContact: " + initialContact + " acceptNewTasks: " + acceptNewTasks + ")" + " with responseId: " + responseId); } short newResponseId; boolean shouldSchedule, addRestartInfo = false; TaskTrackerStatus taskTrackerStatus; String trackerName; synchronized (this) { // Make sure heartbeat is from a tasktracker allowed by the jobtracker. if (!acceptTaskTracker(status)) { throw new DisallowedTaskTrackerException(status); } // First check if the last heartbeat response got through trackerName = status.getTrackerName(); long now = getClock().getTime(); boolean isBlacklisted = false; if (restarted) { faultyTrackers.markTrackerHealthy(status.getHost()); } else { isBlacklisted = faultyTrackers.shouldAssignTasksToTracker(status.getHost(), now); } HeartbeatResponse prevHeartbeatResponse = trackerToHeartbeatResponseMap.get(trackerName); if (initialContact != true) { // If this isn't the 'initial contact' from the tasktracker, // there is something seriously wrong if the JobTracker has // no record of the 'previous heartbeat'; if so, ask the // tasktracker to re-initialize itself. if (prevHeartbeatResponse == null) { // Jobtracker might have restarted but no recovery is needed // otherwise this code should not be reached LOG.warn("Serious problem, cannot find record of 'previous' " + "heartbeat for '" + trackerName + "'; reinitializing the tasktracker"); return new HeartbeatResponse(responseId, new TaskTrackerAction[] {new ReinitTrackerAction()}); } else { // It is completely safe to not process a 'duplicate' heartbeat from a // {@link TaskTracker} since it resends the heartbeat when rpcs are // lost see {@link TaskTracker.transmitHeartbeat()}; // acknowledge it by re-sending the previous response to let the // {@link TaskTracker} go forward. if (prevHeartbeatResponse.getResponseId() != responseId) { LOG.info("Ignoring 'duplicate' heartbeat from '" + trackerName + "'; resending the previous 'lost' response"); return prevHeartbeatResponse; } } } // Process this heartbeat newResponseId = (short)(responseId + 1); status.setLastSeen(now); if (!processHeartbeat(status, initialContact)) { if (prevHeartbeatResponse != null) { trackerToHeartbeatResponseMap.remove(trackerName); } return new HeartbeatResponse(newResponseId, new TaskTrackerAction[] {new ReinitTrackerAction()}); } shouldSchedule = acceptNewTasks && !faultyTrackers.isBlacklisted(status.getHost()); taskTrackerStatus = shouldSchedule ? getTaskTrackerStatus(trackerName) : null; } // synchronized JobTracker // Initialize the response to be sent for the heartbeat HeartbeatResponse response = new HeartbeatResponse(newResponseId, null); List<TaskTrackerAction> actions = new ArrayList<TaskTrackerAction>(); List<Task> setupCleanupTasks = null; // Check for setup/cleanup tasks to be executed on the tasktracker if (shouldSchedule) { if (taskTrackerStatus == null) { LOG.warn("Unknown task tracker polling; ignoring: " + trackerName); } else { setupCleanupTasks = getSetupAndCleanupTasks(taskTrackerStatus); } } synchronized (this) { // Check for tasks to be killed // we compute this first so that additional tasks can be scheduled // to compensate for the kill actions List<TaskTrackerAction> killTasksList = getTasksToKill(trackerName); if (killTasksList != null) { actions.addAll(killTasksList); } // remember how many maps and reduces we killed. this will allow // extra tasks to be scheduled by the taskScheduler int mapsKilled=0, reducesKilled=0; for (TaskTrackerAction t: killTasksList) { if (((KillTaskAction)t).getTaskID().isMap()) mapsKilled++; else reducesKilled++; } status.setMapsKilled(mapsKilled); status.setReducesKilled(reducesKilled); List<Task> tasks = null; // Check for map/reduce tasks to be executed on the tasktracker // ignore any contribution by setup/cleanup tasks - it's ok to try // and overschedule since setup/cleanup tasks are super fast if (taskTrackerStatus != null) { List<Task> assignedTasks = taskScheduler.assignTasks(taskTrackers.get(trackerName)); if ((setupCleanupTasks != null) && (assignedTasks != null)) { // tasks is immutable. so merge the tasks and assignedTasks into a new list // make sure that the setup/cleanup tasks go first since we can be overscheduling // tasks here and we need to make sure that the setup/cleanup is run first tasks = new ArrayList<Task> (assignedTasks.size() + setupCleanupTasks.size()); tasks.addAll(setupCleanupTasks); tasks.addAll(assignedTasks); } else { tasks = (setupCleanupTasks != null) ? setupCleanupTasks : assignedTasks; } } if (tasks != null) { for (Task task : tasks) { TaskAttemptID taskid = task.getTaskID(); JobInProgress job = getJob(taskid.getJobID()); if (job != null) { createTaskEntry (taskid, taskTrackerStatus.getTrackerName(), job.getTaskInProgress(taskid.getTaskID())); } else { // because we do not hold the jobtracker lock throughout this // routine - there is a small chance that the job for the task // we are trying to schedule no longer exists. ignore such tasks LOG.warn("Unable to find job corresponding to task: " + taskid.toString()); } expireLaunchingTasks.addNewTask(task.getTaskID()); LOG.debug(trackerName + " -> LaunchTask: " + task.getTaskID()); actions.add(new LaunchTaskAction(task)); } } // Check for jobs to be killed/cleanedup List<TaskTrackerAction> killJobsList = getJobsForCleanup(trackerName); if (killJobsList != null) { actions.addAll(killJobsList); } // Check for tasks whose outputs can be saved List<TaskTrackerAction> commitTasksList = getTasksToSave(status); if (commitTasksList != null) { actions.addAll(commitTasksList); } // calculate next heartbeat interval and put in heartbeat response int nextInterval = getNextHeartbeatInterval(); response.setHeartbeatInterval(nextInterval); response.setActions( actions.toArray(new TaskTrackerAction[actions.size()])); // Update the trackerToHeartbeatResponseMap trackerToHeartbeatResponseMap.put(trackerName, response); // Done processing the hearbeat, now remove 'marked' tasks removeMarkedTasks(trackerName); return response; } // synchronized JobTracker }
HeartbeatResponse function(TaskTrackerStatus status, boolean restarted, boolean initialContact, boolean acceptNewTasks, short responseId) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug(STR + status.getTrackerName() + STR + restarted + STR + initialContact + STR + acceptNewTasks + ")" + STR + responseId); } short newResponseId; boolean shouldSchedule, addRestartInfo = false; TaskTrackerStatus taskTrackerStatus; String trackerName; synchronized (this) { if (!acceptTaskTracker(status)) { throw new DisallowedTaskTrackerException(status); } trackerName = status.getTrackerName(); long now = getClock().getTime(); boolean isBlacklisted = false; if (restarted) { faultyTrackers.markTrackerHealthy(status.getHost()); } else { isBlacklisted = faultyTrackers.shouldAssignTasksToTracker(status.getHost(), now); } HeartbeatResponse prevHeartbeatResponse = trackerToHeartbeatResponseMap.get(trackerName); if (initialContact != true) { if (prevHeartbeatResponse == null) { LOG.warn(STR + STR + trackerName + STR); return new HeartbeatResponse(responseId, new TaskTrackerAction[] {new ReinitTrackerAction()}); } else { if (prevHeartbeatResponse.getResponseId() != responseId) { LOG.info(STR + trackerName + STR); return prevHeartbeatResponse; } } } newResponseId = (short)(responseId + 1); status.setLastSeen(now); if (!processHeartbeat(status, initialContact)) { if (prevHeartbeatResponse != null) { trackerToHeartbeatResponseMap.remove(trackerName); } return new HeartbeatResponse(newResponseId, new TaskTrackerAction[] {new ReinitTrackerAction()}); } shouldSchedule = acceptNewTasks && !faultyTrackers.isBlacklisted(status.getHost()); taskTrackerStatus = shouldSchedule ? getTaskTrackerStatus(trackerName) : null; } HeartbeatResponse response = new HeartbeatResponse(newResponseId, null); List<TaskTrackerAction> actions = new ArrayList<TaskTrackerAction>(); List<Task> setupCleanupTasks = null; if (shouldSchedule) { if (taskTrackerStatus == null) { LOG.warn(STR + trackerName); } else { setupCleanupTasks = getSetupAndCleanupTasks(taskTrackerStatus); } } synchronized (this) { List<TaskTrackerAction> killTasksList = getTasksToKill(trackerName); if (killTasksList != null) { actions.addAll(killTasksList); } int mapsKilled=0, reducesKilled=0; for (TaskTrackerAction t: killTasksList) { if (((KillTaskAction)t).getTaskID().isMap()) mapsKilled++; else reducesKilled++; } status.setMapsKilled(mapsKilled); status.setReducesKilled(reducesKilled); List<Task> tasks = null; if (taskTrackerStatus != null) { List<Task> assignedTasks = taskScheduler.assignTasks(taskTrackers.get(trackerName)); if ((setupCleanupTasks != null) && (assignedTasks != null)) { tasks = new ArrayList<Task> (assignedTasks.size() + setupCleanupTasks.size()); tasks.addAll(setupCleanupTasks); tasks.addAll(assignedTasks); } else { tasks = (setupCleanupTasks != null) ? setupCleanupTasks : assignedTasks; } } if (tasks != null) { for (Task task : tasks) { TaskAttemptID taskid = task.getTaskID(); JobInProgress job = getJob(taskid.getJobID()); if (job != null) { createTaskEntry (taskid, taskTrackerStatus.getTrackerName(), job.getTaskInProgress(taskid.getTaskID())); } else { LOG.warn(STR + taskid.toString()); } expireLaunchingTasks.addNewTask(task.getTaskID()); LOG.debug(trackerName + STR + task.getTaskID()); actions.add(new LaunchTaskAction(task)); } } List<TaskTrackerAction> killJobsList = getJobsForCleanup(trackerName); if (killJobsList != null) { actions.addAll(killJobsList); } List<TaskTrackerAction> commitTasksList = getTasksToSave(status); if (commitTasksList != null) { actions.addAll(commitTasksList); } int nextInterval = getNextHeartbeatInterval(); response.setHeartbeatInterval(nextInterval); response.setActions( actions.toArray(new TaskTrackerAction[actions.size()])); trackerToHeartbeatResponseMap.put(trackerName, response); removeMarkedTasks(trackerName); return response; } }
/** * The periodic heartbeat mechanism between the {@link TaskTracker} and * the {@link JobTracker}. * * The {@link JobTracker} processes the status information sent by the * {@link TaskTracker} and responds with instructions to start/stop * tasks or jobs, and also 'reset' instructions during contingencies. */
The periodic heartbeat mechanism between the <code>TaskTracker</code> and the <code>JobTracker</code>. The <code>JobTracker</code> processes the status information sent by the <code>TaskTracker</code> and responds with instructions to start/stop tasks or jobs, and also 'reset' instructions during contingencies
heartbeat
{ "repo_name": "jchen123/hadoop-20-warehouse-fix", "path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java", "license": "apache-2.0", "size": 153244 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,613,924
public void testParseElementSerializer_Null() { // SETUP Properties props = new Properties(); // DO WORK IElementSerializer result = AuxiliaryCacheConfigurator .parseElementSerializer( props, "junk" ); // VERIFY assertTrue( "Should have the default Serializer.", result instanceof StandardSerializer ); }
void function() { Properties props = new Properties(); IElementSerializer result = AuxiliaryCacheConfigurator .parseElementSerializer( props, "junk" ); assertTrue( STR, result instanceof StandardSerializer ); }
/** * Verify that we can parse the ElementSerializer. */
Verify that we can parse the ElementSerializer
testParseElementSerializer_Null
{ "repo_name": "tikue/jcs2-snapshot", "path": "src/test/org/apache/commons/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java", "license": "apache-2.0", "size": 4079 }
[ "java.util.Properties", "org.apache.commons.jcs.engine.behavior.IElementSerializer", "org.apache.commons.jcs.utils.serialization.StandardSerializer" ]
import java.util.Properties; import org.apache.commons.jcs.engine.behavior.IElementSerializer; import org.apache.commons.jcs.utils.serialization.StandardSerializer;
import java.util.*; import org.apache.commons.jcs.engine.behavior.*; import org.apache.commons.jcs.utils.serialization.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,660,878
private void validateDialog() { String selectedRemote = getRemote(); if (StringUtil.isEmptyOrSpaces(selectedRemote)) { setOKActionEnabled(false); return; } setOKActionEnabled(myBranchChooser.getMarkedElements().size() != 0); }
void function() { String selectedRemote = getRemote(); if (StringUtil.isEmptyOrSpaces(selectedRemote)) { setOKActionEnabled(false); return; } setOKActionEnabled(myBranchChooser.getMarkedElements().size() != 0); }
/** * Validate dialog and enable buttons */
Validate dialog and enable buttons
validateDialog
{ "repo_name": "consulo/consulo-git", "path": "plugin/src/main/java/git4idea/merge/GitPullDialog.java", "license": "apache-2.0", "size": 11622 }
[ "com.intellij.openapi.util.text.StringUtil" ]
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.*;
[ "com.intellij.openapi" ]
com.intellij.openapi;
822,239
public void writeToFile(Path filename) { lock.lockRead(); Charset charset = Charset.forName("UTF-8"); try (BufferedWriter writer = Files.newBufferedWriter(filename, charset);) { for (String word : wordList.keySet()) { writer.write(word); for (Entry<Path, TreeSet<Integer>> entry : wordList.get(word) .entrySet()) { writer.newLine(); writer.write("\""); writer.write(entry.getKey().toString() .replace("http:/", "http://")); writer.write("\""); for (Integer index : entry.getValue()) { writer.write(", "); writer.write(index.toString()); } } writer.write("\n\n"); } } catch (IOException e) { System.out.println("ERROR: Cannot write to file."); } lock.unlockRead(); }
void function(Path filename) { lock.lockRead(); Charset charset = Charset.forName("UTF-8"); try (BufferedWriter writer = Files.newBufferedWriter(filename, charset);) { for (String word : wordList.keySet()) { writer.write(word); for (Entry<Path, TreeSet<Integer>> entry : wordList.get(word) .entrySet()) { writer.newLine(); writer.write("\"STRhttp:/STRhttp: writer.write("\""); for (Integer index : entry.getValue()) { writer.write(STR); writer.write(index.toString()); } } writer.write("\n\nSTRERROR: Cannot write to file."); } lock.unlockRead(); }
/** * Create a file with the given filename, and write the contents of * InvertedIndex to it. * * @param filename * @param toBeWritten */
Create a file with the given filename, and write the contents of InvertedIndex to it
writeToFile
{ "repo_name": "bjherger/search-engine-and-web-scraper", "path": "src/indexAndSearch/InvertedIndex.java", "license": "mit", "size": 7310 }
[ "java.io.BufferedWriter", "java.nio.charset.Charset", "java.nio.file.Files", "java.nio.file.Path", "java.util.Map", "java.util.TreeSet" ]
import java.io.BufferedWriter; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; import java.util.TreeSet;
import java.io.*; import java.nio.charset.*; import java.nio.file.*; import java.util.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
280,610
public void addFieldPropertyEditor(String propertyPath, PropertyEditor propertyEditor) { if (fieldPropertyEditors == null) { fieldPropertyEditors = new HashMap<String, PropertyEditor>(); } fieldPropertyEditors.put(propertyPath, propertyEditor); }
void function(String propertyPath, PropertyEditor propertyEditor) { if (fieldPropertyEditors == null) { fieldPropertyEditors = new HashMap<String, PropertyEditor>(); } fieldPropertyEditors.put(propertyPath, propertyEditor); }
/** * Associates a property editor instance with the given property path. * * @param propertyPath path for the property the editor should be associated with * @param propertyEditor editor instance to use when binding data for the property */
Associates a property editor instance with the given property path
addFieldPropertyEditor
{ "repo_name": "ricepanda/rice", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/lifecycle/ViewPostMetadata.java", "license": "apache-2.0", "size": 21036 }
[ "java.beans.PropertyEditor", "java.util.HashMap" ]
import java.beans.PropertyEditor; import java.util.HashMap;
import java.beans.*; import java.util.*;
[ "java.beans", "java.util" ]
java.beans; java.util;
1,859,229
public static void main(String[] args) throws TimeoutException, InterruptedException { //#thriftserverapi Hello.FutureIface impl = new HelloImpl(); ListeningServer server = Thrift.serveIface("localhost:8080", impl); Await.ready(server); //#thriftserverapi }
static void function(String[] args) throws TimeoutException, InterruptedException { Hello.FutureIface impl = new HelloImpl(); ListeningServer server = Thrift.serveIface(STR, impl); Await.ready(server); }
/** * Runs the example with given {@code args}. * * @param args the argument list */
Runs the example with given args
main
{ "repo_name": "nkhuyu/finagle", "path": "finagle-example/src/main/java/com/twitter/finagle/example/java/thrift/ThriftServer.java", "license": "apache-2.0", "size": 877 }
[ "com.twitter.finagle.ListeningServer", "com.twitter.finagle.Thrift", "com.twitter.finagle.example.thriftscala.Hello", "com.twitter.util.Await", "com.twitter.util.TimeoutException" ]
import com.twitter.finagle.ListeningServer; import com.twitter.finagle.Thrift; import com.twitter.finagle.example.thriftscala.Hello; import com.twitter.util.Await; import com.twitter.util.TimeoutException;
import com.twitter.finagle.*; import com.twitter.finagle.example.thriftscala.*; import com.twitter.util.*;
[ "com.twitter.finagle", "com.twitter.util" ]
com.twitter.finagle; com.twitter.util;
690,985
@CanIgnoreReturnValue public ToStringHelper addValue(@NullableDecl Object value) { return addHolder(value); }
ToStringHelper function(@NullableDecl Object value) { return addHolder(value); }
/** * Adds an unnamed value to the formatted output. * * <p>It is strongly encouraged to use {@link #add(String, Object)} instead and give value a * readable name. */
Adds an unnamed value to the formatted output. It is strongly encouraged to use <code>#add(String, Object)</code> instead and give value a readable name
addValue
{ "repo_name": "typetools/guava", "path": "android/guava/src/com/google/common/base/MoreObjects.java", "license": "apache-2.0", "size": 13434 }
[ "org.checkerframework.checker.nullness.compatqual.NullableDecl" ]
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
import org.checkerframework.checker.nullness.compatqual.*;
[ "org.checkerframework.checker" ]
org.checkerframework.checker;
1,045,346
void taskPropertyAssignment(@Nullable String comment, String taskType, String propertyName, Object propertyValue);
void taskPropertyAssignment(@Nullable String comment, String taskType, String propertyName, Object propertyValue);
/** * Adds a property assignment statement to the configuration of all tasks with the given type of the target of this block. */
Adds a property assignment statement to the configuration of all tasks with the given type of the target of this block
taskPropertyAssignment
{ "repo_name": "lsmaira/gradle", "path": "subprojects/build-init/src/main/java/org/gradle/buildinit/plugins/internal/CrossConfigurationScriptBlockBuilder.java", "license": "apache-2.0", "size": 2026 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,148,630
public static boolean isStructuralAttribute(String name) { return (IRIMProfileConstants.CLASS_CODE.equals(name) || IRIMProfileConstants.TYPE_CODE.equals(name) || IRIMProfileConstants.MOOD_CODE.equals(name) || IRIMProfileConstants.DETERMINER_CODE.equals(name)); }
static boolean function(String name) { return (IRIMProfileConstants.CLASS_CODE.equals(name) IRIMProfileConstants.TYPE_CODE.equals(name) IRIMProfileConstants.MOOD_CODE.equals(name) IRIMProfileConstants.DETERMINER_CODE.equals(name)); }
/** * Test if the given model attribute name is a RIM structural attribute. * * @param name * attribute name * @return true if given name is structural */
Test if the given model attribute name is a RIM structural attribute
isStructuralAttribute
{ "repo_name": "drbgfc/mdht", "path": "hl7/plugins/org.openhealthtools.mdht.uml.hl7.core/src/org/openhealthtools/mdht/uml/hl7/core/util/RIMUtil.java", "license": "epl-1.0", "size": 2649 }
[ "org.openhealthtools.mdht.uml.hdf.util.IRIMProfileConstants" ]
import org.openhealthtools.mdht.uml.hdf.util.IRIMProfileConstants;
import org.openhealthtools.mdht.uml.hdf.util.*;
[ "org.openhealthtools.mdht" ]
org.openhealthtools.mdht;
1,865,673
socket.dataHandler(new Handler<Buffer>() { @Override public void handle(Buffer event) { accessor.getDispatcher().received(prefix, event.getBytes(), sock); } }); }
socket.dataHandler(new Handler<Buffer>() { void function(Buffer event) { accessor.getDispatcher().received(prefix, event.getBytes(), sock); } }); }
/** * Handles a web socket frames (message) * @param event the data */
Handles a web socket frames (message)
handle
{ "repo_name": "cheleb/wisdom", "path": "core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/SockJsHandler.java", "license": "apache-2.0", "size": 2791 }
[ "org.vertx.java.core.Handler", "org.vertx.java.core.buffer.Buffer" ]
import org.vertx.java.core.Handler; import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.*; import org.vertx.java.core.buffer.*;
[ "org.vertx.java" ]
org.vertx.java;
1,407,641
public void moveRegionAndWait(RegionInfo destRegion, ServerName destServer) throws InterruptedException, IOException { HMaster master = getMiniHBaseCluster().getMaster(); // TODO: Here we start the move. The move can take a while. getAdmin().move(destRegion.getEncodedNameAsBytes(), destServer); while (true) { ServerName serverName = master.getAssignmentManager().getRegionStates() .getRegionServerOfRegion(destRegion); if (serverName != null && serverName.equals(destServer)) { assertRegionOnServer(destRegion, serverName, 2000); break; } Thread.sleep(10); } }
void function(RegionInfo destRegion, ServerName destServer) throws InterruptedException, IOException { HMaster master = getMiniHBaseCluster().getMaster(); getAdmin().move(destRegion.getEncodedNameAsBytes(), destServer); while (true) { ServerName serverName = master.getAssignmentManager().getRegionStates() .getRegionServerOfRegion(destRegion); if (serverName != null && serverName.equals(destServer)) { assertRegionOnServer(destRegion, serverName, 2000); break; } Thread.sleep(10); } }
/** * Move region to destination server and wait till region is completely moved and online * * @param destRegion region to move * @param destServer destination server of the region * @throws InterruptedException * @throws IOException */
Move region to destination server and wait till region is completely moved and online
moveRegionAndWait
{ "repo_name": "HubSpot/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 173926 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.RegionInfo", "org.apache.hadoop.hbase.master.HMaster" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.master.HMaster;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.master.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,069,480
public void processCommand(String scriptFunction, String[] functionArgs) { // // Initialize the JSObject by passing in a reference to the Applet // JSObject win = JSObject.getWindow(this.applet); // // // Call the JavaScript function, setFormTextEntry, and pass in the // // parameters represented by the array, args // return win.call(scriptFunction, functionArgs); DOMService service = null;
void function(String scriptFunction, String[] functionArgs) { DOMService service = null;
/** * Performs actual call to JavaScript via Applet instance passed in Constructor. * @param scriptFunction - Name of JavaScript function to call * @param functionArgs - Array of parameter to pass into JavaScript function. Size of array * must match number of parameter in JavaScript function. * @return value returned from JavaScript function, if any. */
Performs actual call to JavaScript via Applet instance passed in Constructor
processCommand
{ "repo_name": "semantic-web-software/dynagent", "path": "Nucleo/src/dynagent/gui/JavaScriptCommand.java", "license": "agpl-3.0", "size": 3465 }
[ "com.sun.java.browser.dom.DOMService" ]
import com.sun.java.browser.dom.DOMService;
import com.sun.java.browser.dom.*;
[ "com.sun.java" ]
com.sun.java;
2,163,013
LOG.warn("funtion=create, msg=create new one."); OpenstackNetwork openStackNetMgr = new OpenstackNetwork(conInfoMap); return openStackNetMgr.createNetwork(network); }
LOG.warn(STR); OpenstackNetwork openStackNetMgr = new OpenstackNetwork(conInfoMap); return openStackNetMgr.createNetwork(network); }
/** * Create network to openstack.<br/> * * @param network the JSONObject of network information * @param conInfoMap the openstack info map * @return the result of creating network to openstack * @since NFVO 0.5 */
Create network to openstack
create
{ "repo_name": "open-o/nfvo", "path": "drivers/vim/vimadapter/VimDriverService/service/src/main/java/org/openo/nfvo/vimadapter/service/openstack/entry/NetworkMgrOpenstack.java", "license": "apache-2.0", "size": 2195 }
[ "org.openo.nfvo.vimadapter.service.openstack.networkmgr.OpenstackNetwork" ]
import org.openo.nfvo.vimadapter.service.openstack.networkmgr.OpenstackNetwork;
import org.openo.nfvo.vimadapter.service.openstack.networkmgr.*;
[ "org.openo.nfvo" ]
org.openo.nfvo;
419,286
protected String generateBodyParameters() { return KeyValueFormatter.format(bodyParameters, true); }
String function() { return KeyValueFormatter.format(bodyParameters, true); }
/** * Generate the body parameters to be added.<br> * <br> * <i>Note: values are encoded.</i> * * @return Body parameters (e.g. "limit=100&sort=top") */
Generate the body parameters to be added. Note: values are encoded
generateBodyParameters
{ "repo_name": "Murtaza0xFF/jReddit", "path": "src/main/java/com/github/jreddit/request/RedditPostRequest.java", "license": "mit", "size": 2641 }
[ "com.github.jreddit.request.util.KeyValueFormatter" ]
import com.github.jreddit.request.util.KeyValueFormatter;
import com.github.jreddit.request.util.*;
[ "com.github.jreddit" ]
com.github.jreddit;
1,526,154
public static boolean isAm() { Calendar cal = Calendar.getInstance(); return cal.get(GregorianCalendar.AM_PM) == 0; }
static boolean function() { Calendar cal = Calendar.getInstance(); return cal.get(GregorianCalendar.AM_PM) == 0; }
/** * Return whether it is am. * * @return {@code true}: yes<br>{@code false}: no */
Return whether it is am
isAm
{ "repo_name": "didi/DoraemonKit", "path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/TimeUtils.java", "license": "apache-2.0", "size": 58527 }
[ "java.util.Calendar", "java.util.GregorianCalendar" ]
import java.util.Calendar; import java.util.GregorianCalendar;
import java.util.*;
[ "java.util" ]
java.util;
362,415
public static TStatus toTStatus(Exception e) { if (e instanceof HiveSQLException) { return ((HiveSQLException)e).toTStatus(); } TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS); tStatus.setErrorMessage(e.getMessage()); tStatus.setInfoMessages(toString(e)); return tStatus; }
static TStatus function(Exception e) { if (e instanceof HiveSQLException) { return ((HiveSQLException)e).toTStatus(); } TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS); tStatus.setErrorMessage(e.getMessage()); tStatus.setInfoMessages(toString(e)); return tStatus; }
/** * Converts the specified {@link Exception} object into a {@link TStatus} object * @param e a {@link Exception} object * @return a {@link TStatus} object */
Converts the specified <code>Exception</code> object into a <code>TStatus</code> object
toTStatus
{ "repo_name": "LantaoJin/spark", "path": "sql/hive-thriftserver/v2.3.5/src/main/java/org/apache/hive/service/cli/HiveSQLException.java", "license": "apache-2.0", "size": 7742 }
[ "org.apache.hive.service.cli.thrift.TStatus", "org.apache.hive.service.cli.thrift.TStatusCode" ]
import org.apache.hive.service.cli.thrift.TStatus; import org.apache.hive.service.cli.thrift.TStatusCode;
import org.apache.hive.service.cli.thrift.*;
[ "org.apache.hive" ]
org.apache.hive;
2,809,524
public List<BioFuzzParseNode> doTrace(BioFuzzParseTree tree, BioFuzzQuery q, TraceType type) { List<BioFuzzParseNode> ret = new Vector<BioFuzzParseNode>(); assert(tree != null); assert(q != null); if(type == TraceType.BFS) { // add first element just for bfs if(q.condition(tree.getRootNode())){ ret.add(tree.getRootNode()); } traceBFS(tree.getRootNode(), q, ret); } else { traceDFS(tree.getRootNode(), q, ret); } if(ret.size() > 0) return ret; return null; }
List<BioFuzzParseNode> function(BioFuzzParseTree tree, BioFuzzQuery q, TraceType type) { List<BioFuzzParseNode> ret = new Vector<BioFuzzParseNode>(); assert(tree != null); assert(q != null); if(type == TraceType.BFS) { if(q.condition(tree.getRootNode())){ ret.add(tree.getRootNode()); } traceBFS(tree.getRootNode(), q, ret); } else { traceDFS(tree.getRootNode(), q, ret); } if(ret.size() > 0) return ret; return null; }
/** * * Searches for nodes in the parse-tree that satisfy the constraint given * by the query. * * @param tree the parse-tree to analyze. * @param q the search constraint. * @param type the algorithm to use. * @return list of nodes that satisfy the query q. * */
Searches for nodes in the parse-tree that satisfy the constraint given by the query
doTrace
{ "repo_name": "julianthome/biofuzz-tk", "path": "src/main/java/org/biofuzztk/components/BioFuzzTracer.java", "license": "gpl-3.0", "size": 5178 }
[ "java.util.List", "java.util.Vector", "org.biofuzztk.ptree.BioFuzzParseNode", "org.biofuzztk.ptree.BioFuzzParseTree" ]
import java.util.List; import java.util.Vector; import org.biofuzztk.ptree.BioFuzzParseNode; import org.biofuzztk.ptree.BioFuzzParseTree;
import java.util.*; import org.biofuzztk.ptree.*;
[ "java.util", "org.biofuzztk.ptree" ]
java.util; org.biofuzztk.ptree;
2,705,820
public static Object fromXml(InputStream input) { return xstream.fromXML(input); }
static Object function(InputStream input) { return xstream.fromXML(input); }
/** Deserialize an object from an <code>InputStream</code>. * * @param input The <code>InputStream</code> * @return The deserialized <code>Object</code> */
Deserialize an object from an <code>InputStream</code>
fromXml
{ "repo_name": "zamentur/ofbiz_ynh", "path": "sources/framework/base/src/org/ofbiz/base/util/UtilXml.java", "license": "apache-2.0", "size": 49565 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
103,917
public void writeOptionalStreamable(@Nullable Streamable streamable) throws IOException { if (streamable != null) { writeBoolean(true); streamable.writeTo(this); } else { writeBoolean(false); } }
void function(@Nullable Streamable streamable) throws IOException { if (streamable != null) { writeBoolean(true); streamable.writeTo(this); } else { writeBoolean(false); } }
/** * Serializes a potential null value. */
Serializes a potential null value
writeOptionalStreamable
{ "repo_name": "palecur/elasticsearch", "path": "core/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java", "license": "apache-2.0", "size": 27770 }
[ "java.io.IOException", "org.elasticsearch.common.Nullable" ]
import java.io.IOException; import org.elasticsearch.common.Nullable;
import java.io.*; import org.elasticsearch.common.*;
[ "java.io", "org.elasticsearch.common" ]
java.io; org.elasticsearch.common;
2,084,979
@VisibleForTesting static URI getClassPathEntry(File jarFile, String path) throws URISyntaxException { URI uri = new URI(path); if (uri.isAbsolute()) { return uri; } else { return new File(jarFile.getParentFile(), path.replace('/', File.separatorChar)).toURI(); } } }
@VisibleForTesting static URI getClassPathEntry(File jarFile, String path) throws URISyntaxException { URI uri = new URI(path); if (uri.isAbsolute()) { return uri; } else { return new File(jarFile.getParentFile(), path.replace('/', File.separatorChar)).toURI(); } } }
/** * Returns the absolute uri of the Class-Path entry value as specified in * <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Main%20Attributes"> * JAR File Specification</a>. Even though the specification only talks about relative urls, * absolute urls are actually supported too (for example, in Maven surefire plugin). */
Returns the absolute uri of the Class-Path entry value as specified in JAR File Specification. Even though the specification only talks about relative urls, absolute urls are actually supported too (for example, in Maven surefire plugin)
getClassPathEntry
{ "repo_name": "hsaputra/cdap", "path": "cdap-common/src/main/java/co/cask/cdap/common/internal/guava/ClassPath.java", "license": "apache-2.0", "size": 17255 }
[ "com.google.common.annotations.VisibleForTesting", "java.io.File", "java.net.URISyntaxException" ]
import com.google.common.annotations.VisibleForTesting; import java.io.File; import java.net.URISyntaxException;
import com.google.common.annotations.*; import java.io.*; import java.net.*;
[ "com.google.common", "java.io", "java.net" ]
com.google.common; java.io; java.net;
2,680,677
public static String buildValue( String primaryTable, String primaryField, String secondaryTable, String secondaryField ) { StringBuffer ret = new StringBuffer(); ret.append( FormTags.PRIMARY_LINK_TAG ); ret.append( ":" ); ret.append( primaryTable ); ret.append( "." ); ret.append( primaryField ); ret.append( "~" ); ret.append( FormTags.SECONDARY_LINK_TAG ); ret.append( ":" ); ret.append( secondaryTable ); ret.append( "." ); ret.append( secondaryField ); return ret.toString(); }
static String function( String primaryTable, String primaryField, String secondaryTable, String secondaryField ) { StringBuffer ret = new StringBuffer(); ret.append( FormTags.PRIMARY_LINK_TAG ); ret.append( ":" ); ret.append( primaryTable ); ret.append( "." ); ret.append( primaryField ); ret.append( "~" ); ret.append( FormTags.SECONDARY_LINK_TAG ); ret.append( ":" ); ret.append( secondaryTable ); ret.append( "." ); ret.append( secondaryField ); return ret.toString(); }
/** * Builds a value String for a name value pair from the given parameters. * Ex: <code>PrimaryLink:ASQPCOMMON.ASQPDATAID~SecondaryLink:ASQPARRGMT.ASQPDATAID</code> * *@param primaryTable Description of Parameter *@param primaryField Description of Parameter *@param secondaryTable Description of Parameter *@param secondaryField Description of Parameter *@return Description of the Returned Value */
Builds a value String for a name value pair from the given parameters. Ex: <code>PrimaryLink:ASQPCOMMON.ASQPDATAID~SecondaryLink:ASQPARRGMT.ASQPDATAID</code>
buildValue
{ "repo_name": "jchoyt/mrald-lite", "path": "src/org/mitre/mrald/query/LinkElement.java", "license": "apache-2.0", "size": 15083 }
[ "org.mitre.mrald.util.FormTags" ]
import org.mitre.mrald.util.FormTags;
import org.mitre.mrald.util.*;
[ "org.mitre.mrald" ]
org.mitre.mrald;
2,876,742
void removeTrigger(Trigger trigger);
void removeTrigger(Trigger trigger);
/** * remove a Trigger * * @param trigger */
remove a Trigger
removeTrigger
{ "repo_name": "harfalm/Sakai-10.1", "path": "rwiki/rwiki-api/api/src/java/uk/ac/cam/caret/sakai/rwiki/service/message/api/TriggerService.java", "license": "apache-2.0", "size": 2686 }
[ "uk.ac.cam.caret.sakai.rwiki.service.message.api.model.Trigger" ]
import uk.ac.cam.caret.sakai.rwiki.service.message.api.model.Trigger;
import uk.ac.cam.caret.sakai.rwiki.service.message.api.model.*;
[ "uk.ac.cam" ]
uk.ac.cam;
1,048,965
public static void onCreate(Context c, String sdkKey) { if (sdkKey != null && !started) { if (Utils.DEBUG) { Log.i(TAG, "onCreate(" + sdkKey + ")"); } started = true; if (sdkKey.length() > 4) { //Get the public and private key from the SDK key publicKey = sdkKey.substring(0, 4); privateKey = sdkKey.substring(4); Context context = c.getApplicationContext(); preferences = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE); //Get the application details bundleID = context.getPackageName(); try { appVersion = context.getPackageManager().getPackageInfo(DistimoSDK.bundleID, 0).versionName; } catch (final NameNotFoundException nnfe) { if (Utils.DEBUG) { nnfe.printStackTrace(); } appVersion = "0"; } //Generate IDs generateUniqueUserID(); generateUniqueHardwareID(context); //Initialize the EventManager EventManager.initialize(context); //Set exception handler (will preserve the current exception handler) Thread.setDefaultUncaughtExceptionHandler(new DistimoExceptionHandler(context)); //Check (delayed) if a FirstLaunch event needs to be sent checkFirstLaunchDelayed(context); } } } //-- USER VALUE --//
static void function(Context c, String sdkKey) { if (sdkKey != null && !started) { if (Utils.DEBUG) { Log.i(TAG, STR + sdkKey + ")"); } started = true; if (sdkKey.length() > 4) { publicKey = sdkKey.substring(0, 4); privateKey = sdkKey.substring(4); Context context = c.getApplicationContext(); preferences = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE); bundleID = context.getPackageName(); try { appVersion = context.getPackageManager().getPackageInfo(DistimoSDK.bundleID, 0).versionName; } catch (final NameNotFoundException nnfe) { if (Utils.DEBUG) { nnfe.printStackTrace(); } appVersion = "0"; } generateUniqueUserID(); generateUniqueHardwareID(context); EventManager.initialize(context); Thread.setDefaultUncaughtExceptionHandler(new DistimoExceptionHandler(context)); checkFirstLaunchDelayed(context); } } }
/** * Start the SDK. Typically call this method from the onCreate(..) method of your main Activity * * @param c The application context, can be the activity where you are calling this method from * @param sdkKey Your SDK Key, go to https://analytics.distimo.com/settings/sdk to generate an SDK Key. */
Start the SDK. Typically call this method from the onCreate(..) method of your main Activity
onCreate
{ "repo_name": "platogo/DistimoSDK-PhoneGap-Plugin", "path": "src/android/DistimoSDK.java", "license": "apache-2.0", "size": 14078 }
[ "android.content.Context", "android.content.pm.PackageManager", "android.util.Log" ]
import android.content.Context; import android.content.pm.PackageManager; import android.util.Log;
import android.content.*; import android.content.pm.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
1,788,394
public void beforeIndexClosed(IndexService indexService) { }
void function(IndexService indexService) { }
/** * Called before the index get closed. * * @param indexService The index service */
Called before the index get closed
beforeIndexClosed
{ "repo_name": "petmit/elasticsearch", "path": "src/main/java/org/elasticsearch/indices/IndicesLifecycle.java", "license": "apache-2.0", "size": 5157 }
[ "org.elasticsearch.index.IndexService" ]
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
612,245
public void setDescent( float descent ) { dic.setFloat( COSName.DESCENT, descent ); }
void function( float descent ) { dic.setFloat( COSName.DESCENT, descent ); }
/** * This will set the descent for the font. * * @param descent The new descent for the font. */
This will set the descent for the font
setDescent
{ "repo_name": "mdamt/PdfBox-Android", "path": "library/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java", "license": "apache-2.0", "size": 19677 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
528,870
public static int decodeDesc(byte[] src, int srcOffset, BigDecimal[] valueRef) throws CorruptEncodingException { return decode(src, srcOffset, valueRef, -1); }
static int function(byte[] src, int srcOffset, BigDecimal[] valueRef) throws CorruptEncodingException { return decode(src, srcOffset, valueRef, -1); }
/** * Decodes the given BigDecimal as originally encoded for descending order. * * @param src source of encoded data * @param srcOffset offset into encoded data * @param valueRef decoded BigDecimal is stored in element 0, which may be * null * @return amount of bytes read from source * @throws CorruptEncodingException if source data is corrupt * @since 1.2 */
Decodes the given BigDecimal as originally encoded for descending order
decodeDesc
{ "repo_name": "beebeandwer/TDDL", "path": "tddl-optimizer/src/main/java/com/taobao/tddl/optimizer/core/datatype/KeyDecoder.java", "license": "apache-2.0", "size": 31807 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
1,246,698
public TableDescriptor getTableDescriptor() throws StandardException { if (td == null) { td = getDataDictionary().getTableDescriptor(triggerTableId); } return td; } // caller converts referencedCols to referencedColsDescriptor... // public ReferencedColumns getReferencedColumnsDescriptor() // throws StandardException // { // return (referencedCols == null) ? // (ReferencedColumns)null : // new ReferencedColumnsDescriptorImpl(referencedCols); // }
TableDescriptor function() throws StandardException { if (td == null) { td = getDataDictionary().getTableDescriptor(triggerTableId); } return td; }
/** * Get the trigger table descriptor * * @return the table descripor upon which this trigger * is declared * * @exception StandardException on error */
Get the trigger table descriptor
getTableDescriptor
{ "repo_name": "apache/derby", "path": "java/org.apache.derby.engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java", "license": "apache-2.0", "size": 31404 }
[ "org.apache.derby.shared.common.error.StandardException" ]
import org.apache.derby.shared.common.error.StandardException;
import org.apache.derby.shared.common.error.*;
[ "org.apache.derby" ]
org.apache.derby;
855,605
@DELETE @Path("{md_name}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteMd(@PathParam("md_name") String mdName) { log.debug("DELETE called for MD {}", mdName); try { MdId mdId = MdIdCharStr.asMdId(mdName); boolean deleted = get(CfmMdService.class).deleteMaintenanceDomain(mdId); if (!deleted) { return Response.notModified(mdName + " did not exist").build(); } else { return ok("{ \"success\":\"deleted " + mdName + "\" }").build(); } } catch (CfmConfigException e) { log.error("Delete Maintenance Domain {} failed", mdName, e); return Response.serverError() .entity("{ \"failure\":\"" + e.toString() + "\" }").build(); } }
@Path(STR) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(@PathParam(STR) String mdName) { log.debug(STR, mdName); try { MdId mdId = MdIdCharStr.asMdId(mdName); boolean deleted = get(CfmMdService.class).deleteMaintenanceDomain(mdId); if (!deleted) { return Response.notModified(mdName + STR).build(); } else { return ok(STRsuccess\":\"deleted STR\STR).build(); } } catch (CfmConfigException e) { log.error(STR, mdName, e); return Response.serverError() .entity(STRfailure\":\"STR\STR).build(); } }
/** * Delete Maintenance Domain by name. * * @param mdName The name of a Maintenance Domain * @return 200 OK, or 304 if not found or 500 on error */
Delete Maintenance Domain by name
deleteMd
{ "repo_name": "gkatsikas/onos", "path": "apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MdWebResource.java", "license": "apache-2.0", "size": 6144 }
[ "javax.ws.rs.Consumes", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId", "org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr", "org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException", "org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService" ]
import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId; import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr; import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException; import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
import javax.ws.rs.*; import javax.ws.rs.core.*; import org.onosproject.incubator.net.l2monitoring.cfm.identifier.*; import org.onosproject.incubator.net.l2monitoring.cfm.service.*;
[ "javax.ws", "org.onosproject.incubator" ]
javax.ws; org.onosproject.incubator;
142,484
public SourceReference getServiceProvider() ;
SourceReference function() ;
/** * Gets the service provider. * * @return the service provider */
Gets the service provider
getServiceProvider
{ "repo_name": "cts2/cts2-framework", "path": "cts2-service/src/main/java/edu/mayo/cts2/framework/service/profile/BaseService.java", "license": "apache-2.0", "size": 2211 }
[ "edu.mayo.cts2.framework.model.core.SourceReference" ]
import edu.mayo.cts2.framework.model.core.SourceReference;
import edu.mayo.cts2.framework.model.core.*;
[ "edu.mayo.cts2" ]
edu.mayo.cts2;
2,355,552
@Override public void generatePreTry(JavaWriter out) throws IOException { _next.generatePreTry(out); } /** * Generates code before the call, in the try block. * <code><pre> * retType myMethod(...) * { * try { * [pre-call] * value = bean.myMethod(...); * ... * }
void function(JavaWriter out) throws IOException { _next.generatePreTry(out); } /** * Generates code before the call, in the try block. * <code><pre> * retType myMethod(...) * { * try { * [pre-call] * value = bean.myMethod(...); * ... * }
/** * Generates code before the try block */
Generates code before the try block
generatePreTry
{ "repo_name": "CleverCloud/Quercus", "path": "resin/src/main/java/com/caucho/config/gen/AbstractAspectGenerator.java", "license": "gpl-2.0", "size": 11874 }
[ "com.caucho.java.JavaWriter", "java.io.IOException" ]
import com.caucho.java.JavaWriter; import java.io.IOException;
import com.caucho.java.*; import java.io.*;
[ "com.caucho.java", "java.io" ]
com.caucho.java; java.io;
2,902,552
public void asyncUnsubscribe(ByteString topic, ByteString subscriberId, Callback<Void> callback, Object context);
void function(ByteString topic, ByteString subscriberId, Callback<Void> callback, Object context);
/** * Unsubscribe from a topic asynchronously that the subscriberId user has * previously subscribed to. * * @param topic * Topic name of the subscription * @param subscriberId * ID of the subscriber * @param callback * Callback to invoke when the unsubscribe request to the server * has actually gone through. This will have to deal with error * conditions on the async unsubscribe request. * @param context * Calling context that the Callback needs since this is done * asynchronously. */
Unsubscribe from a topic asynchronously that the subscriberId user has previously subscribed to
asyncUnsubscribe
{ "repo_name": "rvenkatesh25/bookkeeper", "path": "hedwig-client/src/main/java/org/apache/hedwig/client/api/Subscriber.java", "license": "apache-2.0", "size": 10109 }
[ "com.google.protobuf.ByteString", "org.apache.hedwig.util.Callback" ]
import com.google.protobuf.ByteString; import org.apache.hedwig.util.Callback;
import com.google.protobuf.*; import org.apache.hedwig.util.*;
[ "com.google.protobuf", "org.apache.hedwig" ]
com.google.protobuf; org.apache.hedwig;
1,024,092
private int deleteFlowFilterEntries(RestResource restResource, String vtnName, String vbrName, String ifName, String seqNum) { StringBuilder sb = new StringBuilder(); sb.append(VtnServiceOpenStackConsts.VTN_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(vtnName); sb.append(VtnServiceOpenStackConsts.VBRIDGE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(vbrName); sb.append(VtnServiceOpenStackConsts.INTERFACE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(ifName); sb.append(VtnServiceOpenStackConsts.FLOWFILTER_PATH); sb.append(VtnServiceOpenStackConsts.IN_PATH); sb.append(VtnServiceOpenStackConsts.FLOWFILTER_ENTRY_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(seqNum); restResource.setPath(sb.toString()); restResource.setSessionID(getSessionID()); restResource.setConfigID(getConfigID()); return restResource.delete(); }
int function(RestResource restResource, String vtnName, String vbrName, String ifName, String seqNum) { StringBuilder sb = new StringBuilder(); sb.append(VtnServiceOpenStackConsts.VTN_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(vtnName); sb.append(VtnServiceOpenStackConsts.VBRIDGE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(vbrName); sb.append(VtnServiceOpenStackConsts.INTERFACE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(ifName); sb.append(VtnServiceOpenStackConsts.FLOWFILTER_PATH); sb.append(VtnServiceOpenStackConsts.IN_PATH); sb.append(VtnServiceOpenStackConsts.FLOWFILTER_ENTRY_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(seqNum); restResource.setPath(sb.toString()); restResource.setSessionID(getSessionID()); restResource.setConfigID(getConfigID()); return restResource.delete(); }
/** * delete Flow Filter Entry at UNC * * @param requestBody * - OpenStack request body * @param flowFilterVrtBean * - flow Filter infomation * @param restResource * - RestResource instance * @return - erorrCode, 200 for Success */
delete Flow Filter Entry at UNC
deleteFlowFilterEntries
{ "repo_name": "opendaylight/vtn", "path": "coordinator/java/vtn-javaapi/src/org/opendaylight/vtn/javaapi/resources/openstack/FilterResource.java", "license": "epl-1.0", "size": 43375 }
[ "org.opendaylight.vtn.javaapi.RestResource", "org.opendaylight.vtn.javaapi.openstack.constants.VtnServiceOpenStackConsts" ]
import org.opendaylight.vtn.javaapi.RestResource; import org.opendaylight.vtn.javaapi.openstack.constants.VtnServiceOpenStackConsts;
import org.opendaylight.vtn.javaapi.*; import org.opendaylight.vtn.javaapi.openstack.constants.*;
[ "org.opendaylight.vtn" ]
org.opendaylight.vtn;
1,769,221
public static Long previousComparableTestResult(Long testResultId) { SelectMode m = ModeFactory.getMode("scap_queries", "previous_comparable_tr"); Map<String, Long> params = new HashMap<String, Long>(); params.put("xid", testResultId); DataResult<Map> toReturn = m.execute(params); return (Long) toReturn.get(0).get("xid"); }
static Long function(Long testResultId) { SelectMode m = ModeFactory.getMode(STR, STR); Map<String, Long> params = new HashMap<String, Long>(); params.put("xid", testResultId); DataResult<Map> toReturn = m.execute(params); return (Long) toReturn.get(0).get("xid"); }
/** * Get a TestResult with metadata similar to the given. * Which has been evaluated on the same machine just before the given. * So it makes a sence to compare these two. * @param testResultId referential TestResult * @return result or null (if not any) */
Get a TestResult with metadata similar to the given. Which has been evaluated on the same machine just before the given. So it makes a sence to compare these two
previousComparableTestResult
{ "repo_name": "mcalmer/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/audit/ScapManager.java", "license": "gpl-2.0", "size": 12626 }
[ "com.redhat.rhn.common.db.datasource.DataResult", "com.redhat.rhn.common.db.datasource.ModeFactory", "com.redhat.rhn.common.db.datasource.SelectMode", "java.util.HashMap", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import java.util.HashMap; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
82,361
String sqlCommand="select * from IntegratorConsent where facilityId=?1 and demographicId=?2 order by createdDate desc"; Query query = entityManager.createNativeQuery(sqlCommand, modelClass); query.setParameter(1, facilityId); query.setParameter(2, demographicId); return(getSingleResultOrNull(query)); }
String sqlCommand=STR; Query query = entityManager.createNativeQuery(sqlCommand, modelClass); query.setParameter(1, facilityId); query.setParameter(2, demographicId); return(getSingleResultOrNull(query)); }
/** * results are ordered by newest first */
results are ordered by newest first
findLatestByFacilityDemographic
{ "repo_name": "hexbinary/landing", "path": "src/main/java/org/oscarehr/common/dao/IntegratorConsentDao.java", "license": "gpl-2.0", "size": 2404 }
[ "javax.persistence.Query" ]
import javax.persistence.Query;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,855,295
public boolean rowDeleted() throws SQLException { throw SQLError.createSQLFeatureNotSupportedException(); }
boolean function() throws SQLException { throw SQLError.createSQLFeatureNotSupportedException(); }
/** * JDBC 2.0 Determine if this row has been deleted. A deleted row may leave * a visible "hole" in a result set. This method can be used to detect holes * in a result set. The value returned depends on whether or not the result * set can detect deletions. * * @return true if deleted and deletes are detected * * @exception SQLException * if a database-access error occurs * @throws NotImplemented * * @see DatabaseMetaData#deletesAreDetected */
JDBC 2.0 Determine if this row has been deleted. A deleted row may leave a visible "hole" in a result set. This method can be used to detect holes in a result set. The value returned depends on whether or not the result set can detect deletions
rowDeleted
{ "repo_name": "martingh15/TPJava", "path": "TPJavaNotebook/mysql-connector-java-5.1.39/src/com/mysql/jdbc/ResultSetImpl.java", "license": "mpl-2.0", "size": 288777 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
695,234
protected Highlights trafficSummary(TrafficLink.StatsType type) { Highlights highlights = new Highlights(); // TODO: consider whether a map would be better... Set<TrafficLink> linksWithTraffic = computeLinksWithTraffic(type); Set<TrafficLink> aggregatedLinks = doAggregation(linksWithTraffic); for (TrafficLink tlink : aggregatedLinks) { highlights.add(tlink.highlight(type)); } return highlights; }
Highlights function(TrafficLink.StatsType type) { Highlights highlights = new Highlights(); Set<TrafficLink> linksWithTraffic = computeLinksWithTraffic(type); Set<TrafficLink> aggregatedLinks = doAggregation(linksWithTraffic); for (TrafficLink tlink : aggregatedLinks) { highlights.add(tlink.highlight(type)); } return highlights; }
/** * Generates a {@link Highlights} object summarizing the traffic on the * network, ready to be transmitted back to the client for display on * the topology view. * * @param type the type of statistics to be displayed * @return highlights, representing links to be labeled/colored */
Generates a <code>Highlights</code> object summarizing the traffic on the network, ready to be transmitted back to the client for display on the topology view
trafficSummary
{ "repo_name": "LorenzReinhart/ONOSnew", "path": "web/gui/src/main/java/org/onosproject/ui/impl/TrafficMonitorBase.java", "license": "apache-2.0", "size": 13921 }
[ "java.util.Set", "org.onosproject.ui.impl.topo.util.TrafficLink", "org.onosproject.ui.topo.Highlights" ]
import java.util.Set; import org.onosproject.ui.impl.topo.util.TrafficLink; import org.onosproject.ui.topo.Highlights;
import java.util.*; import org.onosproject.ui.impl.topo.util.*; import org.onosproject.ui.topo.*;
[ "java.util", "org.onosproject.ui" ]
java.util; org.onosproject.ui;
2,086,363
public void setLastSdkPath(String osSdkPath) { PreferenceStore prefs = getPreferenceStore(); synchronized (DdmsPreferenceStore.class) { prefs.setValue(LAST_SDK_PATH, osSdkPath); try { prefs.save(); } catch (IOException ioe) { } } }
void function(String osSdkPath) { PreferenceStore prefs = getPreferenceStore(); synchronized (DdmsPreferenceStore.class) { prefs.setValue(LAST_SDK_PATH, osSdkPath); try { prefs.save(); } catch (IOException ioe) { } } }
/** * Sets the last SDK OS path. * * @param osSdkPath The SDK OS Path. Can be null or empty. */
Sets the last SDK OS path
setLastSdkPath
{ "repo_name": "consulo/consulo-android", "path": "android/android/src/com/android/tools/idea/stats/DdmsPreferenceStore.java", "license": "apache-2.0", "size": 11022 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,309,447
private static void fixDecimalColumnTypeName(List<FieldSchema> cols) { for (FieldSchema col : cols) { if (serdeConstants.DECIMAL_TYPE_NAME.equals(col.getType())) { col.setType(DecimalTypeInfo.getQualifiedName(HiveDecimal.USER_DEFAULT_PRECISION, HiveDecimal.USER_DEFAULT_SCALE)); } } }
static void function(List<FieldSchema> cols) { for (FieldSchema col : cols) { if (serdeConstants.DECIMAL_TYPE_NAME.equals(col.getType())) { col.setType(DecimalTypeInfo.getQualifiedName(HiveDecimal.USER_DEFAULT_PRECISION, HiveDecimal.USER_DEFAULT_SCALE)); } } }
/** * Fix the type name of a column of type decimal w/o precision/scale specified. This makes * the describe table show "decimal(10,0)" instead of "decimal" even if the type stored * in metastore is "decimal", which is possible with previous hive. * * @param cols columns that to be fixed as such */
Fix the type name of a column of type decimal w/o precision/scale specified. This makes the describe table show "decimal(10,0)" instead of "decimal" even if the type stored in metastore is "decimal", which is possible with previous hive
fixDecimalColumnTypeName
{ "repo_name": "alanfgates/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/DescTableOperation.java", "license": "apache-2.0", "size": 13485 }
[ "java.util.List", "org.apache.hadoop.hive.common.type.HiveDecimal", "org.apache.hadoop.hive.metastore.api.FieldSchema", "org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo" ]
import java.util.List; import org.apache.hadoop.hive.common.type.HiveDecimal; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
import java.util.*; import org.apache.hadoop.hive.common.type.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.serde2.typeinfo.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
457,116