method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void openCore() throws StandardException { beginTime = getCurrentTimeMillis(); if (SanityManager.DEBUG) SanityManager.ASSERT( ! isOpen, "ScrollInsensitiveResultSet already open"); source.openCore(); isOpen = true; numOpens++; final int[] keyCols = new int[] { 0 }; ht = new BackingStoreHashtable(getTransactionController(), null, keyCols, false, -1, // don't trust optimizer row count HashScanResultSet.DEFAULT_MAX_CAPACITY, HashScanResultSet.DEFAULT_INITIAL_CAPACITY, HashScanResultSet.DEFAULT_MAX_CAPACITY, false, keepAfterCommit); // When re-using language result sets (DERBY-827) we need to // reset some member variables to the value they would have // had in a newly constructed object. lastPosition = 0; needsRepositioning = false; numFromHashTable = 0; numToHashTable = 0; positionInSource = 0; seenFirst = false; seenLast = false; maxRows = activation.getMaxRows(); openTime += getElapsedMillis(beginTime); setBeforeFirstRow(); }
void function() throws StandardException { beginTime = getCurrentTimeMillis(); if (SanityManager.DEBUG) SanityManager.ASSERT( ! isOpen, STR); source.openCore(); isOpen = true; numOpens++; final int[] keyCols = new int[] { 0 }; ht = new BackingStoreHashtable(getTransactionController(), null, keyCols, false, -1, HashScanResultSet.DEFAULT_MAX_CAPACITY, HashScanResultSet.DEFAULT_INITIAL_CAPACITY, HashScanResultSet.DEFAULT_MAX_CAPACITY, false, keepAfterCommit); lastPosition = 0; needsRepositioning = false; numFromHashTable = 0; numToHashTable = 0; positionInSource = 0; seenFirst = false; seenLast = false; maxRows = activation.getMaxRows(); openTime += getElapsedMillis(beginTime); setBeforeFirstRow(); }
/** * open a scan on the source. scan parameters are evaluated * at each open, so there is probably some way of altering * their values... * * @exception StandardException thrown on failure */
open a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values..
openCore
{ "repo_name": "scnakandala/derby", "path": "java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java", "license": "apache-2.0", "size": 33262 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.store.access.BackingStoreHashtable", "org.apache.derby.shared.common.sanity.SanityManager" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.store.access.BackingStoreHashtable; import org.apache.derby.shared.common.sanity.SanityManager;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.store.access.*; import org.apache.derby.shared.common.sanity.*;
[ "org.apache.derby" ]
org.apache.derby;
12,974
private void scheduleStorageUsageMonthlyBaseFetcher() { long sleepDurationInSecs = secondsToNextTick(currentMonth, config.mysqlMonthlyBaseFetchOffsetSec); logger.info("Schedule to fetch container storage monthly base after {} seconds", sleepDurationInSecs); scheduler.schedule(this::fetchStorageUsageMonthlyBase, sleepDurationInSecs, TimeUnit.SECONDS); }
void function() { long sleepDurationInSecs = secondsToNextTick(currentMonth, config.mysqlMonthlyBaseFetchOffsetSec); logger.info(STR, sleepDurationInSecs); scheduler.schedule(this::fetchStorageUsageMonthlyBase, sleepDurationInSecs, TimeUnit.SECONDS); }
/** * Schedule the task to fetch storage usage monthly base for next month. */
Schedule the task to fetch storage usage monthly base for next month
scheduleStorageUsageMonthlyBaseFetcher
{ "repo_name": "linkedin/ambry", "path": "ambry-quota/src/main/java/com/github/ambry/quota/storage/MySqlStorageUsageRefresher.java", "license": "apache-2.0", "size": 24084 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,841,142
public static String base64Decode(String encodedSurveyId) { if (encodedSurveyId == null) { return encodedSurveyId; } ByteArrayInputStream bais = new ByteArrayInputStream(encodedSurveyId.getBytes()); InputStream b64is = null; try { b64is = MimeUtility.decode(bais, "base64"); } catch (MessagingException e) { LOGGER.error(e); } byte[] tmp = new byte[encodedSurveyId.getBytes().length]; int n = 0; try { n = b64is.read(tmp); } catch (IOException e) { LOGGER.error(e); } byte[] res = new byte[n]; System.arraycopy(tmp, 0, res, 0, n); return new String(res); }
static String function(String encodedSurveyId) { if (encodedSurveyId == null) { return encodedSurveyId; } ByteArrayInputStream bais = new ByteArrayInputStream(encodedSurveyId.getBytes()); InputStream b64is = null; try { b64is = MimeUtility.decode(bais, STR); } catch (MessagingException e) { LOGGER.error(e); } byte[] tmp = new byte[encodedSurveyId.getBytes().length]; int n = 0; try { n = b64is.read(tmp); } catch (IOException e) { LOGGER.error(e); } byte[] res = new byte[n]; System.arraycopy(tmp, 0, res, 0, n); return new String(res); }
/** * Decodes the encoded string passed, this function is used to get the * information about the users and surveys from the URL. * * @param surveyId * String to be decoded. * @return String Decoded String. */
Decodes the encoded string passed, this function is used to get the information about the users and surveys from the URL
base64Decode
{ "repo_name": "ctsidev/SecureWise", "path": "wise/src/edu/ucla/wise/commons/CommonUtils.java", "license": "bsd-3-clause", "size": 5909 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.io.InputStream", "javax.mail.MessagingException", "javax.mail.internet.MimeUtility" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import javax.mail.MessagingException; import javax.mail.internet.MimeUtility;
import java.io.*; import javax.mail.*; import javax.mail.internet.*;
[ "java.io", "javax.mail" ]
java.io; javax.mail;
2,828,130
private void loadPropertyTags() { checkState(getSearchResultPresenter().getProviderData().getDisplayedItem() != null, "There should be a selected collection item."); checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem() != null, "The displayed collection item to reference a valid entity."); final RESTTopicCollectionItemV1 selectedItem = getSearchResultPresenter().getProviderData().getSelectedItem(); final RESTTopicV1 displayedItem = getSearchResultPresenter().getProviderData().getDisplayedItem().getItem(); final RESTTopicV1 displayedTopic = getDisplayedTopic(); // Are we displaying the latest version of the topic i.e. the one that doesn't have its tags loaded? final boolean displayingLatest = displayedItem == displayedTopic; if (!allPropertyTagsLoadInitiated) { allPropertyTagsLoadInitiated = true; // Get a new collection of property tags getTopicPropertyTagPresenter().refreshPossibleChildrenDataFromRESTAndRedisplayList(displayedItem); } if (!propertyTagsLoadInitiated && displayingLatest) { propertyTagsLoadInitiated = true; // if getSearchResultPresenter().getProviderData().getSelectedItem() == null, then we are displaying a new topic if (selectedItem != null) { checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem().getId() != null, "The displayed collection item to reference a valid entity with a valid ID."); checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem().getRevision() != null, "The displayed collection item to reference a valid entity with a valid revision.");
void function() { checkState(getSearchResultPresenter().getProviderData().getDisplayedItem() != null, STR); checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem() != null, STR); final RESTTopicCollectionItemV1 selectedItem = getSearchResultPresenter().getProviderData().getSelectedItem(); final RESTTopicV1 displayedItem = getSearchResultPresenter().getProviderData().getDisplayedItem().getItem(); final RESTTopicV1 displayedTopic = getDisplayedTopic(); final boolean displayingLatest = displayedItem == displayedTopic; if (!allPropertyTagsLoadInitiated) { allPropertyTagsLoadInitiated = true; getTopicPropertyTagPresenter().refreshPossibleChildrenDataFromRESTAndRedisplayList(displayedItem); } if (!propertyTagsLoadInitiated && displayingLatest) { propertyTagsLoadInitiated = true; if (selectedItem != null) { checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem().getId() != null, STR); checkState(getSearchResultPresenter().getProviderData().getDisplayedItem().getItem().getRevision() != null, STR);
/** * This method will load the complete list of property tags (and set allPropertyTagsLoadInitiated to true), and load * the property tags assigned to the latest revision of the topic (and set propertyTagsLoadInitiated to true). */
This method will load the complete list of property tags (and set allPropertyTagsLoadInitiated to true), and load the property tags assigned to the latest revision of the topic (and set propertyTagsLoadInitiated to true)
loadPropertyTags
{ "repo_name": "pressgang-ccms/PressGangCCMSUI", "path": "src/main/java/org/jboss/pressgang/ccms/ui/client/local/mvp/presenter/topic/searchresults/topics/TopicFilteredResultsAndDetailsPresenter.java", "license": "gpl-3.0", "size": 214511 }
[ "com.google.common.base.Preconditions", "org.jboss.pressgang.ccms.rest.v1.collections.items.RESTTopicCollectionItemV1", "org.jboss.pressgang.ccms.rest.v1.entities.RESTTopicV1" ]
import com.google.common.base.Preconditions; import org.jboss.pressgang.ccms.rest.v1.collections.items.RESTTopicCollectionItemV1; import org.jboss.pressgang.ccms.rest.v1.entities.RESTTopicV1;
import com.google.common.base.*; import org.jboss.pressgang.ccms.rest.v1.collections.items.*; import org.jboss.pressgang.ccms.rest.v1.entities.*;
[ "com.google.common", "org.jboss.pressgang" ]
com.google.common; org.jboss.pressgang;
2,436,860
public void leap(Reaction reaction, PopulationState state, Model model, boolean calcLogP, double thisdt) { // Calculate corrected rate double rho = reaction.getPropensity()*thisdt + 0.5*corrections.get(reaction)*thisdt*thisdt; // Draw number of reactions to fire within time tau: double q = Randomizer.nextPoisson(rho); if (calcLogP) { if (rho>0) stepLogP += -rho + q*Math.log(rho/thisdt) - Gamma.logGamma(q+1); } // Implement reactions: state.implementReaction(reaction, q); // Increment event counter: eventCount += q; }
void function(Reaction reaction, PopulationState state, Model model, boolean calcLogP, double thisdt) { double rho = reaction.getPropensity()*thisdt + 0.5*corrections.get(reaction)*thisdt*thisdt; double q = Randomizer.nextPoisson(rho); if (calcLogP) { if (rho>0) stepLogP += -rho + q*Math.log(rho/thisdt) - Gamma.logGamma(q+1); } state.implementReaction(reaction, q); eventCount += q; }
/** * Generate appropriate random state change according to Sehl's * step anticipation tau-leaping algorithm. * * @param reaction * @param state PopulationState to modify. * @param model * @param calcLogP * @param thisdt */
Generate appropriate random state change according to Sehl's step anticipation tau-leaping algorithm
leap
{ "repo_name": "CompEvol/MASTER", "path": "src/master/steppers/SALStepper.java", "license": "gpl-3.0", "size": 8061 }
[ "org.apache.commons.math.special.Gamma" ]
import org.apache.commons.math.special.Gamma;
import org.apache.commons.math.special.*;
[ "org.apache.commons" ]
org.apache.commons;
2,394,366
protected void createHhea(FontFileReader in, int size) throws IOException { OFDirTabEntry entry = dirTabs.get(OFTableName.HHEA); if (entry != null) { pad4(); seekTab(in, OFTableName.HHEA, 0); writeBytes(in.getBytes((int) entry.getOffset(), (int) entry.getLength())); writeUShort((int) entry.getLength() + currentPos - 2, size); updateCheckSum(currentPos, (int) entry.getLength(), OFTableName.HHEA); currentPos += (int) entry.getLength(); realSize += (int) entry.getLength(); } else { throw new IOException("Can't find hhea table"); } }
void function(FontFileReader in, int size) throws IOException { OFDirTabEntry entry = dirTabs.get(OFTableName.HHEA); if (entry != null) { pad4(); seekTab(in, OFTableName.HHEA, 0); writeBytes(in.getBytes((int) entry.getOffset(), (int) entry.getLength())); writeUShort((int) entry.getLength() + currentPos - 2, size); updateCheckSum(currentPos, (int) entry.getLength(), OFTableName.HHEA); currentPos += (int) entry.getLength(); realSize += (int) entry.getLength(); } else { throw new IOException(STR); } }
/** * Copy the hhea table as is from original font to subset font * and fill in size of hmtx table */
Copy the hhea table as is from original font to subset font and fill in size of hmtx table
createHhea
{ "repo_name": "StrategyObject/fop", "path": "src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java", "license": "apache-2.0", "size": 24571 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
530,646
return InetAddress.getLocalHost().getHostName(); } /** * Get the application working directory {@link Path}. * * @param fs a {@link FileSystem} instance on which {@link FileSystem#getHomeDirectory()} is called * to get the home directory of the {@link FileSystem} of the application working directory * @param applicationName the application name * @param applicationId the application ID in string form * @return the cluster application working directory {@link Path}
return InetAddress.getLocalHost().getHostName(); } /** * Get the application working directory {@link Path}. * * @param fs a {@link FileSystem} instance on which {@link FileSystem#getHomeDirectory()} is called * to get the home directory of the {@link FileSystem} of the application working directory * @param applicationName the application name * @param applicationId the application ID in string form * @return the cluster application working directory {@link Path}
/** * Get the name of the current host. * * @return the name of the current host * @throws UnknownHostException if the host name is unknown */
Get the name of the current host
getHostname
{ "repo_name": "yukuai518/gobblin", "path": "gobblin-cluster/src/main/java/gobblin/cluster/GobblinClusterUtils.java", "license": "apache-2.0", "size": 2117 }
[ "java.net.InetAddress", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import java.net.InetAddress; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import java.net.*; import org.apache.hadoop.fs.*;
[ "java.net", "org.apache.hadoop" ]
java.net; org.apache.hadoop;
1,347,111
@Test public void testAllPositiveCopyFilesOptionsValues() { try { CopyFilesOptions opts = new CopyFilesOptions() .setChangelistId(100) .setNoUpdate(true) .setQuiet(true) .setNoClientSyncOrMod(false) .setBidirectional(true) .setReverseMapping(false) .setMaxFiles(1000); assertEquals(100, opts.getChangelistId()); assertEquals(true, opts.isNoUpdate()); assertEquals(true, opts.isQuiet()); assertEquals(false, opts.isNoClientSyncOrMod()); assertEquals(true, opts.isBidirectional()); assertEquals(false, opts.isReverseMapping()); assertEquals(1000, opts.getMaxFiles()); } catch (Exception exc) { fail("Unexpected exception: " + exc.getLocalizedMessage()); } }
void function() { try { CopyFilesOptions opts = new CopyFilesOptions() .setChangelistId(100) .setNoUpdate(true) .setQuiet(true) .setNoClientSyncOrMod(false) .setBidirectional(true) .setReverseMapping(false) .setMaxFiles(1000); assertEquals(100, opts.getChangelistId()); assertEquals(true, opts.isNoUpdate()); assertEquals(true, opts.isQuiet()); assertEquals(false, opts.isNoClientSyncOrMod()); assertEquals(true, opts.isBidirectional()); assertEquals(false, opts.isReverseMapping()); assertEquals(1000, opts.getMaxFiles()); } catch (Exception exc) { fail(STR + exc.getLocalizedMessage()); } }
/** * Test positive values. */
Test positive values
testAllPositiveCopyFilesOptionsValues
{ "repo_name": "groboclown/p4ic4idea", "path": "p4java/src/test/java/com/perforce/p4java/tests/dev/unit/features131/CopyFilesOptionsQuietTest.java", "license": "apache-2.0", "size": 2772 }
[ "com.perforce.p4java.option.client.CopyFilesOptions", "org.junit.Assert" ]
import com.perforce.p4java.option.client.CopyFilesOptions; import org.junit.Assert;
import com.perforce.p4java.option.client.*; import org.junit.*;
[ "com.perforce.p4java", "org.junit" ]
com.perforce.p4java; org.junit;
318,546
@DataProvider(name = "isValidDurationDataProvider") public Object[][] isValidDurationDataProvider() { return new Object[][]{ {"10 us", true}, {"10 us", true}, {"100 MicroSeconds", true}, {"5 MS", true}, {"5\tMILLISECONDS", true}, {"20 s", true}, {"30 seconds", true}, {"30 Min", true}, {"30 Minutes", true}, {"1 h", true}, {"1 hours", true}, {"10us", false}, {"MicroSeconds", false}, {"5", false}, {"ten seconds", false}, {"5 DAYS", false}, {"20 ko", false} }; }
@DataProvider(name = STR) Object[][] function() { return new Object[][]{ {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {STR, true}, {"10us", false}, {STR, false}, {"5", false}, {STR, false}, {STR, false}, {STR, false} }; }
/** * Data provider. * * @return Test data. */
Data provider
isValidDurationDataProvider
{ "repo_name": "elasticlib/elasticlib", "path": "elasticlib-common/src/test/java/org/elasticlib/common/config/ConfigUtilTest.java", "license": "apache-2.0", "size": 7816 }
[ "org.testng.annotations.DataProvider" ]
import org.testng.annotations.DataProvider;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
1,654,969
@ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) .getSyncPoller(); }
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner> function( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) .getSyncPoller(); }
/** * Creates or updates a threat detection policy. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param securityAlertPolicyName The name of the threat detection policy. * @param parameters The server security alert policy. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a server security alert policy. */
Creates or updates a threat detection policy
beginCreateOrUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java", "license": "mit", "size": 43102 }
[ "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.mariadb.fluent.models.ServerSecurityAlertPolicyInner", "com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName" ]
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.mariadb.fluent.models.ServerSecurityAlertPolicyInner; import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName;
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.mariadb.fluent.models.*; import com.azure.resourcemanager.mariadb.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,896,166
protected Element renameElement(Element el, String newName, boolean isIn) throws MapperException { Element newEl = null; if (isIn) newEl = inResultDoc.createElementNS(FACE_URI, newName); else if (!isIn) newEl = outResultDoc.createElementNS(FACE_URI, newName); // set all attributes of the constrained element, including namespace attributes for (int a = 0; a < el.getAttributes().getLength();a++) { Attr at = (Attr)el.getAttributes().item(a); newEl.setAttribute(at.getName(), at.getValue()); } return newEl; } //-------------------------------------------------------------------------------------------------------------- // XSLT Wrapper Transforms //--------------------------------------------------------------------------------------------------------------
Element function(Element el, String newName, boolean isIn) throws MapperException { Element newEl = null; if (isIn) newEl = inResultDoc.createElementNS(FACE_URI, newName); else if (!isIn) newEl = outResultDoc.createElementNS(FACE_URI, newName); for (int a = 0; a < el.getAttributes().getLength();a++) { Attr at = (Attr)el.getAttributes().item(a); newEl.setAttribute(at.getName(), at.getValue()); } return newEl; }
/** * copy an element and all its attributes to the new document, renaming it * and putting it in no namespace. * @param el * @param newName * @param isIn true for the in-transform, false for the out-transform * @return * @throws MapperException */
copy an element and all its attributes to the new document, renaming it and putting it in no namespace
renameElement
{ "repo_name": "openmapsoftware/mappingtools", "path": "openmap-mapper-lib/src/main/java/com/openMap1/mapper/converters/FACEWrapper.java", "license": "epl-1.0", "size": 11744 }
[ "org.w3c.dom.Attr", "org.w3c.dom.Element" ]
import org.w3c.dom.Attr; import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,284,288
public static void verifyFilesEqual(FileSystem fs, Path p1, Path p2, int len) throws IOException { try (FSDataInputStream in1 = fs.open(p1); FSDataInputStream in2 = fs.open(p2)) { for (int i = 0; i < len; i++) { assertEquals("Mismatch at byte " + i, in1.read(), in2.read()); } } }
static void function(FileSystem fs, Path p1, Path p2, int len) throws IOException { try (FSDataInputStream in1 = fs.open(p1); FSDataInputStream in2 = fs.open(p2)) { for (int i = 0; i < len; i++) { assertEquals(STR + i, in1.read(), in2.read()); } } }
/** * Verify that two files have the same contents. * * @param fs The file system containing the two files. * @param p1 The path of the first file. * @param p2 The path of the second file. * @param len The length of the two files. * @throws IOException */
Verify that two files have the same contents
verifyFilesEqual
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java", "license": "apache-2.0", "size": 90485 }
[ "java.io.IOException", "org.apache.hadoop.fs.FSDataInputStream", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.junit.Assert" ]
import java.io.IOException; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.fs.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
1,901,770
@Override public void toStream(ObjectOutput out) throws CacheLoaderException { try { Set<InternalCacheEntry> loadAll = loadAll(); int count = 0; for (InternalCacheEntry entry : loadAll) { getMarshaller().objectToObjectStream(entry, out); count++; } getMarshaller().objectToObjectStream(null, out); } catch (IOException e) { throw new CacheLoaderException(e); } }
void function(ObjectOutput out) throws CacheLoaderException { try { Set<InternalCacheEntry> loadAll = loadAll(); int count = 0; for (InternalCacheEntry entry : loadAll) { getMarshaller().objectToObjectStream(entry, out); count++; } getMarshaller().objectToObjectStream(null, out); } catch (IOException e) { throw new CacheLoaderException(e); } }
/** * Writes to a stream the number of entries (long) then the entries themselves. */
Writes to a stream the number of entries (long) then the entries themselves
toStream
{ "repo_name": "oscerd/infinispan-cachestore-cassandra", "path": "src/main/java/org/infinispan/loaders/cassandra/CassandraCacheStore.java", "license": "apache-2.0", "size": 24410 }
[ "java.io.IOException", "java.io.ObjectOutput", "java.util.Set", "org.infinispan.container.entries.InternalCacheEntry", "org.infinispan.loaders.CacheLoaderException" ]
import java.io.IOException; import java.io.ObjectOutput; import java.util.Set; import org.infinispan.container.entries.InternalCacheEntry; import org.infinispan.loaders.CacheLoaderException;
import java.io.*; import java.util.*; import org.infinispan.container.entries.*; import org.infinispan.loaders.*;
[ "java.io", "java.util", "org.infinispan.container", "org.infinispan.loaders" ]
java.io; java.util; org.infinispan.container; org.infinispan.loaders;
641,414
private synchronized CmsModule importModule(CmsObject cms, I_CmsReport report, CmsImportParameters parameters) throws CmsSecurityException, CmsConfigurationException, CmsException { // check if the user has the required permissions OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); // read the module from the import file CmsModule importedModule = readModuleFromImport(parameters.getPath()); // check if the module is already installed if (OpenCms.getModuleManager().hasModule(importedModule.getName())) { throw new CmsConfigurationException( Messages.get().container(Messages.ERR_MOD_ALREADY_INSTALLED_1, importedModule.getName())); } // check the module dependencies List<CmsModuleDependency> dependencies = OpenCms.getModuleManager().checkDependencies( importedModule, CmsModuleManager.DEPENDENCY_MODE_IMPORT); if (dependencies.size() > 0) { // some dependencies not fulfilled StringBuffer missingModules = new StringBuffer(); for (CmsModuleDependency dependency : dependencies) { missingModules.append(" ").append(dependency.getName()).append(", Version ").append( dependency.getVersion()).append("\r\n"); } throw new CmsConfigurationException( Messages.get().container( Messages.ERR_MOD_DEPENDENCY_INFO_2, importedModule.getName() + ", Version " + importedModule.getVersion(), missingModules)); } // check the imported resource types for name / id conflicts List<I_CmsResourceType> checkedTypes = new ArrayList<I_CmsResourceType>(); for (I_CmsResourceType type : importedModule.getResourceTypes()) { // first check against the already configured resource types int externalConflictIndex = OpenCms.getResourceManager().getResourceTypes().indexOf(type); if (externalConflictIndex >= 0) { I_CmsResourceType conflictingType = OpenCms.getResourceManager().getResourceTypes().get( externalConflictIndex); if (!type.isIdentical(conflictingType)) { // if name and id are identical, we assume this is a module replace operation throw new CmsConfigurationException( org.opencms.loader.Messages.get().container( org.opencms.loader.Messages.ERR_CONFLICTING_MODULE_RESOURCE_TYPES_5, new Object[] { type.getTypeName(), new Integer(type.getTypeId()), importedModule.getName(), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); } } // now check against the other resource types of the imported module int internalConflictIndex = checkedTypes.indexOf(type); if (internalConflictIndex >= 0) { I_CmsResourceType conflictingType = checkedTypes.get(internalConflictIndex); throw new CmsConfigurationException( org.opencms.loader.Messages.get().container( org.opencms.loader.Messages.ERR_CONFLICTING_RESTYPES_IN_MODULE_5, new Object[] { importedModule.getName(), type.getTypeName(), new Integer(type.getTypeId()), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); } // add the resource type for the next check checkedTypes.add(type); } // import the module resources CmsObject importCms = OpenCms.initCmsObject(cms); String importSite = importedModule.getImportSite(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) { importCms.getRequestContext().setSiteRoot(importSite); } else { String siteToSet = importCms.getRequestContext().getSiteRoot(); if ("".equals(siteToSet)) { siteToSet = "/"; } importedModule.setSite(siteToSet); } // add the imported module to the module manager OpenCms.getModuleManager().addModule(cms, importedModule); // reinitialize the resource manager with additional module resource types if necessary if (importedModule.getResourceTypes() != Collections.EMPTY_LIST) { OpenCms.getResourceManager().initialize(cms); } // reinitialize the workplace manager with additional module explorer types if necessary if (importedModule.getExplorerTypes() != Collections.EMPTY_LIST) { OpenCms.getWorkplaceManager().addExplorerTypeSettings(importedModule); } CmsImport cmsImport = new CmsImport(importCms, report); cmsImport.importData(parameters); String importScript = importedModule.getImportScript(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importScript)) { LOG.info("Executing import script for module " + importedModule.getName()); report.println(Messages.get().container(Messages.RPT_IMPORT_SCRIPT_HEADER_0), I_CmsReport.FORMAT_HEADLINE); importScript = "echo on\n" + importScript; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); CmsShell shell = new CmsShell(cms, "${user}@${project}:${siteroot}|${uri}>", null, out, out); shell.execute(importScript); String outputString = buffer.toString(); LOG.info("Shell output for import script was: \n" + outputString); report.println(Messages.get().container(Messages.RPT_IMPORT_SCRIPT_OUTPUT_1, outputString)); } importedModule.setCheckpointTime(System.currentTimeMillis()); OpenCms.getModuleManager().updateModuleConfiguration(); return importedModule; }
synchronized CmsModule function(CmsObject cms, I_CmsReport report, CmsImportParameters parameters) throws CmsSecurityException, CmsConfigurationException, CmsException { OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); CmsModule importedModule = readModuleFromImport(parameters.getPath()); if (OpenCms.getModuleManager().hasModule(importedModule.getName())) { throw new CmsConfigurationException( Messages.get().container(Messages.ERR_MOD_ALREADY_INSTALLED_1, importedModule.getName())); } List<CmsModuleDependency> dependencies = OpenCms.getModuleManager().checkDependencies( importedModule, CmsModuleManager.DEPENDENCY_MODE_IMPORT); if (dependencies.size() > 0) { StringBuffer missingModules = new StringBuffer(); for (CmsModuleDependency dependency : dependencies) { missingModules.append(" ").append(dependency.getName()).append(STR).append( dependency.getVersion()).append("\r\n"); } throw new CmsConfigurationException( Messages.get().container( Messages.ERR_MOD_DEPENDENCY_INFO_2, importedModule.getName() + STR + importedModule.getVersion(), missingModules)); } List<I_CmsResourceType> checkedTypes = new ArrayList<I_CmsResourceType>(); for (I_CmsResourceType type : importedModule.getResourceTypes()) { int externalConflictIndex = OpenCms.getResourceManager().getResourceTypes().indexOf(type); if (externalConflictIndex >= 0) { I_CmsResourceType conflictingType = OpenCms.getResourceManager().getResourceTypes().get( externalConflictIndex); if (!type.isIdentical(conflictingType)) { throw new CmsConfigurationException( org.opencms.loader.Messages.get().container( org.opencms.loader.Messages.ERR_CONFLICTING_MODULE_RESOURCE_TYPES_5, new Object[] { type.getTypeName(), new Integer(type.getTypeId()), importedModule.getName(), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); } } int internalConflictIndex = checkedTypes.indexOf(type); if (internalConflictIndex >= 0) { I_CmsResourceType conflictingType = checkedTypes.get(internalConflictIndex); throw new CmsConfigurationException( org.opencms.loader.Messages.get().container( org.opencms.loader.Messages.ERR_CONFLICTING_RESTYPES_IN_MODULE_5, new Object[] { importedModule.getName(), type.getTypeName(), new Integer(type.getTypeId()), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); } checkedTypes.add(type); } CmsObject importCms = OpenCms.initCmsObject(cms); String importSite = importedModule.getImportSite(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) { importCms.getRequestContext().setSiteRoot(importSite); } else { String siteToSet = importCms.getRequestContext().getSiteRoot(); if (STR/STRExecuting import script for module STRecho on\nSTR${user}@${project}:${siteroot} ${uri}>STRShell output for import script was: \n" + outputString); report.println(Messages.get().container(Messages.RPT_IMPORT_SCRIPT_OUTPUT_1, outputString)); } importedModule.setCheckpointTime(System.currentTimeMillis()); OpenCms.getModuleManager().updateModuleConfiguration(); return importedModule; }
/** * Imports a module from an external file source.<p> * * @param cms must have been initialized with {@link CmsRole#DATABASE_MANAGER} permissions * @param report the report to print the progress information to * @param parameters the import parameters * * @return the imported module * * @throws CmsSecurityException if no {@link CmsRole#DATABASE_MANAGER} permissions are available * @throws CmsConfigurationException if the module is already installed or the * dependencies are not fulfilled * @throws CmsException if errors occur reading the module data */
Imports a module from an external file source
importModule
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/module/CmsModuleImportExportHandler.java", "license": "lgpl-2.1", "size": 31918 }
[ "java.util.ArrayList", "java.util.List", "org.opencms.configuration.CmsConfigurationException", "org.opencms.file.CmsObject", "org.opencms.importexport.CmsImportParameters", "org.opencms.main.CmsException", "org.opencms.main.OpenCms", "org.opencms.security.CmsRole", "org.opencms.security.CmsSecurityException", "org.opencms.util.CmsStringUtil" ]
import java.util.ArrayList; import java.util.List; import org.opencms.configuration.CmsConfigurationException; import org.opencms.file.CmsObject; import org.opencms.importexport.CmsImportParameters; import org.opencms.main.CmsException; import org.opencms.main.OpenCms; import org.opencms.security.CmsRole; import org.opencms.security.CmsSecurityException; import org.opencms.util.CmsStringUtil;
import java.util.*; import org.opencms.configuration.*; import org.opencms.file.*; import org.opencms.importexport.*; import org.opencms.main.*; import org.opencms.security.*; import org.opencms.util.*;
[ "java.util", "org.opencms.configuration", "org.opencms.file", "org.opencms.importexport", "org.opencms.main", "org.opencms.security", "org.opencms.util" ]
java.util; org.opencms.configuration; org.opencms.file; org.opencms.importexport; org.opencms.main; org.opencms.security; org.opencms.util;
2,541,049
@Test public void testGetWithRunningVmsWhereThereAreNone() { VDSGroup result = dao.getWithRunningVms(groupWithNoRunningVms.getId()); assertNull(result); }
void function() { VDSGroup result = dao.getWithRunningVms(groupWithNoRunningVms.getId()); assertNull(result); }
/** * Ensures that null is returned. */
Ensures that null is returned
testGetWithRunningVmsWhereThereAreNone
{ "repo_name": "derekhiggins/ovirt-engine", "path": "backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java", "license": "apache-2.0", "size": 9506 }
[ "org.junit.Assert", "org.ovirt.engine.core.common.businessentities.VDSGroup" ]
import org.junit.Assert; import org.ovirt.engine.core.common.businessentities.VDSGroup;
import org.junit.*; import org.ovirt.engine.core.common.businessentities.*;
[ "org.junit", "org.ovirt.engine" ]
org.junit; org.ovirt.engine;
1,458,554
//------------// // contextual // //------------// public static double contextual (double inter, double[] partners, double[] ratios) { Objects.requireNonNull(ratios, "Null ratios array"); Objects.requireNonNull(partners, "Null sources array"); if (ratios.length != partners.length) { throw new IllegalArgumentException("Arrays of different lengths"); } double contribution = 0; for (int i = 0; i < partners.length; i++) { contribution += contributionOf(partners[i], ratios[i]); } return contextual(inter, contribution); }
static double function (double inter, double[] partners, double[] ratios) { Objects.requireNonNull(ratios, STR); Objects.requireNonNull(partners, STR); if (ratios.length != partners.length) { throw new IllegalArgumentException(STR); } double contribution = 0; for (int i = 0; i < partners.length; i++) { contribution += contributionOf(partners[i], ratios[i]); } return contextual(inter, contribution); }
/** * Compute contextual grade, knowing inter grade and, for each partner, * its intrinsic grade and the ratio brought by supporting relation. * * @param inter the (intrinsic grade of the) inter * @param partners the array of (intrinsic grades of the) supporting partners * @param ratios the array of ratios of supporting partners, parallel to partners array * @return the resulting contextual probability for inter */
Compute contextual grade, knowing inter grade and, for each partner, its intrinsic grade and the ratio brought by supporting relation
contextual
{ "repo_name": "Audiveris/audiveris", "path": "src/main/org/audiveris/omr/sig/GradeUtil.java", "license": "agpl-3.0", "size": 5695 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,849,497
@RequestMapping(value = "/search/{keyWord}") public List<DrugSearchResult> fetchMedList(@PathVariable String keyWord) { return drugService.fetchMedList(keyWord); }
@RequestMapping(value = STR) List<DrugSearchResult> function(@PathVariable String keyWord) { return drugService.fetchMedList(keyWord); }
/** * GET: {@link http://ec2-54-243-195-170.compute-1.amazonaws.com:8080/drugs/search/{keyWord}}. * This rest endpoint is to search the OpenFDA API data source. * * @return A list of Drug Search Results * @see DrugService * @see RequestMapping * @see <a href="https://open.fda.gov/drug/label/">Open FDA Drug Labeling</a> */
This rest endpoint is to search the OpenFDA API data source
fetchMedList
{ "repo_name": "keithb418/medcheckerapp", "path": "MedAnalyzerResources/src/main/java/com/longview/gsa/controller/DrugLabelingController.java", "license": "cc0-1.0", "size": 3786 }
[ "com.longview.gsa.domain.DrugSearchResult", "java.util.List", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping" ]
import com.longview.gsa.domain.DrugSearchResult; import java.util.List; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping;
import com.longview.gsa.domain.*; import java.util.*; import org.springframework.web.bind.annotation.*;
[ "com.longview.gsa", "java.util", "org.springframework.web" ]
com.longview.gsa; java.util; org.springframework.web;
516,030
@Override public void loadDataToPage(Page page, ReportContext context, WizardSession session) throws Exception { String query = context.getId(); CreateTeamConfig form = new CreateTeamConfig(); // The form will be in the format Account;Pod - grab the former: String account = query.split(";")[0]; // Pre-populate the account field: form.setAccount(account); // Set the account field to read-only page.getFlist().getByFieldId(FORM_ID + ".account").setEditable(false); session.getSessionAttributes().put(FORM_ID, form); page.marshallFromSession(FORM_ID); }
void function(Page page, ReportContext context, WizardSession session) throws Exception { String query = context.getId(); CreateTeamConfig form = new CreateTeamConfig(); String account = query.split(";")[0]; form.setAccount(account); page.getFlist().getByFieldId(FORM_ID + STR).setEditable(false); session.getSessionAttributes().put(FORM_ID, form); page.marshallFromSession(FORM_ID); }
/** * This sets up the initial fields and provides default values (in this case * the account name) */
This sets up the initial fields and provides default values (in this case the account name)
loadDataToPage
{ "repo_name": "CiscoUKIDCDev/ucsd-spark-plugin", "path": "Spark/src/com/cisco/ukidcv/spark/reports/teams/actions/CreateTeamAction.java", "license": "apache-2.0", "size": 4245 }
[ "com.cisco.ukidcv.spark.tasks.teams.CreateTeamConfig", "com.cloupia.model.cIM.ReportContext", "com.cloupia.service.cIM.inframgr.forms.wizard.Page", "com.cloupia.service.cIM.inframgr.forms.wizard.WizardSession" ]
import com.cisco.ukidcv.spark.tasks.teams.CreateTeamConfig; import com.cloupia.model.cIM.ReportContext; import com.cloupia.service.cIM.inframgr.forms.wizard.Page; import com.cloupia.service.cIM.inframgr.forms.wizard.WizardSession;
import com.cisco.ukidcv.spark.tasks.teams.*; import com.cloupia.model.*; import com.cloupia.service.*;
[ "com.cisco.ukidcv", "com.cloupia.model", "com.cloupia.service" ]
com.cisco.ukidcv; com.cloupia.model; com.cloupia.service;
755,856
public void setEPService(EPServiceProvider epService);
void function(EPServiceProvider epService);
/** * Set the epService * @param epService - the value to set */
Set the epService
setEPService
{ "repo_name": "georgenicoll/esper", "path": "esperio-csv/src/main/java/com/espertech/esperio/CoordinatedAdapter.java", "license": "gpl-2.0", "size": 2158 }
[ "com.espertech.esper.client.EPServiceProvider" ]
import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.*;
[ "com.espertech.esper" ]
com.espertech.esper;
1,190,139
T getAssigned(IAssignedTask task); PortMapper PORT_MAPPER = new PortMapper();
T getAssigned(IAssignedTask task); PortMapper PORT_MAPPER = new PortMapper();
/** * Gets assigned resource values stored in {@code task}. * * @param task Task to get assigned resources from. * @return Assigned resource values. */
Gets assigned resource values stored in task
getAssigned
{ "repo_name": "apache/aurora", "path": "src/main/java/org/apache/aurora/scheduler/resources/ResourceMapper.java", "license": "apache-2.0", "size": 3557 }
[ "org.apache.aurora.scheduler.storage.entities.IAssignedTask" ]
import org.apache.aurora.scheduler.storage.entities.IAssignedTask;
import org.apache.aurora.scheduler.storage.entities.*;
[ "org.apache.aurora" ]
org.apache.aurora;
1,664,972
@Override public double estimate(final Node node, final BitExp goal) { return estimateCost(node, goal); }
double function(final Node node, final BitExp goal) { return estimateCost(node, goal); }
/** * Return the estimated distance to the goal to reach the specified state. If the return value is * <code>DOUBLE.MAX_VALUE</code>, it means that the goal is unreachable from the specified * state. * * @param node the state from which the distance to the goal must be estimated. * @param goal the goal expression. * @return the distance to the goal state from the specified state. */
Return the estimated distance to the goal to reach the specified state. If the return value is <code>DOUBLE.MAX_VALUE</code>, it means that the goal is unreachable from the specified state
estimate
{ "repo_name": "pellierd/pddl4j", "path": "src/main/java/fr/uga/pddl4j/heuristics/relaxation/MinCost.java", "license": "lgpl-3.0", "size": 5032 }
[ "fr.uga.pddl4j.planners.statespace.search.strategy.Node", "fr.uga.pddl4j.util.BitExp" ]
import fr.uga.pddl4j.planners.statespace.search.strategy.Node; import fr.uga.pddl4j.util.BitExp;
import fr.uga.pddl4j.planners.statespace.search.strategy.*; import fr.uga.pddl4j.util.*;
[ "fr.uga.pddl4j" ]
fr.uga.pddl4j;
2,657,600
public static void logRenameFileOperation(Context context) { logHistogram(context, COUNT_FILEOP_SYSTEM, FILEOP_RENAME); }
static void function(Context context) { logHistogram(context, COUNT_FILEOP_SYSTEM, FILEOP_RENAME); }
/** * Logs rename file operation. It is a part of file operation stats. We do not differentiate * between internal and external locations, all rename operations are logged under * COUNT_FILEOP_SYSTEM. Call this when a rename file operation has completed. * * @param context */
Logs rename file operation. It is a part of file operation stats. We do not differentiate between internal and external locations, all rename operations are logged under COUNT_FILEOP_SYSTEM. Call this when a rename file operation has completed
logRenameFileOperation
{ "repo_name": "xorware/android_frameworks_base", "path": "packages/DocumentsUI/src/com/android/documentsui/Metrics.java", "license": "apache-2.0", "size": 34732 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
1,258,293
Timeouts pageLoadTimeout(long time, TimeUnit unit); }
Timeouts pageLoadTimeout(long time, TimeUnit unit); }
/** * Sets the amount of time to wait for a page load to complete before throwing an error. * If the timeout is negative, page loads can be indefinite. * * @param time The timeout value. * @param unit The unit of time. * @return A Timeouts interface. */
Sets the amount of time to wait for a page load to complete before throwing an error. If the timeout is negative, page loads can be indefinite
pageLoadTimeout
{ "repo_name": "saikrishna321/java-client", "path": "src/main/java/org/openqa/selenium/WebDriver.java", "license": "apache-2.0", "size": 19339 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,528,227
private void validateEvent(Event event) { if (event.getType() == Event.Type.StartEvent) assertNSequenceFlows(event, 0, 0, 1, 1); else if (event.getType() == Event.Type.EndEvent) assertNSequenceFlows(event, 1, 1, 0, 0); else if (event.getType() == Event.Type.IntermediateEvent) assertNSequenceFlows(event, 1, 1, 1, 1); else throw new NotTransformableException(CauseType.UnsupportedObject, event); }
void function(Event event) { if (event.getType() == Event.Type.StartEvent) assertNSequenceFlows(event, 0, 0, 1, 1); else if (event.getType() == Event.Type.EndEvent) assertNSequenceFlows(event, 1, 1, 0, 0); else if (event.getType() == Event.Type.IntermediateEvent) assertNSequenceFlows(event, 1, 1, 1, 1); else throw new NotTransformableException(CauseType.UnsupportedObject, event); }
/** * Validates an Event with checks for type and number of allowed incoming/outgoing sequence flows. * * @param event * Event to validate */
Validates an Event with checks for type and number of allowed incoming/outgoing sequence flows
validateEvent
{ "repo_name": "fhaer/BPMN-XPDL-to-AristaFlow", "path": "src/de/bpmnaftool/model/bpmn/BpmnValidatorImpl.java", "license": "gpl-3.0", "size": 10946 }
[ "de.bpmnaftool.model.bpmn.flowobject.Event", "de.bpmnaftool.model.transformation.NotTransformableException" ]
import de.bpmnaftool.model.bpmn.flowobject.Event; import de.bpmnaftool.model.transformation.NotTransformableException;
import de.bpmnaftool.model.bpmn.flowobject.*; import de.bpmnaftool.model.transformation.*;
[ "de.bpmnaftool.model" ]
de.bpmnaftool.model;
203,932
public DBExpression transformToStorableType(DBExpression columnExpression) { return columnExpression; }
DBExpression function(DBExpression columnExpression) { return columnExpression; }
/** * Transform a datatype not supported by the database into a type that the * database does support. * * <p> * Used mostly to turn Booleans into numbers. * * <p> * By default this method just returns the input DBExpression. * * @param columnExpression a column expression that might need to change type * for this database * <p style="color: #F90;">Support DBvolution at * <a href="http://patreon.com/dbvolution" target=new>Patreon</a></p> * * @return The DBExpression as a DBExpression supported by the database. */
Transform a datatype not supported by the database into a type that the database does support. Used mostly to turn Booleans into numbers. By default this method just returns the input DBExpression
transformToStorableType
{ "repo_name": "gregorydgraham/DBvolution", "path": "src/main/java/nz/co/gregs/dbvolution/databases/definitions/DBDefinition.java", "license": "apache-2.0", "size": 191012 }
[ "nz.co.gregs.dbvolution.expressions.DBExpression" ]
import nz.co.gregs.dbvolution.expressions.DBExpression;
import nz.co.gregs.dbvolution.expressions.*;
[ "nz.co.gregs" ]
nz.co.gregs;
1,295,343
public void setArrowPaint(Paint paint) { this.arrowPaint = paint; }
void function(Paint paint) { this.arrowPaint = paint; }
/** * Sets the paint used for the arrow. * * @param paint the arrow paint (<code>null</code> not permitted). */
Sets the paint used for the arrow
setArrowPaint
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/annotations/XYPointerAnnotation.java", "license": "lgpl-2.1", "size": 14740 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,927,077
return Duration.ofSeconds(5); } @Value.Default default boolean isLimitConnectionPool() { return true; }
return Duration.ofSeconds(5); } @Value.Default default boolean isLimitConnectionPool() { return true; }
/** * Timeout to check out a connection from the connection pool. * * This connection pool checkout won't occur until you call {@link javax.ws.rs.client.InvocationInvocation#invoke()}. * If the time to get a connection surpasses this value, a runtime exception will be thrown. * * Supported: resteasy-apache, resteasy * Unsupported: resteasy, jersey */
Timeout to check out a connection from the connection pool. This connection pool checkout won't occur until you call <code>javax.ws.rs.client.InvocationInvocation#invoke()</code>. If the time to get a connection surpasses this value, a runtime exception will be thrown. Supported: resteasy-apache, resteasy Unsupported: resteasy, jersey
getConnectionPoolTimeout
{ "repo_name": "opentable/otj-jaxrs", "path": "client/src/main/java/com/opentable/jaxrs/JaxRsClientConfig.java", "license": "apache-2.0", "size": 7783 }
[ "java.time.Duration", "org.immutables.value.Value" ]
import java.time.Duration; import org.immutables.value.Value;
import java.time.*; import org.immutables.value.*;
[ "java.time", "org.immutables.value" ]
java.time; org.immutables.value;
2,573,293
public static int run(String[] args, ClassLoader classLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { final Options options = new Options(); if (args.length ==0) { usage(); return -1; } for (String arg : args) { if (arg.equals("-help")) { usage(); return -1; } if (arg.equals("-version")) { System.out.println(Messages.VERSION.format()); return -1; } } try { options.parseArguments(args); } catch (BadCommandLineException e) { // there was an error in the command line. // print usage and abort. System.out.println(e.getMessage()); System.out.println(); usage(); return -1; } Class schemagenRunner = classLoader.loadClass(Runner.class.getName()); Method mainMethod = schemagenRunner.getDeclaredMethod("main",String[].class,File.class); List<String> aptargs = new ArrayList<String>(); if(hasClass(options.arguments)) aptargs.add("-XclassesAsDecls"); // make jaxb-api.jar visible to classpath File jaxbApi = findJaxbApiJar(); if(jaxbApi!=null) { if(options.classpath!=null) { options.classpath = options.classpath+File.pathSeparatorChar+jaxbApi; } else { options.classpath = jaxbApi.getPath(); } } aptargs.add("-cp"); aptargs.add(options.classpath); if(options.targetDir!=null) { aptargs.add("-d"); aptargs.add(options.targetDir.getPath()); } aptargs.addAll(options.arguments); String[] argsarray = aptargs.toArray(new String[aptargs.size()]); return (Integer)mainMethod.invoke(null,new Object[]{argsarray,options.episodeFile}); }
static int function(String[] args, ClassLoader classLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { final Options options = new Options(); if (args.length ==0) { usage(); return -1; } for (String arg : args) { if (arg.equals("-help")) { usage(); return -1; } if (arg.equals(STR)) { System.out.println(Messages.VERSION.format()); return -1; } } try { options.parseArguments(args); } catch (BadCommandLineException e) { System.out.println(e.getMessage()); System.out.println(); usage(); return -1; } Class schemagenRunner = classLoader.loadClass(Runner.class.getName()); Method mainMethod = schemagenRunner.getDeclaredMethod("main",String[].class,File.class); List<String> aptargs = new ArrayList<String>(); if(hasClass(options.arguments)) aptargs.add(STR); File jaxbApi = findJaxbApiJar(); if(jaxbApi!=null) { if(options.classpath!=null) { options.classpath = options.classpath+File.pathSeparatorChar+jaxbApi; } else { options.classpath = jaxbApi.getPath(); } } aptargs.add("-cp"); aptargs.add(options.classpath); if(options.targetDir!=null) { aptargs.add("-d"); aptargs.add(options.targetDir.getPath()); } aptargs.addAll(options.arguments); String[] argsarray = aptargs.toArray(new String[aptargs.size()]); return (Integer)mainMethod.invoke(null,new Object[]{argsarray,options.episodeFile}); }
/** * Runs the schema generator. * * @param classLoader * the schema generator will run in this classLoader. * It needs to be able to load APT and JAXB RI classes. Note that * JAXB RI classes refer to APT classes. Must not be null. * * @return * exit code. 0 if success. * */
Runs the schema generator
run
{ "repo_name": "samskivert/ikvm-openjdk", "path": "build/linux-amd64/impsrc/com/sun/tools/internal/jxc/SchemaGenerator.java", "license": "gpl-2.0", "size": 7531 }
[ "com.sun.tools.internal.jxc.apt.Options", "com.sun.tools.internal.xjc.BadCommandLineException", "java.io.File", "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method", "java.util.ArrayList", "java.util.List" ]
import com.sun.tools.internal.jxc.apt.Options; import com.sun.tools.internal.xjc.BadCommandLineException; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List;
import com.sun.tools.internal.jxc.apt.*; import com.sun.tools.internal.xjc.*; import java.io.*; import java.lang.reflect.*; import java.util.*;
[ "com.sun.tools", "java.io", "java.lang", "java.util" ]
com.sun.tools; java.io; java.lang; java.util;
129,656
public void test_before_after() { Calendar early = Calendar.getInstance(); Calendar late = Calendar.getInstance(); // test by second early.set(2008, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 22); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); // test by minute early.set(2008, 3, 20, 17, 18, 12); late.set(2008, 3, 20, 17, 28, 12); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); // test by hour early.set(2008, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 27, 28, 12); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); // test by day early.set(2008, 3, 10, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); // test by month early.set(2008, 2, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); // test by year early.set(2007, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); // test before() assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); // test after(); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); }
void function() { Calendar early = Calendar.getInstance(); Calendar late = Calendar.getInstance(); early.set(2008, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 22); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); early.set(2008, 3, 20, 17, 18, 12); late.set(2008, 3, 20, 17, 28, 12); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); early.set(2008, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 27, 28, 12); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); early.set(2008, 3, 10, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); early.set(2008, 2, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); early.set(2007, 3, 20, 17, 28, 12); late.set(2008, 3, 20, 17, 28, 12); assertTrue(early.before(late)); assertFalse(early.before(early)); assertFalse(late.before(early)); assertTrue(late.after(early)); assertFalse(late.after(late)); assertFalse(early.after(late)); }
/** * java.util.Calendar#before(Object) * java.util.Calendar#after(Object) */
java.util.Calendar#before(Object) java.util.Calendar#after(Object)
test_before_after
{ "repo_name": "mirego/j2objc", "path": "jre_emul/android/platform/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/CalendarTest.java", "license": "apache-2.0", "size": 35571 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
387,560
protected static Map<String, String> extractResponseHeaders(Header[] responseHeaders) { if (responseHeaders == null || responseHeaders.length == 0) { return null; } Map<String, String> answer = new HashMap<>(); for (Header header : responseHeaders) { answer.put(header.getName(), header.getValue()); } return answer; }
static Map<String, String> function(Header[] responseHeaders) { if (responseHeaders == null responseHeaders.length == 0) { return null; } Map<String, String> answer = new HashMap<>(); for (Header header : responseHeaders) { answer.put(header.getName(), header.getValue()); } return answer; }
/** * Extracts the response headers * * @param responseHeaders the headers * @return the extracted headers or <tt>null</tt> if no headers existed */
Extracts the response headers
extractResponseHeaders
{ "repo_name": "ullgren/camel", "path": "components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java", "license": "apache-2.0", "size": 27966 }
[ "java.util.HashMap", "java.util.Map", "org.apache.http.Header" ]
import java.util.HashMap; import java.util.Map; import org.apache.http.Header;
import java.util.*; import org.apache.http.*;
[ "java.util", "org.apache.http" ]
java.util; org.apache.http;
886,960
void enterBuiltin_typeof(@NotNull EsperEPL2GrammarParser.Builtin_typeofContext ctx); void exitBuiltin_typeof(@NotNull EsperEPL2GrammarParser.Builtin_typeofContext ctx);
void enterBuiltin_typeof(@NotNull EsperEPL2GrammarParser.Builtin_typeofContext ctx); void exitBuiltin_typeof(@NotNull EsperEPL2GrammarParser.Builtin_typeofContext ctx);
/** * Exit a parse tree produced by {@link EsperEPL2GrammarParser#builtin_typeof}. * @param ctx the parse tree */
Exit a parse tree produced by <code>EsperEPL2GrammarParser#builtin_typeof</code>
exitBuiltin_typeof
{ "repo_name": "georgenicoll/esper", "path": "esper/src/main/java/com/espertech/esper/epl/generated/EsperEPL2GrammarListener.java", "license": "gpl-2.0", "size": 114105 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,636,920
public static TypeInference forScalarFunction( DataTypeFactory typeFactory, Class<? extends ScalarFunction> function) { final FunctionMappingExtractor mappingExtractor = new FunctionMappingExtractor( typeFactory, function, UserDefinedFunctionHelper.SCALAR_EVAL, createParameterSignatureExtraction(0), null, createReturnTypeResultExtraction(), createParameterAndReturnTypeVerification()); return extractTypeInference(mappingExtractor); }
static TypeInference function( DataTypeFactory typeFactory, Class<? extends ScalarFunction> function) { final FunctionMappingExtractor mappingExtractor = new FunctionMappingExtractor( typeFactory, function, UserDefinedFunctionHelper.SCALAR_EVAL, createParameterSignatureExtraction(0), null, createReturnTypeResultExtraction(), createParameterAndReturnTypeVerification()); return extractTypeInference(mappingExtractor); }
/** * Extracts a type inference from a {@link ScalarFunction}. */
Extracts a type inference from a <code>ScalarFunction</code>
forScalarFunction
{ "repo_name": "darionyaphet/flink", "path": "flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java", "license": "apache-2.0", "size": 10427 }
[ "org.apache.flink.table.catalog.DataTypeFactory", "org.apache.flink.table.functions.ScalarFunction", "org.apache.flink.table.functions.UserDefinedFunctionHelper", "org.apache.flink.table.types.extraction.FunctionMappingExtractor", "org.apache.flink.table.types.inference.TypeInference" ]
import org.apache.flink.table.catalog.DataTypeFactory; import org.apache.flink.table.functions.ScalarFunction; import org.apache.flink.table.functions.UserDefinedFunctionHelper; import org.apache.flink.table.types.extraction.FunctionMappingExtractor; import org.apache.flink.table.types.inference.TypeInference;
import org.apache.flink.table.catalog.*; import org.apache.flink.table.functions.*; import org.apache.flink.table.types.extraction.*; import org.apache.flink.table.types.inference.*;
[ "org.apache.flink" ]
org.apache.flink;
1,480,639
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<VirtualMachineInner> listByResourceGroupAsync(String resourceGroupName);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<VirtualMachineInner> listByResourceGroupAsync(String resourceGroupName);
/** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to * get the next page of virtual machines. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the List Virtual Machine operation response. */
Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines
listByResourceGroupAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java", "license": "mit", "size": 106942 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.compute.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,054,097
public static void compileSortRecordFactory(Vector<Sort> sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { String sortRecordClass = compileSortRecord(sortObjects, classGen, methodGen); boolean needsSortRecordFactory = false; final int nsorts = sortObjects.size(); for (int i = 0; i < nsorts; i++) { final Sort sort = sortObjects.elementAt(i); needsSortRecordFactory |= sort._needsSortRecordFactory; } String sortRecordFactoryClass = NODE_SORT_FACTORY; if (needsSortRecordFactory) { sortRecordFactoryClass = compileSortRecordFactory(sortObjects, classGen, methodGen, sortRecordClass); } final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Compile code that initializes the static _sortOrder LocalVariableGen sortOrderTemp = methodGen.addLocalVariable("sort_order_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortOrder(classGen, methodGen); il.append(AASTORE); } sortOrderTemp.setStart(il.append(new ASTORE(sortOrderTemp.getIndex()))); LocalVariableGen sortTypeTemp = methodGen.addLocalVariable("sort_type_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortType(classGen, methodGen); il.append(AASTORE); } sortTypeTemp.setStart(il.append(new ASTORE(sortTypeTemp.getIndex()))); LocalVariableGen sortLangTemp = methodGen.addLocalVariable("sort_lang_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateLang(classGen, methodGen); il.append(AASTORE); } sortLangTemp.setStart(il.append(new ASTORE(sortLangTemp.getIndex()))); LocalVariableGen sortCaseOrderTemp = methodGen.addLocalVariable("sort_case_order_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateCaseOrder(classGen, methodGen); il.append(AASTORE); } sortCaseOrderTemp.setStart( il.append(new ASTORE(sortCaseOrderTemp.getIndex()))); il.append(new NEW(cpg.addClass(sortRecordFactoryClass))); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, sortRecordClass)); il.append(classGen.loadTranslet()); sortOrderTemp.setEnd(il.append(new ALOAD(sortOrderTemp.getIndex()))); sortTypeTemp.setEnd(il.append(new ALOAD(sortTypeTemp.getIndex()))); sortLangTemp.setEnd(il.append(new ALOAD(sortLangTemp.getIndex()))); sortCaseOrderTemp.setEnd( il.append(new ALOAD(sortCaseOrderTemp.getIndex()))); il.append(new INVOKESPECIAL( cpg.addMethodref(sortRecordFactoryClass, "<init>", "(" + DOM_INTF_SIG + STRING_SIG + TRANSLET_INTF_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + ")V"))); // Initialize closure variables in sortRecordFactory final ArrayList<VariableRefBase> dups = new ArrayList<>(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { VariableRefBase varRef = sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; final VariableBase var = varRef.getVariable(); // Store variable in new closure il.append(DUP); il.append(var.loadInstruction()); il.append(new PUTFIELD( cpg.addFieldref(sortRecordFactoryClass, var.getEscapedName(), var.getType().toSignature()))); dups.add(varRef); } } }
static void function(Vector<Sort> sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { String sortRecordClass = compileSortRecord(sortObjects, classGen, methodGen); boolean needsSortRecordFactory = false; final int nsorts = sortObjects.size(); for (int i = 0; i < nsorts; i++) { final Sort sort = sortObjects.elementAt(i); needsSortRecordFactory = sort._needsSortRecordFactory; } String sortRecordFactoryClass = NODE_SORT_FACTORY; if (needsSortRecordFactory) { sortRecordFactoryClass = compileSortRecordFactory(sortObjects, classGen, methodGen, sortRecordClass); } final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); LocalVariableGen sortOrderTemp = methodGen.addLocalVariable(STR, Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortOrder(classGen, methodGen); il.append(AASTORE); } sortOrderTemp.setStart(il.append(new ASTORE(sortOrderTemp.getIndex()))); LocalVariableGen sortTypeTemp = methodGen.addLocalVariable(STR, Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortType(classGen, methodGen); il.append(AASTORE); } sortTypeTemp.setStart(il.append(new ASTORE(sortTypeTemp.getIndex()))); LocalVariableGen sortLangTemp = methodGen.addLocalVariable(STR, Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateLang(classGen, methodGen); il.append(AASTORE); } sortLangTemp.setStart(il.append(new ASTORE(sortLangTemp.getIndex()))); LocalVariableGen sortCaseOrderTemp = methodGen.addLocalVariable(STR, Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateCaseOrder(classGen, methodGen); il.append(AASTORE); } sortCaseOrderTemp.setStart( il.append(new ASTORE(sortCaseOrderTemp.getIndex()))); il.append(new NEW(cpg.addClass(sortRecordFactoryClass))); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, sortRecordClass)); il.append(classGen.loadTranslet()); sortOrderTemp.setEnd(il.append(new ALOAD(sortOrderTemp.getIndex()))); sortTypeTemp.setEnd(il.append(new ALOAD(sortTypeTemp.getIndex()))); sortLangTemp.setEnd(il.append(new ALOAD(sortLangTemp.getIndex()))); sortCaseOrderTemp.setEnd( il.append(new ALOAD(sortCaseOrderTemp.getIndex()))); il.append(new INVOKESPECIAL( cpg.addMethodref(sortRecordFactoryClass, STR, "(" + DOM_INTF_SIG + STRING_SIG + TRANSLET_INTF_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + ")V"))); final ArrayList<VariableRefBase> dups = new ArrayList<>(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { VariableRefBase varRef = sort._closureVars.get(i); if (dups.contains(varRef)) continue; final VariableBase var = varRef.getVariable(); il.append(DUP); il.append(var.loadInstruction()); il.append(new PUTFIELD( cpg.addFieldref(sortRecordFactoryClass, var.getEscapedName(), var.getType().toSignature()))); dups.add(varRef); } } }
/** * Compiles code that instantiates a NodeSortRecordFactory object which * will produce NodeSortRecord objects of a specific type. */
Compiles code that instantiates a NodeSortRecordFactory object which will produce NodeSortRecord objects of a specific type
compileSortRecordFactory
{ "repo_name": "wangsongpeng/jdk-src", "path": "src/main/java/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java", "license": "apache-2.0", "size": 30304 }
[ "com.sun.org.apache.bcel.internal.generic.ConstantPoolGen", "com.sun.org.apache.bcel.internal.generic.InstructionList", "com.sun.org.apache.bcel.internal.generic.LocalVariableGen", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util", "java.util.ArrayList", "java.util.Vector" ]
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; import java.util.ArrayList; import java.util.Vector;
import com.sun.org.apache.bcel.internal.generic.*; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; import java.util.*;
[ "com.sun.org", "java.util" ]
com.sun.org; java.util;
2,032,133
@JsonProperty(K_FIELD_SEPARATOR_ESCAPE) public String getFieldSeparatorEscape() { return fieldSeparatorEscape; }
@JsonProperty(K_FIELD_SEPARATOR_ESCAPE) String function() { return fieldSeparatorEscape; }
/** * Returns the escape character for the field separator. * @return the escape character, or {@code null} if it is specified */
Returns the escape character for the field separator
getFieldSeparatorEscape
{ "repo_name": "asakusafw/asakusafw", "path": "info/hive/src/main/java/com/asakusafw/info/hive/DelimitedRowFormatInfo.java", "license": "apache-2.0", "size": 9899 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,240,789
protected Instances calculateCenters(Instances data, Clusterer clusterer, Instances outputFormat) { Instances result; Hashtable<Integer,Instances> clusters; List<Integer> indices; int i; int cluster; boolean error; String errorMsg; Instances subset; double[] values; Instance inst; int[] counts; int maxIndex; result = new Instances(outputFormat, 0); clusters = new Hashtable<>(); // cluster the data error = false; errorMsg = null; for (i = 0; i < data.numInstances(); i++) { try { cluster = clusterer.clusterInstance(data.instance(i)); if (!clusters.containsKey(cluster)) clusters.put(cluster, new Instances(data, 0)); clusters.get(cluster).add(data.instance(i)); } catch (Exception e) { // ignored if (!error) { error = true; errorMsg = e.toString(); } } } // process clusters if (!error) { indices = new ArrayList<>(clusters.keySet()); Collections.sort(indices); for (Integer cl: indices) { subset = clusters.get(cl); inst = new DenseInstance(result.numAttributes()); inst.setValue(0, cl); for (i = 0; i < subset.numAttributes(); i++) { if (subset.attribute(i).isNumeric()) { values = subset.attributeToDoubleArray(i); if (m_UseMedian) inst.setValue(i + 1, StatUtils.median(values)); else inst.setValue(i + 1, StatUtils.mean(values)); } else if (subset.attribute(i).isNominal()) { counts = subset.attributeStats(i).nominalCounts; if (counts.length > 0) { maxIndex = Utils.maxIndex(counts); inst.setValue(i + 1, maxIndex); } } } result.add(inst); } } else { getLogger().severe("At least one error occurred: " + errorMsg); } return result; }
Instances function(Instances data, Clusterer clusterer, Instances outputFormat) { Instances result; Hashtable<Integer,Instances> clusters; List<Integer> indices; int i; int cluster; boolean error; String errorMsg; Instances subset; double[] values; Instance inst; int[] counts; int maxIndex; result = new Instances(outputFormat, 0); clusters = new Hashtable<>(); error = false; errorMsg = null; for (i = 0; i < data.numInstances(); i++) { try { cluster = clusterer.clusterInstance(data.instance(i)); if (!clusters.containsKey(cluster)) clusters.put(cluster, new Instances(data, 0)); clusters.get(cluster).add(data.instance(i)); } catch (Exception e) { if (!error) { error = true; errorMsg = e.toString(); } } } if (!error) { indices = new ArrayList<>(clusters.keySet()); Collections.sort(indices); for (Integer cl: indices) { subset = clusters.get(cl); inst = new DenseInstance(result.numAttributes()); inst.setValue(0, cl); for (i = 0; i < subset.numAttributes(); i++) { if (subset.attribute(i).isNumeric()) { values = subset.attributeToDoubleArray(i); if (m_UseMedian) inst.setValue(i + 1, StatUtils.median(values)); else inst.setValue(i + 1, StatUtils.mean(values)); } else if (subset.attribute(i).isNominal()) { counts = subset.attributeStats(i).nominalCounts; if (counts.length > 0) { maxIndex = Utils.maxIndex(counts); inst.setValue(i + 1, maxIndex); } } } result.add(inst); } } else { getLogger().severe(STR + errorMsg); } return result; }
/** * Calculates the centers. * * @param data the input data used for training the clusterer * @param clusterer the built clusterer * @param outputFormat the format to use for the output * @return the generated output */
Calculates the centers
calculateCenters
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/flow/transformer/wekaclusterer/ClusterCenters.java", "license": "gpl-3.0", "size": 7089 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Hashtable", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,790,551
public static int[] sampleOOBRows(int nrows, float rate, Random sampler, int[] oob) { int oobcnt = 0; // Number of oob rows Arrays.fill(oob, 0); for(int row = 0; row < nrows; row++) { if (sampler.nextFloat() >= rate) { // it is out-of-bag row oob[1+oobcnt++] = row; if (1+oobcnt>=oob.length) oob = Arrays.copyOf(oob, Math.round(1.2f*nrows+0.5f)+2); } } oob[0] = oobcnt; return oob; }
static int[] function(int nrows, float rate, Random sampler, int[] oob) { int oobcnt = 0; Arrays.fill(oob, 0); for(int row = 0; row < nrows; row++) { if (sampler.nextFloat() >= rate) { oob[1+oobcnt++] = row; if (1+oobcnt>=oob.length) oob = Arrays.copyOf(oob, Math.round(1.2f*nrows+0.5f)+2); } } oob[0] = oobcnt; return oob; }
/** * In-situ version of {@link #sampleOOBRows(int, float, Random)}. * * @param oob an initial array to hold sampled rows. Can be internally reallocated. * @return an array containing sampled rows. * * @see #sampleOOBRows(int, float, Random) */
In-situ version of <code>#sampleOOBRows(int, float, Random)</code>
sampleOOBRows
{ "repo_name": "spennihana/h2o-3", "path": "h2o-genmodel/src/main/java/water/util/ModelUtils.java", "license": "apache-2.0", "size": 1887 }
[ "java.util.Arrays", "java.util.Random" ]
import java.util.Arrays; import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
318,925
public void setFilePaths(Path... filePaths) { if (!supportsMultiPaths() && filePaths.length > 1) { throw new UnsupportedOperationException( "Multiple paths are not supported by this FileInputFormat."); } if (filePaths.length < 1) { throw new IllegalArgumentException("At least one file path must be specified."); } if (filePaths.length == 1) { // set for backwards compatibility this.filePath = filePaths[0]; } else { // clear file path in case it had been set before this.filePath = null; } this.filePaths = filePaths; }
void function(Path... filePaths) { if (!supportsMultiPaths() && filePaths.length > 1) { throw new UnsupportedOperationException( STR); } if (filePaths.length < 1) { throw new IllegalArgumentException(STR); } if (filePaths.length == 1) { this.filePath = filePaths[0]; } else { this.filePath = null; } this.filePaths = filePaths; }
/** * Sets multiple paths of files to be read. * * @param filePaths The paths of the files to read. */
Sets multiple paths of files to be read
setFilePaths
{ "repo_name": "aljoscha/flink", "path": "flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java", "license": "apache-2.0", "size": 43342 }
[ "org.apache.flink.core.fs.Path" ]
import org.apache.flink.core.fs.Path;
import org.apache.flink.core.fs.*;
[ "org.apache.flink" ]
org.apache.flink;
1,612,507
List<PokemonDTO> getPokemonsByTrainer(int trainerId);
List<PokemonDTO> getPokemonsByTrainer(int trainerId);
/** * Gets existing Pokemons by Trainer ID * * @param trainerId * @return List of PokemonDTOs */
Gets existing Pokemons by Trainer ID
getPokemonsByTrainer
{ "repo_name": "domhanak/pa165-pkmn-league", "path": "pkmnleague-api/src/main/java/cz/fi/muni/pa165/seminar/pkmnleague/facade/PokemonFacade.java", "license": "mit", "size": 2730 }
[ "cz.fi.muni.pa165.seminar.pkmnleague.dto.PokemonDTO", "java.util.List" ]
import cz.fi.muni.pa165.seminar.pkmnleague.dto.PokemonDTO; import java.util.List;
import cz.fi.muni.pa165.seminar.pkmnleague.dto.*; import java.util.*;
[ "cz.fi.muni", "java.util" ]
cz.fi.muni; java.util;
2,186,019
public void updateLogo(Logo logo) { if (logo == null) { if (maybeShowDefaultLogo()) return; mLogo = null; invalidate(); return; } String contentDescription = TextUtils.isEmpty(logo.altText) ? null : getResources().getString(R.string.accessibility_google_doodle, logo.altText); updateLogo( logo.image, contentDescription, false, isLogoClickable(logo)); }
void function(Logo logo) { if (logo == null) { if (maybeShowDefaultLogo()) return; mLogo = null; invalidate(); return; } String contentDescription = TextUtils.isEmpty(logo.altText) ? null : getResources().getString(R.string.accessibility_google_doodle, logo.altText); updateLogo( logo.image, contentDescription, false, isLogoClickable(logo)); }
/** * Fades in a new logo over the current logo. * * @param logo The new logo to fade in. */
Fades in a new logo over the current logo
updateLogo
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java", "license": "bsd-3-clause", "size": 15340 }
[ "android.text.TextUtils", "org.chromium.chrome.browser.ntp.LogoBridge" ]
import android.text.TextUtils; import org.chromium.chrome.browser.ntp.LogoBridge;
import android.text.*; import org.chromium.chrome.browser.ntp.*;
[ "android.text", "org.chromium.chrome" ]
android.text; org.chromium.chrome;
1,934,426
public OutputStream getOutputStream() { return this.os; }
OutputStream function() { return this.os; }
/** * Returns the outputstream * * @return the outputstream */
Returns the outputstream
getOutputStream
{ "repo_name": "pellcorp/fop", "path": "src/java/org/apache/fop/afp/modca/StreamedResourceGroup.java", "license": "apache-2.0", "size": 2646 }
[ "java.io.OutputStream" ]
import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
689,544
@Metadata(label = "security", secret = true) public void setOauthTokenUrl(String oauthTokenUrl) { configuration.setOauthTokenUrl(oauthTokenUrl); }
@Metadata(label = STR, secret = true) void function(String oauthTokenUrl) { configuration.setOauthTokenUrl(oauthTokenUrl); }
/** * OAuth token Url */
OAuth token Url
setOauthTokenUrl
{ "repo_name": "kevinearls/camel", "path": "components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java", "license": "apache-2.0", "size": 8815 }
[ "org.apache.camel.spi.Metadata" ]
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
33,763
public static float convertPixelsToDp(float px, Context context) { Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float dp = px / (metrics.densityDpi / 160f); return dp; }
static float function(float px, Context context) { Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float dp = px / (metrics.densityDpi / 160f); return dp; }
/** * This method converts device specific pixels to density independent pixels. * * @param px A value in px (pixels) unit. Which we need to convert into db * @param context Context to get resources and device specific display metrics * @return A float value to represent dp equivalent to px value */
This method converts device specific pixels to density independent pixels
convertPixelsToDp
{ "repo_name": "OleksandrKucherenko/spacefish", "path": "_libs/artfulbits-sdk/src/main/com/artfulbits/utils/Use.java", "license": "mit", "size": 46048 }
[ "android.content.Context", "android.content.res.Resources", "android.util.DisplayMetrics" ]
import android.content.Context; import android.content.res.Resources; import android.util.DisplayMetrics;
import android.content.*; import android.content.res.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
154,603
public static YamlConfiguration loadConfiguration(Reader reader) { Validate.notNull(reader, "Stream cannot be null"); YamlConfiguration config = new YamlConfiguration(); try { config.load(reader); } catch (IOException ex) { Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); } catch (InvalidConfigurationException ex) { Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); } return config; }
static YamlConfiguration function(Reader reader) { Validate.notNull(reader, STR); YamlConfiguration config = new YamlConfiguration(); try { config.load(reader); } catch (IOException ex) { Bukkit.getLogger().log(Level.SEVERE, STR, ex); } catch (InvalidConfigurationException ex) { Bukkit.getLogger().log(Level.SEVERE, STR, ex); } return config; }
/** * Creates a new {@link YamlConfiguration}, loading from the given reader. * <p> * Any errors loading the Configuration will be logged and then ignored. * If the specified input is not a valid config, a blank config will be * returned. * * @param reader input * @return resulting configuration * @throws IllegalArgumentException Thrown if stream is null */
Creates a new <code>YamlConfiguration</code>, loading from the given reader. Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned
loadConfiguration
{ "repo_name": "GlowstoneMC/Glowkit-Legacy", "path": "src/main/java/org/bukkit/configuration/file/YamlConfiguration.java", "license": "gpl-3.0", "size": 8259 }
[ "java.io.IOException", "java.io.Reader", "java.util.logging.Level", "org.apache.commons.lang.Validate", "org.bukkit.Bukkit", "org.bukkit.configuration.InvalidConfigurationException" ]
import java.io.IOException; import java.io.Reader; import java.util.logging.Level; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException;
import java.io.*; import java.util.logging.*; import org.apache.commons.lang.*; import org.bukkit.*; import org.bukkit.configuration.*;
[ "java.io", "java.util", "org.apache.commons", "org.bukkit", "org.bukkit.configuration" ]
java.io; java.util; org.apache.commons; org.bukkit; org.bukkit.configuration;
573,416
public static Map<String, Collection<ClusterNode>> neighborhood(Iterable<ClusterNode> nodes) { Map<String, Collection<ClusterNode>> map = new HashMap<>(); for (ClusterNode n : nodes) { String macs = n.attribute(ATTR_MACS); assert macs != null : "Missing MACs attribute: " + n; Collection<ClusterNode> neighbors = map.get(macs); if (neighbors == null) map.put(macs, neighbors = new ArrayList<>(2)); neighbors.add(n); } return map; }
static Map<String, Collection<ClusterNode>> function(Iterable<ClusterNode> nodes) { Map<String, Collection<ClusterNode>> map = new HashMap<>(); for (ClusterNode n : nodes) { String macs = n.attribute(ATTR_MACS); assert macs != null : STR + n; Collection<ClusterNode> neighbors = map.get(macs); if (neighbors == null) map.put(macs, neighbors = new ArrayList<>(2)); neighbors.add(n); } return map; }
/** * Groups given nodes by the node's physical computer (host). * <p> * Detection of the same physical computer (host) is based on comparing set of network interface MACs. * If two nodes have the same set of MACs, Ignite considers these nodes running on the same * physical computer. * * @param nodes Nodes. * @return Collection of projections where each projection represents all nodes (in this projection) * from a single physical computer. Result collection can be empty if this projection is empty. */
Groups given nodes by the node's physical computer (host). Detection of the same physical computer (host) is based on comparing set of network interface MACs. If two nodes have the same set of MACs, Ignite considers these nodes running on the same physical computer
neighborhood
{ "repo_name": "apache/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 387878 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.HashMap", "java.util.Map", "org.apache.ignite.cluster.ClusterNode" ]
import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.apache.ignite.cluster.ClusterNode;
import java.util.*; import org.apache.ignite.cluster.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,234,869
private static List<ProfileThreadSnapshotRecord> querySnapshot(String segmentId, IProfileThreadSnapshotQueryDAO threadSnapshotQueryDAO, ProfiledBasicInfo.SequenceRange sequenceRange) throws IOException { for (int i = 1; i <= QUERY_PROFILE_SNAPSHOT_RETRY_COUNT; i++) { try { return threadSnapshotQueryDAO.queryRecords(segmentId, sequenceRange.getMin(), sequenceRange.getMax()); } catch (IOException e) { if (i == QUERY_PROFILE_SNAPSHOT_RETRY_COUNT) { throw e; } } } return null; }
static List<ProfileThreadSnapshotRecord> function(String segmentId, IProfileThreadSnapshotQueryDAO threadSnapshotQueryDAO, ProfiledBasicInfo.SequenceRange sequenceRange) throws IOException { for (int i = 1; i <= QUERY_PROFILE_SNAPSHOT_RETRY_COUNT; i++) { try { return threadSnapshotQueryDAO.queryRecords(segmentId, sequenceRange.getMin(), sequenceRange.getMax()); } catch (IOException e) { if (i == QUERY_PROFILE_SNAPSHOT_RETRY_COUNT) { throw e; } } } return null; }
/** * query snapshots with retry mechanism */
query snapshots with retry mechanism
querySnapshot
{ "repo_name": "ascrutae/sky-walking", "path": "oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/main/java/org/apache/skywalking/oap/server/tool/profile/exporter/ProfileSnapshotDumper.java", "license": "apache-2.0", "size": 5162 }
[ "java.io.IOException", "java.util.List", "org.apache.skywalking.oap.server.core.profile.ProfileThreadSnapshotRecord", "org.apache.skywalking.oap.server.core.storage.profile.IProfileThreadSnapshotQueryDAO" ]
import java.io.IOException; import java.util.List; import org.apache.skywalking.oap.server.core.profile.ProfileThreadSnapshotRecord; import org.apache.skywalking.oap.server.core.storage.profile.IProfileThreadSnapshotQueryDAO;
import java.io.*; import java.util.*; import org.apache.skywalking.oap.server.core.profile.*; import org.apache.skywalking.oap.server.core.storage.profile.*;
[ "java.io", "java.util", "org.apache.skywalking" ]
java.io; java.util; org.apache.skywalking;
907,379
private ArrayList<TrafficLight> stringListToTrafficLightList(ArrayList<String> stringList) { ArrayList<TrafficLight> trafficLightList = new ArrayList<TrafficLight>(10); for(String string : stringList) { TrafficLight trafficLight = TrafficLightCenter.getTrafficLightByName(string); if(trafficLight != null) trafficLightList.add(trafficLight); } return trafficLightList; }
ArrayList<TrafficLight> function(ArrayList<String> stringList) { ArrayList<TrafficLight> trafficLightList = new ArrayList<TrafficLight>(10); for(String string : stringList) { TrafficLight trafficLight = TrafficLightCenter.getTrafficLightByName(string); if(trafficLight != null) trafficLightList.add(trafficLight); } return trafficLightList; }
/** * This method converts a string list of traffic light names into an object list * containing the corresponding traffic lights by iteratively looking up traffic * light objects by name. * * @param stringList * string list containing names of traffic lights to look up * * @return * traffic light list containing all traffic lights as specified in input list */
This method converts a string list of traffic light names into an object list containing the corresponding traffic lights by iteratively looking up traffic light objects by name
stringListToTrafficLightList
{ "repo_name": "Karasion/Capstone2015-PurpleOcean2", "path": "OpenDS3.0/src/eu/opends/environment/TrafficLight.java", "license": "gpl-3.0", "size": 13793 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
253,675
public static ims.core.admin.domain.objects.EmergencyAttendance extractEmergencyAttendance(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EmergencyAttendanceForEDDischargeVo valueObject) { return extractEmergencyAttendance(domainFactory, valueObject, new HashMap()); }
static ims.core.admin.domain.objects.EmergencyAttendance function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EmergencyAttendanceForEDDischargeVo valueObject) { return extractEmergencyAttendance(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractEmergencyAttendance
{ "repo_name": "IMS-MAXIMS/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/EmergencyAttendanceForEDDischargeVoAssembler.java", "license": "agpl-3.0", "size": 19870 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
457,535
protected SystemConfigurationType getConfiguration() throws FaultMessage { return getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value()); }
SystemConfigurationType function() throws FaultMessage { return getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value()); }
/** * Retrieves and returns actual system configuration * */
Retrieves and returns actual system configuration
getConfiguration
{ "repo_name": "Pardus-Engerek/engerek", "path": "testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java", "license": "apache-2.0", "size": 34670 }
[ "com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType", "com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType", "com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage" ]
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType; import com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import com.evolveum.midpoint.xml.ns._public.common.fault_3.*;
[ "com.evolveum.midpoint" ]
com.evolveum.midpoint;
2,033,527
public List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>> getRelationshipDetectedBy(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>>> retType = new TypeReference<List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>>>() {}; List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_DetectedBy", args, retType, true, false); return res.get(0); }
List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>>> retType = new TypeReference<List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>>>() {}; List<List<Tuple3<FieldsAssociation, FieldsDetectedWithMethod, FieldsAssociationDetectionType>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); }
/** * <p>Original spec-file function name: get_relationship_DetectedBy</p> * <pre> * </pre> * @param ids instance of list of String * @param fromFields instance of list of String * @param relFields instance of list of String * @param toFields instance of list of String * @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsAssociation FieldsAssociation} (original type "fields_Association"), type {@link us.kbase.cdmientityapi.FieldsDetectedWithMethod FieldsDetectedWithMethod} (original type "fields_DetectedWithMethod"), type {@link us.kbase.cdmientityapi.FieldsAssociationDetectionType FieldsAssociationDetectionType} (original type "fields_AssociationDetectionType") * @throws IOException if an IO exception occurs * @throws JsonClientException if a JSON RPC exception occurs */
Original spec-file function name: get_relationship_DetectedBy <code> </code>
getRelationshipDetectedBy
{ "repo_name": "kbase/trees", "path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java", "license": "mit", "size": 869221 }
[ "com.fasterxml.jackson.core.type.TypeReference", "java.io.IOException", "java.util.ArrayList", "java.util.List", "us.kbase.common.service.JsonClientException", "us.kbase.common.service.Tuple3" ]
import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3;
import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*;
[ "com.fasterxml.jackson", "java.io", "java.util", "us.kbase.common" ]
com.fasterxml.jackson; java.io; java.util; us.kbase.common;
1,967,559
public void setFixedDomainAxisSpace(AxisSpace space) { setFixedDomainAxisSpace(space, true); }
void function(AxisSpace space) { setFixedDomainAxisSpace(space, true); }
/** * Sets the fixed domain axis space and sends a {@link PlotChangeEvent} to * all registered listeners. * * @param space the space (<code>null</code> permitted). * * @see #getFixedDomainAxisSpace() */
Sets the fixed domain axis space and sends a <code>PlotChangeEvent</code> to all registered listeners
setFixedDomainAxisSpace
{ "repo_name": "Epsilon2/Memetic-Algorithm-for-TSP", "path": "jfreechart-1.0.16/source/org/jfree/chart/plot/XYPlot.java", "license": "mit", "size": 199979 }
[ "org.jfree.chart.axis.AxisSpace" ]
import org.jfree.chart.axis.AxisSpace;
import org.jfree.chart.axis.*;
[ "org.jfree.chart" ]
org.jfree.chart;
2,198,172
@Test public void setNoTtlForDirectoryWithTtl() throws Exception { CreateDirectoryOptions createDirectoryOptions = CreateDirectoryOptions.defaults().setRecursive(true).setTtl(0); mFileSystemMaster.createDirectory(NESTED_URI, createDirectoryOptions); // After setting TTL to NO_TTL, the original TTL will be removed, and the file will not be // deleted during next TTL check. mFileSystemMaster.setAttribute(NESTED_URI, SetAttributeOptions.defaults().setTtl(Constants.NO_TTL)); HeartbeatScheduler.execute(HeartbeatContext.MASTER_TTL_CHECK); Assert.assertEquals(NESTED_URI.getName(), mFileSystemMaster.getFileInfo(NESTED_URI, GET_STATUS_OPTIONS).getName()); }
void function() throws Exception { CreateDirectoryOptions createDirectoryOptions = CreateDirectoryOptions.defaults().setRecursive(true).setTtl(0); mFileSystemMaster.createDirectory(NESTED_URI, createDirectoryOptions); mFileSystemMaster.setAttribute(NESTED_URI, SetAttributeOptions.defaults().setTtl(Constants.NO_TTL)); HeartbeatScheduler.execute(HeartbeatContext.MASTER_TTL_CHECK); Assert.assertEquals(NESTED_URI.getName(), mFileSystemMaster.getFileInfo(NESTED_URI, GET_STATUS_OPTIONS).getName()); }
/** * Tests that the original TTL is removed after setting it to {@link Constants#NO_TTL} for * a directory. */
Tests that the original TTL is removed after setting it to <code>Constants#NO_TTL</code> for a directory
setNoTtlForDirectoryWithTtl
{ "repo_name": "Reidddddd/mo-alluxio", "path": "core/server/master/src/test/java/alluxio/master/file/FileSystemMasterTest.java", "license": "apache-2.0", "size": 81136 }
[ "java.net.URI", "org.junit.Assert" ]
import java.net.URI; import org.junit.Assert;
import java.net.*; import org.junit.*;
[ "java.net", "org.junit" ]
java.net; org.junit;
253,357
EClass getReviewOfSystemsSection();
EClass getReviewOfSystemsSection();
/** * Returns the meta object for class '{@link org.openhealthtools.mdht.uml.cda.hitsp.ReviewOfSystemsSection <em>Review Of Systems Section</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Review Of Systems Section</em>'. * @see org.openhealthtools.mdht.uml.cda.hitsp.ReviewOfSystemsSection * @generated */
Returns the meta object for class '<code>org.openhealthtools.mdht.uml.cda.hitsp.ReviewOfSystemsSection Review Of Systems Section</code>'.
getReviewOfSystemsSection
{ "repo_name": "drbgfc/mdht", "path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.hitsp/src/org/openhealthtools/mdht/uml/cda/hitsp/HITSPPackage.java", "license": "epl-1.0", "size": 366422 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
271,904
public void stageInFile2FileSystem(Job job) { List<FileItem> fList = job.getFileList(); for (FileItem file : fList) { switch (ReplicaCatalog.getFileSystem()) { case LOCAL: ReplicaCatalog.addFileToStorage(file.getName(), this.getName()); //ClusterStorage storage = (ClusterStorage) getStorageList().get(0); //storage.addFile(file); break; case SHARED: ReplicaCatalog.addFileToStorage(file.getName(), this.getName()); break; default: break; } } }
void function(Job job) { List<FileItem> fList = job.getFileList(); for (FileItem file : fList) { switch (ReplicaCatalog.getFileSystem()) { case LOCAL: ReplicaCatalog.addFileToStorage(file.getName(), this.getName()); break; case SHARED: ReplicaCatalog.addFileToStorage(file.getName(), this.getName()); break; default: break; } } }
/** * Stage in files for a stage-in job. For a local file system (such as * condor-io) add files to the local storage; For a shared file system (such * as NFS) add files to the shared storage * * @param cl, the job * @pre $none * @post $none */
Stage in files for a stage-in job. For a local file system (such as condor-io) add files to the local storage; For a shared file system (such as NFS) add files to the shared storage
stageInFile2FileSystem
{ "repo_name": "hkchen1983/ComplexCloudSim", "path": "sources/org/workflowsim/WorkflowDatacenter.java", "license": "lgpl-3.0", "size": 16083 }
[ "java.util.List", "org.workflowsim.utils.ReplicaCatalog" ]
import java.util.List; import org.workflowsim.utils.ReplicaCatalog;
import java.util.*; import org.workflowsim.utils.*;
[ "java.util", "org.workflowsim.utils" ]
java.util; org.workflowsim.utils;
1,629,289
public Observable<ServiceResponse<ImagePrediction>> classifyImageWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (publishedName == null) { throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final String application = classifyImageWithNoStoreOptionalParameter != null ? classifyImageWithNoStoreOptionalParameter.application() : null; return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application); }
Observable<ServiceResponse<ImagePrediction>> function(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException(STR); } if (projectId == null) { throw new IllegalArgumentException(STR); } if (publishedName == null) { throw new IllegalArgumentException(STR); } if (imageData == null) { throw new IllegalArgumentException(STR); } if (this.client.apiKey() == null) { throw new IllegalArgumentException(STR); } final String application = classifyImageWithNoStoreOptionalParameter != null ? classifyImageWithNoStoreOptionalParameter.application() : null; return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application); }
/** * Classify an image without saving the result. * * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */
Classify an image without saving the result
classifyImageWithNoStoreWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java", "license": "mit", "size": 89979 }
[ "com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageWithNoStoreOptionalParameter", "com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageWithNoStoreOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,859,896
@Test public final void testGetJobs() throws IOException, ClassNotFoundException { final Map<LocalDate, List<Job>> map = Calendar.getInstance().getJobs(); final List<Job> list = map.get(LocalDate.parse("2015-08-19")); final Job job = list.get(0); try { job.addVolunteer(tester, 'l'); } catch (final BusinessRuleException theE) { fail(theE.toString()); } final List<Job> jobs = tester.getJobs(); assertTrue("Volunteer wasn't added to the job or get jobs didn't get the job.", jobs.contains(job)); }
final void function() throws IOException, ClassNotFoundException { final Map<LocalDate, List<Job>> map = Calendar.getInstance().getJobs(); final List<Job> list = map.get(LocalDate.parse(STR)); final Job job = list.get(0); try { job.addVolunteer(tester, 'l'); } catch (final BusinessRuleException theE) { fail(theE.toString()); } final List<Job> jobs = tester.getJobs(); assertTrue(STR, jobs.contains(job)); }
/** * Test method for {@link model.Volunteer#getJobs()}. * * @throws IOException if the file isn't found * @throws ClassNotFoundException */
Test method for <code>model.Volunteer#getJobs()</code>
testGetJobs
{ "repo_name": "Grantapher/group3factorial-project", "path": "src/tests/VolunteerTest.java", "license": "gpl-2.0", "size": 3100 }
[ "java.io.IOException", "java.time.LocalDate", "java.util.List", "java.util.Map", "org.junit.Assert" ]
import java.io.IOException; import java.time.LocalDate; import java.util.List; import java.util.Map; import org.junit.Assert;
import java.io.*; import java.time.*; import java.util.*; import org.junit.*;
[ "java.io", "java.time", "java.util", "org.junit" ]
java.io; java.time; java.util; org.junit;
2,263,562
public int getAusgleichsMandate(Bundesland bl) { int anzahl = 0; final Set<Bundesland> set = this.ausgleichsMandate.keySet(); final Iterator<Bundesland> i = set.iterator(); while (i.hasNext()) { final Bundesland key = i.next(); if (key.equals(bl)) { anzahl += this.ausgleichsMandate.get(key); } } return anzahl; }
int function(Bundesland bl) { int anzahl = 0; final Set<Bundesland> set = this.ausgleichsMandate.keySet(); final Iterator<Bundesland> i = set.iterator(); while (i.hasNext()) { final Bundesland key = i.next(); if (key.equals(bl)) { anzahl += this.ausgleichsMandate.get(key); } } return anzahl; }
/** * Gibt die Anzahl der Ausgleichsmandate pro Bundesland zurueck. * * @param bl * das ausgewaehlte Bundesland. * @return die Anzahl der Ausgleichsmandate. */
Gibt die Anzahl der Ausgleichsmandate pro Bundesland zurueck
getAusgleichsMandate
{ "repo_name": "smolvo/OpenBundestagswahl", "path": "Implementierung/Mandatsrechner/src/main/java/model/Partei.java", "license": "gpl-3.0", "size": 18784 }
[ "java.util.Iterator", "java.util.Set" ]
import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
798,089
public ServizioComponent getServizio() { return this.servizio; }
ServizioComponent function() { return this.servizio; }
/** * Restituisce il Servizio selezionato */
Restituisce il Servizio selezionato
getServizio
{ "repo_name": "SpeearthTeam/Speearth", "path": "src/com/speearth/view/eventi/EventoSelezionaServizio.java", "license": "cc0-1.0", "size": 974 }
[ "com.speearth.model.core.ServizioComponent" ]
import com.speearth.model.core.ServizioComponent;
import com.speearth.model.core.*;
[ "com.speearth.model" ]
com.speearth.model;
2,421,050
@VisibleForTesting public static List<Edge> getEdges(QueryPlan plan, Index index) { Map<String, Pair<SelectOperator, org.apache.hadoop.hive.ql.metadata.Table>> finalSelOps = index.getFinalSelectOps(); Map<String, Vertex> vertexCache = new LinkedHashMap<String, Vertex>(); List<Edge> edges = new ArrayList<Edge>(); for (Pair<SelectOperator, org.apache.hadoop.hive.ql.metadata.Table> pair: finalSelOps.values()) { List<FieldSchema> fieldSchemas = plan.getResultSchema().getFieldSchemas(); SelectOperator finalSelOp = pair.getLeft(); org.apache.hadoop.hive.ql.metadata.Table t = pair.getRight(); String destTableName = null; List<String> colNames = null; if (t != null) { destTableName = t.getFullyQualifiedName(); fieldSchemas = t.getCols(); } else { // Based on the plan outputs, find out the target table name and column names. for (WriteEntity output : plan.getOutputs()) { Entity.Type entityType = output.getType(); if (entityType == Entity.Type.TABLE || entityType == Entity.Type.PARTITION) { t = output.getTable(); destTableName = t.getFullyQualifiedName(); List<FieldSchema> cols = t.getCols(); if (cols != null && !cols.isEmpty()) { colNames = Utilities.getColumnNamesFromFieldSchema(cols); } break; } } } Map<ColumnInfo, Dependency> colMap = index.getDependencies(finalSelOp); List<Dependency> dependencies = colMap != null ? Lists.newArrayList(colMap.values()) : null; int fields = fieldSchemas.size(); if (t != null && colMap != null && fields < colMap.size()) { // Dynamic partition keys should be added to field schemas. List<FieldSchema> partitionKeys = t.getPartitionKeys(); int dynamicKeyCount = colMap.size() - fields; int keyOffset = partitionKeys.size() - dynamicKeyCount; if (keyOffset >= 0) { fields += dynamicKeyCount; for (int i = 0; i < dynamicKeyCount; i++) { FieldSchema field = partitionKeys.get(keyOffset + i); fieldSchemas.add(field); if (colNames != null) { colNames.add(field.getName()); } } } } if (dependencies == null || dependencies.size() != fields) { log("Result schema has " + fields + " fields, but we don't get as many dependencies"); } else { // Go through each target column, generate the lineage edges. Set<Vertex> targets = new LinkedHashSet<Vertex>(); for (int i = 0; i < fields; i++) { Vertex target = getOrCreateVertex(vertexCache, getTargetFieldName(i, destTableName, colNames, fieldSchemas), Vertex.Type.COLUMN); targets.add(target); Dependency dep = dependencies.get(i); addEdge(vertexCache, edges, dep.getBaseCols(), target, dep.getExpr(), Edge.Type.PROJECTION); } Set<Predicate> conds = index.getPredicates(finalSelOp); if (conds != null && !conds.isEmpty()) { for (Predicate cond: conds) { addEdge(vertexCache, edges, cond.getBaseCols(), new LinkedHashSet<Vertex>(targets), cond.getExpr(), Edge.Type.PREDICATE); } } } } return edges; }
static List<Edge> function(QueryPlan plan, Index index) { Map<String, Pair<SelectOperator, org.apache.hadoop.hive.ql.metadata.Table>> finalSelOps = index.getFinalSelectOps(); Map<String, Vertex> vertexCache = new LinkedHashMap<String, Vertex>(); List<Edge> edges = new ArrayList<Edge>(); for (Pair<SelectOperator, org.apache.hadoop.hive.ql.metadata.Table> pair: finalSelOps.values()) { List<FieldSchema> fieldSchemas = plan.getResultSchema().getFieldSchemas(); SelectOperator finalSelOp = pair.getLeft(); org.apache.hadoop.hive.ql.metadata.Table t = pair.getRight(); String destTableName = null; List<String> colNames = null; if (t != null) { destTableName = t.getFullyQualifiedName(); fieldSchemas = t.getCols(); } else { for (WriteEntity output : plan.getOutputs()) { Entity.Type entityType = output.getType(); if (entityType == Entity.Type.TABLE entityType == Entity.Type.PARTITION) { t = output.getTable(); destTableName = t.getFullyQualifiedName(); List<FieldSchema> cols = t.getCols(); if (cols != null && !cols.isEmpty()) { colNames = Utilities.getColumnNamesFromFieldSchema(cols); } break; } } } Map<ColumnInfo, Dependency> colMap = index.getDependencies(finalSelOp); List<Dependency> dependencies = colMap != null ? Lists.newArrayList(colMap.values()) : null; int fields = fieldSchemas.size(); if (t != null && colMap != null && fields < colMap.size()) { List<FieldSchema> partitionKeys = t.getPartitionKeys(); int dynamicKeyCount = colMap.size() - fields; int keyOffset = partitionKeys.size() - dynamicKeyCount; if (keyOffset >= 0) { fields += dynamicKeyCount; for (int i = 0; i < dynamicKeyCount; i++) { FieldSchema field = partitionKeys.get(keyOffset + i); fieldSchemas.add(field); if (colNames != null) { colNames.add(field.getName()); } } } } if (dependencies == null dependencies.size() != fields) { log(STR + fields + STR); } else { Set<Vertex> targets = new LinkedHashSet<Vertex>(); for (int i = 0; i < fields; i++) { Vertex target = getOrCreateVertex(vertexCache, getTargetFieldName(i, destTableName, colNames, fieldSchemas), Vertex.Type.COLUMN); targets.add(target); Dependency dep = dependencies.get(i); addEdge(vertexCache, edges, dep.getBaseCols(), target, dep.getExpr(), Edge.Type.PROJECTION); } Set<Predicate> conds = index.getPredicates(finalSelOp); if (conds != null && !conds.isEmpty()) { for (Predicate cond: conds) { addEdge(vertexCache, edges, cond.getBaseCols(), new LinkedHashSet<Vertex>(targets), cond.getExpr(), Edge.Type.PREDICATE); } } } } return edges; }
/** * Based on the final select operator, find out all the target columns. * For each target column, find out its sources based on the dependency index. */
Based on the final select operator, find out all the target columns. For each target column, find out its sources based on the dependency index
getEdges
{ "repo_name": "vineetgarg02/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/hooks/LineageLogger.java", "license": "apache-2.0", "size": 17172 }
[ "com.google.common.collect.Lists", "java.util.ArrayList", "java.util.LinkedHashMap", "java.util.LinkedHashSet", "java.util.List", "java.util.Map", "java.util.Set", "org.apache.commons.lang3.tuple.Pair", "org.apache.hadoop.hive.metastore.api.FieldSchema", "org.apache.hadoop.hive.metastore.api.Table", "org.apache.hadoop.hive.ql.QueryPlan", "org.apache.hadoop.hive.ql.exec.ColumnInfo", "org.apache.hadoop.hive.ql.exec.SelectOperator", "org.apache.hadoop.hive.ql.exec.Utilities", "org.apache.hadoop.hive.ql.hooks.LineageInfo", "org.apache.hadoop.hive.ql.optimizer.lineage.LineageCtx" ]
import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.tuple.Pair; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.ql.QueryPlan; import org.apache.hadoop.hive.ql.exec.ColumnInfo; import org.apache.hadoop.hive.ql.exec.SelectOperator; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.hooks.LineageInfo; import org.apache.hadoop.hive.ql.optimizer.lineage.LineageCtx;
import com.google.common.collect.*; import java.util.*; import org.apache.commons.lang3.tuple.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.ql.*; import org.apache.hadoop.hive.ql.exec.*; import org.apache.hadoop.hive.ql.hooks.*; import org.apache.hadoop.hive.ql.optimizer.lineage.*;
[ "com.google.common", "java.util", "org.apache.commons", "org.apache.hadoop" ]
com.google.common; java.util; org.apache.commons; org.apache.hadoop;
385,571
DecodeResult decodeRequest(Channel ch, SessionProtocol sessionProtocol, String hostname, String path, String mappedPath, ByteBuf in, Object originalRequest, Promise<Object> promise) throws Exception;
DecodeResult decodeRequest(Channel ch, SessionProtocol sessionProtocol, String hostname, String path, String mappedPath, ByteBuf in, Object originalRequest, Promise<Object> promise) throws Exception;
/** * Decodes an invocation request. */
Decodes an invocation request
decodeRequest
{ "repo_name": "brant-hwang/armeria", "path": "src/main/java/com/linecorp/armeria/server/ServiceCodec.java", "license": "apache-2.0", "size": 9224 }
[ "com.linecorp.armeria.common.SessionProtocol", "io.netty.buffer.ByteBuf", "io.netty.channel.Channel", "io.netty.util.concurrent.Promise" ]
import com.linecorp.armeria.common.SessionProtocol; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.util.concurrent.Promise;
import com.linecorp.armeria.common.*; import io.netty.buffer.*; import io.netty.channel.*; import io.netty.util.concurrent.*;
[ "com.linecorp.armeria", "io.netty.buffer", "io.netty.channel", "io.netty.util" ]
com.linecorp.armeria; io.netty.buffer; io.netty.channel; io.netty.util;
264,894
public void addQualifier(XMPNode qualNode) throws XMPException { assertQualifierNotExisting(qualNode.getName()); qualNode.setParent(this); qualNode.getOptions().setQualifier(true); getOptions().setHasQualifiers(true); // contraints if (qualNode.isLanguageNode()) { // "xml:lang" is always first and the option "hasLanguage" is set options.setHasLanguage(true); getQualifier().add(0, qualNode); } else if (qualNode.isTypeNode()) { // "rdf:type" must be first or second after "xml:lang" and the option "hasType" is set options.setHasType(true); getQualifier().add( !options.getHasLanguage() ? 0 : 1, qualNode); } else { // other qualifiers are appended getQualifier().add(qualNode); } }
void function(XMPNode qualNode) throws XMPException { assertQualifierNotExisting(qualNode.getName()); qualNode.setParent(this); qualNode.getOptions().setQualifier(true); getOptions().setHasQualifiers(true); if (qualNode.isLanguageNode()) { options.setHasLanguage(true); getQualifier().add(0, qualNode); } else if (qualNode.isTypeNode()) { options.setHasType(true); getQualifier().add( !options.getHasLanguage() ? 0 : 1, qualNode); } else { getQualifier().add(qualNode); } }
/** * Appends a qualifier to the qualifier list and sets respective options. * @param qualNode a qualifier node. * @throws XMPException */
Appends a qualifier to the qualifier list and sets respective options
addQualifier
{ "repo_name": "kesenhoo/Camera2", "path": "src/com/adobe/xmp/impl/XMPNode.java", "license": "apache-2.0", "size": 19696 }
[ "com.adobe.xmp.XMPException" ]
import com.adobe.xmp.XMPException;
import com.adobe.xmp.*;
[ "com.adobe.xmp" ]
com.adobe.xmp;
2,494,832
public List orFilter(int[] filterFlags, String[] filterPatterns, POS pos, int maxResults) { if (filterFlags.length != filterPatterns.length) throw new RiWordNetError(ERROR_FLAGS_AND_PATTERNS); RiFilter[] filters = new RiFilter[filterFlags.length]; for (int i = 0; i < filterPatterns.length; i++) filters[i] = RiFilter.create(filterFlags[i], filterPatterns[i]); return orFilter(filters, pos, maxResults); }
List function(int[] filterFlags, String[] filterPatterns, POS pos, int maxResults) { if (filterFlags.length != filterPatterns.length) throw new RiWordNetError(ERROR_FLAGS_AND_PATTERNS); RiFilter[] filters = new RiFilter[filterFlags.length]; for (int i = 0; i < filterPatterns.length; i++) filters[i] = RiFilter.create(filterFlags[i], filterPatterns[i]); return orFilter(filters, pos, maxResults); }
/** * Runs the specified <code>filters</code> over the * <code>pos</code> accepting if ANY of the filters accept, * returning at most <code>maxResults</code> instances * @see RiFilter#accept(String) */
Runs the specified <code>filters</code> over the <code>pos</code> accepting if ANY of the filters accept, returning at most <code>maxResults</code> instances
orFilter
{ "repo_name": "cqx931/RiTa", "path": "java/rita/wordnet/WordnetFilters.java", "license": "gpl-3.0", "size": 6927 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,698,310
private boolean delBlockFromDisk(File blockFile, File metaFile, Block b) { if (blockFile == null) { LOG.warn("No file exists for block: " + b); return true; } if (!blockFile.delete()) { LOG.warn("Not able to delete the block file: " + blockFile); return false; } else { // remove the meta file if (metaFile != null && !metaFile.delete()) { LOG.warn("Not able to delete the meta block file: " + metaFile); return false; } } return true; }
boolean function(File blockFile, File metaFile, Block b) { if (blockFile == null) { LOG.warn(STR + b); return true; } if (!blockFile.delete()) { LOG.warn(STR + blockFile); return false; } else { if (metaFile != null && !metaFile.delete()) { LOG.warn(STR + metaFile); return false; } } return true; }
/** * Remove a block from disk * @param blockFile block file * @param metaFile block meta file * @param b a block * @return true if on-disk files are deleted; false otherwise */
Remove a block from disk
delBlockFromDisk
{ "repo_name": "hash-X/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java", "license": "apache-2.0", "size": 114698 }
[ "java.io.File", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.io.File; import org.apache.hadoop.hdfs.protocol.Block;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,400,432
public void addPort(Port port) { boolean newPort = ports.add(port.number().toLong()); boolean isMaster = context.mastershipService().isLocalMaster(device.id()); if (newPort && isMaster) { log.debug("Sending initial probe to port {}@{}", port.number().toLong(), device.id()); sendProbes(port.number().toLong()); } }
void function(Port port) { boolean newPort = ports.add(port.number().toLong()); boolean isMaster = context.mastershipService().isLocalMaster(device.id()); if (newPort && isMaster) { log.debug(STR, port.number().toLong(), device.id()); sendProbes(port.number().toLong()); } }
/** * Add physical port to discovery process. * Send out initial LLDP and label it as slow port. * * @param port the port */
Add physical port to discovery process. Send out initial LLDP and label it as slow port
addPort
{ "repo_name": "Phaneendra-Huawei/demo", "path": "providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java", "license": "apache-2.0", "size": 9316 }
[ "org.onosproject.net.Port" ]
import org.onosproject.net.Port;
import org.onosproject.net.*;
[ "org.onosproject.net" ]
org.onosproject.net;
1,468,466
public static void writeUint64(OutputStream out, long val) throws IOException { if (val > 0x7FFFFFFFFFFFFFFFL || val < 0) { throw new IOException("value is too large (wrapped sign)!"); } long v = val & 0x7FFFFFFFFFFFFFFFL; byte[] b = new byte[8]; b[0] = (byte) (v & 0xFF); b[1] = (byte) ((v >> 8) & 0xFF); b[2] = (byte) ((v >> 16) & 0xFF); b[3] = (byte) ((v >> 24) & 0xFF); b[4] = (byte) ((v >> 32) & 0xFF); b[5] = (byte) ((v >> 40) & 0xFF); b[6] = (byte) ((v >> 48) & 0xFF); b[7] = (byte) ((v >> 56) & 0xFF); writeRawBytes(out, b); }
static void function(OutputStream out, long val) throws IOException { if (val > 0x7FFFFFFFFFFFFFFFL val < 0) { throw new IOException(STR); } long v = val & 0x7FFFFFFFFFFFFFFFL; byte[] b = new byte[8]; b[0] = (byte) (v & 0xFF); b[1] = (byte) ((v >> 8) & 0xFF); b[2] = (byte) ((v >> 16) & 0xFF); b[3] = (byte) ((v >> 24) & 0xFF); b[4] = (byte) ((v >> 32) & 0xFF); b[5] = (byte) ((v >> 40) & 0xFF); b[6] = (byte) ((v >> 48) & 0xFF); b[7] = (byte) ((v >> 56) & 0xFF); writeRawBytes(out, b); }
/** * This isn't quite a Uint64, but rather a Uint63 - we will only write positive numbers * @param out * @param val * @throws IOException */
This isn't quite a Uint64, but rather a Uint63 - we will only write positive numbers
writeUint64
{ "repo_name": "compgen-io/compgen-common", "path": "src/java/io/compgen/common/io/DataIO.java", "license": "bsd-3-clause", "size": 11302 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
808,240
private void generateContextC() { try { PrintStream stream_contextc = new PrintStream(new File(dir + "Context.c")); printHeader(stream_contextc); // TODO - Should be using OCR macros instead of cnc_mm.h stream_contextc.println("#include \"cnc_mm.h\""); stream_contextc.println("#include \"Context.h\""); stream_contextc.println("#include <string.h>"); stream_contextc.println(); //Generate "initGraph" method stream_contextc.println("Context *initGraph() {"); stream_contextc.println("\tint i;"); stream_contextc.println("\tContext *CnCGraph = (Context*)cnc_malloc(sizeof(Context));\n"); stream_contextc.println(); StringBuilder sb = new StringBuilder(); for (String item_collection_name : all_items.keySet()) { stream_contextc.printf("\tCnCGraph->%s = cnc_malloc(TABLE_SIZE * sizeof(ItemCollectionEntry*));%n", item_collection_name); sb.append("CnCGraph->"+item_collection_name + "[i] = "); } stream_contextc.println(); stream_contextc.println("\tfor(i=0; i<TABLE_SIZE; i++){"); stream_contextc.println("\t\t" + sb.toString() + " NULL;"); stream_contextc.println("\t}"); stream_contextc.println(); for (String step_name : steps_name_list) { stream_contextc.printf( "\tocrEdtTemplateCreate(&CnCGraph->%s, %s_gets, %s, %s);%n", step_name, step_name, "EDT_PARAM_UNK", "EDT_PARAM_UNK"); } stream_contextc.println(); stream_contextc.println("\tocrEventCreate(&(CnCGraph->cncEnvOutTag), OCR_EVENT_ONCE_T, true);"); stream_contextc.println(); stream_contextc.println("\treturn CnCGraph;"); stream_contextc.println("}"); stream_contextc.println(); // Generate collection-specific functions declareItemCreators(stream_contextc, false); declarePutters(stream_contextc, false); //Generate "deleteGraph" method stream_contextc.println("void deleteGraph(Context *CnCGraph) {"); for (String item_collection_name : all_items.keySet()) { stream_contextc.println("\tcnc_free(CnCGraph->"+item_collection_name +");"); } stream_contextc.println(); stream_contextc.println("\tcnc_free(CnCGraph);"); stream_contextc.println("}"); stream_contextc.println(); stream_contextc.printf("void cncPrescribe_cncEnvOut(%s) {%n", environment.prescriberArgs); stream_contextc.println("\tCncTagComponent *tagPtr;"); stream_contextc.println("\tocrGuid_t tagGuid;"); stream_contextc.println("\tint _paramI=0;"); stream_contextc.printf("\tint tagSize = sizeof(CncTagComponent) * %s;%n", environment.identifiers.size()); stream_contextc.println("\tCNC_CREATE_ITEM(&tagGuid, (void**)&tagPtr, tagSize);"); for (Object o : environment.identifiers.getList()) { stream_contextc.printf("\ttagPtr[_paramI++] = %s;%n", o); } stream_contextc.println("\tocrEventSatisfy(context->cncEnvOutTag, tagGuid);"); stream_contextc.println("}"); } catch (IOException ie) { System.err.println(ie.getMessage()); ie.printStackTrace(); } }
void function() { try { PrintStream stream_contextc = new PrintStream(new File(dir + STR)); printHeader(stream_contextc); stream_contextc.println(STRcnc_mm.h\""); stream_contextc.println(STRContext.h\STR#include <string.h>STRContext *initGraph() {STR\tint i;STR\tContext *CnCGraph = (Context*)cnc_malloc(sizeof(Context));\nSTR\tCnCGraph->%s = cnc_malloc(TABLE_SIZE * sizeof(ItemCollectionEntry*));%nSTRCnCGraph->STR[i] = STR\tfor(i=0; i<TABLE_SIZE; i++){STR\t\tSTR NULL;STR\t}STR\tocrEdtTemplateCreate(&CnCGraph->%s, %s_gets, %s, %s);%nSTREDT_PARAM_UNKSTREDT_PARAM_UNKSTR\tocrEventCreate(&(CnCGraph->cncEnvOutTag), OCR_EVENT_ONCE_T, true);STR\treturn CnCGraph;STR}STRvoid deleteGraph(Context *CnCGraph) {STR\tcnc_free(CnCGraph->STR);STR\tcnc_free(CnCGraph);STR}STRvoid cncPrescribe_cncEnvOut(%s) {%nSTR\tCncTagComponent *tagPtr;STR\tocrGuid_t tagGuid;STR\tint _paramI=0;STR\tint tagSize = sizeof(CncTagComponent) * %s;%nSTR\tCNC_CREATE_ITEM(&tagGuid, (void**)&tagPtr, tagSize);STR\ttagPtr[_paramI++] = %s;%nSTR\tocrEventSatisfy(context->cncEnvOutTag, tagGuid);STR}"); } catch (IOException ie) { System.err.println(ie.getMessage()); ie.printStackTrace(); } }
/** * Generate method to initialize and delete the context: context.c */
Generate method to initialize and delete the context: context.c
generateContextC
{ "repo_name": "pelmers/cnc-ocr", "path": "CnCLPGParser/src/CnCParser/CncHcGenerator.java", "license": "bsd-3-clause", "size": 65250 }
[ "java.io.File", "java.io.IOException", "java.io.PrintStream" ]
import java.io.File; import java.io.IOException; import java.io.PrintStream;
import java.io.*;
[ "java.io" ]
java.io;
24,506
public static ImageJobResult runShader( File shaderJobResultFile, File shaderJobFile, IShaderDispatcher imageGenerator, Optional<File> referenceShaderResult, ShaderJobFileOperations fileOps) throws ShaderDispatchException, InterruptedException, IOException { LOGGER.info("Running shader job: {} ", shaderJobFile); // shaderJobFile -> imageJob ImageJob imageJob = new ImageJob(); fileOps.readShaderJobFileToImageJob(shaderJobFile, imageJob); // imageJob -> imageJobResult ImageJobResult imageJobResult = imageGenerator.getImage(imageJob); // imageJobResult -> shaderJobResultFile fileOps.writeShaderResultToFile( imageJobResult, shaderJobResultFile, referenceShaderResult); return imageJobResult; }
static ImageJobResult function( File shaderJobResultFile, File shaderJobFile, IShaderDispatcher imageGenerator, Optional<File> referenceShaderResult, ShaderJobFileOperations fileOps) throws ShaderDispatchException, InterruptedException, IOException { LOGGER.info(STR, shaderJobFile); ImageJob imageJob = new ImageJob(); fileOps.readShaderJobFileToImageJob(shaderJobFile, imageJob); ImageJobResult imageJobResult = imageGenerator.getImage(imageJob); fileOps.writeShaderResultToFile( imageJobResult, shaderJobResultFile, referenceShaderResult); return imageJobResult; }
/** * This method runs shaderJobFile using the imageGenerator (IShaderDispatcher), * writes the ImageJobResult to shaderJobResultFile, and returns the ImageJobResult. * If you don't need an output file, you can just use an IShaderDispatcher directly. * * @param shaderJobResultFile E.g. "variant_blah.info.json" * @param shaderJobFile E.g. "variant_blah.json" * @param imageGenerator to generate an ImageJobResult * @param referenceShaderResult E.g. "reference.info.json" * @param fileOps File operations. * @return ImageJobResult * @throws ShaderDispatchException On imageGenerator failure. * @throws InterruptedException On imageGenerator failure. * @throws IOException On IO failure. */
This method runs shaderJobFile using the imageGenerator (IShaderDispatcher), writes the ImageJobResult to shaderJobResultFile, and returns the ImageJobResult. If you don't need an output file, you can just use an IShaderDispatcher directly
runShader
{ "repo_name": "google/graphicsfuzz", "path": "common/src/main/java/com/graphicsfuzz/shadersets/RunShaderFamily.java", "license": "apache-2.0", "size": 7977 }
[ "com.graphicsfuzz.common.util.ShaderJobFileOperations", "com.graphicsfuzz.server.thrift.ImageJob", "com.graphicsfuzz.server.thrift.ImageJobResult", "java.io.File", "java.io.IOException", "java.util.Optional" ]
import com.graphicsfuzz.common.util.ShaderJobFileOperations; import com.graphicsfuzz.server.thrift.ImageJob; import com.graphicsfuzz.server.thrift.ImageJobResult; import java.io.File; import java.io.IOException; import java.util.Optional;
import com.graphicsfuzz.common.util.*; import com.graphicsfuzz.server.thrift.*; import java.io.*; import java.util.*;
[ "com.graphicsfuzz.common", "com.graphicsfuzz.server", "java.io", "java.util" ]
com.graphicsfuzz.common; com.graphicsfuzz.server; java.io; java.util;
1,623,191
synchronized public void startRing(String remoteContact) { saveAudioState(); if(!ringer.isRinging()) { ringer.ring(remoteContact, service.getPrefs().getRingtone()); }else { Log.d(THIS_FILE, "Already ringing ...."); } }
synchronized void function(String remoteContact) { saveAudioState(); if(!ringer.isRinging()) { ringer.ring(remoteContact, service.getPrefs().getRingtone()); }else { Log.d(THIS_FILE, STR); } }
/** * Start ringing announce for a given contact. * It will also focus audio for us. * @param remoteContact the contact to ring for. May resolve the contact ringtone if any. */
Start ringing announce for a given contact. It will also focus audio for us
startRing
{ "repo_name": "xiejianying/csipsimple", "path": "src/com/csipsimple/service/MediaManager.java", "license": "lgpl-3.0", "size": 28524 }
[ "com.csipsimple.utils.Log" ]
import com.csipsimple.utils.Log;
import com.csipsimple.utils.*;
[ "com.csipsimple.utils" ]
com.csipsimple.utils;
1,125,560
@BeforeClass(groups = { "structured", "postgres","nightly" }) @Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" }) public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) { // If running from eclipse set env var -Penv=docker or use the following // url variable settings: // url = "http://192.168.99.100:8665/rapture"; // docker // url="http://localhost:8665/rapture"; try { helper = new IntegrationTestHelper(url, username, password); } catch (Exception e) { throw new SkipException("Cannot connect to IntegrationTestHelper " + e.getMessage()); } structApi = helper.getStructApi(); admin = helper.getAdminApi(); pluginApi = helper.getPluginApi(); if (!admin.doesUserExist(user)) { admin.addUser(user, "Another User", MD5Utils.hash16(user), "user@incapture.net"); } repoUri = helper.getRandomAuthority(Scheme.DOCUMENT); helper.configureTestRepo(repoUri, "MONGODB"); // TODO Make this configurable }
@BeforeClass(groups = { STR, STR,STR }) @Parameters({ STR, STR, STR }) void function(@Optional(STRCannot connect to IntegrationTestHelper STRAnother UserSTRuser@incapture.netSTRMONGODB"); }
/** * Setup TestNG method to create Rapture login object and objects. * * @param RaptureURL * Passed in from <env>_testng.xml suite file * @param RaptureUser * Passed in from <env>_testng.xml suite file * @param RapturePassword * Passed in from <env>_testng.xml suite file * @return none */
Setup TestNG method to create Rapture login object and objects
setUp
{ "repo_name": "scarabus/Rapture", "path": "Apps/RaptureIntTests/src/test/java/rapture/structured/StructuredApiIntegrationTests.java", "license": "mit", "size": 36099 }
[ "org.testng.annotations.BeforeClass", "org.testng.annotations.Optional", "org.testng.annotations.Parameters" ]
import org.testng.annotations.BeforeClass; import org.testng.annotations.Optional; import org.testng.annotations.Parameters;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
389,839
public void run(@Nullable final ConsoleView consoleView) throws ExecutionException { run(createCommandLine().getEnvironment(), consoleView); }
void function(@Nullable final ConsoleView consoleView) throws ExecutionException { run(createCommandLine().getEnvironment(), consoleView); }
/** * Runs command using env vars from facet * @param consoleView console view to be used for command or null to create new * @throws ExecutionException failed to execute command */
Runs command using env vars from facet
run
{ "repo_name": "caot/intellij-community", "path": "python/src/com/jetbrains/python/run/PythonTask.java", "license": "apache-2.0", "size": 8743 }
[ "com.intellij.execution.ExecutionException", "com.intellij.execution.ui.ConsoleView", "org.jetbrains.annotations.Nullable" ]
import com.intellij.execution.ExecutionException; import com.intellij.execution.ui.ConsoleView; import org.jetbrains.annotations.Nullable;
import com.intellij.execution.*; import com.intellij.execution.ui.*; import org.jetbrains.annotations.*;
[ "com.intellij.execution", "org.jetbrains.annotations" ]
com.intellij.execution; org.jetbrains.annotations;
2,884,719
EList<Expression> getSubscripts();
EList<Expression> getSubscripts();
/** * Returns the value of the '<em><b>Subscripts</b></em>' containment reference list. * The list contents are of type {@link org.xtext.example.delphi.astm.Expression}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Subscripts</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Subscripts</em>' containment reference list. * @see org.xtext.example.delphi.astm.AstmPackage#getArrayAccess_Subscripts() * @model containment="true" * annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://modelum.es/modernization/astm!ArrayAccess!subscripts'" * @generated */
Returns the value of the 'Subscripts' containment reference list. The list contents are of type <code>org.xtext.example.delphi.astm.Expression</code>. If the meaning of the 'Subscripts' containment reference list isn't clear, there really should be more of a description here...
getSubscripts
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.delphi/emf-gen/org/xtext/example/delphi/astm/ArrayAccess.java", "license": "epl-1.0", "size": 2609 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,392,192
public JsonBuilder addDoc(Map<String, Object> doc) throws IOException { try (XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent())) { builder.map(doc); bytes.add(ByteBuffer.wrap(BytesReference.toBytes(BytesReference.bytes(builder)))); } return this; }
JsonBuilder function(Map<String, Object> doc) throws IOException { try (XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent())) { builder.map(doc); bytes.add(ByteBuffer.wrap(BytesReference.toBytes(BytesReference.bytes(builder)))); } return this; }
/** * Add a document via an object map * * @param doc document object to add to bulk request * @throws IOException on parsing/serialization errors */
Add a document via an object map
addDoc
{ "repo_name": "nknize/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataRequest.java", "license": "apache-2.0", "size": 8193 }
[ "java.io.IOException", "java.nio.ByteBuffer", "java.util.Map", "org.elasticsearch.common.bytes.BytesReference", "org.elasticsearch.common.xcontent.XContentBuilder", "org.elasticsearch.common.xcontent.XContentType" ]
import java.io.IOException; import java.nio.ByteBuffer; import java.util.Map; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType;
import java.io.*; import java.nio.*; import java.util.*; import org.elasticsearch.common.bytes.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "java.nio", "java.util", "org.elasticsearch.common" ]
java.io; java.nio; java.util; org.elasticsearch.common;
600,507
@Before public void beforeTest() { config = mainConfiguration.copy(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);factory.setXIncludeAware(false); factory.setExpandEntityReferences(false);factory.setValidating(false);// we do not have a schema to validate against-this does not seem necessary for the simple data format we are considering here. doc = factory.newDocumentBuilder().newDocument(); } catch(ParserConfigurationException e) { statechum.Helper.throwUnchecked("failed to construct DOM document",e); } } Configuration config = null, mainConfiguration = null; ConvertALabel converter = null;
void function() { config = mainConfiguration.copy(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);factory.setXIncludeAware(false); factory.setExpandEntityReferences(false);factory.setValidating(false); doc = factory.newDocumentBuilder().newDocument(); } catch(ParserConfigurationException e) { statechum.Helper.throwUnchecked(STR,e); } } Configuration config = null, mainConfiguration = null; ConvertALabel converter = null;
/** Make sure that whatever changes a test have made to the * configuration, next test is not affected. */
Make sure that whatever changes a test have made to the configuration, next test is not affected
beforeTest
{ "repo_name": "kirilluk/statechum", "path": "tests/statechum/analysis/learning/rpnicore/TestRejectManipulation.java", "license": "gpl-3.0", "size": 12822 }
[ "javax.xml.XMLConstants", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException" ]
import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.*; import javax.xml.parsers.*;
[ "javax.xml" ]
javax.xml;
482,890
protected Field getField(Object obj, String fieldname) { Class<?> type = obj.getClass(); // Creates the fields cache if (fields == null) { fields = new HashMap<Class, Map<String, Field>>(); } // Creates the fields cache entry for the given type Map<String, Field> map = fields.get(type); if (map == null) { map = new HashMap<String, Field>(); fields.put(type, map); } // Tries to get cached field Field field = map.get(fieldname); if (field != null) { return field; } while (type != null) { try { field = type.getDeclaredField(fieldname); if (field != null) { // Adds field to fields cache map.put(fieldname, field); return field; } } catch (Exception e) { log.log(Level.FINEST, "Failed to get field " + fieldname + " in class " + type, e); } type = type.getSuperclass(); } log.log(Level.FINEST, "Field " + fieldname + " not found in " + obj); return null; }
Field function(Object obj, String fieldname) { Class<?> type = obj.getClass(); if (fields == null) { fields = new HashMap<Class, Map<String, Field>>(); } Map<String, Field> map = fields.get(type); if (map == null) { map = new HashMap<String, Field>(); fields.put(type, map); } Field field = map.get(fieldname); if (field != null) { return field; } while (type != null) { try { field = type.getDeclaredField(fieldname); if (field != null) { map.put(fieldname, field); return field; } } catch (Exception e) { log.log(Level.FINEST, STR + fieldname + STR + type, e); } type = type.getSuperclass(); } log.log(Level.FINEST, STR + fieldname + STR + obj); return null; }
/** * Returns the field with the specified name. */
Returns the field with the specified name
getField
{ "repo_name": "jgraph/mxgraph", "path": "java/src/com/mxgraph/io/mxObjectCodec.java", "license": "apache-2.0", "size": 33561 }
[ "java.lang.reflect.Field", "java.util.HashMap", "java.util.Map", "java.util.logging.Level" ]
import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; import java.util.logging.Level;
import java.lang.reflect.*; import java.util.*; import java.util.logging.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,835,688
public static AbstractBooleanAssert<?> then(Boolean actual) { return assertThat(actual); }
static AbstractBooleanAssert<?> function(Boolean actual) { return assertThat(actual); }
/** * Creates a new instance of <code>{@link org.assertj.core.api.BooleanAssert}</code>. * * @param actual the actual value. * @return the created assertion object. */
Creates a new instance of <code><code>org.assertj.core.api.BooleanAssert</code></code>
then
{ "repo_name": "hazendaz/assertj-core", "path": "src/main/java/org/assertj/core/api/Java6BDDAssertions.java", "license": "apache-2.0", "size": 42180 }
[ "org.assertj.core.api.Java6Assertions" ]
import org.assertj.core.api.Java6Assertions;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
1,763,007
public void characters(XMLString text, Augmentations augs) throws XNIException { boolean callNextCharacters = true; // REVISIT: [Q] Is there a more efficient way of doing this? // Perhaps if the scanner told us so we don't have to // look at the characters again. -Ac boolean allWhiteSpace = true; for (int i=text.offset; i< text.offset+text.length; i++) { if (!isSpace(text.ch[i])) { allWhiteSpace = false; break; } } // call the ignoreableWhiteSpace callback // never call ignorableWhitespace if we are in cdata section if (fInElementContent && allWhiteSpace && !fInCDATASection) { if (fDocumentHandler != null) { fDocumentHandler.ignorableWhitespace(text, augs); callNextCharacters = false; } } // validate if (fPerformValidation) { if (fInElementContent) { if (fGrammarBucket.getStandalone() && fDTDGrammar.getElementDeclIsExternal(fCurrentElementIndex)) { if (allWhiteSpace) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, "MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE", null, XMLErrorReporter.SEVERITY_ERROR); } } if (!allWhiteSpace) { charDataInContent(); } // For E15.2 if (augs != null && augs.getItem(Constants.CHAR_REF_PROBABLE_WS) == Boolean.TRUE) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, fDTDGrammar.getContentSpecAsString(fElementDepth), "character reference"}, XMLErrorReporter.SEVERITY_ERROR); } } if (fCurrentContentSpecType == XMLElementDecl.TYPE_EMPTY) { charDataInContent(); } } // call handlers if (callNextCharacters && fDocumentHandler != null) { fDocumentHandler.characters(text, augs); } } // characters(XMLString)
void function(XMLString text, Augmentations augs) throws XNIException { boolean callNextCharacters = true; boolean allWhiteSpace = true; for (int i=text.offset; i< text.offset+text.length; i++) { if (!isSpace(text.ch[i])) { allWhiteSpace = false; break; } } if (fInElementContent && allWhiteSpace && !fInCDATASection) { if (fDocumentHandler != null) { fDocumentHandler.ignorableWhitespace(text, augs); callNextCharacters = false; } } if (fPerformValidation) { if (fInElementContent) { if (fGrammarBucket.getStandalone() && fDTDGrammar.getElementDeclIsExternal(fCurrentElementIndex)) { if (allWhiteSpace) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, STR, null, XMLErrorReporter.SEVERITY_ERROR); } } if (!allWhiteSpace) { charDataInContent(); } if (augs != null && augs.getItem(Constants.CHAR_REF_PROBABLE_WS) == Boolean.TRUE) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, STR, new Object[]{ fCurrentElement.rawname, fDTDGrammar.getContentSpecAsString(fElementDepth), STR}, XMLErrorReporter.SEVERITY_ERROR); } } if (fCurrentContentSpecType == XMLElementDecl.TYPE_EMPTY) { charDataInContent(); } } if (callNextCharacters && fDocumentHandler != null) { fDocumentHandler.characters(text, augs); } }
/** * Character content. * * @param text The content. * * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */
Character content
characters
{ "repo_name": "AaronZhangL/SplitCharater", "path": "xerces-2_11_0/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java", "license": "gpl-2.0", "size": 87117 }
[ "org.apache.xerces.impl.Constants", "org.apache.xerces.impl.XMLErrorReporter", "org.apache.xerces.impl.msg.XMLMessageFormatter", "org.apache.xerces.xni.Augmentations", "org.apache.xerces.xni.XMLString", "org.apache.xerces.xni.XNIException" ]
import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.XMLErrorReporter; import org.apache.xerces.impl.msg.XMLMessageFormatter; import org.apache.xerces.xni.Augmentations; import org.apache.xerces.xni.XMLString; import org.apache.xerces.xni.XNIException;
import org.apache.xerces.impl.*; import org.apache.xerces.impl.msg.*; import org.apache.xerces.xni.*;
[ "org.apache.xerces" ]
org.apache.xerces;
511,487
public static <T extends Number> IPoint4<T> revertShear( final IPoint4<T> pointToShear, final IShearFactor<?> shearFactor) { IMatrix4<? extends Number> shearMatrix = GeometricOperations .inverseShearMatrix(shearFactor); return VectorAlgebraicOperations.multiply(shearMatrix, pointToShear, pointToShear.getType()); }
static <T extends Number> IPoint4<T> function( final IPoint4<T> pointToShear, final IShearFactor<?> shearFactor) { IMatrix4<? extends Number> shearMatrix = GeometricOperations .inverseShearMatrix(shearFactor); return VectorAlgebraicOperations.multiply(shearMatrix, pointToShear, pointToShear.getType()); }
/** * Reverts the shear of the {@link IPoint4 Point} by the provided * {@link IShearFactor ShearFactor Factor}. * * @param <T> * the {@link Number} type of the {@link IPoint4 Point} to shear. * * @param pointToShear * the {@link IPoint4 Point} to shear. * @param shearFactor * the {@link IShearFactor ShearFactor Factor}. * @return the sheared {@link IPoint4 Point}. */
Reverts the shear of the <code>IPoint4 Point</code> by the provided <code>IShearFactor ShearFactor Factor</code>
revertShear
{ "repo_name": "aftenkap/jutility", "path": "jutility-math/src/main/java/org/jutility/math/geometry/GeometricOperations.java", "license": "apache-2.0", "size": 125764 }
[ "org.jutility.math.vectoralgebra.IMatrix4", "org.jutility.math.vectoralgebra.IPoint4", "org.jutility.math.vectoralgebra.VectorAlgebraicOperations" ]
import org.jutility.math.vectoralgebra.IMatrix4; import org.jutility.math.vectoralgebra.IPoint4; import org.jutility.math.vectoralgebra.VectorAlgebraicOperations;
import org.jutility.math.vectoralgebra.*;
[ "org.jutility.math" ]
org.jutility.math;
2,838,842
@JsonProperty(value = "max") public void setMax(Object max) { this.max = max; }
@JsonProperty(value = "max") void function(Object max) { this.max = max; }
/** * setter used during deserialization of the 'max' field of the metadata cache file. * * @param max */
setter used during deserialization of the 'max' field of the metadata cache file
setMax
{ "repo_name": "shakamunyi/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java", "license": "apache-2.0", "size": 71648 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
2,816,834
public ServiceResponse<List<Integer>> getIntInvalidString() throws ErrorException, IOException { Call<ResponseBody> call = service.getIntInvalidString(); return getIntInvalidStringDelegate(call.execute()); }
ServiceResponse<List<Integer>> function() throws ErrorException, IOException { Call<ResponseBody> call = service.getIntInvalidString(); return getIntInvalidStringDelegate(call.execute()); }
/** * Get integer array value [1, 'integer', 0]. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the List&lt;Integer&gt; object wrapped in {@link ServiceResponse} if successful. */
Get integer array value [1, 'integer', 0]
getIntInvalidString
{ "repo_name": "stankovski/AutoRest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java", "license": "mit", "size": 167174 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException", "java.util.List" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List;
import com.microsoft.rest.*; import java.io.*; import java.util.*;
[ "com.microsoft.rest", "java.io", "java.util" ]
com.microsoft.rest; java.io; java.util;
2,041,918
@Override public void initialize(Map<String, Object> externalProperty) { setExternalProperties(externalProperty); initializePropertyReader(); }
void function(Map<String, Object> externalProperty) { setExternalProperties(externalProperty); initializePropertyReader(); }
/** * Initialize redis client factory. */
Initialize redis client factory
initialize
{ "repo_name": "impetus-opensource/Kundera", "path": "src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClientFactory.java", "license": "apache-2.0", "size": 13718 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,188,791
public boolean hasAlphabeticCharacters() { for (Component component : components) { if (!Objects.equals(component.alphaSequence, NO_ALPHA_SEQUENCE)) { return true; } } return false; }
boolean function() { for (Component component : components) { if (!Objects.equals(component.alphaSequence, NO_ALPHA_SEQUENCE)) { return true; } } return false; }
/** * Returns true if this version number has any alphabetic characters, such as 'alpha' in * "7.3alpha.2". */
Returns true if this version number has any alphabetic characters, such as 'alpha' in "7.3alpha.2"
hasAlphabeticCharacters
{ "repo_name": "twitter-forks/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java", "license": "apache-2.0", "size": 15202 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,279,410
protected Node newNode() { return new SVGOMTitleElement(); }
Node function() { return new SVGOMTitleElement(); }
/** * Returns a new uninitialized instance of this object's class. */
Returns a new uninitialized instance of this object's class
newNode
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/dom/svg/SVGOMTitleElement.java", "license": "apache-2.0", "size": 1939 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
389,802
public void process(ControlFrame frame);
void function(ControlFrame frame);
/** * <p>Processes the given control frame, * for example by updating the stream's state or by calling listeners.</p> * * @param frame the control frame to process * @see #process(DataInfo) */
Processes the given control frame, for example by updating the stream's state or by calling listeners
process
{ "repo_name": "jamiepg1/jetty.project", "path": "jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/IStream.java", "license": "apache-2.0", "size": 3905 }
[ "org.eclipse.jetty.spdy.frames.ControlFrame" ]
import org.eclipse.jetty.spdy.frames.ControlFrame;
import org.eclipse.jetty.spdy.frames.*;
[ "org.eclipse.jetty" ]
org.eclipse.jetty;
1,832,678
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.application_list_fragment, container, false); applicationListView = (ListView) view .findViewById(R.id.applicationListView); adapter = new ApplicationViewAdapter(getActivity(), ApplicationList.appList); if (getActivity() instanceof OnItemClickListener) { applicationListView .setOnItemClickListener((OnItemClickListener) getActivity()); } applicationListView.setAdapter(adapter); return view; }
View function(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.application_list_fragment, container, false); applicationListView = (ListView) view .findViewById(R.id.applicationListView); adapter = new ApplicationViewAdapter(getActivity(), ApplicationList.appList); if (getActivity() instanceof OnItemClickListener) { applicationListView .setOnItemClickListener((OnItemClickListener) getActivity()); } applicationListView.setAdapter(adapter); return view; }
/** * Creates the fragment. Loading the ApplicationViewAdapter with it's data and giving it to the listview. */
Creates the fragment. Loading the ApplicationViewAdapter with it's data and giving it to the listview
onCreateView
{ "repo_name": "madelinecameron/CS397", "path": "src/com/Lumension/android/permission_scanner/ApplicationListFragment.java", "license": "mit", "size": 1683 }
[ "android.os.Bundle", "android.view.LayoutInflater", "android.view.View", "android.view.ViewGroup", "android.widget.AdapterView", "android.widget.ListView" ]
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView;
import android.os.*; import android.view.*; import android.widget.*;
[ "android.os", "android.view", "android.widget" ]
android.os; android.view; android.widget;
1,240,009
public synchronized void mapOutputLost(TaskAttemptID taskid, String errorMsg) throws IOException { TaskInProgress tip = tasks.get(taskid); if (tip != null) { tip.mapOutputLost(errorMsg); } else { LOG.warn("Unknown child with bad map output: "+taskid+". Ignored."); } } static class RunningJob{ private JobID jobid; private JobConf jobConf; private volatile InterTrackerProtocol jobClient; private Writable extensible; // keep this for later use volatile Set<TaskInProgress> tasks; volatile boolean localized; final Object localizationLock; boolean keepJobFiles; FetchStatus f; RunningJob(JobID jobid, InterTrackerProtocol jobClient, Writable extensible) { this.jobid = jobid; this.jobClient = jobClient; this.extensible = extensible; localized = false; localizationLock = new Object(); tasks = new HashSet<TaskInProgress>(); keepJobFiles = false; }
synchronized void function(TaskAttemptID taskid, String errorMsg) throws IOException { TaskInProgress tip = tasks.get(taskid); if (tip != null) { tip.mapOutputLost(errorMsg); } else { LOG.warn(STR+taskid+STR); } } static class RunningJob{ private JobID jobid; private JobConf jobConf; private volatile InterTrackerProtocol jobClient; private Writable extensible; volatile Set<TaskInProgress> tasks; volatile boolean localized; final Object localizationLock; boolean keepJobFiles; FetchStatus f; RunningJob(JobID jobid, InterTrackerProtocol jobClient, Writable extensible) { this.jobid = jobid; this.jobClient = jobClient; this.extensible = extensible; localized = false; localizationLock = new Object(); tasks = new HashSet<TaskInProgress>(); keepJobFiles = false; }
/** * A completed map task's output has been lost. */
A completed map task's output has been lost
mapOutputLost
{ "repo_name": "rvadali/fb-raid-refactoring", "path": "src/mapred/org/apache/hadoop/mapred/TaskTracker.java", "license": "apache-2.0", "size": 135755 }
[ "java.io.IOException", "java.util.HashSet", "java.util.Set", "org.apache.hadoop.io.Writable" ]
import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.apache.hadoop.io.Writable;
import java.io.*; import java.util.*; import org.apache.hadoop.io.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,677,861
public List<ResourceLookup> getResourcesByIdList(List<Long> idList);
List<ResourceLookup> function(List<Long> idList);
/** * Lists resources by internal IDs. * * @param idList the list of IDs of the resources to be listed * @return a list of {@link ResourceLookup} objects * @since 3.7.0 */
Lists resources by internal IDs
getResourcesByIdList
{ "repo_name": "leocockroach/JasperServer5.6", "path": "jasperserver-api/metadata/src/main/java/com/jaspersoft/jasperserver/api/metadata/common/service/RepositoryService.java", "license": "gpl-2.0", "size": 27135 }
[ "com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceLookup", "java.util.List" ]
import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceLookup; import java.util.List;
import com.jaspersoft.jasperserver.api.metadata.common.domain.*; import java.util.*;
[ "com.jaspersoft.jasperserver", "java.util" ]
com.jaspersoft.jasperserver; java.util;
1,998,620
public static ByteArrayComparable parseFrom( final byte[] pbBytes ) { DataInput in = new DataInputStream( new ByteArrayInputStream( pbBytes ) ); try { boolean m_value = new Boolean( in.readBoolean() ); return new DeserializedBooleanComparator( m_value ); } catch ( IOException e ) { throw new RuntimeException( "Unable to deserialize byte array", e ); } }
static ByteArrayComparable function( final byte[] pbBytes ) { DataInput in = new DataInputStream( new ByteArrayInputStream( pbBytes ) ); try { boolean m_value = new Boolean( in.readBoolean() ); return new DeserializedBooleanComparator( m_value ); } catch ( IOException e ) { throw new RuntimeException( STR, e ); } }
/** * Needed for hbase-0.95+ * * @throws java.io.IOException */
Needed for hbase-0.95+
parseFrom
{ "repo_name": "andrei-viaryshka/pentaho-hadoop-shims", "path": "common/hbase-comparators/src/main/java/org/pentaho/hbase/shim/common/DeserializedBooleanComparator.java", "license": "apache-2.0", "size": 6476 }
[ "java.io.ByteArrayInputStream", "java.io.DataInput", "java.io.DataInputStream", "java.io.IOException", "org.apache.hadoop.hbase.filter.ByteArrayComparable" ]
import java.io.ByteArrayInputStream; import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; import org.apache.hadoop.hbase.filter.ByteArrayComparable;
import java.io.*; import org.apache.hadoop.hbase.filter.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
207,621
@RequestMapping( value = "", method = RequestMethod.GET, produces = "application/json" ) public @ResponseBody List<String> getNamespaces( HttpServletResponse response ) throws IOException { return userKeyJsonValueService.getNamespacesByUser( currentUserService.getCurrentUser() ); }
@RequestMapping( value = STRapplication/json" ) @ResponseBody List<String> function( HttpServletResponse response ) throws IOException { return userKeyJsonValueService.getNamespacesByUser( currentUserService.getCurrentUser() ); }
/** * Returns a JSON array of strings representing the different namespaces used. * If no namespaces exist, an empty array is returned. */
Returns a JSON array of strings representing the different namespaces used. If no namespaces exist, an empty array is returned
getNamespaces
{ "repo_name": "uonafya/jphes-core", "path": "dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/UserKeyJsonValueController.java", "license": "bsd-3-clause", "size": 9381 }
[ "java.io.IOException", "java.util.List", "javax.servlet.http.HttpServletResponse", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.ResponseBody" ]
import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;
import java.io.*; import java.util.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*;
[ "java.io", "java.util", "javax.servlet", "org.springframework.web" ]
java.io; java.util; javax.servlet; org.springframework.web;
257,929
report.set(GalenReportsContainer.get().registerTest(getTestName(), null)); }
report.set(GalenReportsContainer.get().registerTest(getTestName(), null)); }
/** * Initializes the TestReport instance with the name of current test method and stores it in {@link ThreadLocal} */
Initializes the TestReport instance with the name of current test method and stores it in <code>ThreadLocal</code>
initReport
{ "repo_name": "tommywo/galen", "path": "galen-java-support/src/main/java/com/galenframework/junit/GalenJUnitTestBase.java", "license": "apache-2.0", "size": 2436 }
[ "com.galenframework.support.GalenReportsContainer" ]
import com.galenframework.support.GalenReportsContainer;
import com.galenframework.support.*;
[ "com.galenframework.support" ]
com.galenframework.support;
2,423,662
@Override public URI getURI() throws IOException { if (this.uri != null) { return this.uri; } else { return super.getURI(); } }
URI function() throws IOException { if (this.uri != null) { return this.uri; } else { return super.getURI(); } }
/** * This implementation returns the underlying URI directly, * if possible. */
This implementation returns the underlying URI directly, if possible
getURI
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.core/org/springframework/core/io/UrlResource.java", "license": "mit", "size": 7936 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
946,442
return new PropertySourcesPlaceholderConfigurer(); }
return new PropertySourcesPlaceholderConfigurer(); }
/** * This is needed to make property resolving work on annotations ... * (see http://stackoverflow.com/questions/11925952/custom-spring-property-source-does-not-resolve-placeholders-in-value) * * @Scheduled(cron="${someProperty}") */
This is needed to make property resolving work on annotations ... (see HREF)
propertySourcesPlaceholderConfigurer
{ "repo_name": "motorina0/flowable-engine", "path": "modules/flowable-ui-admin/src/main/java/org/flowable/admin/conf/ApplicationConfiguration.java", "license": "apache-2.0", "size": 2562 }
[ "org.springframework.context.support.PropertySourcesPlaceholderConfigurer" ]
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.context.support.*;
[ "org.springframework.context" ]
org.springframework.context;
232,589
@Override public void finishedItem(Item item) { try { store(item); } catch (ObjectStoreException e) { throw new RuntimeException(e); } count++; if (count % 10000 == 0) { long now = System.currentTimeMillis(); if (times[(int) ((count / 10000) % 20)] == -1) { LOG.info("Processed " + count + " rows - running at " + (600000000L / (now - time)) + " (avg " + ((60000L * count) / (now - start)) + ") rows per minute"); } else { LOG.info("Processed " + count + " rows - running at " + (600000000L / (now - time)) + " (200000 avg " + (12000000000L / (now - times[(int) ((count / 10000) % 20)])) + ") (avg " + ((60000L * count) / (now - start)) + ") rows per minute"); } time = now; times[(int) ((count / 10000) % 20)] = now; } } }
void function(Item item) { try { store(item); } catch (ObjectStoreException e) { throw new RuntimeException(e); } count++; if (count % 10000 == 0) { long now = System.currentTimeMillis(); if (times[(int) ((count / 10000) % 20)] == -1) { LOG.info(STR + count + STR + (600000000L / (now - time)) + STR + ((60000L * count) / (now - start)) + STR); } else { LOG.info(STR + count + STR + (600000000L / (now - time)) + STR + (12000000000L / (now - times[(int) ((count / 10000) % 20)])) + STR + ((60000L * count) / (now - start)) + STR); } time = now; times[(int) ((count / 10000) % 20)] = now; } } }
/** * Do something useful with the Item. * @param item the Item */
Do something useful with the Item
finishedItem
{ "repo_name": "JoeCarlson/intermine", "path": "intermine/integrate/main/src/org/intermine/dataconversion/FullXmlConverter.java", "license": "lgpl-2.1", "size": 3295 }
[ "org.intermine.objectstore.ObjectStoreException", "org.intermine.xml.full.Item" ]
import org.intermine.objectstore.ObjectStoreException; import org.intermine.xml.full.Item;
import org.intermine.objectstore.*; import org.intermine.xml.full.*;
[ "org.intermine.objectstore", "org.intermine.xml" ]
org.intermine.objectstore; org.intermine.xml;
1,953,522
public RectF getZoomedRect() { if (mScaleType == ScaleType.FIT_XY) { throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY"); } PointF topLeft = transformCoordTouchToBitmap(0, 0, true); PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true); float w = getDrawable().getIntrinsicWidth(); float h = getDrawable().getIntrinsicHeight(); return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h); }
RectF function() { if (mScaleType == ScaleType.FIT_XY) { throw new UnsupportedOperationException(STR); } PointF topLeft = transformCoordTouchToBitmap(0, 0, true); PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true); float w = getDrawable().getIntrinsicWidth(); float h = getDrawable().getIntrinsicHeight(); return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h); }
/** * Return a Rect representing the zoomed image. * @return rect representing zoomed image */
Return a Rect representing the zoomed image
getZoomedRect
{ "repo_name": "dbuscaglia/codepath_project_2", "path": "app/src/main/java/danbuscaglia/googleimagesearch/components/TouchImageView.java", "license": "apache-2.0", "size": 42695 }
[ "android.graphics.PointF", "android.graphics.RectF" ]
import android.graphics.PointF; import android.graphics.RectF;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
864,511
private void rewriteCallSites(SimpleDefinitionFinder defFinder, Definition definition, String newMethodName) { Collection<UseSite> useSites = defFinder.getUseSites(definition); for (UseSite site : useSites) { Node node = site.node; Node parent = node.getParent(); Node objectNode = node.getFirstChild(); node.removeChild(objectNode); parent.replaceChild(node, objectNode); parent.addChildToFront(IR.name(newMethodName).srcref(node)); Preconditions.checkState(parent.isCall()); parent.putBooleanProp(Node.FREE_CALL, true); compiler.reportCodeChange(); } } /** * Rewrites method definitions as global functions that take "this" * as their first argument. * * Before: * a.prototype.b = function(a, b, c) {...} * * After: * var b = function(self, a, b, c) {...}
void function(SimpleDefinitionFinder defFinder, Definition definition, String newMethodName) { Collection<UseSite> useSites = defFinder.getUseSites(definition); for (UseSite site : useSites) { Node node = site.node; Node parent = node.getParent(); Node objectNode = node.getFirstChild(); node.removeChild(objectNode); parent.replaceChild(node, objectNode); parent.addChildToFront(IR.name(newMethodName).srcref(node)); Preconditions.checkState(parent.isCall()); parent.putBooleanProp(Node.FREE_CALL, true); compiler.reportCodeChange(); } } /** * Rewrites method definitions as global functions that take "this" * as their first argument. * * Before: * a.prototype.b = function(a, b, c) {...} * * After: * var b = function(self, a, b, c) {...}
/** * Rewrites object method call sites as calls to global functions * that take "this" as their first argument. * * Before: * o.foo(a, b, c) * * After: * foo(o, a, b, c) */
Rewrites object method call sites as calls to global functions that take "this" as their first argument. Before: o.foo(a, b, c) After: foo(o, a, b, c)
rewriteCallSites
{ "repo_name": "ralic/closure-compiler", "path": "src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java", "license": "apache-2.0", "size": 13194 }
[ "com.google.common.base.Preconditions", "com.google.javascript.jscomp.DefinitionsRemover", "com.google.javascript.rhino.IR", "com.google.javascript.rhino.Node", "java.util.Collection" ]
import com.google.common.base.Preconditions; import com.google.javascript.jscomp.DefinitionsRemover; import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node; import java.util.Collection;
import com.google.common.base.*; import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*; import java.util.*;
[ "com.google.common", "com.google.javascript", "java.util" ]
com.google.common; com.google.javascript; java.util;
1,873,172
protected void rethrow(SQLException e) { throw new RuntimeException(e.getMessage()); }
void function(SQLException e) { throw new RuntimeException(e.getMessage()); }
/** * Rethrow the SQLException as a RuntimeException. This implementation * creates a new RuntimeException with the SQLException's error message. * @param e SQLException to rethrow * @since DbUtils 1.1 */
Rethrow the SQLException as a RuntimeException. This implementation creates a new RuntimeException with the SQLException's error message
rethrow
{ "repo_name": "penggangshu/uhm", "path": "src/main/java/org/apache/commons/dbutils/ResultSetIterator.java", "license": "unlicense", "size": 4278 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,430,615
public boolean hasInstanceOf(Class clazz) { for (BaseBrick item : this.items) { if (clazz.isInstance(item)) { return true; } } return false; }
boolean function(Class clazz) { for (BaseBrick item : this.items) { if (clazz.isInstance(item)) { return true; } } return false; }
/** * If all items have instance of clazz. * * @param clazz class to be found * @return whether the clazz is in the all items */
If all items have instance of clazz
hasInstanceOf
{ "repo_name": "patbeagan1/brickkit-android", "path": "BrickKit/bricks/src/main/java/com/wayfair/brickkit/BrickDataManager.java", "license": "apache-2.0", "size": 41493 }
[ "com.wayfair.brickkit.brick.BaseBrick" ]
import com.wayfair.brickkit.brick.BaseBrick;
import com.wayfair.brickkit.brick.*;
[ "com.wayfair.brickkit" ]
com.wayfair.brickkit;
1,577,083
public Stat setAcl(String path, List<ACL> acls, int version) throws KeeperException, InterruptedException { TraceScope traceScope = null; try { traceScope = Trace.startSpan("RecoverableZookeeper.setAcl"); RetryCounter retryCounter = retryCounterFactory.create(); while (true) { try { long startTime = EnvironmentEdgeManager.currentTime(); Stat nodeStat = checkZk().setACL(path, acls, version); this.metrics.registerWriteOperationLatency(Math.min(EnvironmentEdgeManager.currentTime() - startTime, 1)); return nodeStat; } catch (KeeperException e) { this.metrics.registerFailedZKCall(); switch (e.code()) { case CONNECTIONLOSS: this.metrics.registerConnectionLossException(); retryOrThrow(retryCounter, e, "setAcl"); break; case OPERATIONTIMEOUT: this.metrics.registerOperationTimeoutException(); retryOrThrow(retryCounter, e, "setAcl"); break; default: throw e; } } retryCounter.sleepUntilNextRetry(); } } finally { if (traceScope != null) traceScope.close(); } }
Stat function(String path, List<ACL> acls, int version) throws KeeperException, InterruptedException { TraceScope traceScope = null; try { traceScope = Trace.startSpan(STR); RetryCounter retryCounter = retryCounterFactory.create(); while (true) { try { long startTime = EnvironmentEdgeManager.currentTime(); Stat nodeStat = checkZk().setACL(path, acls, version); this.metrics.registerWriteOperationLatency(Math.min(EnvironmentEdgeManager.currentTime() - startTime, 1)); return nodeStat; } catch (KeeperException e) { this.metrics.registerFailedZKCall(); switch (e.code()) { case CONNECTIONLOSS: this.metrics.registerConnectionLossException(); retryOrThrow(retryCounter, e, STR); break; case OPERATIONTIMEOUT: this.metrics.registerOperationTimeoutException(); retryOrThrow(retryCounter, e, STR); break; default: throw e; } } retryCounter.sleepUntilNextRetry(); } } finally { if (traceScope != null) traceScope.close(); } }
/** * setAcl is an idempotent operation. Retry before throwing exception * @return list of ACLs */
setAcl is an idempotent operation. Retry before throwing exception
setAcl
{ "repo_name": "JingchengDu/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java", "license": "apache-2.0", "size": 34075 }
[ "java.util.List", "org.apache.hadoop.hbase.util.EnvironmentEdgeManager", "org.apache.hadoop.hbase.util.RetryCounter", "org.apache.htrace.Trace", "org.apache.htrace.TraceScope", "org.apache.zookeeper.KeeperException", "org.apache.zookeeper.data.Stat" ]
import java.util.List; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.RetryCounter; import org.apache.htrace.Trace; import org.apache.htrace.TraceScope; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat;
import java.util.*; import org.apache.hadoop.hbase.util.*; import org.apache.htrace.*; import org.apache.zookeeper.*; import org.apache.zookeeper.data.*;
[ "java.util", "org.apache.hadoop", "org.apache.htrace", "org.apache.zookeeper" ]
java.util; org.apache.hadoop; org.apache.htrace; org.apache.zookeeper;
1,426,217
public void testHasNonnegativePayrollAmount_No() throws Exception { String testTarget = "hasNonnegativePayrollAmount.no."; EffortCertificationDocument document = this.loadEffortCertificationDocument(testTarget); List<EffortCertificationDetail> details = document.getEffortCertificationDetailLines(); for (EffortCertificationDetail detailLine : details) { assertFalse(EffortCertificationDocumentRuleUtil.hasNonnegativePayrollAmount(detailLine)); } }
void function() throws Exception { String testTarget = STR; EffortCertificationDocument document = this.loadEffortCertificationDocument(testTarget); List<EffortCertificationDetail> details = document.getEffortCertificationDetailLines(); for (EffortCertificationDetail detailLine : details) { assertFalse(EffortCertificationDocumentRuleUtil.hasNonnegativePayrollAmount(detailLine)); } }
/** * the payroll amount of the detail line is a negatitive number */
the payroll amount of the detail line is a negatitive number
testHasNonnegativePayrollAmount_No
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "test/unit/src/org/kuali/kfs/module/ec/document/validation/impl/EffortCertificationDocumentRuleUtilTest.java", "license": "agpl-3.0", "size": 30412 }
[ "java.util.List", "org.kuali.kfs.module.ec.businessobject.EffortCertificationDetail", "org.kuali.kfs.module.ec.document.EffortCertificationDocument" ]
import java.util.List; import org.kuali.kfs.module.ec.businessobject.EffortCertificationDetail; import org.kuali.kfs.module.ec.document.EffortCertificationDocument;
import java.util.*; import org.kuali.kfs.module.ec.businessobject.*; import org.kuali.kfs.module.ec.document.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,505,644
public Reader getCharacterStream() throws SQLException { return this.clob.getCharacterStream(); }
Reader function() throws SQLException { return this.clob.getCharacterStream(); }
/** * Retrieves the <code>CLOB</code> value designated by this * <code>Clob</code> object as a <code>java.io.Reader</code> object (or as a * stream of characters). * * @return a <code>java.io.Reader</code> object containing the * <code>CLOB</code> data * @exception SQLException * if there is an error accessing the <code>CLOB</code> value * @see #setCharacterStream * @since 1.2 */
Retrieves the <code>CLOB</code> value designated by this <code>Clob</code> object as a <code>java.io.Reader</code> object (or as a stream of characters)
getCharacterStream
{ "repo_name": "abecquereau/awake-file", "path": "src-main/org/kawanfw/commons/jdbc/abstracts/AbstractClob.java", "license": "lgpl-2.1", "size": 12608 }
[ "java.io.Reader", "java.sql.SQLException" ]
import java.io.Reader; import java.sql.SQLException;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
2,426,517
private JScrollPane getScrollPane() { if (scrollPane == null) { scrollPane = new JScrollPane(); scrollPane.setViewportView(getTable()); } return scrollPane; }
JScrollPane function() { if (scrollPane == null) { scrollPane = new JScrollPane(); scrollPane.setViewportView(getTable()); } return scrollPane; }
/** * This method initializes scrollPane * * @return javax.swing.JScrollPane */
This method initializes scrollPane
getScrollPane
{ "repo_name": "bwkimmel/java-util", "path": "src/main/java/ca/eandb/util/progress/ProgressPanel.java", "license": "mit", "size": 3561 }
[ "javax.swing.JScrollPane" ]
import javax.swing.JScrollPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,227,769