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
@Nonnull public static Date getSignatureDate( @Nonnull final EnumSet<SignatureVersion> versions, @Nonnull final Function<String,List<String>> headerLookup, @Nonnull final Function<String,List<String>> parameterLookup ) throws AuthenticationException { final Date signatureDate = getSignatureDateInternal( versions, headerLookup, parameterLookup ); if ( signatureDate == null) { throw new AuthenticationException("Date not found."); } return signatureDate; }
static Date function( @Nonnull final EnumSet<SignatureVersion> versions, @Nonnull final Function<String,List<String>> headerLookup, @Nonnull final Function<String,List<String>> parameterLookup ) throws AuthenticationException { final Date signatureDate = getSignatureDateInternal( versions, headerLookup, parameterLookup ); if ( signatureDate == null) { throw new AuthenticationException(STR); } return signatureDate; }
/** * Locate and return the date for a signature. * * @param versions The versions to allow * @param headerLookup Function to get an HTTP header value * @param parameterLookup Function to get a parameter value * @return The date * @throws AuthenticationException If a date could not be located */
Locate and return the date for a signature
getSignatureDate
{ "repo_name": "acmyonghua/eucalyptus", "path": "clc/modules/msgs/src/main/java/com/eucalyptus/ws/util/HmacUtils.java", "license": "gpl-3.0", "size": 29484 }
[ "com.eucalyptus.auth.login.AuthenticationException", "com.google.common.base.Function", "java.util.Date", "java.util.EnumSet", "java.util.List", "javax.annotation.Nonnull" ]
import com.eucalyptus.auth.login.AuthenticationException; import com.google.common.base.Function; import java.util.Date; import java.util.EnumSet; import java.util.List; import javax.annotation.Nonnull;
import com.eucalyptus.auth.login.*; import com.google.common.base.*; import java.util.*; import javax.annotation.*;
[ "com.eucalyptus.auth", "com.google.common", "java.util", "javax.annotation" ]
com.eucalyptus.auth; com.google.common; java.util; javax.annotation;
1,796,522
@ServiceMethod(returns = ReturnType.SINGLE) Map<String, Object> createRefRegisteredUsers(String deviceId, Map<String, Object> body);
@ServiceMethod(returns = ReturnType.SINGLE) Map<String, Object> createRefRegisteredUsers(String deviceId, Map<String, Object> body);
/** * Create new navigation property ref to registeredUsers for devices. * * @param deviceId key: id of device. * @param body New navigation property ref value. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is * rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return dictionary of &lt;any&gt;. */
Create new navigation property ref to registeredUsers for devices
createRefRegisteredUsers
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/DevicesClient.java", "license": "mit", "size": 81714 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "java.util.Map" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import java.util.Map;
import com.azure.core.annotation.*; import java.util.*;
[ "com.azure.core", "java.util" ]
com.azure.core; java.util;
448,679
public static short min(short... array) { checkArgument(array.length > 0); short min = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < min) { min = array[i]; } } return min; }
static short function(short... array) { checkArgument(array.length > 0); short min = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < min) { min = array[i]; } } return min; }
/** * Returns the least value present in {@code array}. * * @param array a <i>nonempty</i> array of {@code short} values * @return the value present in {@code array} that is less than or equal to * every other value in the array * @throws IllegalArgumentException if {@code array} is empty */
Returns the least value present in array
min
{ "repo_name": "sarvex/guava", "path": "guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java", "license": "apache-2.0", "size": 18943 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,822,846
public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { boolean comparison; if ((left instanceof SQLChar) && (right instanceof SQLChar)) { comparison = stringCompare((SQLChar) left, (SQLChar) right) != 0; } else { comparison = stringCompare(left.getString(), right.getString()) != 0; } return SQLBoolean.truthValue(left, right, comparison); }
BooleanDataValue function(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { boolean comparison; if ((left instanceof SQLChar) && (right instanceof SQLChar)) { comparison = stringCompare((SQLChar) left, (SQLChar) right) != 0; } else { comparison = stringCompare(left.getString(), right.getString()) != 0; } return SQLBoolean.truthValue(left, right, comparison); }
/** * The <> operator as called from the language module, as opposed to * the storage module. * * @param left The value on the left side of the <> * @param right The value on the right side of the <> * * @return A SQL boolean value telling whether the two parameters * are not equal * * @exception StandardException Thrown on error */
The <> operator as called from the language module, as opposed to the storage module
notEquals
{ "repo_name": "gemxd/gemfirexd-oss", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/iapi/types/SQLChar.java", "license": "apache-2.0", "size": 173809 }
[ "com.pivotal.gemfirexd.internal.iapi.error.StandardException", "com.pivotal.gemfirexd.internal.iapi.types.BooleanDataValue", "com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor" ]
import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.types.BooleanDataValue; import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.types.*;
[ "com.pivotal.gemfirexd" ]
com.pivotal.gemfirexd;
1,801,244
private String getString(final Properties props, final String propName, final String defaultVal) { if(props.containsKey(propName)) { return ((String)props.get(propName)).trim(); } return defaultVal; }
String function(final Properties props, final String propName, final String defaultVal) { if(props.containsKey(propName)) { return ((String)props.get(propName)).trim(); } return defaultVal; }
/** * Get a property as a String * @param props the props to look in * @param propName the name of the prop * @param defaultVal what to return if its not there * @return */
Get a property as a String
getString
{ "repo_name": "vjanmey/EpicMudfia", "path": "com/planet_ink/miniweb/util/MiniWebConfig.java", "license": "apache-2.0", "size": 30908 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,255,135
private String getReportName(String pid) { SolrClient solrClient = SolrManager.getInstance().getSolrClient(); String escapedPid = SolrUtils.escapeSpecialCharacters(pid); SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery("id:" + escapedPid); solrQuery.addField("id"); solrQuery.addField("unpublished.name"); String name = null; try { QueryResponse queryResponse = solrClient.query(solrQuery); SolrDocumentList resultList = queryResponse.getResults(); if (resultList.getNumFound() > 0) { SolrDocument doc = resultList.get(0); name = (String) doc.getFirstValue("unpublished.name"); } } catch (SolrServerException | IOException e) { LOGGER.error("Error executing query", e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return name; }
String function(String pid) { SolrClient solrClient = SolrManager.getInstance().getSolrClient(); String escapedPid = SolrUtils.escapeSpecialCharacters(pid); SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery("id:" + escapedPid); solrQuery.addField("id"); solrQuery.addField(STR); String name = null; try { QueryResponse queryResponse = solrClient.query(solrQuery); SolrDocumentList resultList = queryResponse.getResults(); if (resultList.getNumFound() > 0) { SolrDocument doc = resultList.get(0); name = (String) doc.getFirstValue(STR); } } catch (SolrServerException IOException e) { LOGGER.error(STR, e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return name; }
/** * getReportName * * Retrieves the name of the record associated with the pid * * <pre> * Version Date Developer Description * 0.3 03/10/2012 Genevieve Turner(GT) Initial * </pre> * * @param pid The pid of the object the report is about * @return The name of the object */
getReportName Retrieves the name of the record associated with the pid <code> Version Date Developer Description 0.3 03/10/2012 Genevieve Turner(GT) Initial </code>
getReportName
{ "repo_name": "anu-doi/anudc", "path": "DataCommons/src/main/java/au/edu/anu/datacommons/report/ReportGenerator.java", "license": "gpl-3.0", "size": 16861 }
[ "au.edu.anu.datacommons.data.solr.SolrManager", "au.edu.anu.datacommons.data.solr.SolrUtils", "java.io.IOException", "javax.ws.rs.WebApplicationException", "javax.ws.rs.core.Response", "org.apache.solr.client.solrj.SolrClient", "org.apache.solr.client.solrj.SolrQuery", "org.apache.solr.client.solrj.SolrServerException", "org.apache.solr.client.solrj.response.QueryResponse", "org.apache.solr.common.SolrDocument", "org.apache.solr.common.SolrDocumentList" ]
import au.edu.anu.datacommons.data.solr.SolrManager; import au.edu.anu.datacommons.data.solr.SolrUtils; import java.io.IOException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList;
import au.edu.anu.datacommons.data.solr.*; import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.solr.client.solrj.*; import org.apache.solr.client.solrj.response.*; import org.apache.solr.common.*;
[ "au.edu.anu", "java.io", "javax.ws", "org.apache.solr" ]
au.edu.anu; java.io; javax.ws; org.apache.solr;
2,127,307
public void putTrue(boolean boolBody) throws ErrorException, IOException { putTrueWithServiceResponseAsync(boolBody).toBlocking().single().getBody(); }
void function(boolean boolBody) throws ErrorException, IOException { putTrueWithServiceResponseAsync(boolBody).toBlocking().single().getBody(); }
/** * Set Boolean value true. * * @param boolBody the boolean value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization */
Set Boolean value true
putTrue
{ "repo_name": "tbombach/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodyboolean/implementation/BoolsImpl.java", "license": "mit", "size": 17539 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
256,587
private TileMatrix getTileMatrix(BoundingBox projectedRequestBoundingBox) { TileMatrix tileMatrix = null; // Check if the request overlaps the tile matrix set if (TileBoundingBoxUtils.overlap(projectedRequestBoundingBox, tileSetBoundingBox) != null) { // Get the tile distance double distanceWidth = projectedRequestBoundingBox .getMaxLongitude() - projectedRequestBoundingBox.getMinLongitude(); double distanceHeight = projectedRequestBoundingBox .getMaxLatitude() - projectedRequestBoundingBox.getMinLatitude(); // Get the zoom level to request based upon the tile size Long zoomLevel = tileDao .getZoomLevel(distanceWidth, distanceHeight); // If there is a matching zoom level if (zoomLevel != null) { tileMatrix = tileDao.getTileMatrix(zoomLevel); } } return tileMatrix; }
TileMatrix function(BoundingBox projectedRequestBoundingBox) { TileMatrix tileMatrix = null; if (TileBoundingBoxUtils.overlap(projectedRequestBoundingBox, tileSetBoundingBox) != null) { double distanceWidth = projectedRequestBoundingBox .getMaxLongitude() - projectedRequestBoundingBox.getMinLongitude(); double distanceHeight = projectedRequestBoundingBox .getMaxLatitude() - projectedRequestBoundingBox.getMinLatitude(); Long zoomLevel = tileDao .getZoomLevel(distanceWidth, distanceHeight); if (zoomLevel != null) { tileMatrix = tileDao.getTileMatrix(zoomLevel); } } return tileMatrix; }
/** * Get the tile matrix that contains the tiles for the bounding box, matches * against the bounding box and zoom level * * @param projectedRequestBoundingBox * bounding box projected to the tiles * @return tile matrix or null */
Get the tile matrix that contains the tiles for the bounding box, matches against the bounding box and zoom level
getTileMatrix
{ "repo_name": "restjohn/geopackage-java", "path": "src/main/java/mil/nga/geopackage/tiles/TileCreator.java", "license": "mit", "size": 16346 }
[ "mil.nga.geopackage.BoundingBox", "mil.nga.geopackage.tiles.matrix.TileMatrix" ]
import mil.nga.geopackage.BoundingBox; import mil.nga.geopackage.tiles.matrix.TileMatrix;
import mil.nga.geopackage.*; import mil.nga.geopackage.tiles.matrix.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
214,984
public ArrayList<RequestResult> getRequestResults() { return this.requestResults; }
ArrayList<RequestResult> function() { return this.requestResults; }
/** * Returns the set of request results that the current operation has created. * * @return An <code>ArrayList</code> object that contains {@link RequestResult} objects that represent * the request results created by the current operation. */
Returns the set of request results that the current operation has created
getRequestResults
{ "repo_name": "emgerner-msft/azure-storage-android", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/OperationContext.java", "license": "apache-2.0", "size": 20008 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
299,977
@Override public boolean onOptionsItemSelected(MenuItem item) { // int id = item.getItemId(); // if (id == R.id.action_refresh) { // if (mEditArtistName != null && mEditArtistName.getText() != null) { // artistNameEntered(mEditArtistName.getText().toString()); // } // return true; // } return super.onOptionsItemSelected(item); }
boolean function(MenuItem item) { return super.onOptionsItemSelected(item); }
/** * Handle the selection of a menu item. * The action bar will automatically handle clicks on the Home/Up button, so long * as a parent activity is specified in AndroidManifest.xml. * @param item the menu item selected * @return whether the event has been consumed */
Handle the selection of a menu item. The action bar will automatically handle clicks on the Home/Up button, so long as a parent activity is specified in AndroidManifest.xml
onOptionsItemSelected
{ "repo_name": "edmundjohnson/nd-spotify", "path": "app/src/main/java/uk/jumpingmouse/spotify/ArtistListFragment.java", "license": "mit", "size": 13276 }
[ "android.view.MenuItem" ]
import android.view.MenuItem;
import android.view.*;
[ "android.view" ]
android.view;
2,162,368
private JMenuItem createButler2MenuItem() { final String title = org.openide.util.NbBundle.getMessage(Butler2Dialog.class, "Butler2Dialog.title"); final AbstractAction action = new AbstractAction(title) {
JMenuItem function() { final String title = org.openide.util.NbBundle.getMessage(Butler2Dialog.class, STR); final AbstractAction action = new AbstractAction(title) {
/** * DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
createButler2MenuItem
{ "repo_name": "cismet/cids-custom-wuppertal", "path": "src/main/java/de/cismet/cids/custom/butler/DigitalDataExportToolbarComponentProvider.java", "license": "lgpl-3.0", "size": 10555 }
[ "javax.swing.AbstractAction", "javax.swing.JMenuItem", "org.openide.util.NbBundle" ]
import javax.swing.AbstractAction; import javax.swing.JMenuItem; import org.openide.util.NbBundle;
import javax.swing.*; import org.openide.util.*;
[ "javax.swing", "org.openide.util" ]
javax.swing; org.openide.util;
2,679,781
public static void registerActions( RuleContext ruleContext, List<ToolchainInvocation> toolchainInvocations, ProtoInfo protoInfo, Label ruleLabel, Iterable<Artifact> outputs, String flavorName, Exports useExports, Services allowServices) { ProtoToolchainInfo protoToolchain = ProtoToolchainInfo.fromRuleContext(ruleContext); if (protoToolchain == null) { return; } SpawnAction.Builder actions = createActions( ruleContext, protoToolchain, toolchainInvocations, protoInfo, ruleLabel, outputs, flavorName, useExports, allowServices); if (actions != null) { ruleContext.registerAction(actions.build(ruleContext)); } }
static void function( RuleContext ruleContext, List<ToolchainInvocation> toolchainInvocations, ProtoInfo protoInfo, Label ruleLabel, Iterable<Artifact> outputs, String flavorName, Exports useExports, Services allowServices) { ProtoToolchainInfo protoToolchain = ProtoToolchainInfo.fromRuleContext(ruleContext); if (protoToolchain == null) { return; } SpawnAction.Builder actions = createActions( ruleContext, protoToolchain, toolchainInvocations, protoInfo, ruleLabel, outputs, flavorName, useExports, allowServices); if (actions != null) { ruleContext.registerAction(actions.build(ruleContext)); } }
/** * Registers actions to generate code from .proto files. * * <p>This method uses information from proto_lang_toolchain() rules. New rules should use this * method instead of the soup of methods above. * * @param toolchainInvocations See {@link #createCommandLineFromToolchains}. * @param ruleLabel See {@link #createCommandLineFromToolchains}. * @param outputs The artifacts that the resulting action must create. * @param flavorName e.g., "Java (Immutable)" * @param allowServices If false, the compilation will break if any .proto file has service */
Registers actions to generate code from .proto files. This method uses information from proto_lang_toolchain() rules. New rules should use this method instead of the soup of methods above
registerActions
{ "repo_name": "perezd/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java", "license": "apache-2.0", "size": 24560 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.analysis.RuleContext", "com.google.devtools.build.lib.analysis.actions.SpawnAction", "com.google.devtools.build.lib.cmdline.Label", "java.util.List" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.cmdline.Label; import java.util.List;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.analysis.actions.*; import com.google.devtools.build.lib.cmdline.*; import java.util.*;
[ "com.google.devtools", "java.util" ]
com.google.devtools; java.util;
2,546,532
public java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI> getSubterm_multisets_ContainsHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.ContainsImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI( (fr.lip6.move.pnml.hlpn.multisets.Contains)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.ContainsImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.ContainsHLAPI( (fr.lip6.move.pnml.hlpn.multisets.Contains)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of ContainsHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of ContainsHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_multisets_ContainsHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/finiteIntRanges/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 108747 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,531,722
protected int executePreparedUpdate() throws SQLException, InterruptedException { SQLPreparedStatementExecutor executor = new SQLPreparedStatementExecutor(); execute(executor); return executor.getResult(); } private class SQLPreparedStatementExecutor extends SQLExecutor { private int result;
int function() throws SQLException, InterruptedException { SQLPreparedStatementExecutor executor = new SQLPreparedStatementExecutor(); execute(executor); return executor.getResult(); } private class SQLPreparedStatementExecutor extends SQLExecutor { private int result;
/** * Execute a prepared statement so that it is terminated when this thread is interrupted. * <p> * Data member stmt must contain a prepared statement. * * @return the result of the PreparedStatement.executeUpdate() method on the statement. * @throws SQLException if thrown by the PreparedStatement.execute() method. * @throws InterruptedException if this thread was interrupted while the statement was in progress, * in which case the statement execution is attempted to be terminated subject * to the limitations specified on Statement.cancel(). */
Execute a prepared statement so that it is terminated when this thread is interrupted. Data member stmt must contain a prepared statement
executePreparedUpdate
{ "repo_name": "rdesantis/hauldata", "path": "dbpa/src/main/java/com/hauldata/dbpa/datasource/DataSource.java", "license": "apache-2.0", "size": 5685 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
537,776
private void testFindByRange(int samplingSize, int startRange, int endRange, boolean startInclusive, boolean endInclusive, boolean testSortOrder) { final DocumentDataset<K, V> data = gen.sortDocumentDataset(generateDataAndPopulateKVStore(samplingSize)); final int expectedSize = expectedSizeHelper(startRange, endRange, startInclusive, endInclusive); final int sliceStart = (startInclusive) ? startRange : startRange + 1; final int sliceEnd = (endInclusive) ? endRange : endRange - 1; final FindByRange<K> range = makeRange(data.getDocument(startRange).getKey(), startInclusive, data.getDocument(endRange).getKey(), endInclusive); final Iterable<Document<K, V>> result = kvStore.find(range); if (expectedSize <= 0 && (sliceStart > sliceEnd)) { // Testing empty ranges, result should be empty. assertEquals(0, Iterables.size(result)); } else { assertResultsAreEqual(data.getDocumentDatasetSlice(sliceStart, sliceEnd), result, testSortOrder); } }
void function(int samplingSize, int startRange, int endRange, boolean startInclusive, boolean endInclusive, boolean testSortOrder) { final DocumentDataset<K, V> data = gen.sortDocumentDataset(generateDataAndPopulateKVStore(samplingSize)); final int expectedSize = expectedSizeHelper(startRange, endRange, startInclusive, endInclusive); final int sliceStart = (startInclusive) ? startRange : startRange + 1; final int sliceEnd = (endInclusive) ? endRange : endRange - 1; final FindByRange<K> range = makeRange(data.getDocument(startRange).getKey(), startInclusive, data.getDocument(endRange).getKey(), endInclusive); final Iterable<Document<K, V>> result = kvStore.find(range); if (expectedSize <= 0 && (sliceStart > sliceEnd)) { assertEquals(0, Iterables.size(result)); } else { assertResultsAreEqual(data.getDocumentDatasetSlice(sliceStart, sliceEnd), result, testSortOrder); } }
/** * Helper method to test FindByRange queries. * * @param samplingSize size of the dataset to test. * @param startRange start range index. * @param endRange end range index. * @param startInclusive whether start is inclusive. * @param endInclusive whether end is inclusive. * @param testSortOrder boolean indicating whether test should take result set sort order into account. */
Helper method to test FindByRange queries
testFindByRange
{ "repo_name": "dremio/dremio-oss", "path": "services/datastore/src/test/java/com/dremio/datastore/AbstractTestKVStore.java", "license": "apache-2.0", "size": 24115 }
[ "com.dremio.datastore.api.Document", "com.dremio.datastore.api.FindByRange", "com.dremio.datastore.generator.DocumentDataset", "com.google.common.collect.Iterables", "org.junit.Assert" ]
import com.dremio.datastore.api.Document; import com.dremio.datastore.api.FindByRange; import com.dremio.datastore.generator.DocumentDataset; import com.google.common.collect.Iterables; import org.junit.Assert;
import com.dremio.datastore.api.*; import com.dremio.datastore.generator.*; import com.google.common.collect.*; import org.junit.*;
[ "com.dremio.datastore", "com.google.common", "org.junit" ]
com.dremio.datastore; com.google.common; org.junit;
1,779,065
assert header.recordType == ChillDefines.HSK_ID_SCAN_SEG; assert header.headerLength == ChillScanSeg.BYTE_SIZE + extraData.length; super.header.write(out); out.writeFloat(this.az_manual); out.writeFloat(this.el_manual); out.writeFloat(this.az_start); out.writeFloat(this.el_start); out.writeFloat(this.scan_rate); SocketUtil.writeString(this.segname, out, MAX_SEGNAME_LENGTH); out.writeFloat(this.opt.rmax_km); out.writeFloat(this.opt.htmax_km); out.writeFloat(this.opt.res_m); out.writeInt(this.follow_mode.ordinal()); out.writeInt(this.scan_type.ordinal()); out.writeInt(this.scan_flags); out.writeInt(this.volume_num); out.writeInt(this.sweep_num); out.writeInt(this.time_limit); out.writeInt(this.webtilt); out.writeFloat(this.left_limit); out.writeFloat(this.right_limit); out.writeFloat(this.up_limit); out.writeFloat(this.down_limit); out.writeFloat(this.step); out.writeInt(this.max_sweeps); out.writeInt(this.filter_break_sweep); out.writeInt(this.clutter_filter1); out.writeInt(this.clutter_filter2); SocketUtil.writeString(this.project, out, MAX_SEGNAME_LENGTH); out.writeFloat(this.current_fixed_angle); out.write(this.extraData); }
assert header.recordType == ChillDefines.HSK_ID_SCAN_SEG; assert header.headerLength == ChillScanSeg.BYTE_SIZE + extraData.length; super.header.write(out); out.writeFloat(this.az_manual); out.writeFloat(this.el_manual); out.writeFloat(this.az_start); out.writeFloat(this.el_start); out.writeFloat(this.scan_rate); SocketUtil.writeString(this.segname, out, MAX_SEGNAME_LENGTH); out.writeFloat(this.opt.rmax_km); out.writeFloat(this.opt.htmax_km); out.writeFloat(this.opt.res_m); out.writeInt(this.follow_mode.ordinal()); out.writeInt(this.scan_type.ordinal()); out.writeInt(this.scan_flags); out.writeInt(this.volume_num); out.writeInt(this.sweep_num); out.writeInt(this.time_limit); out.writeInt(this.webtilt); out.writeFloat(this.left_limit); out.writeFloat(this.right_limit); out.writeFloat(this.up_limit); out.writeFloat(this.down_limit); out.writeFloat(this.step); out.writeInt(this.max_sweeps); out.writeInt(this.filter_break_sweep); out.writeInt(this.clutter_filter1); out.writeInt(this.clutter_filter2); SocketUtil.writeString(this.project, out, MAX_SEGNAME_LENGTH); out.writeFloat(this.current_fixed_angle); out.write(this.extraData); }
/** * Writes this header to a DataOut * * @param out the DataOutput to write values to */
Writes this header to a DataOut
write
{ "repo_name": "CSU-RADAR-GROUP/VCHILL", "path": "src/edu/colostate/vchill/chill/ChillScanSeg.java", "license": "gpl-3.0", "size": 8207 }
[ "edu.colostate.vchill.ChillDefines", "edu.colostate.vchill.socket.SocketUtil" ]
import edu.colostate.vchill.ChillDefines; import edu.colostate.vchill.socket.SocketUtil;
import edu.colostate.vchill.*; import edu.colostate.vchill.socket.*;
[ "edu.colostate.vchill" ]
edu.colostate.vchill;
1,037,241
private String getVertxVersion() { return VersionCommand.getVersion(); }
String function() { return VersionCommand.getVersion(); }
/** * Return the vertx version. * * @return */
Return the vertx version
getVertxVersion
{ "repo_name": "gentics/mesh", "path": "core/src/main/java/com/gentics/mesh/cli/MeshImpl.java", "license": "apache-2.0", "size": 14490 }
[ "io.vertx.core.impl.launcher.commands.VersionCommand" ]
import io.vertx.core.impl.launcher.commands.VersionCommand;
import io.vertx.core.impl.launcher.commands.*;
[ "io.vertx.core" ]
io.vertx.core;
1,514,220
public void send(BufferedReader in, BufferedWriter out, String s) { try { out.write(s + "\n"); out.flush(); s = in.readLine(); } catch (IOException ioe) { System.out.println("error: "+ioe); } }
void function(BufferedReader in, BufferedWriter out, String s) { try { out.write(s + "\n"); out.flush(); s = in.readLine(); } catch (IOException ioe) { System.out.println(STR+ioe); } }
/** * This method writes data to a BufferedWriter and reads the * response in a BufferedReader. * * @param in BufferedReader to read the response from * @param out BufferedWriter to write data to * @param s The data to write out */
This method writes data to a BufferedWriter and reads the response in a BufferedReader
send
{ "repo_name": "hungyao/context-toolkit", "path": "src/main/java/context/arch/util/SendMail.java", "license": "gpl-3.0", "size": 3014 }
[ "java.io.BufferedReader", "java.io.BufferedWriter", "java.io.IOException" ]
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,600,492
protected static LabelValueBean lvl10n(String label, String value) { return new LabelValueBean( LocalizationService.getInstance(). getMessage(label), value); }
static LabelValueBean function(String label, String value) { return new LabelValueBean( LocalizationService.getInstance(). getMessage(label), value); }
/** * Construct a LabelValueBean instance where the label is localized * using the LocalizationService.getMessage() method. * @param label to localize * @param value value of selection * @return LabelValueBean instance */
Construct a LabelValueBean instance where the label is localized using the LocalizationService.getMessage() method
lvl10n
{ "repo_name": "mcalmer/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/struts/RhnAction.java", "license": "gpl-2.0", "size": 11553 }
[ "com.redhat.rhn.common.localization.LocalizationService", "org.apache.struts.util.LabelValueBean" ]
import com.redhat.rhn.common.localization.LocalizationService; import org.apache.struts.util.LabelValueBean;
import com.redhat.rhn.common.localization.*; import org.apache.struts.util.*;
[ "com.redhat.rhn", "org.apache.struts" ]
com.redhat.rhn; org.apache.struts;
2,458,951
public BlockVector2D getCenter() { return cylRegion.getCenter().toVector2D().toBlockVector2D(); }
BlockVector2D function() { return cylRegion.getCenter().toVector2D().toBlockVector2D(); }
/** * Returns the center vector of the cylinder * * @return the center */
Returns the center vector of the cylinder
getCenter
{ "repo_name": "UnlimitedFreedom/UF-WorldEdit", "path": "worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CylinderSelection.java", "license": "gpl-3.0", "size": 2655 }
[ "com.sk89q.worldedit.BlockVector2D" ]
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.*;
[ "com.sk89q.worldedit" ]
com.sk89q.worldedit;
859,157
private int read(ByteBuffer target, int readLength) throws IOException { int result = 0; if (target.hasArray()) { // Use directly the underlying byte array byte[] byteArray = target.array(); result = getInputStream().read(byteArray, target.position(), Math.min(readLength, target.remaining())); if (result > 0) { target.position(target.position() + result); } } else { if (this.buffer.length < IoUtils.BUFFER_SIZE) { this.buffer = new byte[IoUtils.BUFFER_SIZE]; } result = getInputStream().read( this.buffer, 0, Math.min(Math.min(readLength, IoUtils.BUFFER_SIZE), target.remaining())); if (result > 0) { target.put(buffer, 0, result); } } return result; }
int function(ByteBuffer target, int readLength) throws IOException { int result = 0; if (target.hasArray()) { byte[] byteArray = target.array(); result = getInputStream().read(byteArray, target.position(), Math.min(readLength, target.remaining())); if (result > 0) { target.position(target.position() + result); } } else { if (this.buffer.length < IoUtils.BUFFER_SIZE) { this.buffer = new byte[IoUtils.BUFFER_SIZE]; } result = getInputStream().read( this.buffer, 0, Math.min(Math.min(readLength, IoUtils.BUFFER_SIZE), target.remaining())); if (result > 0) { target.put(buffer, 0, result); } } return result; }
/** * Reads a given number of bytes into a target byte buffer. * * @param target * The target byte buffer. * @param readLength * The maximum number of bytes to read. * @return The number of bytes effectively read or -1 if end reached. * @throws IOException */
Reads a given number of bytes into a target byte buffer
read
{ "repo_name": "zhangjunfang/eclipse-dir", "path": "restlet/src/org/restlet/engine/io/InputStreamChannel.java", "license": "bsd-2-clause", "size": 5357 }
[ "java.io.IOException", "java.nio.ByteBuffer" ]
import java.io.IOException; import java.nio.ByteBuffer;
import java.io.*; import java.nio.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,143,905
public IDocumentObject openDocumentObject( String documentObjectName ) throws IOException;
IDocumentObject function( String documentObjectName ) throws IOException;
/** * Open the named document object. * @param documentObjectName * @return */
Open the named document object
openDocumentObject
{ "repo_name": "Charling-Huang/birt", "path": "data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/document/IDocumentManager.java", "license": "epl-1.0", "size": 1665 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
575,327
public void setMenuBar(final MenuBar newMenuBar) { menuBar = newMenuBar; if (!isAppleUI()) { return; } for (int i = 0; i < menuBar.getMenuCount(); i++) { final JMenu menu = menuBar.getMenu(i); if (menu == null) { continue; } menu.setMnemonic(0); for (int j = 0; j < menu.getItemCount(); j++) { final JMenuItem menuItem = menu.getItem(j); if (menuItem != null) { menuItem.setMnemonic(0); } } } }
void function(final MenuBar newMenuBar) { menuBar = newMenuBar; if (!isAppleUI()) { return; } for (int i = 0; i < menuBar.getMenuCount(); i++) { final JMenu menu = menuBar.getMenu(i); if (menu == null) { continue; } menu.setMnemonic(0); for (int j = 0; j < menu.getItemCount(); j++) { final JMenuItem menuItem = menu.getItem(j); if (menuItem != null) { menuItem.setMnemonic(0); } } } }
/** * Set the MenuBar. This will unset all menu mnemonics aswell if on the OSX ui. * * @param newMenuBar MenuBar to use to send events to, */
Set the MenuBar. This will unset all menu mnemonics aswell if on the OSX ui
setMenuBar
{ "repo_name": "DMDirc/Plugins", "path": "ui_swing/src/main/java/com/dmdirc/addons/ui_swing/Apple.java", "license": "mit", "size": 18523 }
[ "com.dmdirc.addons.ui_swing.components.menubar.MenuBar", "javax.swing.JMenu", "javax.swing.JMenuItem" ]
import com.dmdirc.addons.ui_swing.components.menubar.MenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem;
import com.dmdirc.addons.ui_swing.components.menubar.*; import javax.swing.*;
[ "com.dmdirc.addons", "javax.swing" ]
com.dmdirc.addons; javax.swing;
1,767,942
return XmlUtils.getNodeValue(XmlUtils.getFirstMatchingChildNode(mResourceNode, STATIC_RESOURCE)); } /** * If this node has a static resource, then this method returns the type of the static resource. * This returns {@code null} if this node does not have a static resource. * * @return The static resource type or {@code null}
return XmlUtils.getNodeValue(XmlUtils.getFirstMatchingChildNode(mResourceNode, STATIC_RESOURCE)); } /** * If this node has a static resource, then this method returns the type of the static resource. * This returns {@code null} if this node does not have a static resource. * * @return The static resource type or {@code null}
/** * If this node has a static resource, then this method returns the static resource data, * if present. This returns {@code null} if this node does not have a static resource. * * @return The static resource data or {@code null} */
If this node has a static resource, then this method returns the static resource data, if present. This returns null if this node does not have a static resource
getStaticResource
{ "repo_name": "JSafaiyeh/Fabric-Example-App-Android", "path": "mopub-sdk/src/main/java/com/mopub/mobileads/VastResourceXmlManager.java", "license": "mit", "size": 2651 }
[ "com.mopub.mobileads.util.XmlUtils" ]
import com.mopub.mobileads.util.XmlUtils;
import com.mopub.mobileads.util.*;
[ "com.mopub.mobileads" ]
com.mopub.mobileads;
2,904,374
public static String getVersion(FileSystem fs, Path rootdir) throws IOException { Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME); String version = null; if (fs.exists(versionFile)) { FSDataInputStream s = fs.open(versionFile); try { version = DataInputStream.readUTF(s); } catch (EOFException eof) { LOG.warn("Version file was empty, odd, will try to set it."); } finally { s.close(); } } return version; }
static String function(FileSystem fs, Path rootdir) throws IOException { Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME); String version = null; if (fs.exists(versionFile)) { FSDataInputStream s = fs.open(versionFile); try { version = DataInputStream.readUTF(s); } catch (EOFException eof) { LOG.warn(STR); } finally { s.close(); } } return version; }
/** * Verifies current version of file system * * @param fs filesystem object * @param rootdir root hbase directory * @return null if no version file exists, version string otherwise. * @throws IOException e */
Verifies current version of file system
getVersion
{ "repo_name": "lifeng5042/RStore", "path": "src/org/apache/hadoop/hbase/util/FSUtils.java", "license": "gpl-2.0", "size": 32784 }
[ "java.io.DataInputStream", "java.io.EOFException", "java.io.IOException", "org.apache.hadoop.fs.FSDataInputStream", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.HConstants" ]
import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HConstants;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,024,003
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<ManagedIdentitySqlControlSettingsModelInner>, ManagedIdentitySqlControlSettingsModelInner> beginCreateOrUpdate( String resourceGroupName, String workspaceName, ManagedIdentitySqlControlSettingsModelInner managedIdentitySqlControlSettings, Context context);
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<ManagedIdentitySqlControlSettingsModelInner>, ManagedIdentitySqlControlSettingsModelInner> beginCreateOrUpdate( String resourceGroupName, String workspaceName, ManagedIdentitySqlControlSettingsModelInner managedIdentitySqlControlSettings, Context context);
/** * Create or update Managed Identity Sql Control Settings. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. * @param managedIdentitySqlControlSettings Managed Identity Sql Control Settings. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return managed Identity Sql Control Settings along with {@link Response} on successful completion of {@link * Mono}. */
Create or update Managed Identity Sql Control Settings
beginCreateOrUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/fluent/WorkspaceManagedIdentitySqlControlSettingsClient.java", "license": "mit", "size": 6754 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.synapse.fluent.models.ManagedIdentitySqlControlSettingsModelInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.synapse.fluent.models.ManagedIdentitySqlControlSettingsModelInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.synapse.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
477,798
@Override public Iterator<String> names() { List<String> result; result = new ArrayList<String>(); result.add(VALUE_HEADER); result.add(VALUE_ROW); return result.iterator(); }
Iterator<String> function() { List<String> result; result = new ArrayList<String>(); result.add(VALUE_HEADER); result.add(VALUE_ROW); return result.iterator(); }
/** * Returns all value names that can be used (theoretically). * * @return enumeration over all possible value names */
Returns all value names that can be used (theoretically)
names
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/flow/container/FeatureConverterContainer.java", "license": "gpl-3.0", "size": 2806 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,638,113
public void showComponent(ConsoleComponent component) { component.show(); scrollDown(); }
void function(ConsoleComponent component) { component.show(); scrollDown(); }
/** * Shows the component * @param component Component */
Shows the component
showComponent
{ "repo_name": "iAmGio/jrfl", "path": "src/eu/iamgio/jrfl/Console.java", "license": "apache-2.0", "size": 11053 }
[ "eu.iamgio.jrfl.api.components.ConsoleComponent" ]
import eu.iamgio.jrfl.api.components.ConsoleComponent;
import eu.iamgio.jrfl.api.components.*;
[ "eu.iamgio.jrfl" ]
eu.iamgio.jrfl;
1,643,552
protected Connection getConnection(String id) throws SQLException { Connection c = DriverManager.getConnection("jdbc:hsqldb:file:" + baseDir.getAbsolutePath() + '/' + id + "/dbfile", "SA", ""); if (verbose) { System.err.println("Opening JDBC URL '" + "jdbc:hsqldb:file:" + baseDir.getAbsolutePath() + '/' + id + "/dbfile"); } c.setAutoCommit(false); return c; }
Connection function(String id) throws SQLException { Connection c = DriverManager.getConnection(STR + baseDir.getAbsolutePath() + '/' + id + STR, "SA", STROpening JDBC URL '" + STR + baseDir.getAbsolutePath() + '/' + id + STR); } c.setAutoCommit(false); return c; }
/** * Make sure to close after using the returned connection * (like in a finally block). */
Make sure to close after using the returned connection (like in a finally block)
getConnection
{ "repo_name": "ThangBK2009/android-source-browsing.platform--external--hsqldb", "path": "src/org/hsqldb/test/TestDbBackup.java", "license": "bsd-3-clause", "size": 22987 }
[ "java.sql.Connection", "java.sql.DriverManager", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,996,015
WeightedEntityCollectionValue possibleEntitiesToSpawn(); interface NextEntityToSpawnValue extends Value<WeightedEntity> { /** * Sets this value with the provided {@link EntityType} and * {@link Collection} of {@link DataManipulator}s. * * @param type The type of {@link Entity}
WeightedEntityCollectionValue possibleEntitiesToSpawn(); interface NextEntityToSpawnValue extends Value<WeightedEntity> { /** * Sets this value with the provided {@link EntityType} and * {@link Collection} of {@link DataManipulator}s. * * @param type The type of {@link Entity}
/** * Gets the {@link WeightedEntityCollectionValue} of all possible * {@link Entity} instances that can be spawned by the spawner. As they * are all {@link WeightedEntity} instances, their weight is defined as * a {@link Random} to determine the next {@link Entity} that will be * spawned, unless overriden by {@link #nextEntityToSpawn()}. * * @return The immutable weighted entity collection value of entities */
Gets the <code>WeightedEntityCollectionValue</code> of all possible <code>Entity</code> instances that can be spawned by the spawner. As they are all <code>WeightedEntity</code> instances, their weight is defined as a <code>Random</code> to determine the next <code>Entity</code> that will be spawned, unless overriden by <code>#nextEntityToSpawn()</code>
possibleEntitiesToSpawn
{ "repo_name": "Kiskae/SpongeAPI", "path": "src/main/java/org/spongepowered/api/data/manipulator/mutable/MobSpawnerData.java", "license": "mit", "size": 6461 }
[ "java.util.Collection", "org.spongepowered.api.data.manipulator.DataManipulator", "org.spongepowered.api.data.value.mutable.Value", "org.spongepowered.api.data.value.mutable.WeightedEntityCollectionValue", "org.spongepowered.api.entity.Entity", "org.spongepowered.api.entity.EntityType", "org.spongepowered.api.util.weighted.WeightedEntity" ]
import java.util.Collection; import org.spongepowered.api.data.manipulator.DataManipulator; import org.spongepowered.api.data.value.mutable.Value; import org.spongepowered.api.data.value.mutable.WeightedEntityCollectionValue; import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.util.weighted.WeightedEntity;
import java.util.*; import org.spongepowered.api.data.manipulator.*; import org.spongepowered.api.data.value.mutable.*; import org.spongepowered.api.entity.*; import org.spongepowered.api.util.weighted.*;
[ "java.util", "org.spongepowered.api" ]
java.util; org.spongepowered.api;
2,085,102
private IProject createProjectHandle(IWorkspaceRoot root, String projectName) { return root.getProject(projectName); }
IProject function(IWorkspaceRoot root, String projectName) { return root.getProject(projectName); }
/** * Creates a project resource handle for the project with the given name. * This method does not create the project resource; this is the responsibility * of <code>createProject</code>. * * @param root the workspace root resource * @param projectName the name of the project * @return the new project resource handle */
Creates a project resource handle for the project with the given name. This method does not create the project resource; this is the responsibility of <code>createProject</code>
createProjectHandle
{ "repo_name": "dhuebner/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-ui-ide/src/main/java/org/eclipse/ui/dialogs/ContainerGenerator.java", "license": "epl-1.0", "size": 8698 }
[ "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IWorkspaceRoot" ]
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.*;
[ "org.eclipse.core" ]
org.eclipse.core;
220,003
public void setQuota(String volume, long quota) throws IOException { Preconditions.checkNotNull(volume); metadataManager.writeLock().lock(); try { byte[] dbVolumeKey = metadataManager.getVolumeKey(volume); byte[] volInfo = metadataManager.getVolumeTable().get(dbVolumeKey); if (volInfo == null) { LOG.debug("volume:{} does not exist", volume); throw new OMException(ResultCodes.FAILED_VOLUME_NOT_FOUND); } VolumeInfo volumeInfo = VolumeInfo.parseFrom(volInfo); OmVolumeArgs volumeArgs = OmVolumeArgs.getFromProtobuf(volumeInfo); Preconditions.checkState(volume.equals(volumeInfo.getVolume())); OmVolumeArgs newVolumeArgs = OmVolumeArgs.newBuilder() .setVolume(volumeArgs.getVolume()) .setAdminName(volumeArgs.getAdminName()) .setOwnerName(volumeArgs.getOwnerName()) .setQuotaInBytes(quota) .setCreationTime(volumeArgs.getCreationTime()).build(); VolumeInfo newVolumeInfo = newVolumeArgs.getProtobuf(); metadataManager.getVolumeTable().put(dbVolumeKey, newVolumeInfo.toByteArray()); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Changing volume quota failed for volume:{} quota:{}", volume, quota, ex); } throw ex; } finally { metadataManager.writeLock().unlock(); } }
void function(String volume, long quota) throws IOException { Preconditions.checkNotNull(volume); metadataManager.writeLock().lock(); try { byte[] dbVolumeKey = metadataManager.getVolumeKey(volume); byte[] volInfo = metadataManager.getVolumeTable().get(dbVolumeKey); if (volInfo == null) { LOG.debug(STR, volume); throw new OMException(ResultCodes.FAILED_VOLUME_NOT_FOUND); } VolumeInfo volumeInfo = VolumeInfo.parseFrom(volInfo); OmVolumeArgs volumeArgs = OmVolumeArgs.getFromProtobuf(volumeInfo); Preconditions.checkState(volume.equals(volumeInfo.getVolume())); OmVolumeArgs newVolumeArgs = OmVolumeArgs.newBuilder() .setVolume(volumeArgs.getVolume()) .setAdminName(volumeArgs.getAdminName()) .setOwnerName(volumeArgs.getOwnerName()) .setQuotaInBytes(quota) .setCreationTime(volumeArgs.getCreationTime()).build(); VolumeInfo newVolumeInfo = newVolumeArgs.getProtobuf(); metadataManager.getVolumeTable().put(dbVolumeKey, newVolumeInfo.toByteArray()); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error(STR, volume, quota, ex); } throw ex; } finally { metadataManager.writeLock().unlock(); } }
/** * Changes the Quota on a volume. * * @param volume - Name of the volume. * @param quota - Quota in bytes. * @throws IOException */
Changes the Quota on a volume
setQuota
{ "repo_name": "dierobotsdie/hadoop", "path": "hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java", "license": "apache-2.0", "size": 15316 }
[ "com.google.common.base.Preconditions", "java.io.IOException", "org.apache.hadoop.ozone.om.exceptions.OMException", "org.apache.hadoop.ozone.om.helpers.OmVolumeArgs" ]
import com.google.common.base.Preconditions; import java.io.IOException; import org.apache.hadoop.ozone.om.exceptions.OMException; import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
import com.google.common.base.*; import java.io.*; import org.apache.hadoop.ozone.om.exceptions.*; import org.apache.hadoop.ozone.om.helpers.*;
[ "com.google.common", "java.io", "org.apache.hadoop" ]
com.google.common; java.io; org.apache.hadoop;
93,086
List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(1); roles.add(new SimpleGrantedAuthority(getUser().getRole().getShortName())); return roles; }
List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(1); roles.add(new SimpleGrantedAuthority(getUser().getRole().getShortName())); return roles; }
/** * Return provided authorities. It returns one Role from {@link User} in the {@link GrantedAuthority} list. * * @return {@link GrantedAuthority} list */
Return provided authorities. It returns one Role from <code>User</code> in the <code>GrantedAuthority</code> list
getAuthorities
{ "repo_name": "nanpa83/ngrinder", "path": "ngrinder-controller/src/main/java/org/ngrinder/security/SecuredUser.java", "license": "apache-2.0", "size": 3237 }
[ "java.util.ArrayList", "java.util.List", "org.springframework.security.core.GrantedAuthority", "org.springframework.security.core.authority.SimpleGrantedAuthority" ]
import java.util.ArrayList; import java.util.List; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.util.*; import org.springframework.security.core.*; import org.springframework.security.core.authority.*;
[ "java.util", "org.springframework.security" ]
java.util; org.springframework.security;
1,053,002
public void checkForOutdatedCaches() { Iterator<CachedQuery> iter = this.cachedQueries.values().iterator(); while (iter.hasNext()) { CachedQuery query = iter.next(); if (System.currentTimeMillis() - query.getCacheTime() > this.maxCacheTime) { iter.remove(); } } }
void function() { Iterator<CachedQuery> iter = this.cachedQueries.values().iterator(); while (iter.hasNext()) { CachedQuery query = iter.next(); if (System.currentTimeMillis() - query.getCacheTime() > this.maxCacheTime) { iter.remove(); } } }
/** * Method which should be invoked frequently to check for outdated caches. */
Method which should be invoked frequently to check for outdated caches
checkForOutdatedCaches
{ "repo_name": "tttro/projektityokurssi", "path": "mobile/LBDMobileClient/app/src/main/java/fi/lbd/mobile/backendhandler/CachingBackendHandler.java", "license": "mit", "size": 3388 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
978,290
public static byte[] copyToBytes(MemorySegment[] segments, int offset, byte[] bytes, int bytesOffset, int numBytes) { if (inFirstSegment(segments, offset, numBytes)) { segments[0].get(offset, bytes, bytesOffset, numBytes); } else { copyMultiSegmentsToBytes(segments, offset, bytes, bytesOffset, numBytes); } return bytes; }
static byte[] function(MemorySegment[] segments, int offset, byte[] bytes, int bytesOffset, int numBytes) { if (inFirstSegment(segments, offset, numBytes)) { segments[0].get(offset, bytes, bytesOffset, numBytes); } else { copyMultiSegmentsToBytes(segments, offset, bytes, bytesOffset, numBytes); } return bytes; }
/** * Copy segments to target byte[]. * * @param segments Source segments. * @param offset Source segments offset. * @param bytes target byte[]. * @param bytesOffset target byte[] offset. * @param numBytes the number bytes to copy. */
Copy segments to target byte[]
copyToBytes
{ "repo_name": "hequn8128/flink", "path": "flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/SegmentsUtil.java", "license": "apache-2.0", "size": 30468 }
[ "org.apache.flink.core.memory.MemorySegment" ]
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.core.memory.*;
[ "org.apache.flink" ]
org.apache.flink;
1,440,085
static SQLTimestamp promote( DateTimeDataValue dateTime, java.sql.Date currentDate) throws StandardException { if( dateTime instanceof SQLTimestamp) return (SQLTimestamp) dateTime; else if( dateTime instanceof SQLTime) return new SQLTimestamp( SQLDate.computeEncodedDate( currentDate, (Calendar) null), ((SQLTime) dateTime).getEncodedTime(), 0 ); else if( dateTime instanceof SQLDate) return new SQLTimestamp( ((SQLDate) dateTime).getEncodedDate(), 0, 0); else return new SQLTimestamp( dateTime.getTimestamp( new GregorianCalendar())); } // end of promote
static SQLTimestamp promote( DateTimeDataValue dateTime, java.sql.Date currentDate) throws StandardException { if( dateTime instanceof SQLTimestamp) return (SQLTimestamp) dateTime; else if( dateTime instanceof SQLTime) return new SQLTimestamp( SQLDate.computeEncodedDate( currentDate, (Calendar) null), ((SQLTime) dateTime).getEncodedTime(), 0 ); else if( dateTime instanceof SQLDate) return new SQLTimestamp( ((SQLDate) dateTime).getEncodedDate(), 0, 0); else return new SQLTimestamp( dateTime.getTimestamp( new GregorianCalendar())); }
/** * Promotes a DateTimeDataValue to a timestamp. * * * @return the corresponding timestamp, using the current date if datetime is a time, * or time 00:00:00 if datetime is a date. * * @exception StandardException */
Promotes a DateTimeDataValue to a timestamp
promote
{ "repo_name": "viaper/DBPlus", "path": "DerbyHodgepodge/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java", "license": "apache-2.0", "size": 38799 }
[ "java.sql.Date", "java.util.Calendar", "java.util.GregorianCalendar", "org.apache.derby.iapi.error.StandardException" ]
import java.sql.Date; import java.util.Calendar; import java.util.GregorianCalendar; import org.apache.derby.iapi.error.StandardException;
import java.sql.*; import java.util.*; import org.apache.derby.iapi.error.*;
[ "java.sql", "java.util", "org.apache.derby" ]
java.sql; java.util; org.apache.derby;
2,507,085
public static byte[] toByteArray(Reader input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
static byte[] function(Reader input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of a <code>Reader</code> as a <code>byte[]</code> * using the default character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from * @return the requested byte array * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs */
Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the default character encoding of the platform. This method buffers the input internally, so there is no need to use a <code>BufferedReader</code>
toByteArray
{ "repo_name": "rytina/dukecon_appsgenerator", "path": "org.apache.commons.io/source-bundle/org/apache/commons/io/IOUtils.java", "license": "epl-1.0", "size": 62217 }
[ "java.io.IOException", "java.io.Reader", "org.apache.commons.io.output.ByteArrayOutputStream" ]
import java.io.IOException; import java.io.Reader; import org.apache.commons.io.output.ByteArrayOutputStream;
import java.io.*; import org.apache.commons.io.output.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
531,373
@PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Transactional public Response updateEvents(final MultivaluedMapImpl formProperties) { writeLock(); try { Boolean ack = false; if (formProperties.containsKey("ack")) { ack = "true".equals(formProperties.getFirst("ack")); formProperties.remove("ack"); } final CriteriaBuilder builder = new CriteriaBuilder(OnmsEvent.class); applyQueryFilters(formProperties, builder); builder.orderBy("eventTime").desc(); for (final OnmsEvent event : m_eventDao.findMatching(builder.toCriteria())) { processEventAck(event, ack); } return Response.seeOther(getRedirectUri(m_uriInfo)).build(); } finally { writeUnlock(); } }
@Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response function(final MultivaluedMapImpl formProperties) { writeLock(); try { Boolean ack = false; if (formProperties.containsKey("ack")) { ack = "true".equals(formProperties.getFirst("ack")); formProperties.remove("ack"); } final CriteriaBuilder builder = new CriteriaBuilder(OnmsEvent.class); applyQueryFilters(formProperties, builder); builder.orderBy(STR).desc(); for (final OnmsEvent event : m_eventDao.findMatching(builder.toCriteria())) { processEventAck(event, ack); } return Response.seeOther(getRedirectUri(m_uriInfo)).build(); } finally { writeUnlock(); } }
/** * Updates all the events that match any filter/query supplied in the * form. If the "ack" parameter is "true", then acks the events as the * current logged in user, otherwise unacks the events * * @param formProperties * Map of the parameters passed in by form encoding */
Updates all the events that match any filter/query supplied in the form. If the "ack" parameter is "true", then acks the events as the current logged in user, otherwise unacks the events
updateEvents
{ "repo_name": "RangerRick/opennms", "path": "opennms-webapp/src/main/java/org/opennms/web/rest/EventRestService.java", "license": "gpl-2.0", "size": 9832 }
[ "javax.ws.rs.Consumes", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.opennms.core.criteria.CriteriaBuilder", "org.opennms.netmgt.model.OnmsEvent" ]
import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.opennms.core.criteria.CriteriaBuilder; import org.opennms.netmgt.model.OnmsEvent;
import javax.ws.rs.*; import javax.ws.rs.core.*; import org.opennms.core.criteria.*; import org.opennms.netmgt.model.*;
[ "javax.ws", "org.opennms.core", "org.opennms.netmgt" ]
javax.ws; org.opennms.core; org.opennms.netmgt;
1,263,616
@Test public void deleteUnsyncedPersistedDirectoryWithCheck() throws Exception { AlluxioURI ufsMount = createPersistedDirectories(1); mountPersistedDirectories(ufsMount); loadPersistedDirectories(1); // Add a file to the UFS Files.createFile( Paths.get(ufsMount.join(DIR_TOP_LEVEL).join(FILE_PREFIX + (DIR_WIDTH)).getPath())); mThrown.expect(IOException.class); // delete top-level directory mFileSystemMaster.delete(new AlluxioURI(MOUNT_URI).join(DIR_TOP_LEVEL), DeleteOptions.defaults().setRecursive(true).setAlluxioOnly(false).setUnchecked(false)); // Check all that could be deleted List<AlluxioURI> except = new LinkedList<>(); except.add(new AlluxioURI(MOUNT_URI).join(DIR_TOP_LEVEL)); checkPersistedDirectoriesDeleted(1, ufsMount, except); }
void function() throws Exception { AlluxioURI ufsMount = createPersistedDirectories(1); mountPersistedDirectories(ufsMount); loadPersistedDirectories(1); Files.createFile( Paths.get(ufsMount.join(DIR_TOP_LEVEL).join(FILE_PREFIX + (DIR_WIDTH)).getPath())); mThrown.expect(IOException.class); mFileSystemMaster.delete(new AlluxioURI(MOUNT_URI).join(DIR_TOP_LEVEL), DeleteOptions.defaults().setRecursive(true).setAlluxioOnly(false).setUnchecked(false)); List<AlluxioURI> except = new LinkedList<>(); except.add(new AlluxioURI(MOUNT_URI).join(DIR_TOP_LEVEL)); checkPersistedDirectoriesDeleted(1, ufsMount, except); }
/** * Tests the {@link FileSystemMaster#delete(AlluxioURI, DeleteOptions)} method for * a directory with un-synced persistent entries with a sync check. */
Tests the <code>FileSystemMaster#delete(AlluxioURI, DeleteOptions)</code> method for a directory with un-synced persistent entries with a sync check
deleteUnsyncedPersistedDirectoryWithCheck
{ "repo_name": "Reidddddd/mo-alluxio", "path": "core/server/master/src/test/java/alluxio/master/file/FileSystemMasterTest.java", "license": "apache-2.0", "size": 81136 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Paths", "java.util.LinkedList", "java.util.List" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.LinkedList; import java.util.List;
import java.io.*; import java.nio.file.*; import java.util.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
253,333
Agency getAgency(String agencyId) throws IOException;
Agency getAgency(String agencyId) throws IOException;
/** * Get details about the agency. * @param agencyId the agency identifier * @return the agency details * @throws IOException * an error occurred */
Get details about the agency
getAgency
{ "repo_name": "jeremiehuchet/onebusaway-java-api", "path": "src/main/java/fr/itinerennes/api/client/ItineRennesApiClient.java", "license": "gpl-3.0", "size": 2386 }
[ "fr.itinerennes.api.client.model.Agency", "java.io.IOException" ]
import fr.itinerennes.api.client.model.Agency; import java.io.IOException;
import fr.itinerennes.api.client.model.*; import java.io.*;
[ "fr.itinerennes.api", "java.io" ]
fr.itinerennes.api; java.io;
2,178,890
static SSLHandshakeException toSSLHandshakeException(Throwable e) { if (e instanceof SSLHandshakeException) { return (SSLHandshakeException) e; } return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e); } /** * Return how much bytes can be read out of the encrypted data. Be aware that this method will not increase * the readerIndex of the given {@link ByteBuf}. * * @param buffer * The {@link ByteBuf} to read from. Be aware that it must have at least * {@link #SSL_RECORD_HEADER_LENGTH} bytes to read, * otherwise it will throw an {@link IllegalArgumentException}. * @return length * The length of the encrypted packet that is included in the buffer or * {@link #SslUtils#NOT_ENOUGH_DATA} if not enough data is present in the * {@link ByteBuf}. This will return {@link SslUtils#NOT_ENCRYPTED} if * the given {@link ByteBuf} is not encrypted at all. * @throws IllegalArgumentException * Is thrown if the given {@link ByteBuf} has not at least {@link #SSL_RECORD_HEADER_LENGTH}
static SSLHandshakeException toSSLHandshakeException(Throwable e) { if (e instanceof SSLHandshakeException) { return (SSLHandshakeException) e; } return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e); } /** * Return how much bytes can be read out of the encrypted data. Be aware that this method will not increase * the readerIndex of the given {@link ByteBuf}. * * @param buffer * The {@link ByteBuf} to read from. Be aware that it must have at least * {@link #SSL_RECORD_HEADER_LENGTH} bytes to read, * otherwise it will throw an {@link IllegalArgumentException}. * @return length * The length of the encrypted packet that is included in the buffer or * {@link #SslUtils#NOT_ENOUGH_DATA} if not enough data is present in the * {@link ByteBuf}. This will return {@link SslUtils#NOT_ENCRYPTED} if * the given {@link ByteBuf} is not encrypted at all. * @throws IllegalArgumentException * Is thrown if the given {@link ByteBuf} has not at least {@link #SSL_RECORD_HEADER_LENGTH}
/** * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already. */
Converts the given exception to a <code>SSLHandshakeException</code>, if it isn't already
toSSLHandshakeException
{ "repo_name": "NiteshKant/netty", "path": "handler/src/main/java/io/netty/handler/ssl/SslUtils.java", "license": "apache-2.0", "size": 18470 }
[ "io.netty.buffer.ByteBuf", "javax.net.ssl.SSLHandshakeException" ]
import io.netty.buffer.ByteBuf; import javax.net.ssl.SSLHandshakeException;
import io.netty.buffer.*; import javax.net.ssl.*;
[ "io.netty.buffer", "javax.net" ]
io.netty.buffer; javax.net;
652,146
public static Set getClassDependencies(String path, Set classpath) throws IOException { InputStream is = new FileInputStream(path); Set result = new HashSet(); Set done = new HashSet(); computeClassDependencies(is, classpath, done, result); return result; }
static Set function(String path, Set classpath) throws IOException { InputStream is = new FileInputStream(path); Set result = new HashSet(); Set done = new HashSet(); computeClassDependencies(is, classpath, done, result); return result; }
/** * Returns the dependencies of the given class. * @param path The root class path. * @param classpath The set of directories (Strings) to scan. * @return a list of paths representing the used classes. */
Returns the dependencies of the given class
getClassDependencies
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/util/ClassFileUtilities.java", "license": "apache-2.0", "size": 8248 }
[ "java.io.FileInputStream", "java.io.IOException", "java.io.InputStream", "java.util.HashSet", "java.util.Set" ]
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.util.Set;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
831,513
void exitSwitchLabels(@NotNull Java8Parser.SwitchLabelsContext ctx);
void exitSwitchLabels(@NotNull Java8Parser.SwitchLabelsContext ctx);
/** * Exit a parse tree produced by {@link Java8Parser#switchLabels}. * * @param ctx the parse tree */
Exit a parse tree produced by <code>Java8Parser#switchLabels</code>
exitSwitchLabels
{ "repo_name": "BigDaddy-Germany/WHOAMI", "path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java", "license": "mit", "size": 97945 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
100,311
private void syncShardStatsOnNewMaster(ClusterChangedEvent event) { SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE); if (snapshotsInProgress == null) { return; } // Clear request deduplicator since we need to send all requests that were potentially not handled by the previous // master again remoteFailedRequestDeduplicator.clear(); for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) { if (snapshot.state() == State.STARTED || snapshot.state() == State.ABORTED) { Map<ShardId, IndexShardSnapshotStatus> localShards = currentSnapshotShards(snapshot.snapshot()); if (localShards != null) { ImmutableOpenMap<ShardId, ShardSnapshotStatus> masterShards = snapshot.shards(); for(Map.Entry<ShardId, IndexShardSnapshotStatus> localShard : localShards.entrySet()) { ShardId shardId = localShard.getKey(); ShardSnapshotStatus masterShard = masterShards.get(shardId); if (masterShard != null && masterShard.state().completed() == false) { final IndexShardSnapshotStatus.Copy indexShardSnapshotStatus = localShard.getValue().asCopy(); final Stage stage = indexShardSnapshotStatus.getStage(); // Master knows about the shard and thinks it has not completed if (stage == Stage.DONE) { // but we think the shard is done - we need to make new master know that the shard is done logger.debug("[{}] new master thinks the shard [{}] is not completed but the shard is done locally, " + "updating status on the master", snapshot.snapshot(), shardId); notifySuccessfulSnapshotShard(snapshot.snapshot(), shardId, localShard.getValue().getShardSnapshotResult()); } else if (stage == Stage.FAILURE) { // but we think the shard failed - we need to make new master know that the shard failed logger.debug("[{}] new master thinks the shard [{}] is not completed but the shard failed locally, " + "updating status on master", snapshot.snapshot(), shardId); notifyFailedSnapshotShard(snapshot.snapshot(), shardId, indexShardSnapshotStatus.getFailure()); } } } } } } }
void function(ClusterChangedEvent event) { SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE); if (snapshotsInProgress == null) { return; } remoteFailedRequestDeduplicator.clear(); for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) { if (snapshot.state() == State.STARTED snapshot.state() == State.ABORTED) { Map<ShardId, IndexShardSnapshotStatus> localShards = currentSnapshotShards(snapshot.snapshot()); if (localShards != null) { ImmutableOpenMap<ShardId, ShardSnapshotStatus> masterShards = snapshot.shards(); for(Map.Entry<ShardId, IndexShardSnapshotStatus> localShard : localShards.entrySet()) { ShardId shardId = localShard.getKey(); ShardSnapshotStatus masterShard = masterShards.get(shardId); if (masterShard != null && masterShard.state().completed() == false) { final IndexShardSnapshotStatus.Copy indexShardSnapshotStatus = localShard.getValue().asCopy(); final Stage stage = indexShardSnapshotStatus.getStage(); if (stage == Stage.DONE) { logger.debug(STR + STR, snapshot.snapshot(), shardId); notifySuccessfulSnapshotShard(snapshot.snapshot(), shardId, localShard.getValue().getShardSnapshotResult()); } else if (stage == Stage.FAILURE) { logger.debug(STR + STR, snapshot.snapshot(), shardId); notifyFailedSnapshotShard(snapshot.snapshot(), shardId, indexShardSnapshotStatus.getFailure()); } } } } } } }
/** * Checks if any shards were processed that the new master doesn't know about */
Checks if any shards were processed that the new master doesn't know about
syncShardStatsOnNewMaster
{ "repo_name": "robin13/elasticsearch", "path": "server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java", "license": "apache-2.0", "size": 24525 }
[ "java.util.Map", "org.elasticsearch.cluster.ClusterChangedEvent", "org.elasticsearch.cluster.SnapshotsInProgress", "org.elasticsearch.common.collect.ImmutableOpenMap", "org.elasticsearch.index.shard.ShardId", "org.elasticsearch.index.snapshots.IndexShardSnapshotStatus" ]
import java.util.Map; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.SnapshotsInProgress; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus;
import java.util.*; import org.elasticsearch.cluster.*; import org.elasticsearch.common.collect.*; import org.elasticsearch.index.shard.*; import org.elasticsearch.index.snapshots.*;
[ "java.util", "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.index" ]
java.util; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.index;
2,188,790
private long resolveTerm(LinkedList<Var> vl, long count) { long newcount = count; for (int c = 0; c < arity; c++) { Term term = arg[c]; if (term != null) { //-------------------------------- // we want to resolve only not linked variables: // so linked variables must get the linked term term = term.getTerm(); //-------------------------------- if (term instanceof Var) { Var t = (Var) term; t.setInternalTimestamp(newcount++); if (!t.isAnonymous()) { // searching a variable with the same name in the list String name = t.getName(); Iterator<Var> it = vl.iterator(); Var found = null; while (it.hasNext()) { Var vn = it.next(); if (name.equals(vn.getName())) { found = vn; break; } } if (found != null) { arg[c] = found; } else { vl.add(t); } } } else if (term instanceof Struct) { newcount = ((Struct) term).resolveTerm(vl, newcount); } } } resolved = true; return newcount; } // services for list structures
long function(LinkedList<Var> vl, long count) { long newcount = count; for (int c = 0; c < arity; c++) { Term term = arg[c]; if (term != null) { term = term.getTerm(); if (term instanceof Var) { Var t = (Var) term; t.setInternalTimestamp(newcount++); if (!t.isAnonymous()) { String name = t.getName(); Iterator<Var> it = vl.iterator(); Var found = null; while (it.hasNext()) { Var vn = it.next(); if (name.equals(vn.getName())) { found = vn; break; } } if (found != null) { arg[c] = found; } else { vl.add(t); } } } else if (term instanceof Struct) { newcount = ((Struct) term).resolveTerm(vl, newcount); } } } resolved = true; return newcount; }
/** * Resolve name of terms * * @param vl list of variables resolved * @param count start timestamp for variables of this term * @return next timestamp for other terms */
Resolve name of terms
resolveTerm
{ "repo_name": "zakski/project-soisceal", "path": "gospel-core/src/main/scala/com/szadowsz/gospel/core/data/Struct.java", "license": "lgpl-3.0", "size": 27261 }
[ "java.util.Iterator", "java.util.LinkedList" ]
import java.util.Iterator; import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
744,831
void reverseComplement() throws ReadOnlyException;
void reverseComplement() throws ReadOnlyException;
/** * Reverse and complement the sequence and all features in every Entry in * this EntryGroup. **/
Reverse and complement the sequence and all features in every Entry in this EntryGroup
reverseComplement
{ "repo_name": "satta/Artemis", "path": "uk/ac/sanger/artemis/EntryGroup.java", "license": "gpl-3.0", "size": 11744 }
[ "uk.ac.sanger.artemis.util.ReadOnlyException" ]
import uk.ac.sanger.artemis.util.ReadOnlyException;
import uk.ac.sanger.artemis.util.*;
[ "uk.ac.sanger" ]
uk.ac.sanger;
2,498,174
public Observable<ServiceResponse<WorkerPoolResourceInner>> getMultiRolePoolWithServiceResponseAsync(String resourceGroupName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<WorkerPoolResourceInner>> function(String resourceGroupName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Get properties of a multi-role pool. * Get properties of a multi-role pool. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service Environment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the WorkerPoolResourceInner object */
Get properties of a multi-role pool. Get properties of a multi-role pool
getMultiRolePoolWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java", "license": "mit", "size": 595166 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,234,492
public List<Object> getHeaderValues(String name) { HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); if (header != null) { return header.getValues(); } else { return Collections.emptyList(); } }
List<Object> function(String name) { HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); if (header != null) { return header.getValues(); } else { return Collections.emptyList(); } }
/** * Return all values for the given header as a List of value objects. * @param name the name of the header * @return the associated header values, or an empty List if none */
Return all values for the given header as a List of value objects
getHeaderValues
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java", "license": "apache-2.0", "size": 17896 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,650,412
public static boolean softUninstall(AddOn addOn, AddOnUninstallationProgressCallback callback) { Validate.notNull(addOn, "Parameter addOn must not be null."); validateCallbackNotNull(callback); try { boolean uninstalledWithoutErrors = true; uninstalledWithoutErrors &= uninstallAddOnPassiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnActiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnExtensions(addOn, callback); return uninstalledWithoutErrors; } catch (Throwable e) { logger.error("An error occurred while uninstalling the add-on: " + addOn.getId(), e); return false; } }
static boolean function(AddOn addOn, AddOnUninstallationProgressCallback callback) { Validate.notNull(addOn, STR); validateCallbackNotNull(callback); try { boolean uninstalledWithoutErrors = true; uninstalledWithoutErrors &= uninstallAddOnPassiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnActiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnExtensions(addOn, callback); return uninstalledWithoutErrors; } catch (Throwable e) { logger.error(STR + addOn.getId(), e); return false; } }
/** * Uninstalls Java classes ({@code Extension}s, {@code Plugin}s, {@code PassiveScanner}s) of the * given {@code addOn}. Should be called when the add-on must be temporarily uninstalled for an * update of a dependency. * * <p>The Java classes are uninstalled in the following order (inverse to installation): * * <ol> * <li>Passive scanners; * <li>Active scanners; * <li>Extensions. * </ol> * * @param addOn the add-on that will be softly uninstalled * @param callback the callback that will be notified of the progress of the uninstallation * @return {@code true} if the add-on was uninstalled without errors, {@code false} otherwise. * @since 2.4.0 * @see Extension * @see PassiveScanner * @see org.parosproxy.paros.core.scanner.Plugin */
Uninstalls Java classes (Extensions, Plugins, PassiveScanners) of the given addOn. Should be called when the add-on must be temporarily uninstalled for an update of a dependency. The Java classes are uninstalled in the following order (inverse to installation): Passive scanners; Active scanners; Extensions.
softUninstall
{ "repo_name": "meitar/zaproxy", "path": "zap/src/main/java/org/zaproxy/zap/control/AddOnInstaller.java", "license": "apache-2.0", "size": 33023 }
[ "org.apache.commons.lang.Validate" ]
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,036,224
public void addMember(final @NonNull UUID uuid) { for (final Plot current : getConnectedPlots()) { if (current.getMembers().add(uuid)) { DBFunc.setMember(current, uuid); } } }
void function(final @NonNull UUID uuid) { for (final Plot current : getConnectedPlots()) { if (current.getMembers().add(uuid)) { DBFunc.setMember(current, uuid); } } }
/** * Add someone as a trusted user (updates database as well) * * @param uuid the uuid of the player to add as a member */
Add someone as a trusted user (updates database as well)
addMember
{ "repo_name": "IntellectualSites/PlotSquared", "path": "Core/src/main/java/com/plotsquared/core/plot/Plot.java", "license": "gpl-3.0", "size": 117872 }
[ "com.plotsquared.core.database.DBFunc", "org.checkerframework.checker.nullness.qual.NonNull" ]
import com.plotsquared.core.database.DBFunc; import org.checkerframework.checker.nullness.qual.NonNull;
import com.plotsquared.core.database.*; import org.checkerframework.checker.nullness.qual.*;
[ "com.plotsquared.core", "org.checkerframework.checker" ]
com.plotsquared.core; org.checkerframework.checker;
1,659,157
@Test (timeout=60000) public void testDiffReport2() throws Exception { Path subsub1 = new Path(sub1, "subsub1"); Path subsubsub1 = new Path(subsub1, "subsubsub1"); hdfs.mkdirs(subsubsub1); modifyAndCreateSnapshot(subsubsub1, new Path[]{sub1}); // delete subsub1 hdfs.delete(subsub1, true); // check diff report between s0 and s2 verifyDiffReport(sub1, "s0", "s2", new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("subsub1/subsubsub1")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file15")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("subsub1/subsubsub1/file12")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("subsub1/subsubsub1/file11")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file11")), new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("subsub1/subsubsub1/file13")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/link13")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("subsub1/subsubsub1/link13"))); // check diff report between s0 and the current status verifyDiffReport(sub1, "s0", "", new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("subsub1"))); }
@Test (timeout=60000) void function() throws Exception { Path subsub1 = new Path(sub1, STR); Path subsubsub1 = new Path(subsub1, STR); hdfs.mkdirs(subsubsub1); modifyAndCreateSnapshot(subsubsub1, new Path[]{sub1}); hdfs.delete(subsub1, true); verifyDiffReport(sub1, "s0", "s2", new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes(STR)), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes(STR))); verifyDiffReport(sub1, "s0", STR")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes(STR))); }
/** * Make changes under a sub-directory, then delete the sub-directory. Make * sure the diff report computation correctly retrieve the diff from the * deleted sub-directory. */
Make changes under a sub-directory, then delete the sub-directory. Make sure the diff report computation correctly retrieve the diff from the deleted sub-directory
testDiffReport2
{ "repo_name": "Ethanlm/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java", "license": "apache-2.0", "size": 28312 }
[ "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.DFSUtil", "org.apache.hadoop.hdfs.protocol.SnapshotDiffReport", "org.junit.Test" ]
import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport; import org.junit.Test;
import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
2,809,211
@NotNull Map<String, ColumnHandle> getColumnHandles(TableHandle tableHandle);
Map<String, ColumnHandle> getColumnHandles(TableHandle tableHandle);
/** * Gets all of the columns on the specified table, or an empty map if the columns can not be enumerated. * * @throws RuntimeException if table handle is no longer valid */
Gets all of the columns on the specified table, or an empty map if the columns can not be enumerated
getColumnHandles
{ "repo_name": "vishalsan/presto", "path": "presto-main/src/main/java/com/facebook/presto/metadata/Metadata.java", "license": "apache-2.0", "size": 3843 }
[ "com.facebook.presto.spi.ColumnHandle", "com.facebook.presto.spi.TableHandle", "java.util.Map" ]
import com.facebook.presto.spi.ColumnHandle; import com.facebook.presto.spi.TableHandle; import java.util.Map;
import com.facebook.presto.spi.*; import java.util.*;
[ "com.facebook.presto", "java.util" ]
com.facebook.presto; java.util;
970,476
public Paint getWallPaint() { return this.wallPaint; }
Paint function() { return this.wallPaint; }
/** * Returns the paint used to highlight the left and bottom wall in the plot * background. * * @return The paint. * * @see #setWallPaint(Paint) */
Returns the paint used to highlight the left and bottom wall in the plot background
getWallPaint
{ "repo_name": "JSansalone/JFreeChart", "path": "source/org/jfree/chart/renderer/category/BarRenderer3D.java", "license": "lgpl-2.1", "size": 31043 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
826,006
public void testBwcSerialization() throws IOException { for (int runs = 0; runs < NUMBER_OF_TEST_RUNS; runs++) { final DateHistogramGroupConfig reference = ConfigTestHelpers.randomDateHistogramGroupConfig(random()); final BytesStreamOutput out = new BytesStreamOutput(); reference.writeTo(out); // previous way to deserialize a DateHistogramGroupConfig final StreamInput in = out.bytes().streamInput(); DateHistogramInterval interval = new DateHistogramInterval(in); String field = in.readString(); DateHistogramInterval delay = in.readOptionalWriteable(DateHistogramInterval::new); DateTimeZone timeZone = in.readTimeZone(); assertEqualInstances(reference, new DateHistogramGroupConfig(field, interval, delay, timeZone.getID())); } for (int runs = 0; runs < NUMBER_OF_TEST_RUNS; runs++) { final String field = ConfigTestHelpers.randomField(random()); final DateHistogramInterval interval = ConfigTestHelpers.randomInterval(); final DateHistogramInterval delay = randomBoolean() ? ConfigTestHelpers.randomInterval() : null; final DateTimeZone timezone = randomDateTimeZone(); // previous way to serialize a DateHistogramGroupConfig final BytesStreamOutput out = new BytesStreamOutput(); interval.writeTo(out); out.writeString(field); out.writeOptionalWriteable(delay); out.writeTimeZone(timezone); final StreamInput in = out.bytes().streamInput(); DateHistogramGroupConfig deserialized = new DateHistogramGroupConfig(in); assertEqualInstances(new DateHistogramGroupConfig(field, interval, delay, timezone.getID()), deserialized); } }
void function() throws IOException { for (int runs = 0; runs < NUMBER_OF_TEST_RUNS; runs++) { final DateHistogramGroupConfig reference = ConfigTestHelpers.randomDateHistogramGroupConfig(random()); final BytesStreamOutput out = new BytesStreamOutput(); reference.writeTo(out); final StreamInput in = out.bytes().streamInput(); DateHistogramInterval interval = new DateHistogramInterval(in); String field = in.readString(); DateHistogramInterval delay = in.readOptionalWriteable(DateHistogramInterval::new); DateTimeZone timeZone = in.readTimeZone(); assertEqualInstances(reference, new DateHistogramGroupConfig(field, interval, delay, timeZone.getID())); } for (int runs = 0; runs < NUMBER_OF_TEST_RUNS; runs++) { final String field = ConfigTestHelpers.randomField(random()); final DateHistogramInterval interval = ConfigTestHelpers.randomInterval(); final DateHistogramInterval delay = randomBoolean() ? ConfigTestHelpers.randomInterval() : null; final DateTimeZone timezone = randomDateTimeZone(); final BytesStreamOutput out = new BytesStreamOutput(); interval.writeTo(out); out.writeString(field); out.writeOptionalWriteable(delay); out.writeTimeZone(timezone); final StreamInput in = out.bytes().streamInput(); DateHistogramGroupConfig deserialized = new DateHistogramGroupConfig(in); assertEqualInstances(new DateHistogramGroupConfig(field, interval, delay, timezone.getID()), deserialized); } }
/** * Tests that a DateHistogramGroupConfig can be serialized/deserialized correctly after * the timezone was changed from DateTimeZone to String. */
Tests that a DateHistogramGroupConfig can be serialized/deserialized correctly after the timezone was changed from DateTimeZone to String
testBwcSerialization
{ "repo_name": "gfyoung/elasticsearch", "path": "x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/rollup/job/DateHistogramGroupConfigSerializingTests.java", "license": "apache-2.0", "size": 9355 }
[ "java.io.IOException", "org.elasticsearch.common.io.stream.BytesStreamOutput", "org.elasticsearch.common.io.stream.StreamInput", "org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval", "org.elasticsearch.xpack.core.rollup.ConfigTestHelpers", "org.joda.time.DateTimeZone" ]
import java.io.IOException; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.xpack.core.rollup.ConfigTestHelpers; import org.joda.time.DateTimeZone;
import java.io.*; import org.elasticsearch.common.io.stream.*; import org.elasticsearch.search.aggregations.bucket.histogram.*; import org.elasticsearch.xpack.core.rollup.*; import org.joda.time.*;
[ "java.io", "org.elasticsearch.common", "org.elasticsearch.search", "org.elasticsearch.xpack", "org.joda.time" ]
java.io; org.elasticsearch.common; org.elasticsearch.search; org.elasticsearch.xpack; org.joda.time;
363,725
@Test public void Test_CharClass1() { String[] str = { "A-Za-z]", "a-zA-Z]", "A-z]", "a-Z]", "a-c]", "!-*]", "1-34-9]", "1-9]", "9-1]", "^]", "^0] IN [0-9]", "^1-3] in [1-9]", "^a-b] in [a-b]", "^a-b] IN [a-b]", "^b] IN [a-c]" }; ArrayList<RegexParserInput> list = new ArrayList<RegexParserInput>(); boolean[] expected = { true, true, true, true, true, true, true, true, true, false, true, false, false, true, true }; for (int i = 0; i < str.length; i++) { // add RPI to list as ordered RegexParserInput temp = new RegexParserInput(str[i]); list.add(temp); } for (int i = 0; i < str.length; i++) { // System.out.println(list.get(i)); RegexParserOutput r = RegexParser.char_class1(list.get(i)); if (expected[i] != r.isWorkedOrNot()) { System.out.println("#" + i + " expected: " + expected[i] + " vs actual " + r.isWorkedOrNot()); System.out.println("TestCase# " + i + ": " + str[i] + " Failed"); // System.out.println(r.getCharSet()); } assertEquals(expected[i], r.isWorkedOrNot()); // if true, print out the charSet } }
void function() { String[] str = { STR, STR, "A-z]", "a-Z]", "a-c]", "!-*]", STR, "1-9]", "9-1]", "^]", STR, STR, STR, STR, STR }; ArrayList<RegexParserInput> list = new ArrayList<RegexParserInput>(); boolean[] expected = { true, true, true, true, true, true, true, true, true, false, true, false, false, true, true }; for (int i = 0; i < str.length; i++) { RegexParserInput temp = new RegexParserInput(str[i]); list.add(temp); } for (int i = 0; i < str.length; i++) { RegexParserOutput r = RegexParser.char_class1(list.get(i)); if (expected[i] != r.isWorkedOrNot()) { System.out.println("#" + i + STR + expected[i] + STR + r.isWorkedOrNot()); System.out.println(STR + i + STR + str[i] + STR); } assertEquals(expected[i], r.isWorkedOrNot()); } }
/** * Tests char class1 */
Tests char class1
Test_CharClass1
{ "repo_name": "ldong/cs3240", "path": "3240proj1/PHASE1_DONE/cs3240-project-master/java-project/RegexParserTest.java", "license": "apache-2.0", "size": 11924 }
[ "java.util.ArrayList", "org.junit.Assert" ]
import java.util.ArrayList; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,785,437
private void setDimLookup( RowMetaInterface rowMeta ) throws KettleDatabaseException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); data.lookupRowMeta = new RowMeta(); String sql = "SELECT " + databaseMeta.quoteField( meta.getKeyField() ) + ", " + databaseMeta.quoteField( meta.getVersionField() ); if ( !Const.isEmpty( meta.getFieldLookup() ) ) { for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { // Don't retrieve the fields without input if ( !Const.isEmpty( meta.getFieldLookup()[i] ) && !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); if ( !Const.isEmpty( meta.getFieldStream()[i] ) && !meta.getFieldLookup()[i].equals( meta.getFieldStream()[i] ) ) { sql += " AS " + databaseMeta.quoteField( meta.getFieldStream()[i] ); } } } } if ( meta.getCacheSize() >= 0 ) { sql += ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); } sql += " FROM " + data.schemaTable + " WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i != 0 ) { sql += " AND "; } sql += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ? "; data.lookupRowMeta.addValueMeta( rowMeta.getValueMeta( data.keynrs[i] ) ); } String dateFromField = databaseMeta.quoteField( meta.getDateFrom() ); String dateToField = databaseMeta.quoteField( meta.getDateTo() ); if ( meta.isUsingStartDateAlternative() && ( meta.getStartDateAlternative() == DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL ) || ( meta.getStartDateAlternative() == DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE ) ) { // Null as a start date is possible... // sql += " AND ( " + dateFromField + " IS NULL OR " + dateFromField + " <= ? )" + Const.CR; sql += " AND " + dateToField + " > ?" + Const.CR; data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateFrom(), ValueMetaInterface.TYPE_DATE ) ); data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateTo(), ValueMetaInterface.TYPE_DATE ) ); } else { // Null as a start date is NOT possible // sql += " AND ? >= " + dateFromField + Const.CR; sql += " AND ? < " + dateToField + Const.CR; data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateFrom(), ValueMetaInterface.TYPE_DATE ) ); data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateTo(), ValueMetaInterface.TYPE_DATE ) ); } try { logDetailed( "Dimension Lookup setting preparedStatement to [" + sql + "]" ); data.prepStatementLookup = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); if ( databaseMeta.supportsSetMaxRows() ) { data.prepStatementLookup.setMaxRows( 1 ); // alywas get only 1 line back! } if ( databaseMeta.getDatabaseInterface() instanceof MySQLDatabaseMeta ) { data.prepStatementLookup.setFetchSize( 0 ); // Make sure to DISABLE Streaming Result sets } logDetailed( "Finished preparing dimension lookup statement." ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension lookup", ex ); } }
void function( RowMetaInterface rowMeta ) throws KettleDatabaseException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); data.lookupRowMeta = new RowMeta(); String sql = STR + databaseMeta.quoteField( meta.getKeyField() ) + STR + databaseMeta.quoteField( meta.getVersionField() ); if ( !Const.isEmpty( meta.getFieldLookup() ) ) { for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !Const.isEmpty( meta.getFieldLookup()[i] ) && !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += STR + databaseMeta.quoteField( meta.getFieldLookup()[i] ); if ( !Const.isEmpty( meta.getFieldStream()[i] ) && !meta.getFieldLookup()[i].equals( meta.getFieldStream()[i] ) ) { sql += STR + databaseMeta.quoteField( meta.getFieldStream()[i] ); } } } } if ( meta.getCacheSize() >= 0 ) { sql += STR + databaseMeta.quoteField( meta.getDateFrom() ) + STR + databaseMeta.quoteField( meta.getDateTo() ); } sql += STR + data.schemaTable + STR; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i != 0 ) { sql += STR; } sql += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + STR; data.lookupRowMeta.addValueMeta( rowMeta.getValueMeta( data.keynrs[i] ) ); } String dateFromField = databaseMeta.quoteField( meta.getDateFrom() ); String dateToField = databaseMeta.quoteField( meta.getDateTo() ); if ( meta.isUsingStartDateAlternative() && ( meta.getStartDateAlternative() == DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL ) ( meta.getStartDateAlternative() == DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE ) ) { sql += STR + dateToField + STR + Const.CR; data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateFrom(), ValueMetaInterface.TYPE_DATE ) ); data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateTo(), ValueMetaInterface.TYPE_DATE ) ); } else { sql += STR + dateToField + Const.CR; data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateFrom(), ValueMetaInterface.TYPE_DATE ) ); data.lookupRowMeta.addValueMeta( new ValueMeta( meta.getDateTo(), ValueMetaInterface.TYPE_DATE ) ); } try { logDetailed( STR + sql + "]" ); data.prepStatementLookup = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); if ( databaseMeta.supportsSetMaxRows() ) { data.prepStatementLookup.setMaxRows( 1 ); } if ( databaseMeta.getDatabaseInterface() instanceof MySQLDatabaseMeta ) { data.prepStatementLookup.setFetchSize( 0 ); } logDetailed( STR ); } catch ( SQLException ex ) { throw new KettleDatabaseException( STR, ex ); } }
/** * table: dimension table keys[]: which dim-fields do we use to look up key? retval: name of the key to return * datefield: do we have a datefield? datefrom, dateto: date-range, if any. */
table: dimension table keys[]: which dim-fields do we use to look up key? retval: name of the key to return datefield: do we have a datefield? datefrom, dateto: date-range, if any
setDimLookup
{ "repo_name": "YuryBY/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java", "license": "apache-2.0", "size": 69645 }
[ "java.sql.SQLException", "org.pentaho.di.core.Const", "org.pentaho.di.core.database.DatabaseMeta", "org.pentaho.di.core.database.MySQLDatabaseMeta", "org.pentaho.di.core.exception.KettleDatabaseException", "org.pentaho.di.core.row.RowMeta", "org.pentaho.di.core.row.RowMetaInterface", "org.pentaho.di.core.row.ValueMeta", "org.pentaho.di.core.row.ValueMetaInterface" ]
import java.sql.SQLException; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.database.MySQLDatabaseMeta; import org.pentaho.di.core.exception.KettleDatabaseException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMeta; import org.pentaho.di.core.row.ValueMetaInterface;
import java.sql.*; import org.pentaho.di.core.*; import org.pentaho.di.core.database.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*;
[ "java.sql", "org.pentaho.di" ]
java.sql; org.pentaho.di;
1,715,409
public void testTempDir() throws Exception { File tempDir = TempFileProvider.getTempDir(); assertTrue("Not a directory", tempDir.isDirectory()); File tempDirParent = tempDir.getParentFile(); // create a temp file File tempFile = File.createTempFile("AAAA", ".tmp"); File tempFileParent = tempFile.getParentFile(); // they should be equal assertEquals("Our temp dir not subdirectory system temp directory", tempFileParent, tempDirParent); }
void function() throws Exception { File tempDir = TempFileProvider.getTempDir(); assertTrue(STR, tempDir.isDirectory()); File tempDirParent = tempDir.getParentFile(); File tempFile = File.createTempFile("AAAA", ".tmp"); File tempFileParent = tempFile.getParentFile(); assertEquals(STR, tempFileParent, tempDirParent); }
/** * test of getTempDir * * @throws Exception */
test of getTempDir
testTempDir
{ "repo_name": "Alfresco/gytheio", "path": "gytheio-commons/src/test/java/org/gytheio/content/file/TempFileProviderTest.java", "license": "lgpl-3.0", "size": 3172 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
930,384
public JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { if (!TextUtils.isEmpty(mFirstName)) { json.put("f", mFirstName); } if (!TextUtils.isEmpty(mLastName)) { json.put("l", mLastName); } if (!TextUtils.isEmpty(mCellPhone)) { json.put("m", mCellPhone); } if (!TextUtils.isEmpty(mOfficePhone)) { json.put("o", mOfficePhone); } if (!TextUtils.isEmpty(mHomePhone)) { json.put("h", mHomePhone); } if (!TextUtils.isEmpty(mEmail)) { json.put("e", mEmail); } if (mServerContactId > 0) { json.put("i", mServerContactId); } if (mRawContactId > 0) { json.put("c", mRawContactId); } if (mDeleted) { json.put("d", mDeleted); } } catch (final Exception ex) { Log.i(TAG, "Error converting RawContact to JSONObject" + ex.toString()); } return json; } public RawContact(String name, String fullName, String firstName, String lastName, String cellPhone, String officePhone, String homePhone, String email, String status, String avatarUrl, boolean deleted, long serverContactId, long rawContactId, long syncState, boolean dirty) { mUserName = name; mFullName = fullName; mFirstName = firstName; mLastName = lastName; mCellPhone = cellPhone; mOfficePhone = officePhone; mHomePhone = homePhone; mEmail = email; mStatus = status; mAvatarUrl = avatarUrl; mDeleted = deleted; mServerContactId = serverContactId; mRawContactId = rawContactId; mSyncState = syncState; mDirty = dirty; }
JSONObject function() { JSONObject json = new JSONObject(); try { if (!TextUtils.isEmpty(mFirstName)) { json.put("f", mFirstName); } if (!TextUtils.isEmpty(mLastName)) { json.put("l", mLastName); } if (!TextUtils.isEmpty(mCellPhone)) { json.put("m", mCellPhone); } if (!TextUtils.isEmpty(mOfficePhone)) { json.put("o", mOfficePhone); } if (!TextUtils.isEmpty(mHomePhone)) { json.put("h", mHomePhone); } if (!TextUtils.isEmpty(mEmail)) { json.put("e", mEmail); } if (mServerContactId > 0) { json.put("i", mServerContactId); } if (mRawContactId > 0) { json.put("c", mRawContactId); } if (mDeleted) { json.put("d", mDeleted); } } catch (final Exception ex) { Log.i(TAG, STR + ex.toString()); } return json; } public RawContact(String name, String fullName, String firstName, String lastName, String cellPhone, String officePhone, String homePhone, String email, String status, String avatarUrl, boolean deleted, long serverContactId, long rawContactId, long syncState, boolean dirty) { mUserName = name; mFullName = fullName; mFirstName = firstName; mLastName = lastName; mCellPhone = cellPhone; mOfficePhone = officePhone; mHomePhone = homePhone; mEmail = email; mStatus = status; mAvatarUrl = avatarUrl; mDeleted = deleted; mServerContactId = serverContactId; mRawContactId = rawContactId; mSyncState = syncState; mDirty = dirty; }
/** * Convert the RawContact object into a JSON string. From the * JSONString interface. * @return a JSON string representation of the object */
Convert the RawContact object into a JSON string. From the JSONString interface
toJSONObject
{ "repo_name": "blois/AndroidSDKCloneMin", "path": "sdk/samples/android-20/legacy/SampleSyncAdapter/src/com/example/android/samplesync/client/RawContact.java", "license": "apache-2.0", "size": 8423 }
[ "android.text.TextUtils", "android.util.Log", "org.json.JSONObject" ]
import android.text.TextUtils; import android.util.Log; import org.json.JSONObject;
import android.text.*; import android.util.*; import org.json.*;
[ "android.text", "android.util", "org.json" ]
android.text; android.util; org.json;
2,011,692
public java.lang.Integer save(com.floreantpos.model.MenuItemShift menuItemShift, Session s) { return (java.lang.Integer) save((Object) menuItemShift, s); }
java.lang.Integer function(com.floreantpos.model.MenuItemShift menuItemShift, Session s) { return (java.lang.Integer) save((Object) menuItemShift, s); }
/** * Persist the given transient instance, first assigning a generated identifier. (Or using the current value * of the identifier property if the assigned generator is used.) * Use the Session given. * @param menuItemShift a transient instance of a persistent class * @param s the Session * @return the class identifier */
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) Use the Session given
save
{ "repo_name": "meyerdg/floreant", "path": "src/com/floreantpos/model/dao/BaseMenuItemShiftDAO.java", "license": "gpl-2.0", "size": 7760 }
[ "org.hibernate.Session" ]
import org.hibernate.Session;
import org.hibernate.*;
[ "org.hibernate" ]
org.hibernate;
2,490,493
@POST("v2/bot/group/{groupId}/leave") Call<BotApiResponse> leaveGroup(@Path("groupId") String groupId);
@POST(STR) Call<BotApiResponse> leaveGroup(@Path(STR) String groupId);
/** * Leave a group. * * @see <a href="https://devdocs.line.me?java#leave">//devdocs.line.me#leave</a> */
Leave a group
leaveGroup
{ "repo_name": "TerukiKawamura/Prototype-161215", "path": "line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingService.java", "license": "apache-2.0", "size": 3240 }
[ "com.linecorp.bot.model.response.BotApiResponse" ]
import com.linecorp.bot.model.response.BotApiResponse;
import com.linecorp.bot.model.response.*;
[ "com.linecorp.bot" ]
com.linecorp.bot;
2,069,508
public void createAdapter(Context context) { sLeDeviceListAdapter = new BflDeviceListAdapter(context.getApplicationContext()); }
void function(Context context) { sLeDeviceListAdapter = new BflDeviceListAdapter(context.getApplicationContext()); }
/** * Create an object of device list adapter. * * @param context is gettable from caller application. * @see kr.co.sevencore.blefotalib.BflDeviceListAdapter */
Create an object of device list adapter
createAdapter
{ "repo_name": "sevencore/BLEFOTA", "path": "blefotalib/src/main/java/kr/co/sevencore/blefotalib/BflDeviceScanner.java", "license": "gpl-2.0", "size": 12444 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,404,299
public final ValueWithPos<String> formatE123InternationalWithPos( final ValueWithPos<PhoneNumberData> pphoneNumberData) { final StringBuilder resultNumber = new StringBuilder(); if (pphoneNumberData == null) { return null; } int cursor = pphoneNumberData.getPos(); if (isPhoneNumberNotEmpty(pphoneNumberData.getValue())) { cursor++; resultNumber.append('+').append(pphoneNumberData.getValue().getCountryCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getAreaCode())) { resultNumber.append(pphoneNumberData.getValue().getAreaCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); } resultNumber.append(pphoneNumberData.getValue().getLineNumber()); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getExtension())) { resultNumber.append(pphoneNumberData.getValue().getExtension()); } } return new ValueWithPos<>(StringUtils.trimToNull(resultNumber.toString()), cursor); }
final ValueWithPos<String> function( final ValueWithPos<PhoneNumberData> pphoneNumberData) { final StringBuilder resultNumber = new StringBuilder(); if (pphoneNumberData == null) { return null; } int cursor = pphoneNumberData.getPos(); if (isPhoneNumberNotEmpty(pphoneNumberData.getValue())) { cursor++; resultNumber.append('+').append(pphoneNumberData.getValue().getCountryCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getAreaCode())) { resultNumber.append(pphoneNumberData.getValue().getAreaCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); } resultNumber.append(pphoneNumberData.getValue().getLineNumber()); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getExtension())) { resultNumber.append(pphoneNumberData.getValue().getExtension()); } } return new ValueWithPos<>(StringUtils.trimToNull(resultNumber.toString()), cursor); }
/** * format phone number in E123 international format with cursor position handling. * * @param pphoneNumberData phone number to format with cursor position * @return formated phone number as String with new cursor position */
format phone number in E123 international format with cursor position handling
formatE123InternationalWithPos
{ "repo_name": "ManfredTremmel/gwt-bean-validators", "path": "mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java", "license": "apache-2.0", "size": 76134 }
[ "de.knightsoftnet.validators.shared.data.PhoneNumberData", "de.knightsoftnet.validators.shared.data.ValueWithPos", "org.apache.commons.lang3.StringUtils" ]
import de.knightsoftnet.validators.shared.data.PhoneNumberData; import de.knightsoftnet.validators.shared.data.ValueWithPos; import org.apache.commons.lang3.StringUtils;
import de.knightsoftnet.validators.shared.data.*; import org.apache.commons.lang3.*;
[ "de.knightsoftnet.validators", "org.apache.commons" ]
de.knightsoftnet.validators; org.apache.commons;
2,414,480
public Element getElement() { ensureValidity(); Element element = new Element("property", ""); if (m_name != null) { element.addAttribute(new Attribute("name", m_name)); } if (m_type != null) { element.addAttribute(new Attribute("type", m_type)); } if (m_value != null) { element.addAttribute(new Attribute("value", m_value)); } if (m_field != null) { element.addAttribute(new Attribute("field", m_field)); } if (m_mandatory) { element.addAttribute(new Attribute("mandatory", new Boolean(m_mandatory).toString())); } if (m_immutable) { element.addAttribute(new Attribute("immutable", new Boolean(m_immutable).toString())); } return element; }
Element function() { ensureValidity(); Element element = new Element(STR, STRnameSTRtypeSTRvalueSTRfieldSTRmandatorySTRimmutable", new Boolean(m_immutable).toString())); } return element; }
/** * Gets the 'property' element. * @return the element describing the current property. */
Gets the 'property' element
getElement
{ "repo_name": "boneman1231/org.apache.felix", "path": "trunk/ipojo/api/src/main/java/org/apache/felix/ipojo/api/ServiceProperty.java", "license": "apache-2.0", "size": 5735 }
[ "org.apache.felix.ipojo.metadata.Element" ]
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.metadata.*;
[ "org.apache.felix" ]
org.apache.felix;
1,707,395
public void removeObject(StaticObject object) { synchronized (this) { objects.remove(object); if (object.isGlobal() && object.isClientside() && !removedObjects.contains(object)) { removedObjects.add(object); } } }
void function(StaticObject object) { synchronized (this) { objects.remove(object); if (object.isGlobal() && object.isClientside() && !removedObjects.contains(object)) { removedObjects.add(object); } } }
/** * Removes an old GameObject. * @param object The GameObject to remove. */
Removes an old GameObject
removeObject
{ "repo_name": "AWildridge/ProtoScape", "path": "src/org/apollo/game/model/region/Region.java", "license": "isc", "size": 9633 }
[ "org.apollo.game.model.obj.StaticObject" ]
import org.apollo.game.model.obj.StaticObject;
import org.apollo.game.model.obj.*;
[ "org.apollo.game" ]
org.apollo.game;
1,239,941
BankOrder mergeFromInvoicePayments(Collection<InvoicePayment> invoicePayments) throws AxelorException;
BankOrder mergeFromInvoicePayments(Collection<InvoicePayment> invoicePayments) throws AxelorException;
/** * Merge bank orders from invoice payments. * * @param invoicePayments * @return * @throws AxelorException */
Merge bank orders from invoice payments
mergeFromInvoicePayments
{ "repo_name": "ama-axelor/axelor-business-suite", "path": "axelor-bank-payment/src/main/java/com/axelor/apps/bankpayment/service/bankorder/BankOrderMergeService.java", "license": "agpl-3.0", "size": 1431 }
[ "com.axelor.apps.account.db.InvoicePayment", "com.axelor.apps.bankpayment.db.BankOrder", "com.axelor.exception.AxelorException", "java.util.Collection" ]
import com.axelor.apps.account.db.InvoicePayment; import com.axelor.apps.bankpayment.db.BankOrder; import com.axelor.exception.AxelorException; import java.util.Collection;
import com.axelor.apps.account.db.*; import com.axelor.apps.bankpayment.db.*; import com.axelor.exception.*; import java.util.*;
[ "com.axelor.apps", "com.axelor.exception", "java.util" ]
com.axelor.apps; com.axelor.exception; java.util;
2,249,732
public static final RecommendationServiceClient create(RecommendationServiceSettings settings) throws IOException { return new RecommendationServiceClient(settings); }
static final RecommendationServiceClient function(RecommendationServiceSettings settings) throws IOException { return new RecommendationServiceClient(settings); }
/** * Constructs an instance of RecommendationServiceClient, using the given settings. The channels * are created based on the settings passed in, or defaults for any settings that are not set. */
Constructs an instance of RecommendationServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set
create
{ "repo_name": "googleads/google-ads-java", "path": "google-ads-stubs-v10/src/main/java/com/google/ads/googleads/v10/services/RecommendationServiceClient.java", "license": "apache-2.0", "size": 15036 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
537,710
private boolean getBoolean(String name, boolean def) { ContentValues values = getValues(name); return values != null ? values.getAsBoolean(VALUE) : def; }
boolean function(String name, boolean def) { ContentValues values = getValues(name); return values != null ? values.getAsBoolean(VALUE) : def; }
/** * Convenience function for retrieving a single settings value as a * boolean. * * @param name The name of the setting to retrieve. * @param def Value to return if the setting is not defined. * @return The setting's current value, or 'def' if it is not * defined. */
Convenience function for retrieving a single settings value as a boolean
getBoolean
{ "repo_name": "kden/ChatSecureAndroid", "path": "src/info/guardianproject/otr/app/im/provider/Imps.java", "license": "apache-2.0", "size": 100497 }
[ "android.content.ContentValues" ]
import android.content.ContentValues;
import android.content.*;
[ "android.content" ]
android.content;
1,230,415
public synchronized static void initConfig() { SeLionLogger.getLogger().entering(); Map<ConfigProperty, String> initialValues = new HashMap<>(); initConfig(initialValues); SeLionLogger.getLogger().exiting(); }
synchronized static void function() { SeLionLogger.getLogger().entering(); Map<ConfigProperty, String> initialValues = new HashMap<>(); initConfig(initialValues); SeLionLogger.getLogger().exiting(); }
/** * Reads and parses configuration file Initializes the configuration, reloading all data */
Reads and parses configuration file Initializes the configuration, reloading all data
initConfig
{ "repo_name": "vikram1711/SeLion", "path": "client/src/main/java/com/paypal/selion/configuration/Config.java", "license": "apache-2.0", "size": 34065 }
[ "com.paypal.selion.logger.SeLionLogger", "java.util.HashMap", "java.util.Map" ]
import com.paypal.selion.logger.SeLionLogger; import java.util.HashMap; import java.util.Map;
import com.paypal.selion.logger.*; import java.util.*;
[ "com.paypal.selion", "java.util" ]
com.paypal.selion; java.util;
1,405,410
public final Execution onMembers(DistributedSystem system, Set<DistributedMember> distributedMembers) { if (system == null) { throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL .toLocalizedString("DistributedSystem instance ")); } if (distributedMembers == null) { throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL .toLocalizedString("distributedMembers set ")); } return new MemberFunctionExecutor(system, distributedMembers); }
final Execution function(DistributedSystem system, Set<DistributedMember> distributedMembers) { if (system == null) { throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL .toLocalizedString(STR)); } if (distributedMembers == null) { throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL .toLocalizedString(STR)); } return new MemberFunctionExecutor(system, distributedMembers); }
/** * Returns an {@link Execution} object that can be used to execute a data independent function on the set of * {@link DistributedMember}s of the {@link DistributedSystem}. If one of the members goes down while dispatching or * executing the function, an Exception will be thrown. * * @param system * defines the distributed system * @param distributedMembers * set of distributed members on which {@link Function} to be executed * @throws FunctionException * if DistributedSystem instance passed is null * @since 6.0 */
Returns an <code>Execution</code> object that can be used to execute a data independent function on the set of <code>DistributedMember</code>s of the <code>DistributedSystem</code>. If one of the members goes down while dispatching or executing the function, an Exception will be thrown
onMembers
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java", "license": "apache-2.0", "size": 19067 }
[ "com.gemstone.gemfire.cache.execute.Execution", "com.gemstone.gemfire.cache.execute.FunctionException", "com.gemstone.gemfire.cache.execute.FunctionService", "com.gemstone.gemfire.distributed.DistributedMember", "com.gemstone.gemfire.distributed.DistributedSystem", "com.gemstone.gemfire.internal.cache.execute.MemberFunctionExecutor", "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "java.util.Set" ]
import com.gemstone.gemfire.cache.execute.Execution; import com.gemstone.gemfire.cache.execute.FunctionException; import com.gemstone.gemfire.cache.execute.FunctionService; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.execute.MemberFunctionExecutor; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import java.util.Set;
import com.gemstone.gemfire.cache.execute.*; import com.gemstone.gemfire.distributed.*; import com.gemstone.gemfire.internal.cache.execute.*; import com.gemstone.gemfire.internal.i18n.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
1,577,527
protected void prepareGlobalsForSave() { GlobalBusinessObject gbo = (GlobalBusinessObject) businessObject; // set the documentNumber for all gbo.setDocumentNumber(getDocumentNumber()); List<? extends GlobalBusinessObjectDetail> details = gbo.getAllDetailObjects(); for (GlobalBusinessObjectDetail detail : details) { detail.setDocumentNumber(getDocumentNumber()); } }
void function() { GlobalBusinessObject gbo = (GlobalBusinessObject) businessObject; gbo.setDocumentNumber(getDocumentNumber()); List<? extends GlobalBusinessObjectDetail> details = gbo.getAllDetailObjects(); for (GlobalBusinessObjectDetail detail : details) { detail.setDocumentNumber(getDocumentNumber()); } }
/** * This method does special-case handling for Globals, filling out various fields that need to be filled, etc. */
This method does special-case handling for Globals, filling out various fields that need to be filled, etc
prepareGlobalsForSave
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-kns/src/main/java/org/kuali/kfs/kns/maintenance/KualiGlobalMaintainableImpl.java", "license": "agpl-3.0", "size": 8018 }
[ "java.util.List", "org.kuali.kfs.krad.bo.GlobalBusinessObject", "org.kuali.kfs.krad.bo.GlobalBusinessObjectDetail" ]
import java.util.List; import org.kuali.kfs.krad.bo.GlobalBusinessObject; import org.kuali.kfs.krad.bo.GlobalBusinessObjectDetail;
import java.util.*; import org.kuali.kfs.krad.bo.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,402,048
@Override public String getReply(CommandIssuer issuer,RoboToyServerContext context,String message,WebSocketActiveSession session,Object parsedMessage) { if (!CommandIssuer.PLAYER.equals(issuer)) { return null; } if (message.length()>3 && message.charAt(0)==RoboToyServerController.PING && message.charAt(1)=='{' && message.charAt(message.length()-1)=='}') { // reply to message generated remotelly PingMessage ping = JSONUtils.fromJSON(message.substring(1), PingMessage.class); if (ping!=null) { ping.count++; return JSONUtils.toJSON(ping, false); } } return null; }
String function(CommandIssuer issuer,RoboToyServerContext context,String message,WebSocketActiveSession session,Object parsedMessage) { if (!CommandIssuer.PLAYER.equals(issuer)) { return null; } if (message.length()>3 && message.charAt(0)==RoboToyServerController.PING && message.charAt(1)=='{' && message.charAt(message.length()-1)=='}') { PingMessage ping = JSONUtils.fromJSON(message.substring(1), PingMessage.class); if (ping!=null) { ping.count++; return JSONUtils.toJSON(ping, false); } } return null; }
/** * After a call to 'parseMessage', this method will be called to get some custom reply to the caller. * @param parsedMessage Returned value from previous parseMessage call */
After a call to 'parseMessage', this method will be called to get some custom reply to the caller
getReply
{ "repo_name": "gustavohbf/robotoy", "path": "src/main/java/org/guga/robotoy/rasp/commands/CmdPing.java", "license": "apache-2.0", "size": 8207 }
[ "org.guga.robotoy.rasp.controller.RoboToyServerContext", "org.guga.robotoy.rasp.controller.RoboToyServerController", "org.guga.robotoy.rasp.network.WebSocketActiveSession", "org.guga.robotoy.rasp.utils.JSONUtils" ]
import org.guga.robotoy.rasp.controller.RoboToyServerContext; import org.guga.robotoy.rasp.controller.RoboToyServerController; import org.guga.robotoy.rasp.network.WebSocketActiveSession; import org.guga.robotoy.rasp.utils.JSONUtils;
import org.guga.robotoy.rasp.controller.*; import org.guga.robotoy.rasp.network.*; import org.guga.robotoy.rasp.utils.*;
[ "org.guga.robotoy" ]
org.guga.robotoy;
2,458,167
EAttribute getSketch_ByteVar5();
EAttribute getSketch_ByteVar5();
/** * Returns the meta object for the attribute '{@link com.specmate.migration.test.baseline.testmodel.artefact.Sketch#getByteVar5 <em>Byte Var5</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Byte Var5</em>'. * @see com.specmate.migration.test.baseline.testmodel.artefact.Sketch#getByteVar5() * @see #getSketch() * @generated */
Returns the meta object for the attribute '<code>com.specmate.migration.test.baseline.testmodel.artefact.Sketch#getByteVar5 Byte Var5</code>'.
getSketch_ByteVar5
{ "repo_name": "junkerm/specmate", "path": "bundles/specmate-migration-test/src/com/specmate/migration/test/baseline/testmodel/artefact/ArtefactPackage.java", "license": "apache-2.0", "size": 47870 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,603,191
@Generated @Selector("velocity") @NFloat public native double velocity();
@Selector(STR) native double function();
/** * The initial mean velocity of each emitted object, and its range. Both * values default to zero. Animatable. */
The initial mean velocity of each emitted object, and its range. Both values default to zero. Animatable
velocity
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/quartzcore/CAEmitterCell.java", "license": "apache-2.0", "size": 20919 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,118,679
protected boolean filterLeftoverView(ViewGroup parent, int childIndex) { parent.removeViewAt(childIndex); return true; }
boolean function(ViewGroup parent, int childIndex) { parent.removeViewAt(childIndex); return true; }
/** * Filter the child view at index and remove it if appropriate. * @param parent Parent to filter from * @param childIndex Index to filter * @return true if the child view at index was removed */
Filter the child view at index and remove it if appropriate
filterLeftoverView
{ "repo_name": "yesterdaylike/DailyLady", "path": "src/com/yesterday/like/ActionBar/internal/view/menu/BaseMenuPresenter.java", "license": "apache-2.0", "size": 7734 }
[ "android.view.ViewGroup" ]
import android.view.ViewGroup;
import android.view.*;
[ "android.view" ]
android.view;
2,369,289
public VirtualHubInner withVirtualNetworkConnections(List<HubVirtualNetworkConnectionInner> virtualNetworkConnections) { this.virtualNetworkConnections = virtualNetworkConnections; return this; }
VirtualHubInner function(List<HubVirtualNetworkConnectionInner> virtualNetworkConnections) { this.virtualNetworkConnections = virtualNetworkConnections; return this; }
/** * Set list of all vnet connections with this VirtualHub. * * @param virtualNetworkConnections the virtualNetworkConnections value to set * @return the VirtualHubInner object itself. */
Set list of all vnet connections with this VirtualHub
withVirtualNetworkConnections
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/VirtualHubInner.java", "license": "mit", "size": 7813 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
954,644
public Collection<Ticket> getTickets(Player player);
Collection<Ticket> function(Player player);
/** * Gets the tickets filed by a specific player * * @param player the player to get tickets from * @return a collection of the tickets filed by the given player */
Gets the tickets filed by a specific player
getTickets
{ "repo_name": "Gildorym/GildorymAPI", "path": "src/com/gildorymrp/api/plugin/moderation/GildorymModerationPlugin.java", "license": "agpl-3.0", "size": 3440 }
[ "java.util.Collection", "org.bukkit.entity.Player" ]
import java.util.Collection; import org.bukkit.entity.Player;
import java.util.*; import org.bukkit.entity.*;
[ "java.util", "org.bukkit.entity" ]
java.util; org.bukkit.entity;
1,266,750
public Phidget getSource() { return source; }
Phidget function() { return source; }
/** * Returns the source Phidget of this event. This is a reference to the Phidget object from which this * event was called. This object can be cast into a specific type of Phidget object to call specific * device calls on it. * * @return the event caller */
Returns the source Phidget of this event. This is a reference to the Phidget object from which this event was called. This object can be cast into a specific type of Phidget object to call specific device calls on it
getSource
{ "repo_name": "asteever/thirdparty_phidget", "path": "Java/com/phidgets/event/RawDataEvent.java", "license": "lgpl-3.0", "size": 2205 }
[ "com.phidgets.Phidget" ]
import com.phidgets.Phidget;
import com.phidgets.*;
[ "com.phidgets" ]
com.phidgets;
1,139,268
@Deprecated public static <T> Set<T> createCopyOnWriteSet() { return new CopyOnWriteArraySet<T>(); }
static <T> Set<T> function() { return new CopyOnWriteArraySet<T>(); }
/** * Create a copy-on-write Set (allowing for synchronization-less iteration) if possible: * This implementation always creates a {@link java.util.concurrent.CopyOnWriteArraySet}. * @return the new Set instance * @deprecated */
Create a copy-on-write Set (allowing for synchronization-less iteration) if possible: This implementation always creates a <code>java.util.concurrent.CopyOnWriteArraySet</code>
createCopyOnWriteSet
{ "repo_name": "spring-projects/spring-android", "path": "spring-android-core/src/main/java/org/springframework/core/CollectionFactory.java", "license": "apache-2.0", "size": 11269 }
[ "java.util.Set", "java.util.concurrent.CopyOnWriteArraySet" ]
import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,581,769
public Set<Source> getSuccessorSources() { Set<AbstractSampleDataRelationshipNode> sourceNodes = getSuccessorsOfType(SdrfNodeType.SOURCE, true); HashSet<Source> sources = new HashSet<Source>(sourceNodes.size()); for (AbstractSampleDataRelationshipNode sourceNode : sourceNodes) { sources.add((Source) sourceNode); } return sources; }
Set<Source> function() { Set<AbstractSampleDataRelationshipNode> sourceNodes = getSuccessorsOfType(SdrfNodeType.SOURCE, true); HashSet<Source> sources = new HashSet<Source>(sourceNodes.size()); for (AbstractSampleDataRelationshipNode sourceNode : sourceNodes) { sources.add((Source) sourceNode); } return sources; }
/** * Returns all <code>Sources</code> that originate from this node (searched recursively). * * @return the originating <code>Sources</code>. */
Returns all <code>Sources</code> that originate from this node (searched recursively)
getSuccessorSources
{ "repo_name": "NCIP/caarray", "path": "software/caarray-common.jar/src/main/java/gov/nih/nci/caarray/magetab/sdrf/AbstractSampleDataRelationshipNode.java", "license": "bsd-3-clause", "size": 15344 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,625,722
void doRead() throws IOException { int nbytes; ByteBuffer net_in = state.getNetInBuffer(); synchronized (net_in) { nbytes = channel.read(net_in); } if (nbytes > 0) processor.processMessages(this); else if (nbytes < 0) throw new EOFException(); }
void doRead() throws IOException { int nbytes; ByteBuffer net_in = state.getNetInBuffer(); synchronized (net_in) { nbytes = channel.read(net_in); } if (nbytes > 0) processor.processMessages(this); else if (nbytes < 0) throw new EOFException(); }
/** Read messages from the socket channel. * This may only be called on the Server thread. */
Read messages from the socket channel
doRead
{ "repo_name": "CA-IRIS/mn-sonar", "path": "src/us/mn/state/dot/sonar/server/ConnectionImpl.java", "license": "gpl-2.0", "size": 18623 }
[ "java.io.EOFException", "java.io.IOException", "java.nio.ByteBuffer" ]
import java.io.EOFException; import java.io.IOException; import java.nio.ByteBuffer;
import java.io.*; import java.nio.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,460,250
@Test public void testTranslateContextSuccessfull2() { ichunk.setContext(ExplanationChunk.INFORMATIONAL); String expResult = "INFORMATIONAL"; String result = PDFChunkUtility.translateContext(ichunk); assertEquals(expResult, result); }
void function() { ichunk.setContext(ExplanationChunk.INFORMATIONAL); String expResult = STR; String result = PDFChunkUtility.translateContext(ichunk); assertEquals(expResult, result); }
/** * Test of translateContext method, of class PDFChunkUtility. * Test case: successfull execution - INFORMATIONAL context */
Test of translateContext method, of class PDFChunkUtility. Test case: successfull execution - INFORMATIONAL context
testTranslateContextSuccessfull2
{ "repo_name": "mladensavic94/jeff", "path": "src/test/java/org/goodoldai/jeff/report/pdf/PDFChunkUtilityTest.java", "license": "lgpl-3.0", "size": 13462 }
[ "org.goodoldai.jeff.explanation.ExplanationChunk", "org.junit.Assert" ]
import org.goodoldai.jeff.explanation.ExplanationChunk; import org.junit.Assert;
import org.goodoldai.jeff.explanation.*; import org.junit.*;
[ "org.goodoldai.jeff", "org.junit" ]
org.goodoldai.jeff; org.junit;
1,425,283
public static String buildPostString(Map par0Map) { StringBuilder var1 = new StringBuilder(); Iterator var2 = par0Map.entrySet().iterator(); while (var2.hasNext()) { Entry var3 = (Entry)var2.next(); if (var1.length() > 0) { var1.append('&'); } try { var1.append(URLEncoder.encode((String)var3.getKey(), "UTF-8")); } catch (UnsupportedEncodingException var6) { var6.printStackTrace(); } if (var3.getValue() != null) { var1.append('='); try { var1.append(URLEncoder.encode(var3.getValue().toString(), "UTF-8")); } catch (UnsupportedEncodingException var5) { var5.printStackTrace(); } } } return var1.toString(); }
static String function(Map par0Map) { StringBuilder var1 = new StringBuilder(); Iterator var2 = par0Map.entrySet().iterator(); while (var2.hasNext()) { Entry var3 = (Entry)var2.next(); if (var1.length() > 0) { var1.append('&'); } try { var1.append(URLEncoder.encode((String)var3.getKey(), "UTF-8")); } catch (UnsupportedEncodingException var6) { var6.printStackTrace(); } if (var3.getValue() != null) { var1.append('='); try { var1.append(URLEncoder.encode(var3.getValue().toString(), "UTF-8")); } catch (UnsupportedEncodingException var5) { var5.printStackTrace(); } } } return var1.toString(); }
/** * Builds an encoded HTTP POST content string from a string map */
Builds an encoded HTTP POST content string from a string map
buildPostString
{ "repo_name": "herpingdo/Hakkit", "path": "net/minecraft/src/HttpUtil.java", "license": "gpl-3.0", "size": 3850 }
[ "java.io.UnsupportedEncodingException", "java.net.URLEncoder", "java.util.Iterator", "java.util.Map" ]
import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Iterator; import java.util.Map;
import java.io.*; import java.net.*; import java.util.*;
[ "java.io", "java.net", "java.util" ]
java.io; java.net; java.util;
261,854
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); this.jumpRotation = MathHelper.sin(((TameableRabbit)entitylivingbaseIn).setJumpCompletion(partialTickTime) * (float)Math.PI); TameableRabbit TameableRabbit = (TameableRabbit) entitylivingbaseIn; int height = 0; if (TameableRabbit.isSitting()) { rabbitLeftArm.setRotationPoint(3.0F, 17.0F, -1.0F); rabbitLeftArm.rotateAngleY = 1f; rabbitLeftArm.rotateAngleZ = 1f; rabbitLeftArm.offsetY = 0.099f; rabbitRightArm.setRotationPoint(-3.0F, 17.0F, -1.0F); rabbitRightArm.rotateAngleY = -1f; rabbitRightArm.rotateAngleZ = -1f; rabbitRightArm.rotateAngleX = -1f; rabbitRightArm.offsetY = 0.099f; } else { rabbitLeftArm.setRotationPoint(3.0F, 17.0F, -1.0F); rabbitLeftArm.rotateAngleY = 0f; rabbitLeftArm.rotateAngleZ = 0f; rabbitLeftArm.offsetY = 0.f; rabbitRightArm.setRotationPoint(-3.0F, 17.0F, -1.0F); rabbitRightArm.rotateAngleY = 0f; rabbitRightArm.rotateAngleZ = 0f; rabbitRightArm.offsetY = 0.0f; } }
void function(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); this.jumpRotation = MathHelper.sin(((TameableRabbit)entitylivingbaseIn).setJumpCompletion(partialTickTime) * (float)Math.PI); TameableRabbit TameableRabbit = (TameableRabbit) entitylivingbaseIn; int height = 0; if (TameableRabbit.isSitting()) { rabbitLeftArm.setRotationPoint(3.0F, 17.0F, -1.0F); rabbitLeftArm.rotateAngleY = 1f; rabbitLeftArm.rotateAngleZ = 1f; rabbitLeftArm.offsetY = 0.099f; rabbitRightArm.setRotationPoint(-3.0F, 17.0F, -1.0F); rabbitRightArm.rotateAngleY = -1f; rabbitRightArm.rotateAngleZ = -1f; rabbitRightArm.rotateAngleX = -1f; rabbitRightArm.offsetY = 0.099f; } else { rabbitLeftArm.setRotationPoint(3.0F, 17.0F, -1.0F); rabbitLeftArm.rotateAngleY = 0f; rabbitLeftArm.rotateAngleZ = 0f; rabbitLeftArm.offsetY = 0.f; rabbitRightArm.setRotationPoint(-3.0F, 17.0F, -1.0F); rabbitRightArm.rotateAngleY = 0f; rabbitRightArm.rotateAngleZ = 0f; rabbitRightArm.offsetY = 0.0f; } }
/** * Used for easily adding entity-dependent animations. The second and third float params here are the same second * and third as in the setRotationAngles method. */
Used for easily adding entity-dependent animations. The second and third float params here are the same second and third as in the setRotationAngles method
setLivingAnimations
{ "repo_name": "EPIICTHUNDERCAT/TameableMobs", "path": "src/main/java/com/github/EPIICTHUNDERCAT/TameableMobs/models/ModelTameableRabbit.java", "license": "mit", "size": 11259 }
[ "com.github.epiicthundercat.tameablemobs.mobs.TameableRabbit", "net.minecraft.entity.EntityLivingBase", "net.minecraft.util.math.MathHelper" ]
import com.github.epiicthundercat.tameablemobs.mobs.TameableRabbit; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.math.MathHelper;
import com.github.epiicthundercat.tameablemobs.mobs.*; import net.minecraft.entity.*; import net.minecraft.util.math.*;
[ "com.github.epiicthundercat", "net.minecraft.entity", "net.minecraft.util" ]
com.github.epiicthundercat; net.minecraft.entity; net.minecraft.util;
1,429,421
private int parseOUTOVROPT() throws DRDAProtocolException { checkLength(CodePoint.OUTOVROPT, 1); int outovropt = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace("output override option: "+outovropt); if (outovropt != CodePoint.OUTOVRFRS && outovropt != CodePoint.OUTOVRANY) invalidValue(CodePoint.OUTOVROPT); return outovropt; }
int function() throws DRDAProtocolException { checkLength(CodePoint.OUTOVROPT, 1); int outovropt = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace(STR+outovropt); if (outovropt != CodePoint.OUTOVRFRS && outovropt != CodePoint.OUTOVRANY) invalidValue(CodePoint.OUTOVROPT); return outovropt; }
/** * Parse OUTOVROPT - this indicates whether output description can be * overridden on just the first CNTQRY or on any CNTQRY * * @return output override option * @exception DRDAProtocolException */
Parse OUTOVROPT - this indicates whether output description can be overridden on just the first CNTQRY or on any CNTQRY
parseOUTOVROPT
{ "repo_name": "kavin256/Derby", "path": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "license": "apache-2.0", "size": 298871 }
[ "org.apache.derby.iapi.services.sanity.SanityManager" ]
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.sanity.*;
[ "org.apache.derby" ]
org.apache.derby;
2,143,472
public Object getParameter(String name) throws DOMException { // REVISIT: Recognizes DOM L3 default features only. // Does not yet recognize Xerces features. if (name.equalsIgnoreCase(Constants.DOM_COMMENTS)) { return ((features & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)) { return (features & NAMESPACES) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION)) { // REVISIT: datatype-normalization only takes effect if validation is on return (features & DTNORMALIZATION) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS)) { return (features & CDATA) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_ENTITIES)) { return (features & ENTITIES) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)) { return (features & SPLITCDATA) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_VALIDATE)) { return (features & VALIDATE) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_WELLFORMED)) { return (features & WELLFORMED) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) { return (features & NSDECL) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_INFOSET)) { return (features & INFOSET_MASK) == INFOSET_TRUE_PARAMS ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS) || name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION) ) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(SEND_PSVI)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(Constants.DOM_PSVI)) { return (features & PSVI) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER)) { return fErrorHandlerWrapper.getErrorHandler(); } else if (name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)) { XMLEntityResolver entityResolver = getEntityResolver(); if (entityResolver != null && entityResolver instanceof DOMEntityResolverWrapper) { return ((DOMEntityResolverWrapper) entityResolver).getEntityResolver(); } return null; } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)) { return getProperty(Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE); } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)) { return getProperty(Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE); } else if (name.equalsIgnoreCase(SYMBOL_TABLE)){ return getProperty(SYMBOL_TABLE); } else if (name.equalsIgnoreCase(GRAMMAR_POOL)){ return getProperty(GRAMMAR_POOL); } else { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "FEATURE_NOT_FOUND", new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
Object function(String name) throws DOMException { if (name.equalsIgnoreCase(Constants.DOM_COMMENTS)) { return ((features & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)) { return (features & NAMESPACES) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION)) { return (features & DTNORMALIZATION) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS)) { return (features & CDATA) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_ENTITIES)) { return (features & ENTITIES) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)) { return (features & SPLITCDATA) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_VALIDATE)) { return (features & VALIDATE) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_WELLFORMED)) { return (features & WELLFORMED) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) { return (features & NSDECL) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_INFOSET)) { return (features & INFOSET_MASK) == INFOSET_TRUE_PARAMS ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS) name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM) name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA) name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION) ) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(SEND_PSVI)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(Constants.DOM_PSVI)) { return (features & PSVI) != 0 ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER)) { return fErrorHandlerWrapper.getErrorHandler(); } else if (name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)) { XMLEntityResolver entityResolver = getEntityResolver(); if (entityResolver != null && entityResolver instanceof DOMEntityResolverWrapper) { return ((DOMEntityResolverWrapper) entityResolver).getEntityResolver(); } return null; } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)) { return getProperty(Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE); } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)) { return getProperty(Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE); } else if (name.equalsIgnoreCase(SYMBOL_TABLE)){ return getProperty(SYMBOL_TABLE); } else if (name.equalsIgnoreCase(GRAMMAR_POOL)){ return getProperty(GRAMMAR_POOL); } else { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, STR, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
/** * DOM Level 3 WD - Experimental. * getParameter */
DOM Level 3 WD - Experimental. getParameter
getParameter
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java", "license": "gpl-2.0", "size": 44184 }
[ "com.sun.org.apache.xerces.internal.impl.Constants", "com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper", "com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver", "org.w3c.dom.DOMException" ]
import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper; import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; import org.w3c.dom.DOMException;
import com.sun.org.apache.xerces.internal.impl.*; import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.xni.parser.*; import org.w3c.dom.*;
[ "com.sun.org", "org.w3c.dom" ]
com.sun.org; org.w3c.dom;
1,990,964
public long runtime(TimeUnit unit) { return unit.convert(getNanos(), TimeUnit.NANOSECONDS); }
long function(TimeUnit unit) { return unit.convert(getNanos(), TimeUnit.NANOSECONDS); }
/** * Gets the runtime for the test. * * @param unit time unit for returned runtime * @return runtime measured during the test */
Gets the runtime for the test
runtime
{ "repo_name": "antalpeti/JUnit", "path": "src/org/junit/rules/Stopwatch.java", "license": "epl-1.0", "size": 5268 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
959,520
public static int setupAndRun(final String[] args) { int returnCode = -1; try { final Configuration conf = new Configuration(); final Set<String> toolArgs = ToolConfigUtils.getUserArguments(conf, args); if (!toolArgs.isEmpty()) { final String parameters = Joiner.on("\r\n\t").join(toolArgs); log.info("Running Merge Tool with the following parameters...\r\n\t" + parameters); } returnCode = ToolRunner.run(conf, new MergeTool(), args); } catch (final Exception e) { log.error("Error running merge tool", e); } return returnCode; }
static int function(final String[] args) { int returnCode = -1; try { final Configuration conf = new Configuration(); final Set<String> toolArgs = ToolConfigUtils.getUserArguments(conf, args); if (!toolArgs.isEmpty()) { final String parameters = Joiner.on(STR).join(toolArgs); log.info(STR + parameters); } returnCode = ToolRunner.run(conf, new MergeTool(), args); } catch (final Exception e) { log.error(STR, e); } return returnCode; }
/** * Sets up and runs the merge tool with the provided args. * @param args the arguments list. * @return the execution result. */
Sets up and runs the merge tool with the provided args
setupAndRun
{ "repo_name": "meiercaleb/incubator-rya", "path": "extras/rya.merger/src/main/java/org/apache/rya/accumulo/mr/merge/MergeTool.java", "license": "apache-2.0", "size": 24155 }
[ "com.google.common.base.Joiner", "java.util.Set", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.util.ToolRunner", "org.apache.rya.accumulo.mr.merge.util.ToolConfigUtils" ]
import com.google.common.base.Joiner; import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner; import org.apache.rya.accumulo.mr.merge.util.ToolConfigUtils;
import com.google.common.base.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.util.*; import org.apache.rya.accumulo.mr.merge.util.*;
[ "com.google.common", "java.util", "org.apache.hadoop", "org.apache.rya" ]
com.google.common; java.util; org.apache.hadoop; org.apache.rya;
2,804,834
private void setExceptionAndMaybeLog(Throwable throwable) { boolean visibleFromOutputFuture = false; boolean firstTimeSeeingThisException = true; if (allMustSucceed) { // As soon as the first one fails, throw the exception up. // The result of all other inputs is then ignored. visibleFromOutputFuture = super.setException(throwable); synchronized (seenExceptionsLock) { if (seenExceptions == null) { seenExceptions = Sets.newHashSet(); } firstTimeSeeingThisException = seenExceptions.add(throwable); } } if (throwable instanceof Error || (allMustSucceed && !visibleFromOutputFuture && firstTimeSeeingThisException)) { logger.log(Level.SEVERE, "input future failed.", throwable); } }
void function(Throwable throwable) { boolean visibleFromOutputFuture = false; boolean firstTimeSeeingThisException = true; if (allMustSucceed) { visibleFromOutputFuture = super.setException(throwable); synchronized (seenExceptionsLock) { if (seenExceptions == null) { seenExceptions = Sets.newHashSet(); } firstTimeSeeingThisException = seenExceptions.add(throwable); } } if (throwable instanceof Error (allMustSucceed && !visibleFromOutputFuture && firstTimeSeeingThisException)) { logger.log(Level.SEVERE, STR, throwable); } }
/** * Fails this future with the given Throwable if {@link #allMustSucceed} is * true. Also, logs the throwable if it is an {@link Error} or if * {@link #allMustSucceed} is {@code true}, the throwable did not cause * this future to fail, and it is the first time we've seen that particular Throwable. */
Fails this future with the given Throwable if <code>#allMustSucceed</code> is true. Also, logs the throwable if it is an <code>Error</code> or if <code>#allMustSucceed</code> is true, the throwable did not cause this future to fail, and it is the first time we've seen that particular Throwable
setExceptionAndMaybeLog
{ "repo_name": "gym0915/GoogleGuava", "path": "guava/src/com/google/common/util/concurrent/Futures.java", "license": "apache-2.0", "size": 72087 }
[ "com.google.common.collect.Sets", "java.util.logging.Level" ]
import com.google.common.collect.Sets; import java.util.logging.Level;
import com.google.common.collect.*; import java.util.logging.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
667,276
@Override public GridArray getGridArray(String varName) { return null; }
GridArray function(String varName) { return null; }
/** * Get grid data * * @param varName Variable name * @return Grid data */
Get grid data
getGridArray
{ "repo_name": "meteoinfo/meteoinfolib", "path": "src/org/meteoinfo/data/meteodata/hysplit/HYSPLITConcDataInfo.java", "license": "lgpl-3.0", "size": 37674 }
[ "org.meteoinfo.data.GridArray" ]
import org.meteoinfo.data.GridArray;
import org.meteoinfo.data.*;
[ "org.meteoinfo.data" ]
org.meteoinfo.data;
656,709
public void sourceAttached(IJavaElement element) { JavaElementDelta attachedDelta = new JavaElementDelta(element); attachedDelta.changed(F_SOURCEATTACHED); insertDeltaTree(element, attachedDelta); }
void function(IJavaElement element) { JavaElementDelta attachedDelta = new JavaElementDelta(element); attachedDelta.changed(F_SOURCEATTACHED); insertDeltaTree(element, attachedDelta); }
/** * Creates the nested deltas resulting from a change operation. * Convenience method for creating change deltas. * The constructor should be used to create the root delta * and then a change operation should call this method. */
Creates the nested deltas resulting from a change operation. Convenience method for creating change deltas. The constructor should be used to create the root delta and then a change operation should call this method
sourceAttached
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java", "license": "gpl-3.0", "size": 26099 }
[ "org.eclipse.jdt.core.IJavaElement" ]
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
21,431
@Test public void shouldReturnListOfRecords() { StoredProcedureQuery proc = em.createStoredProcedureQuery("gen_rows"); proc.registerStoredProcedureParameter(1, Integer.class, ParameterMode.IN); proc.setParameter(1, 6); List<Object[]> result = proc.getResultList(); Assertions.assertThat(result).hasSize(6); }
void function() { StoredProcedureQuery proc = em.createStoredProcedureQuery(STR); proc.registerStoredProcedureParameter(1, Integer.class, ParameterMode.IN); proc.setParameter(1, 6); List<Object[]> result = proc.getResultList(); Assertions.assertThat(result).hasSize(6); }
/** * Calls procedure that returns list of rows - records. Each record is * represented as array of objects */
Calls procedure that returns list of rows - records. Each record is represented as array of objects
shouldReturnListOfRecords
{ "repo_name": "miloszpiglas/stored-proc-java", "path": "postgres/dbproc-java-postgres/dbproc-java-postgres-jpa/src/test/java/pl/mpiglas/dbproc/postgres/jpa/PostgresJpaTest.java", "license": "gpl-3.0", "size": 6823 }
[ "java.util.List", "javax.persistence.ParameterMode", "javax.persistence.StoredProcedureQuery", "org.assertj.core.api.Assertions" ]
import java.util.List; import javax.persistence.ParameterMode; import javax.persistence.StoredProcedureQuery; import org.assertj.core.api.Assertions;
import java.util.*; import javax.persistence.*; import org.assertj.core.api.*;
[ "java.util", "javax.persistence", "org.assertj.core" ]
java.util; javax.persistence; org.assertj.core;
2,871,842
public BticinoBindingConfig getBticinoBindingConfigForItem(String itemName) { // Get the bticino binding config for the associated item BticinoBindingConfig l_item_binding = null; for (BticinoBindingProvider provider : providers) { if (provider.providesBindingFor(itemName)) { l_item_binding = provider.getConfig(itemName); break; } } // the item must have a config if (l_item_binding == null) { throw new RuntimeException("BindingConfig not found for item [" + itemName + "]"); } return l_item_binding; }
BticinoBindingConfig function(String itemName) { BticinoBindingConfig l_item_binding = null; for (BticinoBindingProvider provider : providers) { if (provider.providesBindingFor(itemName)) { l_item_binding = provider.getConfig(itemName); break; } } if (l_item_binding == null) { throw new RuntimeException(STR + itemName + "]"); } return l_item_binding; }
/** * For the given item, get the bticino binding configuration * * @param itemName * @return * @throws Exception */
For the given item, get the bticino binding configuration
getBticinoBindingConfigForItem
{ "repo_name": "openhab/openhab", "path": "bundles/binding/org.openhab.binding.bticino/src/main/java/org/openhab/binding/bticino/internal/BticinoBinding.java", "license": "epl-1.0", "size": 12386 }
[ "org.openhab.binding.bticino.internal.BticinoGenericBindingProvider" ]
import org.openhab.binding.bticino.internal.BticinoGenericBindingProvider;
import org.openhab.binding.bticino.internal.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,314,407
public static ImageIcon getImageIcon(String simpleImageFileName) { return getImageIcon(ImageProvider.class.getResource(getCurrentPackageName() + simpleImageFileName)); }
static ImageIcon function(String simpleImageFileName) { return getImageIcon(ImageProvider.class.getResource(getCurrentPackageName() + simpleImageFileName)); }
/** * Returns an image out of the current package as ImageIcon. * @param simpleImageFileName the simple image file name * @return the internal image icon */
Returns an image out of the current package as ImageIcon
getImageIcon
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/de.enflexit.common/src/de/enflexit/common/images/ImageProvider.java", "license": "lgpl-2.1", "size": 3290 }
[ "javax.swing.ImageIcon" ]
import javax.swing.ImageIcon;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,451,001
public Servlet getBoundServlet( ) { return boundServlet; }
Servlet function( ) { return boundServlet; }
/** * Returns the servlet this contract is bound to. * @return the bound servlet */
Returns the servlet this contract is bound to
getBoundServlet
{ "repo_name": "Talvish/Tales", "path": "product/services/src/com/talvish/tales/contracts/services/http/HttpServletContract.java", "license": "apache-2.0", "size": 1253 }
[ "javax.servlet.Servlet" ]
import javax.servlet.Servlet;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
585,683
private static List<BatterySipper> getCoalescedUsageList(final List<BatterySipper> sippers) { final SparseArray<BatterySipper> uidList = new SparseArray<>(); final ArrayList<BatterySipper> results = new ArrayList<>(); final int numSippers = sippers.size(); for (int i = 0; i < numSippers; i++) { BatterySipper sipper = sippers.get(i); if (sipper.getUid() > 0) { int realUid = sipper.getUid(); // Check if this UID is a shared GID. If so, we combine it with the OWNER's // actual app UID. if (isSharedGid(sipper.getUid())) { realUid = UserHandle.getUid(UserHandle.USER_SYSTEM, UserHandle.getAppIdFromSharedAppGid(sipper.getUid())); } // Check if this UID is a system UID (mediaserver, logd, nfc, drm, etc). if (isSystemUid(realUid) && !"mediaserver".equals(sipper.packageWithHighestDrain)) { // Use the system UID for all UIDs running in their own sandbox that // are not apps. We exclude mediaserver because we already are expected to // report that as a separate item. realUid = Process.SYSTEM_UID; } if (realUid != sipper.getUid()) { // Replace the BatterySipper with a new one with the real UID set. BatterySipper newSipper = new BatterySipper(sipper.drainType, new FakeUid(realUid), 0.0); newSipper.add(sipper); newSipper.packageWithHighestDrain = sipper.packageWithHighestDrain; newSipper.mPackages = sipper.mPackages; sipper = newSipper; } int index = uidList.indexOfKey(realUid); if (index < 0) { // New entry. uidList.put(realUid, sipper); } else { // Combine BatterySippers if we already have one with this UID. final BatterySipper existingSipper = uidList.valueAt(index); existingSipper.add(sipper); if (existingSipper.packageWithHighestDrain == null && sipper.packageWithHighestDrain != null) { existingSipper.packageWithHighestDrain = sipper.packageWithHighestDrain; } final int existingPackageLen = existingSipper.mPackages != null ? existingSipper.mPackages.length : 0; final int newPackageLen = sipper.mPackages != null ? sipper.mPackages.length : 0; if (newPackageLen > 0) { String[] newPackages = new String[existingPackageLen + newPackageLen]; if (existingPackageLen > 0) { System.arraycopy(existingSipper.mPackages, 0, newPackages, 0, existingPackageLen); } System.arraycopy(sipper.mPackages, 0, newPackages, existingPackageLen, newPackageLen); existingSipper.mPackages = newPackages; } } } else { results.add(sipper); } } final int numUidSippers = uidList.size(); for (int i = 0; i < numUidSippers; i++) { results.add(uidList.valueAt(i)); }
static List<BatterySipper> function(final List<BatterySipper> sippers) { final SparseArray<BatterySipper> uidList = new SparseArray<>(); final ArrayList<BatterySipper> results = new ArrayList<>(); final int numSippers = sippers.size(); for (int i = 0; i < numSippers; i++) { BatterySipper sipper = sippers.get(i); if (sipper.getUid() > 0) { int realUid = sipper.getUid(); if (isSharedGid(sipper.getUid())) { realUid = UserHandle.getUid(UserHandle.USER_SYSTEM, UserHandle.getAppIdFromSharedAppGid(sipper.getUid())); } if (isSystemUid(realUid) && !STR.equals(sipper.packageWithHighestDrain)) { realUid = Process.SYSTEM_UID; } if (realUid != sipper.getUid()) { BatterySipper newSipper = new BatterySipper(sipper.drainType, new FakeUid(realUid), 0.0); newSipper.add(sipper); newSipper.packageWithHighestDrain = sipper.packageWithHighestDrain; newSipper.mPackages = sipper.mPackages; sipper = newSipper; } int index = uidList.indexOfKey(realUid); if (index < 0) { uidList.put(realUid, sipper); } else { final BatterySipper existingSipper = uidList.valueAt(index); existingSipper.add(sipper); if (existingSipper.packageWithHighestDrain == null && sipper.packageWithHighestDrain != null) { existingSipper.packageWithHighestDrain = sipper.packageWithHighestDrain; } final int existingPackageLen = existingSipper.mPackages != null ? existingSipper.mPackages.length : 0; final int newPackageLen = sipper.mPackages != null ? sipper.mPackages.length : 0; if (newPackageLen > 0) { String[] newPackages = new String[existingPackageLen + newPackageLen]; if (existingPackageLen > 0) { System.arraycopy(existingSipper.mPackages, 0, newPackages, 0, existingPackageLen); } System.arraycopy(sipper.mPackages, 0, newPackages, existingPackageLen, newPackageLen); existingSipper.mPackages = newPackages; } } } else { results.add(sipper); } } final int numUidSippers = uidList.size(); for (int i = 0; i < numUidSippers; i++) { results.add(uidList.valueAt(i)); }
/** * We want to coalesce some UIDs. For example, dex2oat runs under a shared gid that * exists for all users of the same app. We detect this case and merge the power use * for dex2oat to the device OWNER's use of the app. * @return A sorted list of apps using power. */
We want to coalesce some UIDs. For example, dex2oat runs under a shared gid that exists for all users of the same app. We detect this case and merge the power use for dex2oat to the device OWNER's use of the app
getCoalescedUsageList
{ "repo_name": "xorware/android_packages_apps_Settings", "path": "src/com/android/settings/fuelgauge/PowerUsageSummary.java", "license": "lgpl-3.0", "size": 20494 }
[ "android.os.Process", "android.os.UserHandle", "android.util.SparseArray", "com.android.internal.os.BatterySipper", "java.util.ArrayList", "java.util.List" ]
import android.os.Process; import android.os.UserHandle; import android.util.SparseArray; import com.android.internal.os.BatterySipper; import java.util.ArrayList; import java.util.List;
import android.os.*; import android.util.*; import com.android.internal.os.*; import java.util.*;
[ "android.os", "android.util", "com.android.internal", "java.util" ]
android.os; android.util; com.android.internal; java.util;
2,480,707
interface WithWorkerTierName { WithCreate withWorkerTierName(String workerTierName); } interface WithCreate extends Creatable<AppServicePlan>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithAdminSiteName, DefinitionStages.WithHostingEnvironmentProfile, DefinitionStages.WithIsSpot, DefinitionStages.WithKind, DefinitionStages.WithPerSiteScaling, DefinitionStages.WithReserved, DefinitionStages.WithSku, DefinitionStages.WithSpotExpirationTime, DefinitionStages.WithTargetWorkerCount, DefinitionStages.WithTargetWorkerSizeId, DefinitionStages.WithWorkerTierName { } } interface Update extends Appliable<AppServicePlan>, Resource.UpdateWithTags<Update>, UpdateStages.WithAdminSiteName, UpdateStages.WithHostingEnvironmentProfile, UpdateStages.WithIsSpot, UpdateStages.WithKind, UpdateStages.WithPerSiteScaling, UpdateStages.WithReserved, UpdateStages.WithSpotExpirationTime, UpdateStages.WithTargetWorkerCount, UpdateStages.WithTargetWorkerSizeId, UpdateStages.WithWorkerTierName { }
interface WithWorkerTierName { WithCreate withWorkerTierName(String workerTierName); } interface WithCreate extends Creatable<AppServicePlan>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithAdminSiteName, DefinitionStages.WithHostingEnvironmentProfile, DefinitionStages.WithIsSpot, DefinitionStages.WithKind, DefinitionStages.WithPerSiteScaling, DefinitionStages.WithReserved, DefinitionStages.WithSku, DefinitionStages.WithSpotExpirationTime, DefinitionStages.WithTargetWorkerCount, DefinitionStages.WithTargetWorkerSizeId, DefinitionStages.WithWorkerTierName { } } interface Update extends Appliable<AppServicePlan>, Resource.UpdateWithTags<Update>, UpdateStages.WithAdminSiteName, UpdateStages.WithHostingEnvironmentProfile, UpdateStages.WithIsSpot, UpdateStages.WithKind, UpdateStages.WithPerSiteScaling, UpdateStages.WithReserved, UpdateStages.WithSpotExpirationTime, UpdateStages.WithTargetWorkerCount, UpdateStages.WithTargetWorkerSizeId, UpdateStages.WithWorkerTierName { }
/** * Specifies workerTierName. * @param workerTierName Target worker tier assigned to the App Service plan * @return the next definition stage */
Specifies workerTierName
withWorkerTierName
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/AppServicePlan.java", "license": "mit", "size": 15030 }
[ "com.microsoft.azure.arm.model.Appliable", "com.microsoft.azure.arm.model.Creatable", "com.microsoft.azure.arm.resources.models.Resource" ]
import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.Resource;
import com.microsoft.azure.arm.model.*; import com.microsoft.azure.arm.resources.models.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,078,039
public Image copy() { throw new OperationNotSupportedException("Can't copy big images yet"); }
Image function() { throw new OperationNotSupportedException(STR); }
/** * Not supported in BigImage * * @see org.newdawn.slick.Image#copy() */
Not supported in BigImage
copy
{ "repo_name": "JordanForeman/SpeedRunner", "path": "libraries/slick/src/org/newdawn/slick/BigImage.java", "license": "mit", "size": 21319 }
[ "org.newdawn.slick.util.OperationNotSupportedException" ]
import org.newdawn.slick.util.OperationNotSupportedException;
import org.newdawn.slick.util.*;
[ "org.newdawn.slick" ]
org.newdawn.slick;
896,772
interface WithClusterSettings { WithCreate withClusterSettings(List<NameValuePair> clusterSettings); }
interface WithClusterSettings { WithCreate withClusterSettings(List<NameValuePair> clusterSettings); }
/** * Specifies clusterSettings. */
Specifies clusterSettings
withClusterSettings
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/AppServiceEnvironmentResource.java", "license": "mit", "size": 19906 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,060,309
public Observable<ServiceResponse<Page<SiteInner>>> resumeSinglePageAsync(final String resourceGroupName, final String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<Page<SiteInner>>> function(final String resourceGroupName, final String name) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Resume an App Service Environment. * Resume an App Service Environment. * ServiceResponse<PageImpl<SiteInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<SiteInner>> * @param name Name of the App Service Environment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;SiteInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Resume an App Service Environment. Resume an App Service Environment
resumeSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java", "license": "mit", "size": 664956 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,440,074
public void setSampleRate(HackRFSampleRate rate) throws UsbException, SourceException { setSampleRateManual(rate.getRate(), 1); mFrequencyController.setSampleRate(rate.getRate()); setBasebandFilter(rate.getFilter()); mSampleRate = rate; }
void function(HackRFSampleRate rate) throws UsbException, SourceException { setSampleRateManual(rate.getRate(), 1); mFrequencyController.setSampleRate(rate.getRate()); setBasebandFilter(rate.getFilter()); mSampleRate = rate; }
/** * Sample Rate * * Note: the libhackrf set sample rate method is designed to allow fractional * sample rates. However, since we're only using integral sample rates, we * simply invoke the setSampleRateManual method directly. */
Sample Rate Note: the libhackrf set sample rate method is designed to allow fractional sample rates. However, since we're only using integral sample rates, we simply invoke the setSampleRateManual method directly
setSampleRate
{ "repo_name": "ImagoTrigger/sdrtrunk", "path": "src/main/java/io/github/dsheirer/source/tuner/hackrf/HackRFTunerController.java", "license": "gpl-3.0", "size": 23860 }
[ "io.github.dsheirer.source.SourceException", "javax.usb.UsbException" ]
import io.github.dsheirer.source.SourceException; import javax.usb.UsbException;
import io.github.dsheirer.source.*; import javax.usb.*;
[ "io.github.dsheirer", "javax.usb" ]
io.github.dsheirer; javax.usb;
1,487,841