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 ManagedClusterInner withSku(ManagedClusterSku sku) {
this.sku = sku;
return this;
} | ManagedClusterInner function(ManagedClusterSku sku) { this.sku = sku; return this; } | /**
* Set the sku property: The managed cluster SKU.
*
* @param sku the sku value to set.
* @return the ManagedClusterInner object itself.
*/ | Set the sku property: The managed cluster SKU | withSku | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/fluent/models/ManagedClusterInner.java",
"license": "mit",
"size": 31519
} | [
"com.azure.resourcemanager.containerservice.models.ManagedClusterSku"
] | import com.azure.resourcemanager.containerservice.models.ManagedClusterSku; | import com.azure.resourcemanager.containerservice.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 513,719 |
@Test
public final void equalsIsSymmetricAndTransitive() {
assertEquals("1st vs. 2nd", eq1, eq2);
assertEquals("2nd vs. 1st", eq2, eq1);
assertEquals("1st vs. 3rd", eq1, eq3);
assertEquals("3rd vs. 1st", eq3, eq1);
assertEquals("2nd vs. 3rd", eq2, eq3);
assertEquals("3rd vs. 2nd", eq3, eq2);
}
| final void function() { assertEquals(STR, eq1, eq2); assertEquals(STR, eq2, eq1); assertEquals(STR, eq1, eq3); assertEquals(STR, eq3, eq1); assertEquals(STR, eq2, eq3); assertEquals(STR, eq3, eq2); } | /**
* Tests whether <code>equals</code> is <em>symmetric</em> and
* <em>transitive</em>.
*/ | Tests whether <code>equals</code> is symmetric and transitive | equalsIsSymmetricAndTransitive | {
"repo_name": "link-intersystems/lis-commons",
"path": "lis-commons-lang/src/test/java/com/link_intersystems/EqualsAndHashCodeTest.java",
"license": "apache-2.0",
"size": 6785
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 539,888 |
public Observable<ServiceResponse<FrontendIPConfigurationInner>> getWithServiceResponseAsync(String resourceGroupName, String loadBalancerName, String frontendIPConfigurationName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (loadBalancerName == null) {
throw new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.");
}
if (frontendIPConfigurationName == null) {
throw new IllegalArgumentException("Parameter frontendIPConfigurationName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<FrontendIPConfigurationInner>> function(String resourceGroupName, String loadBalancerName, String frontendIPConfigurationName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (loadBalancerName == null) { throw new IllegalArgumentException(STR); } if (frontendIPConfigurationName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Gets load balancer frontend IP configuration.
*
* @param resourceGroupName The name of the resource group.
* @param loadBalancerName The name of the load balancer.
* @param frontendIPConfigurationName The name of the frontend IP configuration.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the FrontendIPConfigurationInner object
*/ | Gets load balancer frontend IP configuration | getWithServiceResponseAsync | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancerFrontendIPConfigurationsInner.java",
"license": "mit",
"size": 23152
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,779,419 |
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
if (fData == null) {
fData = new StringBuffer(length);
}
fData.append(ch, start, length);
}
| void function(char[] ch, int start, int length) throws SAXException { if (fData == null) { fData = new StringBuffer(length); } fData.append(ch, start, length); } | /**
* parse an unlimited amount of characters between 2 enclosing XML-Tags
*
* @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
*/ | parse an unlimited amount of characters between 2 enclosing XML-Tags | characters | {
"repo_name": "abdollahpour/xweb-wiki",
"path": "src/main/java/info/bliki/api/AbstractXMLParser.java",
"license": "lgpl-3.0",
"size": 1973
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,890,145 |
@Override
public Method resolveAction(DefaultActionContext ctx) {
if (ctx.getModelName() != null && !ctx.getModelName().isEmpty()) {
return (nextResolver == null) ? null : nextResolver.resolveAction(ctx);
}
// set attribute to avoid null point exception at RequestHandler
ctx.setModelName(MODELNAME);
ctx.setActionName(ACTION);
// Find out if user actions for this request exists
Reflections reflections = Reflections.collect();
Set<Method> hpActions = reflections
.getMethodsAnnotatedWith(HomePageAction.class);
if (!hpActions.isEmpty()) {
if (hpActions.size() > 1) {
LOGGER.warn("Multiple user actions for homepage, no automatic resolution possible!");
return findMethodInClass(ControllerHelper.findErrorController(),
DefaultErrorController.MULTIPLE_HOMEPAGE_ACTIONS);
} else {
return hpActions.iterator().next();
}
}
Method action = findMethodInClass(MainPageController.class,
ctx.getActionName());
if (action != null) {
return action;
}
LOGGER.debug("ControllerList Method cannot found in MainPageController.",
MainPageController.class, ACTION);
return null;
} | Method function(DefaultActionContext ctx) { if (ctx.getModelName() != null && !ctx.getModelName().isEmpty()) { return (nextResolver == null) ? null : nextResolver.resolveAction(ctx); } ctx.setModelName(MODELNAME); ctx.setActionName(ACTION); Reflections reflections = Reflections.collect(); Set<Method> hpActions = reflections .getMethodsAnnotatedWith(HomePageAction.class); if (!hpActions.isEmpty()) { if (hpActions.size() > 1) { LOGGER.warn(STR); return findMethodInClass(ControllerHelper.findErrorController(), DefaultErrorController.MULTIPLE_HOMEPAGE_ACTIONS); } else { return hpActions.iterator().next(); } } Method action = findMethodInClass(MainPageController.class, ctx.getActionName()); if (action != null) { return action; } LOGGER.debug(STR, MainPageController.class, ACTION); return null; } | /**
* Returns MainPageController if modelName is empty or asking the
* next resolver.
*
* @param ctx the current action context
* @return method reference
*/ | Returns MainPageController if modelName is empty or asking the next resolver | resolveAction | {
"repo_name": "mheck136/TUB_RPWF",
"path": "RPWF_Core/src/main/java/org/rpwf/controller/resolver/MainPageControllerResolver.java",
"license": "mit",
"size": 2655
} | [
"java.lang.reflect.Method",
"java.util.Set",
"org.reflections.Reflections",
"org.rpwf.action.DefaultActionContext",
"org.rpwf.controller.annotation.HomePageAction",
"org.rpwf.controller.standard.DefaultErrorController",
"org.rpwf.controller.standard.MainPageController",
"org.rpwf.util.ControllerHelper... | import java.lang.reflect.Method; import java.util.Set; import org.reflections.Reflections; import org.rpwf.action.DefaultActionContext; import org.rpwf.controller.annotation.HomePageAction; import org.rpwf.controller.standard.DefaultErrorController; import org.rpwf.controller.standard.MainPageController; import org.rpwf.util.ControllerHelper; | import java.lang.reflect.*; import java.util.*; import org.reflections.*; import org.rpwf.action.*; import org.rpwf.controller.annotation.*; import org.rpwf.controller.standard.*; import org.rpwf.util.*; | [
"java.lang",
"java.util",
"org.reflections",
"org.rpwf.action",
"org.rpwf.controller",
"org.rpwf.util"
] | java.lang; java.util; org.reflections; org.rpwf.action; org.rpwf.controller; org.rpwf.util; | 778,568 |
@SuppressWarnings("rawtypes")
@Test
public void testMath70LocalOutputs() throws Exception {
AstorMain main1 = new AstorMain();
CommandSummary cs = MathCommandsTests.getMath70Command();
cs.command.put("-stopfirst", "true");
System.out.println(Arrays.toString(cs.flat()));
main1.execute(cs.flat());
List<ProgramVariant> solutions = main1.getEngine().getSolutions();
assertTrue(solutions.size() > 0);
assertEquals(1, solutions.size());
Stats stats = Stats.getCurrentStat();
assertNotNull(stats);
String jsonpath = main1.getEngine().getProjectFacade().getProperties().getWorkingDirRoot() + File.separator
+ ConfigurationProperties.getProperty("jsonoutputname") + ".json";
File filejson = new File(jsonpath);
assertTrue(filejson.exists());
JSONParser parser = new JSONParser();
Object obj = parser.parse(new FileReader(filejson));
JSONObject jsonroot = (JSONObject) obj;
// loop array
JSONArray msg = (JSONArray) jsonroot.get("patches");
assertEquals(1, msg.size());
JSONObject pob = (JSONObject) msg.get(0);
JSONArray hunks = (JSONArray) pob.get("patchhunks");
assertEquals(1, hunks.size());
JSONObject hunkob = (JSONObject) hunks.get(0);
assertEquals("return solve(f, min, max)", hunkob.get(HunkStatEnum.PATCH_HUNK_CODE.name()));
assertEquals("return solve(min, max)", hunkob.get(HunkStatEnum.ORIGINAL_CODE.name()));
// Test API
assertEquals(1, main1.getEngine().getPatchInfo().size());
PatchStat patchstats = main1.getEngine().getPatchInfo().get(0);
List<PatchHunkStats> hunksApi = (List<PatchHunkStats>) patchstats.getStats().get(PatchStatEnum.HUNKS);
assertNotNull(hunksApi);
PatchHunkStats hunkStats = hunksApi.get(0);
assertNotNull(hunkStats);
assertEquals("return solve(f, min, max)", hunkStats.getStats().get(HunkStatEnum.PATCH_HUNK_CODE));
assertEquals("return solve(min, max)", hunkStats.getStats().get(HunkStatEnum.ORIGINAL_CODE));
assertNotNull(hunkStats.getStats().get(HunkStatEnum.PATH));
assertFalse(hunkStats.getStats().get(HunkStatEnum.PATH).toString().isEmpty());
} | @SuppressWarnings(STR) void function() throws Exception { AstorMain main1 = new AstorMain(); CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put(STR, "true"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); List<ProgramVariant> solutions = main1.getEngine().getSolutions(); assertTrue(solutions.size() > 0); assertEquals(1, solutions.size()); Stats stats = Stats.getCurrentStat(); assertNotNull(stats); String jsonpath = main1.getEngine().getProjectFacade().getProperties().getWorkingDirRoot() + File.separator + ConfigurationProperties.getProperty(STR) + ".json"; File filejson = new File(jsonpath); assertTrue(filejson.exists()); JSONParser parser = new JSONParser(); Object obj = parser.parse(new FileReader(filejson)); JSONObject jsonroot = (JSONObject) obj; JSONArray msg = (JSONArray) jsonroot.get(STR); assertEquals(1, msg.size()); JSONObject pob = (JSONObject) msg.get(0); JSONArray hunks = (JSONArray) pob.get(STR); assertEquals(1, hunks.size()); JSONObject hunkob = (JSONObject) hunks.get(0); assertEquals(STR, hunkob.get(HunkStatEnum.PATCH_HUNK_CODE.name())); assertEquals(STR, hunkob.get(HunkStatEnum.ORIGINAL_CODE.name())); assertEquals(1, main1.getEngine().getPatchInfo().size()); PatchStat patchstats = main1.getEngine().getPatchInfo().get(0); List<PatchHunkStats> hunksApi = (List<PatchHunkStats>) patchstats.getStats().get(PatchStatEnum.HUNKS); assertNotNull(hunksApi); PatchHunkStats hunkStats = hunksApi.get(0); assertNotNull(hunkStats); assertEquals(STR, hunkStats.getStats().get(HunkStatEnum.PATCH_HUNK_CODE)); assertEquals(STR, hunkStats.getStats().get(HunkStatEnum.ORIGINAL_CODE)); assertNotNull(hunkStats.getStats().get(HunkStatEnum.PATH)); assertFalse(hunkStats.getStats().get(HunkStatEnum.PATH).toString().isEmpty()); } | /**
* Math 70 bug can be fixed by replacing a method invocation inside a return
* statement. + return solve(f, min, max); - return solve(min, max); One
* solution with local scope, another with package This test validates the stats
* via API and JSON
*
* @throws Exception
*/ | Math 70 bug can be fixed by replacing a method invocation inside a return statement. + return solve(f, min, max); - return solve(min, max); One solution with local scope, another with package This test validates the stats via API and JSON | testMath70LocalOutputs | {
"repo_name": "martingwhite/astor",
"path": "src/test/java/fr/inria/astor/test/repair/core/OutputTest.java",
"license": "gpl-2.0",
"size": 13873
} | [
"fr.inria.astor.core.entities.ProgramVariant",
"fr.inria.astor.core.setup.ConfigurationProperties",
"fr.inria.astor.core.stats.PatchHunkStats",
"fr.inria.astor.core.stats.PatchStat",
"fr.inria.astor.core.stats.Stats",
"fr.inria.astor.test.repair.evaluation.regression.MathCommandsTests",
"fr.inria.main.C... | import fr.inria.astor.core.entities.ProgramVariant; import fr.inria.astor.core.setup.ConfigurationProperties; import fr.inria.astor.core.stats.PatchHunkStats; import fr.inria.astor.core.stats.PatchStat; import fr.inria.astor.core.stats.Stats; import fr.inria.astor.test.repair.evaluation.regression.MathCommandsTests; import fr.inria.main.CommandSummary; import fr.inria.main.evolution.AstorMain; import java.io.File; import java.io.FileReader; import java.util.Arrays; import java.util.List; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.junit.Assert; | import fr.inria.astor.core.entities.*; import fr.inria.astor.core.setup.*; import fr.inria.astor.core.stats.*; import fr.inria.astor.test.repair.evaluation.regression.*; import fr.inria.main.*; import fr.inria.main.evolution.*; import java.io.*; import java.util.*; import org.json.simple.*; import org.json.simple.parser.*; import org.junit.*; | [
"fr.inria.astor",
"fr.inria.main",
"java.io",
"java.util",
"org.json.simple",
"org.junit"
] | fr.inria.astor; fr.inria.main; java.io; java.util; org.json.simple; org.junit; | 2,289,201 |
@Test
public void test_validateStringContent_stringNull_succeeds() {
try {
Expectation expectation = new ResponseFullExpectation(action, Constants.STRING_NULL, searchFor, failureMsg);
String contentToValidate = null;
utils.validateStringContent(expectation, contentToValidate);
} catch (Throwable t) {
outputMgr.failWithThrowable(testName.getMethodName(), t);
}
} | void function() { try { Expectation expectation = new ResponseFullExpectation(action, Constants.STRING_NULL, searchFor, failureMsg); String contentToValidate = null; utils.validateStringContent(expectation, contentToValidate); } catch (Throwable t) { outputMgr.failWithThrowable(testName.getMethodName(), t); } } | /**
* Tests:
* - Expectation check type: Null
* - Content to validate: Null
* Expects:
* - Assertion should succeed
*/ | Tests: - Expectation check type: Null - Content to validate: Null Expects: - Assertion should succeed | test_validateStringContent_stringNull_succeeds | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.fat.common/test/com/ibm/ws/security/fat/common/validation/TestValidationUtilsTest.java",
"license": "epl-1.0",
"size": 91503
} | [
"com.ibm.ws.security.fat.common.Constants",
"com.ibm.ws.security.fat.common.expectations.Expectation",
"com.ibm.ws.security.fat.common.expectations.ResponseFullExpectation"
] | import com.ibm.ws.security.fat.common.Constants; import com.ibm.ws.security.fat.common.expectations.Expectation; import com.ibm.ws.security.fat.common.expectations.ResponseFullExpectation; | import com.ibm.ws.security.fat.common.*; import com.ibm.ws.security.fat.common.expectations.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,393,312 |
@Override
public Session createSession(final boolean transacted, final int acknowledgeMode) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("createSession(" + transacted + ", " + acknowledgeMode + ")");
}
checkClosed();
return allocateConnection(transacted, acknowledgeMode, type);
} | Session function(final boolean transacted, final int acknowledgeMode) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace(STR + transacted + STR + acknowledgeMode + ")"); } checkClosed(); return allocateConnection(transacted, acknowledgeMode, type); } | /**
* Create a session
*
* @param transacted Use transactions
* @param acknowledgeMode The acknowledge mode
* @return The session
* @throws JMSException Thrown if an error occurs
*/ | Create a session | createSession | {
"repo_name": "kjniemi/activemq-artemis",
"path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java",
"license": "apache-2.0",
"size": 32007
} | [
"javax.jms.JMSException",
"javax.jms.Session"
] | import javax.jms.JMSException; import javax.jms.Session; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 541,176 |
public static int writeMessageFully(Message msg, OutputStream out, ByteBuffer buf,
MessageWriter writer) throws IOException {
assert msg != null;
assert out != null;
assert buf != null;
assert buf.hasArray();
if (writer != null)
writer.setCurrentWriteClass(msg.getClass());
boolean finished = false;
int cnt = 0;
while (!finished) {
finished = msg.writeTo(buf, writer);
out.write(buf.array(), 0, buf.position());
cnt += buf.position();
buf.clear();
}
return cnt;
} | static int function(Message msg, OutputStream out, ByteBuffer buf, MessageWriter writer) throws IOException { assert msg != null; assert out != null; assert buf != null; assert buf.hasArray(); if (writer != null) writer.setCurrentWriteClass(msg.getClass()); boolean finished = false; int cnt = 0; while (!finished) { finished = msg.writeTo(buf, writer); out.write(buf.array(), 0, buf.position()); cnt += buf.position(); buf.clear(); } return cnt; } | /**
* Fully writes communication message to provided stream.
*
* @param msg Message.
* @param out Stream to write to.
* @param buf Byte buffer that will be passed to {@link Message#writeTo(ByteBuffer, MessageWriter)} method.
* @param writer Message writer.
* @return Number of written bytes.
* @throws IOException In case of error.
*/ | Fully writes communication message to provided stream | writeMessageFully | {
"repo_name": "apache/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 387878
} | [
"java.io.IOException",
"java.io.OutputStream",
"java.nio.ByteBuffer",
"org.apache.ignite.plugin.extensions.communication.Message",
"org.apache.ignite.plugin.extensions.communication.MessageWriter"
] | import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.plugin.extensions.communication.MessageWriter; | import java.io.*; import java.nio.*; import org.apache.ignite.plugin.extensions.communication.*; | [
"java.io",
"java.nio",
"org.apache.ignite"
] | java.io; java.nio; org.apache.ignite; | 1,234,900 |
public WebPage afterDelete(); | WebPage function(); | /**
* Will be called directly after deleting the data object (delete or update deleted=true). Any return value is not yet supported.
*/ | Will be called directly after deleting the data object (delete or update deleted=true). Any return value is not yet supported | afterDelete | {
"repo_name": "developerleo/ProjectForge-2nd",
"path": "src/main/java/org/projectforge/web/wicket/IEditPage.java",
"license": "gpl-3.0",
"size": 4949
} | [
"org.apache.wicket.markup.html.WebPage"
] | import org.apache.wicket.markup.html.WebPage; | import org.apache.wicket.markup.html.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 621,668 |
@UpdateProvider(type=LdHomeWorkSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(LdHomeWork record); | @UpdateProvider(type=LdHomeWorkSqlProvider.class, method=STR) int updateByPrimaryKeySelective(LdHomeWork record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ld_homework
*
* @mbg.generated
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table ld_homework | updateByPrimaryKeySelective | {
"repo_name": "upup1000/spring",
"path": "spring-09/target/classes/edu/ldcollege/mapping/LdHomeWorkMapper.java",
"license": "apache-2.0",
"size": 7488
} | [
"edu.ldcollege.domain.LdHomeWork",
"org.apache.ibatis.annotations.UpdateProvider"
] | import edu.ldcollege.domain.LdHomeWork; import org.apache.ibatis.annotations.UpdateProvider; | import edu.ldcollege.domain.*; import org.apache.ibatis.annotations.*; | [
"edu.ldcollege.domain",
"org.apache.ibatis"
] | edu.ldcollege.domain; org.apache.ibatis; | 1,634,829 |
public Builder name(String displayName) {
this.displayName = Objects.requireNonNull(displayName);
return this;
} | Builder function(String displayName) { this.displayName = Objects.requireNonNull(displayName); return this; } | /**
* Set "dn" parameter.
* Caller must NOT perform URL encoding, otherwise the value will get encoded twice.
*
* @param displayName Suggested display name
* @since 1.3
*/ | Set "dn" parameter. Caller must NOT perform URL encoding, otherwise the value will get encoded twice | name | {
"repo_name": "atomashpolskiy/bt",
"path": "bt-core/src/main/java/bt/magnet/MagnetUri.java",
"license": "apache-2.0",
"size": 5145
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 1,871,809 |
public void getIccCardStatus(Message result);
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE} | void function(Message result); /** * Return if the current radio is LTE on CDMA. This * is a tri-state return value as for a period of time * the mode may be unknown. * * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE} * or {@link PhoneConstants#LTE_ON_CDMA_TRUE} | /**
* Request the status of the ICC and UICC cards.
*
* @param result
* Callback message containing {@link IccCardStatus} structure for the card.
*/ | Request the status of the ICC and UICC cards | getIccCardStatus | {
"repo_name": "indashnet/InDashNet.Open.UN2000",
"path": "android/frameworks/opt/telephony/src/java/com/android/internal/telephony/CommandsInterface.java",
"license": "apache-2.0",
"size": 60442
} | [
"android.os.Message"
] | import android.os.Message; | import android.os.*; | [
"android.os"
] | android.os; | 1,621,264 |
public byte[] generateSignature()
throws CryptoException, DataLengthException
{
if (!forSigning)
{
throw new IllegalStateException("GenericSigner not initialised for signature generation.");
}
byte[] hash = new byte[digest.getDigestSize()];
digest.doFinal(hash, 0);
try {
return smartcard.encryptBlock(hash, 0, hash.length);
} catch (Exception e) {
throw new CryptoException("unable to encode signature: " + e.getMessage(), e);
}
} | byte[] function() throws CryptoException, DataLengthException { if (!forSigning) { throw new IllegalStateException(STR); } byte[] hash = new byte[digest.getDigestSize()]; digest.doFinal(hash, 0); try { return smartcard.encryptBlock(hash, 0, hash.length); } catch (Exception e) { throw new CryptoException(STR + e.getMessage(), e); } } | /**
* Generate a signature for the message we've been loaded with using the key
* we were initialised with.
*/ | Generate a signature for the message we've been loaded with using the key we were initialised with | generateSignature | {
"repo_name": "matthewcaperon/contactless-tls",
"path": "lib-cltls/src/com/microexpert/cltls/core/SmartcardGenericSigner.java",
"license": "mit",
"size": 3415
} | [
"org.spongycastle.crypto.CryptoException",
"org.spongycastle.crypto.DataLengthException"
] | import org.spongycastle.crypto.CryptoException; import org.spongycastle.crypto.DataLengthException; | import org.spongycastle.crypto.*; | [
"org.spongycastle.crypto"
] | org.spongycastle.crypto; | 1,112,739 |
void setDate(Calendar date); | void setDate(Calendar date); | /**
* Modifie la date de ce statut.
* @param date la nouvelle date du statut.
*/ | Modifie la date de ce statut | setDate | {
"repo_name": "Parkidia/GestionParking_JEE",
"path": "EJB/src/com/parkidia/modeles/place/statut/IStatutId.java",
"license": "apache-2.0",
"size": 773
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,009,712 |
public CompletableFuture<?> cancel() {
// to avoid any case of mixup in the presence of concurrent calls,
// we copy a reference to the stack to make sure both calls go to the same Execution
final Execution exec = currentExecution;
exec.cancel();
return exec.getReleaseFuture();
} | CompletableFuture<?> function() { final Execution exec = currentExecution; exec.cancel(); return exec.getReleaseFuture(); } | /**
* Cancels this ExecutionVertex.
*
* @return A future that completes once the execution has reached its final state.
*/ | Cancels this ExecutionVertex | cancel | {
"repo_name": "kl0u/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java",
"license": "apache-2.0",
"size": 29710
} | [
"java.util.concurrent.CompletableFuture"
] | import java.util.concurrent.CompletableFuture; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,526,052 |
public void postGetClosestRowBefore(final RegionCoprocessorEnvironment e,
final byte [] row, final byte [] family, final Result result)
throws IOException; | void function(final RegionCoprocessorEnvironment e, final byte [] row, final byte [] family, final Result result) throws IOException; | /**
* Called after a client makes a GetClosestRowBefore request.
* <p>
* Call CoprocessorEnvironment#complete to skip any subsequent chained
* coprocessors
* @param e the environment provided by the region server
* @param row the row
* @param family the desired family
* @param result the result to return to the client, modify as necessary
* @throws IOException if an error occurred on the coprocessor
*/ | Called after a client makes a GetClosestRowBefore request. Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors | postGetClosestRowBefore | {
"repo_name": "centiteo/hbase",
"path": "src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java",
"license": "apache-2.0",
"size": 20383
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.client.Result"
] | import java.io.IOException; import org.apache.hadoop.hbase.client.Result; | import java.io.*; import org.apache.hadoop.hbase.client.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,564,963 |
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
this.field_149394_a = p_148837_1_.readInt();
this.field_149392_b = p_148837_1_.readShort();
this.field_149393_c = p_148837_1_.readItemStackFromBuffer();
} | void function(PacketBuffer p_148837_1_) throws IOException { this.field_149394_a = p_148837_1_.readInt(); this.field_149392_b = p_148837_1_.readShort(); this.field_149393_c = p_148837_1_.readItemStackFromBuffer(); } | /**
* Reads the raw packet data from the data stream.
*/ | Reads the raw packet data from the data stream | readPacketData | {
"repo_name": "mviitanen/marsmod",
"path": "mcp/src/minecraft/net/minecraft/network/play/server/S04PacketEntityEquipment.java",
"license": "gpl-2.0",
"size": 2338
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 1,242,551 |
// Parse the pattern
// -----------------------------------------------------------------------
protected List<Rule> parsePattern() {
final DateFormatSymbols symbols = new DateFormatSymbols(mLocale);
final List<Rule> rules = new ArrayList<Rule>();
final String[] ERAs = symbols.getEras();
final String[] months = symbols.getMonths();
final String[] shortMonths = symbols.getShortMonths();
final String[] weekdays = symbols.getWeekdays();
final String[] shortWeekdays = symbols.getShortWeekdays();
final String[] AmPmStrings = symbols.getAmPmStrings();
final int length = mPattern.length();
final int[] indexRef = new int[1];
for (int i = 0; i < length; i++) {
indexRef[0] = i;
final String token = parseToken(mPattern, indexRef);
i = indexRef[0];
final int tokenLen = token.length();
if (tokenLen == 0) {
break;
}
Rule rule;
final char c = token.charAt(0);
switch (c) {
case 'G': // era designator (text)
rule = new TextField(Calendar.ERA, ERAs);
break;
case 'y': // year (number)
if (tokenLen == 2) {
rule = TwoDigitYearField.INSTANCE;
} else {
rule = selectNumberRule(Calendar.YEAR, tokenLen < 4 ? 4 : tokenLen);
}
break;
case 'M': // month in year (text and number)
if (tokenLen >= 4) {
rule = new TextField(Calendar.MONTH, months);
} else if (tokenLen == 3) {
rule = new TextField(Calendar.MONTH, shortMonths);
} else if (tokenLen == 2) {
rule = TwoDigitMonthField.INSTANCE;
} else {
rule = UnpaddedMonthField.INSTANCE;
}
break;
case 'd': // day in month (number)
rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen);
break;
case 'h': // hour in am/pm (number, 1..12)
rule = new TwelveHourField(selectNumberRule(Calendar.HOUR, tokenLen));
break;
case 'H': // hour in day (number, 0..23)
rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen);
break;
case 'm': // minute in hour (number)
rule = selectNumberRule(Calendar.MINUTE, tokenLen);
break;
case 's': // second in minute (number)
rule = selectNumberRule(Calendar.SECOND, tokenLen);
break;
case 'S': // millisecond (number)
rule = selectNumberRule(Calendar.MILLISECOND, tokenLen);
break;
case 'E': // day in week (text)
rule = new TextField(Calendar.DAY_OF_WEEK, tokenLen < 4 ? shortWeekdays : weekdays);
break;
case 'D': // day in year (number)
rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen);
break;
case 'F': // day of week in month (number)
rule = selectNumberRule(Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen);
break;
case 'w': // week in year (number)
rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen);
break;
case 'W': // week in month (number)
rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen);
break;
case 'a': // am/pm marker (text)
rule = new TextField(Calendar.AM_PM, AmPmStrings);
break;
case 'k': // hour in day (1..24)
rule = new TwentyFourHourField(selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen));
break;
case 'K': // hour in am/pm (0..11)
rule = selectNumberRule(Calendar.HOUR, tokenLen);
break;
case 'u': // day of week (1..7)
rule = selectNumberRule(Calendar.DAY_OF_WEEK, tokenLen);
break;
case 'X': // ISO 8601
rule = Iso8601_Rule.getRule(tokenLen);
break;
case 'z': // time zone (text)
if (tokenLen >= 4) {
rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG);
} else {
rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.SHORT);
}
break;
case 'Z': // time zone (value)
if (tokenLen == 1) {
rule = TimeZoneNumberRule.INSTANCE_NO_COLON;
} else if (tokenLen == 2) {
rule = Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES;
} else {
rule = TimeZoneNumberRule.INSTANCE_COLON;
}
break;
case '\'': // literal text
final String sub = token.substring(1);
if (sub.length() == 1) {
rule = new CharacterLiteral(sub.charAt(0));
} else {
rule = new StringLiteral(sub);
}
break;
default:
throw new IllegalArgumentException("Illegal pattern component: " + token);
}
rules.add(rule);
}
return rules;
} | List<Rule> function() { final DateFormatSymbols symbols = new DateFormatSymbols(mLocale); final List<Rule> rules = new ArrayList<Rule>(); final String[] ERAs = symbols.getEras(); final String[] months = symbols.getMonths(); final String[] shortMonths = symbols.getShortMonths(); final String[] weekdays = symbols.getWeekdays(); final String[] shortWeekdays = symbols.getShortWeekdays(); final String[] AmPmStrings = symbols.getAmPmStrings(); final int length = mPattern.length(); final int[] indexRef = new int[1]; for (int i = 0; i < length; i++) { indexRef[0] = i; final String token = parseToken(mPattern, indexRef); i = indexRef[0]; final int tokenLen = token.length(); if (tokenLen == 0) { break; } Rule rule; final char c = token.charAt(0); switch (c) { case 'G': rule = new TextField(Calendar.ERA, ERAs); break; case 'y': if (tokenLen == 2) { rule = TwoDigitYearField.INSTANCE; } else { rule = selectNumberRule(Calendar.YEAR, tokenLen < 4 ? 4 : tokenLen); } break; case 'M': if (tokenLen >= 4) { rule = new TextField(Calendar.MONTH, months); } else if (tokenLen == 3) { rule = new TextField(Calendar.MONTH, shortMonths); } else if (tokenLen == 2) { rule = TwoDigitMonthField.INSTANCE; } else { rule = UnpaddedMonthField.INSTANCE; } break; case 'd': rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen); break; case 'h': rule = new TwelveHourField(selectNumberRule(Calendar.HOUR, tokenLen)); break; case 'H': rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen); break; case 'm': rule = selectNumberRule(Calendar.MINUTE, tokenLen); break; case 's': rule = selectNumberRule(Calendar.SECOND, tokenLen); break; case 'S': rule = selectNumberRule(Calendar.MILLISECOND, tokenLen); break; case 'E': rule = new TextField(Calendar.DAY_OF_WEEK, tokenLen < 4 ? shortWeekdays : weekdays); break; case 'D': rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen); break; case 'F': rule = selectNumberRule(Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen); break; case 'w': rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen); break; case 'W': rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen); break; case 'a': rule = new TextField(Calendar.AM_PM, AmPmStrings); break; case 'k': rule = new TwentyFourHourField(selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen)); break; case 'K': rule = selectNumberRule(Calendar.HOUR, tokenLen); break; case 'u': rule = selectNumberRule(Calendar.DAY_OF_WEEK, tokenLen); break; case 'X': rule = Iso8601_Rule.getRule(tokenLen); break; case 'z': if (tokenLen >= 4) { rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG); } else { rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.SHORT); } break; case 'Z': if (tokenLen == 1) { rule = TimeZoneNumberRule.INSTANCE_NO_COLON; } else if (tokenLen == 2) { rule = Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES; } else { rule = TimeZoneNumberRule.INSTANCE_COLON; } break; case '\'': final String sub = token.substring(1); if (sub.length() == 1) { rule = new CharacterLiteral(sub.charAt(0)); } else { rule = new StringLiteral(sub); } break; default: throw new IllegalArgumentException(STR + token); } rules.add(rule); } return rules; } | /**
* <p>
* Returns a list of Rules given a pattern.
* </p>
*
* @return a {@code List} of Rule objects
* @throws IllegalArgumentException if pattern is invalid
*/ | Returns a list of Rules given a pattern. | parsePattern | {
"repo_name": "SourceStudyNotes/log4j2",
"path": "src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java",
"license": "apache-2.0",
"size": 41597
} | [
"java.text.DateFormatSymbols",
"java.util.ArrayList",
"java.util.Calendar",
"java.util.List",
"java.util.TimeZone"
] | import java.text.DateFormatSymbols; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.TimeZone; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 2,365,270 |
public static String formatToolTip(final Kost2DO kost2)
{
if (kost2 == null) {
return "";
}
final StringBuffer buf = new StringBuffer();
if (StringUtils.isNotBlank(kost2.getDescription()) == true) {
buf.append(kost2.getDescription()).append("; ");
}
if (kost2.getProjekt() != null) {
if (kost2.getProjekt().getKunde() != null) {
buf.append(kost2.getProjekt().getKunde().getKundeIdentifierDisplayName()).append(" - ");
}
buf.append(kost2.getProjekt().getProjektIdentifierDisplayName()).append("; ");
if (kost2.getKost2Art() != null) {
// Nur, wenn Projekt gegeben ist!
buf.append(StringHelper.format2DigitNumber(kost2.getKost2Art().getId())).append(" - ").append(kost2.getKost2Art().getName());
}
}
return buf.toString();
} | static String function(final Kost2DO kost2) { if (kost2 == null) { return STR; STR - STR; STR - ").append(kost2.getKost2Art().getName()); } } return buf.toString(); } | /**
* Format Kost2DO in form (for displaying tool tips):
* <ul>
* <li>Project is given: [description]; [projekt.kunde.name] - [projekt.name]; [kost2Art.id] - [kost2Art.name];</li>
* <li>Project is not given: [description]</li>
* </ul>
* DONT'T forget to escape html if displayed directly!
* @param kost2
* @return formatted string or "" if kost2 is null.
*/ | Format Kost2DO in form (for displaying tool tips): Project is given: [description]; [projekt.kunde.name] - [projekt.name]; [kost2Art.id] - [kost2Art.name]; Project is not given: [description] DONT'T forget to escape html if displayed directly | formatToolTip | {
"repo_name": "micromata/projectforge-webapp",
"path": "src/main/java/org/projectforge/fibu/KostFormatter.java",
"license": "gpl-3.0",
"size": 12521
} | [
"org.projectforge.fibu.kost.Kost2DO"
] | import org.projectforge.fibu.kost.Kost2DO; | import org.projectforge.fibu.kost.*; | [
"org.projectforge.fibu"
] | org.projectforge.fibu; | 1,896,633 |
@Override
public void walk(Node nd) throws SemanticException {
List<? extends Node> children = nd.getChildren();
// maintain the stack of operators encountered
opStack.push(nd);
Boolean skip = dispatchAndReturn(nd, opStack);
// save some positional state
Operator<? extends OperatorDesc> currentRoot = ctx.currentRootOperator;
Operator<? extends OperatorDesc> parentOfRoot = ctx.parentOfRoot;
BaseWork preceedingWork = ctx.preceedingWork;
if (skip == null || !skip) {
// move all the children to the front of queue
for (Node ch : children) {
// and restore the state before walking each child
ctx.currentRootOperator = currentRoot;
ctx.parentOfRoot = parentOfRoot;
ctx.preceedingWork = preceedingWork;
walk(ch);
}
}
// done with this operator
opStack.pop();
} | void function(Node nd) throws SemanticException { List<? extends Node> children = nd.getChildren(); opStack.push(nd); Boolean skip = dispatchAndReturn(nd, opStack); Operator<? extends OperatorDesc> currentRoot = ctx.currentRootOperator; Operator<? extends OperatorDesc> parentOfRoot = ctx.parentOfRoot; BaseWork preceedingWork = ctx.preceedingWork; if (skip == null !skip) { for (Node ch : children) { ctx.currentRootOperator = currentRoot; ctx.parentOfRoot = parentOfRoot; ctx.preceedingWork = preceedingWork; walk(ch); } } opStack.pop(); } | /**
* Walk the given operator.
*
* @param nd operator being walked
*/ | Walk the given operator | walk | {
"repo_name": "winningsix/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/parse/spark/GenSparkWorkWalker.java",
"license": "apache-2.0",
"size": 3423
} | [
"java.util.List",
"org.apache.hadoop.hive.ql.exec.Operator",
"org.apache.hadoop.hive.ql.lib.Node",
"org.apache.hadoop.hive.ql.parse.SemanticException",
"org.apache.hadoop.hive.ql.plan.BaseWork",
"org.apache.hadoop.hive.ql.plan.OperatorDesc"
] | import java.util.List; import org.apache.hadoop.hive.ql.exec.Operator; import org.apache.hadoop.hive.ql.lib.Node; import org.apache.hadoop.hive.ql.parse.SemanticException; import org.apache.hadoop.hive.ql.plan.BaseWork; import org.apache.hadoop.hive.ql.plan.OperatorDesc; | import java.util.*; import org.apache.hadoop.hive.ql.exec.*; import org.apache.hadoop.hive.ql.lib.*; import org.apache.hadoop.hive.ql.parse.*; import org.apache.hadoop.hive.ql.plan.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 356,978 |
public static List<FederationModel> getFederationRegistrations(String serverUrl,
String account, char[] password) throws IOException {
String url = asLink(serverUrl, RpcRequest.LIST_FEDERATION_REGISTRATIONS);
Collection<FederationModel> registrations = JsonUtils.retrieveJson(url, REGISTRATIONS_TYPE,
account, password);
List<FederationModel> list = new ArrayList<FederationModel>(registrations);
return list;
}
| static List<FederationModel> function(String serverUrl, String account, char[] password) throws IOException { String url = asLink(serverUrl, RpcRequest.LIST_FEDERATION_REGISTRATIONS); Collection<FederationModel> registrations = JsonUtils.retrieveJson(url, REGISTRATIONS_TYPE, account, password); List<FederationModel> list = new ArrayList<FederationModel>(registrations); return list; } | /**
* Retrieves the list of federation registrations. These are the list of
* registrations that this Gitblit instance is pulling from.
*
* @param serverUrl
* @param account
* @param password
* @return a collection of FederationRegistration objects
* @throws IOException
*/ | Retrieves the list of federation registrations. These are the list of registrations that this Gitblit instance is pulling from | getFederationRegistrations | {
"repo_name": "heavenlyhash/gitblit",
"path": "src/main/java/com/gitblit/utils/RpcUtils.java",
"license": "apache-2.0",
"size": 20704
} | [
"com.gitblit.Constants",
"com.gitblit.models.FederationModel",
"java.io.IOException",
"java.util.ArrayList",
"java.util.Collection",
"java.util.List"
] | import com.gitblit.Constants; import com.gitblit.models.FederationModel; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; | import com.gitblit.*; import com.gitblit.models.*; import java.io.*; import java.util.*; | [
"com.gitblit",
"com.gitblit.models",
"java.io",
"java.util"
] | com.gitblit; com.gitblit.models; java.io; java.util; | 1,571,923 |
public void testConnectionEventListenerIsNull() throws SQLException {
ConnectionPoolDataSource cpds =
J2EEDataSource.getConnectionPoolDataSource();
subtestCloseEventWithNullListener(cpds.getPooledConnection());
subtestErrorEventWithNullListener(cpds.getPooledConnection());
XADataSource xads = J2EEDataSource.getXADataSource();
subtestCloseEventWithNullListener(xads.getXAConnection());
subtestErrorEventWithNullListener(xads.getXAConnection());
} | void function() throws SQLException { ConnectionPoolDataSource cpds = J2EEDataSource.getConnectionPoolDataSource(); subtestCloseEventWithNullListener(cpds.getPooledConnection()); subtestErrorEventWithNullListener(cpds.getPooledConnection()); XADataSource xads = J2EEDataSource.getXADataSource(); subtestCloseEventWithNullListener(xads.getXAConnection()); subtestErrorEventWithNullListener(xads.getXAConnection()); } | /**
* Test that event notification doesn't fail when a null listener has
* been registered (DERBY-3307).
*/ | Test that event notification doesn't fail when a null listener has been registered (DERBY-3307) | testConnectionEventListenerIsNull | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java",
"license": "apache-2.0",
"size": 186130
} | [
"java.sql.SQLException",
"javax.sql.ConnectionPoolDataSource",
"javax.sql.XADataSource",
"org.apache.derbyTesting.junit.J2EEDataSource"
] | import java.sql.SQLException; import javax.sql.ConnectionPoolDataSource; import javax.sql.XADataSource; import org.apache.derbyTesting.junit.J2EEDataSource; | import java.sql.*; import javax.sql.*; import org.apache.*; | [
"java.sql",
"javax.sql",
"org.apache"
] | java.sql; javax.sql; org.apache; | 1,054,650 |
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
} | ItemStack function(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); return par1ItemStack; } | /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ | Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer | onItemRightClick | {
"repo_name": "RedGear/Chateau",
"path": "enosphorous/chateau_romani/items/ItemRedPotion.java",
"license": "epl-1.0",
"size": 3518
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.item.ItemStack",
"net.minecraft.world.World"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; | import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.item; net.minecraft.world; | 1,186,414 |
Reader getReader(InputStream inputstream, String charset, String streamId, IPipeLineSession session) throws SenderException; | Reader getReader(InputStream inputstream, String charset, String streamId, IPipeLineSession session) throws SenderException; | /**
* Obtain a Reader that reads lines in the given characterset.
*/ | Obtain a Reader that reads lines in the given characterset | getReader | {
"repo_name": "smhoekstra/iaf",
"path": "JavaSource/nl/nn/adapterframework/batch/IInputStreamReaderFactory.java",
"license": "apache-2.0",
"size": 1229
} | [
"java.io.InputStream",
"java.io.Reader",
"nl.nn.adapterframework.core.IPipeLineSession",
"nl.nn.adapterframework.core.SenderException"
] | import java.io.InputStream; import java.io.Reader; import nl.nn.adapterframework.core.IPipeLineSession; import nl.nn.adapterframework.core.SenderException; | import java.io.*; import nl.nn.adapterframework.core.*; | [
"java.io",
"nl.nn.adapterframework"
] | java.io; nl.nn.adapterframework; | 2,838,992 |
public void setFocusOnFirstChild() {
View firstChild = getCurrentCellLayout().getChildAt(0, 0);
if (firstChild != null) {
firstChild.requestFocus();
}
} | void function() { View firstChild = getCurrentCellLayout().getChildAt(0, 0); if (firstChild != null) { firstChild.requestFocus(); } } | /**
* Sets the focus on the first visible child.
*/ | Sets the focus on the first visible child | setFocusOnFirstChild | {
"repo_name": "Hapsidra/Chavah",
"path": "Chavah/src/main/java/com/android/chavah/FolderPagedView.java",
"license": "gpl-3.0",
"size": 26438
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 535,096 |
protected List<Found> find(ScopeItems m, String fullRep) {
ArrayList<Found> foundItems = new ArrayList<Found>();
if (m == null) {
return foundItems;
}
int i = fullRep.indexOf('.', 0);
while (i >= 0) {
String sub = fullRep.substring(0, i);
i = fullRep.indexOf('.', i + 1);
foundItems.addAll(m.getAll(sub));
}
foundItems.addAll(m.getAll(fullRep));
return foundItems;
} | List<Found> function(ScopeItems m, String fullRep) { ArrayList<Found> foundItems = new ArrayList<Found>(); if (m == null) { return foundItems; } int i = fullRep.indexOf('.', 0); while (i >= 0) { String sub = fullRep.substring(0, i); i = fullRep.indexOf('.', i + 1); foundItems.addAll(m.getAll(sub)); } foundItems.addAll(m.getAll(fullRep)); return foundItems; } | /**
* Finds an item given its full representation (so, os.path can be found as 'os' and 'os.path')
*/ | Finds an item given its full representation (so, os.path can be found as 'os' and 'os.path') | find | {
"repo_name": "RandallDW/Aruba_plugin",
"path": "plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/scopeanalysis/AbstractScopeAnalyzerVisitor.java",
"license": "epl-1.0",
"size": 53216
} | [
"com.python.pydev.analysis.visitors.Found",
"com.python.pydev.analysis.visitors.ScopeItems",
"java.util.ArrayList",
"java.util.List"
] | import com.python.pydev.analysis.visitors.Found; import com.python.pydev.analysis.visitors.ScopeItems; import java.util.ArrayList; import java.util.List; | import com.python.pydev.analysis.visitors.*; import java.util.*; | [
"com.python.pydev",
"java.util"
] | com.python.pydev; java.util; | 28,114 |
private void initialize() {
Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (REGEXP_KEY.equals(params[i].getType())) {
String pattern = params[i].getValue();
RegularExpression regexp = new RegularExpression();
regexp.setPattern(pattern);
regexps.addElement(regexp);
} else if (NEGATE_KEY.equals(params[i].getType())) {
setNegate(Project.toBoolean(params[i].getValue()));
} else if (CS_KEY.equals(params[i].getType())) {
setCaseSensitive(Project.toBoolean(params[i].getValue()));
}
}
}
} | void function() { Parameter[] params = getParameters(); if (params != null) { for (int i = 0; i < params.length; i++) { if (REGEXP_KEY.equals(params[i].getType())) { String pattern = params[i].getValue(); RegularExpression regexp = new RegularExpression(); regexp.setPattern(pattern); regexps.addElement(regexp); } else if (NEGATE_KEY.equals(params[i].getType())) { setNegate(Project.toBoolean(params[i].getValue())); } else if (CS_KEY.equals(params[i].getType())) { setCaseSensitive(Project.toBoolean(params[i].getValue())); } } } } | /**
* Parses parameters to add user defined regular expressions.
*/ | Parses parameters to add user defined regular expressions | initialize | {
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java",
"license": "mit",
"size": 8118
} | [
"org.apache.tools.ant.Project",
"org.apache.tools.ant.types.Parameter",
"org.apache.tools.ant.types.RegularExpression"
] | import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Parameter; import org.apache.tools.ant.types.RegularExpression; | import org.apache.tools.ant.*; import org.apache.tools.ant.types.*; | [
"org.apache.tools"
] | org.apache.tools; | 2,388,003 |
@Generated
@Selector("allowedTouchTypes")
public native NSArray<? extends NSNumber> allowedTouchTypes(); | @Selector(STR) native NSArray<? extends NSNumber> function(); | /**
* Array of UITouchTypes as NSNumbers.
*/ | Array of UITouchTypes as NSNumbers | allowedTouchTypes | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIGestureRecognizer.java",
"license": "apache-2.0",
"size": 17111
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,591,135 |
//vpj-cd begin e-evolution
public static int getWindow_ID(String windowName) {
int retValue = 0;
String SQL = "SELECT AD_Window_ID FROM AD_Window WHERE Name = ?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(SQL, null);
pstmt.setString(1, windowName);
rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
}
catch (SQLException e)
{
s_log.error(SQL, e);
retValue = -1;
}
finally
{
DB.close(rs, pstmt);
}
return retValue;
}
//end vpj-cd e-evolution
| static int function(String windowName) { int retValue = 0; String SQL = STR; PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(SQL, null); pstmt.setString(1, windowName); rs = pstmt.executeQuery(); if (rs.next()) retValue = rs.getInt(1); } catch (SQLException e) { s_log.error(SQL, e); retValue = -1; } finally { DB.close(rs, pstmt); } return retValue; } | /**
* get Window ID
* @param String windowName
* @return int retValue
*/ | get Window ID | getWindow_ID | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-legacy/org/compiere/model/MWindow.java",
"license": "gpl-2.0",
"size": 6631
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.compiere.util.DB"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.compiere.util.DB; | import java.sql.*; import org.compiere.util.*; | [
"java.sql",
"org.compiere.util"
] | java.sql; org.compiere.util; | 1,780,741 |
protected void generateLookupResultsMessages(Map<String, String> searchCriteria, Collection<?> searchResults,
boolean bounded, Integer searchResultsLimit) {
MessageMap messageMap = GlobalVariables.getMessageMap();
Long searchResultsSize = Long.valueOf(0);
if (searchResults instanceof CollectionIncomplete
&& ((CollectionIncomplete<?>) searchResults).getActualSizeIfTruncated() > 0) {
searchResultsSize = ((CollectionIncomplete<?>) searchResults).getActualSizeIfTruncated();
} else if (searchResults != null) {
searchResultsSize = Long.valueOf(searchResults.size());
}
if (searchResultsSize == 0) {
messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES,
RiceKeyConstants.INFO_LOOKUP_RESULTS_NONE_FOUND);
} else if (searchResultsSize == 1) {
messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES,
RiceKeyConstants.INFO_LOOKUP_RESULTS_DISPLAY_ONE);
} else if (searchResultsSize > 1) {
boolean resultsExceedsLimit =
bounded && (searchResultsLimit != null) && (searchResultsSize > searchResultsLimit);
if (resultsExceedsLimit) {
messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES,
RiceKeyConstants.INFO_LOOKUP_RESULTS_EXCEEDS_LIMIT, searchResultsSize.toString(),
searchResultsLimit.toString());
}
}
Boolean usingPrimaryKey = getLookupService().allPrimaryKeyValuesPresentAndNotWildcard(getDataObjectClass(),
searchCriteria);
if (usingPrimaryKey) {
List<String> pkNames = getLegacyDataAdapter().listPrimaryKeyFieldNames(getDataObjectClass());
List<String> pkLabels = new ArrayList<String>();
for (String pkName : pkNames) {
pkLabels.add(getDataDictionaryService().getAttributeLabel(getDataObjectClass(), pkName));
}
messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES,
RiceKeyConstants.INFO_LOOKUP_RESULTS_USING_PRIMARY_KEY, StringUtils.join(pkLabels, ","));
}
}
| void function(Map<String, String> searchCriteria, Collection<?> searchResults, boolean bounded, Integer searchResultsLimit) { MessageMap messageMap = GlobalVariables.getMessageMap(); Long searchResultsSize = Long.valueOf(0); if (searchResults instanceof CollectionIncomplete && ((CollectionIncomplete<?>) searchResults).getActualSizeIfTruncated() > 0) { searchResultsSize = ((CollectionIncomplete<?>) searchResults).getActualSizeIfTruncated(); } else if (searchResults != null) { searchResultsSize = Long.valueOf(searchResults.size()); } if (searchResultsSize == 0) { messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES, RiceKeyConstants.INFO_LOOKUP_RESULTS_NONE_FOUND); } else if (searchResultsSize == 1) { messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES, RiceKeyConstants.INFO_LOOKUP_RESULTS_DISPLAY_ONE); } else if (searchResultsSize > 1) { boolean resultsExceedsLimit = bounded && (searchResultsLimit != null) && (searchResultsSize > searchResultsLimit); if (resultsExceedsLimit) { messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES, RiceKeyConstants.INFO_LOOKUP_RESULTS_EXCEEDS_LIMIT, searchResultsSize.toString(), searchResultsLimit.toString()); } } Boolean usingPrimaryKey = getLookupService().allPrimaryKeyValuesPresentAndNotWildcard(getDataObjectClass(), searchCriteria); if (usingPrimaryKey) { List<String> pkNames = getLegacyDataAdapter().listPrimaryKeyFieldNames(getDataObjectClass()); List<String> pkLabels = new ArrayList<String>(); for (String pkName : pkNames) { pkLabels.add(getDataDictionaryService().getAttributeLabel(getDataObjectClass(), pkName)); } messageMap.putInfoForSectionId(UifConstants.MessageKeys.LOOKUP_RESULT_MESSAGES, RiceKeyConstants.INFO_LOOKUP_RESULTS_USING_PRIMARY_KEY, StringUtils.join(pkLabels, ",")); } } | /**
* Generates messages for the user based on the search results.
*
* <p>Messages are generated for the number of results, if the results exceed the result limit, and if the
* search was done using the primary keys for the data object.</p>
*
* @param searchCriteria map of search criteria that was used for the search
* @param searchResults list of result data objects from the search
* @param bounded whether the search was bounded
* @param searchResultsLimit maximum number of search results to return
*/ | Generates messages for the user based on the search results. Messages are generated for the number of results, if the results exceed the result limit, and if the search was done using the primary keys for the data object | generateLookupResultsMessages | {
"repo_name": "mztaylor/rice-git",
"path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/lookup/LookupableImpl.java",
"license": "apache-2.0",
"size": 54828
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.Map",
"org.apache.commons.lang.StringUtils",
"org.kuali.rice.core.api.util.RiceKeyConstants",
"org.kuali.rice.krad.uif.UifConstants",
"org.kuali.rice.krad.util.GlobalVariables",
"org.kuali.rice.krad.util.MessageMap"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.kuali.rice.core.api.util.RiceKeyConstants; import org.kuali.rice.krad.uif.UifConstants; import org.kuali.rice.krad.util.GlobalVariables; import org.kuali.rice.krad.util.MessageMap; | import java.util.*; import org.apache.commons.lang.*; import org.kuali.rice.core.api.util.*; import org.kuali.rice.krad.uif.*; import org.kuali.rice.krad.util.*; | [
"java.util",
"org.apache.commons",
"org.kuali.rice"
] | java.util; org.apache.commons; org.kuali.rice; | 1,964,065 |
public BehaviourOperation refreshApplication(final IModule module) {
return new BehaviourOperation(behaviour, module) { | BehaviourOperation function(final IModule module) { return new BehaviourOperation(behaviour, module) { | /**
* Refreshes the instances of given module. The module must not be null.
* @param module
* @return Non-null operation.
*/ | Refreshes the instances of given module. The module must not be null | refreshApplication | {
"repo_name": "osswangxining/dockerfoundry",
"path": "cn.dockerfoundry.ide.eclipse.server.core/src/cn/dockerfoundry/ide/eclipse/server/core/internal/client/CloudBehaviourOperations.java",
"license": "apache-2.0",
"size": 13361
} | [
"org.eclipse.wst.server.core.IModule"
] | import org.eclipse.wst.server.core.IModule; | import org.eclipse.wst.server.core.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 579,277 |
public Settings additionalSettings() {
return Settings.Builder.EMPTY_SETTINGS;
}
public void onIndexModule(IndexModule indexModule) {} | Settings function() { return Settings.Builder.EMPTY_SETTINGS; } public void onIndexModule(IndexModule indexModule) {} | /**
* Additional node settings loaded by the plugin. Note that settings that are explicit in the nodes settings can't be
* overwritten with the additional settings. These settings added if they don't exist.
*/ | Additional node settings loaded by the plugin. Note that settings that are explicit in the nodes settings can't be overwritten with the additional settings. These settings added if they don't exist | additionalSettings | {
"repo_name": "sreeramjayan/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/plugins/Plugin.java",
"license": "apache-2.0",
"size": 5536
} | [
"org.elasticsearch.common.settings.Settings",
"org.elasticsearch.index.IndexModule"
] | import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexModule; | import org.elasticsearch.common.settings.*; import org.elasticsearch.index.*; | [
"org.elasticsearch.common",
"org.elasticsearch.index"
] | org.elasticsearch.common; org.elasticsearch.index; | 129,879 |
private void add(HashSet<Participant> set, Participant p) {
if (p != null) set.add(p);
}
| void function(HashSet<Participant> set, Participant p) { if (p != null) set.add(p); } | /**
* these 3 add methods adds to a privilege set a Participant, a Participant by ID,
* and a Set of Particpants respectively
*/ | these 3 add methods adds to a privilege set a Participant, a Participant by ID, and a Set of Particpants respectively | add | {
"repo_name": "yawlfoundation/yawl",
"path": "src/org/yawlfoundation/yawl/resourcing/TaskPrivileges.java",
"license": "lgpl-3.0",
"size": 20185
} | [
"java.util.HashSet",
"org.yawlfoundation.yawl.resourcing.resource.Participant"
] | import java.util.HashSet; import org.yawlfoundation.yawl.resourcing.resource.Participant; | import java.util.*; import org.yawlfoundation.yawl.resourcing.resource.*; | [
"java.util",
"org.yawlfoundation.yawl"
] | java.util; org.yawlfoundation.yawl; | 2,045,826 |
public static void copy(InputStream input, Writer output, String encoding) throws IOException
{
copy(new InputStreamReader(input, encoding), output);
}
| static void function(InputStream input, Writer output, String encoding) throws IOException { copy(new InputStreamReader(input, encoding), output); } | /**
* Copies input stream to writer using buffer and specified encoding.
*
* @param input
* the input
* @param output
* the output
* @param encoding
* the encoding
* @throws IOException
* Signals that an I/O exception has occurred.
*/ | Copies input stream to writer using buffer and specified encoding | copy | {
"repo_name": "varra4u/utils4j",
"path": "src/main/java/com/varra/util/StreamUtils.java",
"license": "apache-2.0",
"size": 17485
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.io.Writer"
] | import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,405,004 |
public Object createMBean(String className, ObjectName objectName)
throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException;
/**
* Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer.
* The MBeanServer will use its ClassLoaderRepository to load the class of the MBean and the specified
* constructor's parameter classes, and creates the instance passing the specified arguments.
* The ObjectName may be null if the MBean implements {@link MBeanRegistration} | Object function(String className, ObjectName objectName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException; /** * Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer. * The MBeanServer will use its ClassLoaderRepository to load the class of the MBean and the specified * constructor's parameter classes, and creates the instance passing the specified arguments. * The ObjectName may be null if the MBean implements {@link MBeanRegistration} | /**
* A facility method for <code>createMBean(className, objectName, null, null)</code>.
*
* @see #createMBean(String, ObjectName, Object[], String[])
*/ | A facility method for <code>createMBean(className, objectName, null, null)</code> | createMBean | {
"repo_name": "xien777/yajsw",
"path": "yajsw/ahessian/src/main/java/org/rzo/netty/ahessian/application/jmx/remote/service/AsyncMBeanServerConnection.java",
"license": "lgpl-2.1",
"size": 23146
} | [
"java.io.IOException",
"javax.management.InstanceAlreadyExistsException",
"javax.management.MBeanException",
"javax.management.MBeanRegistration",
"javax.management.MBeanRegistrationException",
"javax.management.NotCompliantMBeanException",
"javax.management.ObjectName",
"javax.management.ReflectionEx... | import java.io.IOException; import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanException; import javax.management.MBeanRegistration; import javax.management.MBeanRegistrationException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; import javax.management.ReflectionException; | import java.io.*; import javax.management.*; | [
"java.io",
"javax.management"
] | java.io; javax.management; | 1,443,169 |
public List<RotelSource> getZone4Sources() {
return hasZone4SourceControl() ? RotelSource.getSources(sourceCategory, 4) : new ArrayList<>();
} | List<RotelSource> function() { return hasZone4SourceControl() ? RotelSource.getSources(sourceCategory, 4) : new ArrayList<>(); } | /**
* Get the list of available {@link RotelSource} in the zone 4
*
* @return the list of available {@link RotelSource} in the zone 4
*/ | Get the list of available <code>RotelSource</code> in the zone 4 | getZone4Sources | {
"repo_name": "Snickermicker/openhab2",
"path": "bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelModel.java",
"license": "epl-1.0",
"size": 33047
} | [
"java.util.ArrayList",
"java.util.List",
"org.openhab.binding.rotel.internal.communication.RotelSource"
] | import java.util.ArrayList; import java.util.List; import org.openhab.binding.rotel.internal.communication.RotelSource; | import java.util.*; import org.openhab.binding.rotel.internal.communication.*; | [
"java.util",
"org.openhab.binding"
] | java.util; org.openhab.binding; | 2,002,501 |
public static void main(String[] args)
{
try
{
// Class names of the basic filters. These need to be declared since the base class
// for all filters is abstract and XML needs to know how to build specific abstract XML types
final String CONFIG_CLASS = "edu.uis.csc478b.team3.config.Configuration";
final String SENTENCE_SIMILARITY_CLASS = "edu.uis.csc478b.team3.filters.SentenceSimilarity";
final String CONFIG_WORD_SIMILARITY_CLASS = "edu.uis.csc478b.team3.filters.WordSimilarity";
Class [] listOfClasses = new Class [3];
// The runtime information below is used to scale the throughput of adding new test cases
Runtime runtime = Runtime.getRuntime();
// Number of bytes in a MegaByte
final float MEGABYTE = 1024*1024;
// Used to wait for new memory to be reclaimed by the JVM
final int SLEEP_MILLISECONDS = 10;
// The threshold of the last available MB free in the JVM before we wait for tasks to complete.
final float REMAINING_HEAP_MB = 200;
// Max size of the heap
float heapMax = (runtime.maxMemory()/MEGABYTE);
// Test pairs hold a combination of all files
TestPairs testPairs = new TestPairs();
// Serialization/Deserialization of the XML configuration
XmlConfig xmlConfig = new XmlConfig();
// If zero arguments create a sample configuration
// Req 8.0.0
if(args.length == 0)
{
xmlConfig.createSampleProfile();
return;
}
ClassFiles classFiles = new ClassFiles();
String configFile;
// If only the XML config file is given then use basic steup
if(args.length == 1)
{
listOfClasses[0] = Class.forName(CONFIG_CLASS);
listOfClasses[1] = Class.forName(SENTENCE_SIMILARITY_CLASS);
listOfClasses[2] = Class.forName(CONFIG_WORD_SIMILARITY_CLASS);
classFiles.setClasses(listOfClasses);
configFile = args[0];
}
// If Class XML and Config XML are given
else if(args.length == 2)
{
classFiles = xmlConfig.readXmlClassFiles(args[0]);
configFile = args[1];
}
else
{
throw new Exception("main::main Incorrect Number of Arguments");
}
// Read in the XML config file
Configuration configuration = xmlConfig.readXmlConfiguration( configFile, classFiles.getClasses());
// Get all the test sets
ArrayList< PlagiarismTest > tests = configuration.getTests();
// Create a thread pool
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool();
//Collections.reverse(tests);
// Iterate over the test sets
for(PlagiarismTest testCase : tests)
{
// Get the files to test against
ArrayList< String > files = testCase.getFiles();
// Create all combinations of files to test for plagairism
ArrayList<TestPair> pairs = testPairs.createPairs(files);
// Push each test onto the queue which will be run as a thread
for(TestPair tp : pairs)
{
// Test to see if we have enough memory
float heapFree = (runtime.freeMemory()/MEGABYTE);
float heapTotal = (runtime.totalMemory()/MEGABYTE);
int count = 0;
while( (heapMax - (heapTotal - heapFree)) < REMAINING_HEAP_MB)
{
count++;
// If we've paused for 1 second in total then try to force a garbage collection cycle
if(count > 100)
{
runtime.gc();
}
Thread.sleep(SLEEP_MILLISECONDS);
}
// Req 9.2.0, Req 10.0.0, Req 10.1.0
if(tp.file1 != null && tp.file2 != null && !tp.file1.isEmpty() && !tp.file2.isEmpty() )
{
executor.execute( new Plagiarism( tp.file1 , tp.file2, testCase ) );
}
}
}
// Close threadpool after all test suites are complete
executor.shutdown();
}
catch(Exception ex)
{
System.out.println(ex);
}
} | static void function(String[] args) { try { final String CONFIG_CLASS = STR; final String SENTENCE_SIMILARITY_CLASS = STR; final String CONFIG_WORD_SIMILARITY_CLASS = STR; Class [] listOfClasses = new Class [3]; Runtime runtime = Runtime.getRuntime(); final float MEGABYTE = 1024*1024; final int SLEEP_MILLISECONDS = 10; final float REMAINING_HEAP_MB = 200; float heapMax = (runtime.maxMemory()/MEGABYTE); TestPairs testPairs = new TestPairs(); XmlConfig xmlConfig = new XmlConfig(); if(args.length == 0) { xmlConfig.createSampleProfile(); return; } ClassFiles classFiles = new ClassFiles(); String configFile; if(args.length == 1) { listOfClasses[0] = Class.forName(CONFIG_CLASS); listOfClasses[1] = Class.forName(SENTENCE_SIMILARITY_CLASS); listOfClasses[2] = Class.forName(CONFIG_WORD_SIMILARITY_CLASS); classFiles.setClasses(listOfClasses); configFile = args[0]; } else if(args.length == 2) { classFiles = xmlConfig.readXmlClassFiles(args[0]); configFile = args[1]; } else { throw new Exception(STR); } Configuration configuration = xmlConfig.readXmlConfiguration( configFile, classFiles.getClasses()); ArrayList< PlagiarismTest > tests = configuration.getTests(); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); for(PlagiarismTest testCase : tests) { ArrayList< String > files = testCase.getFiles(); ArrayList<TestPair> pairs = testPairs.createPairs(files); for(TestPair tp : pairs) { float heapFree = (runtime.freeMemory()/MEGABYTE); float heapTotal = (runtime.totalMemory()/MEGABYTE); int count = 0; while( (heapMax - (heapTotal - heapFree)) < REMAINING_HEAP_MB) { count++; if(count > 100) { runtime.gc(); } Thread.sleep(SLEEP_MILLISECONDS); } if(tp.file1 != null && tp.file2 != null && !tp.file1.isEmpty() && !tp.file2.isEmpty() ) { executor.execute( new Plagiarism( tp.file1 , tp.file2, testCase ) ); } } } executor.shutdown(); } catch(Exception ex) { System.out.println(ex); } } | /**
* Main entry for the program.
*
* @param args
*/ | Main entry for the program | main | {
"repo_name": "codewarriorx0539/team3",
"path": "src/edu/uis/csc478b/team3/Plagiarism.java",
"license": "apache-2.0",
"size": 11104
} | [
"edu.uis.csc478b.team3.config.ClassFiles",
"edu.uis.csc478b.team3.config.Configuration",
"edu.uis.csc478b.team3.config.PlagiarismTest",
"java.util.ArrayList",
"java.util.concurrent.Executors",
"java.util.concurrent.ThreadPoolExecutor"
] | import edu.uis.csc478b.team3.config.ClassFiles; import edu.uis.csc478b.team3.config.Configuration; import edu.uis.csc478b.team3.config.PlagiarismTest; import java.util.ArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; | import edu.uis.csc478b.team3.config.*; import java.util.*; import java.util.concurrent.*; | [
"edu.uis.csc478b",
"java.util"
] | edu.uis.csc478b; java.util; | 432,987 |
public static <K,V> Object getByPath(Map<K,V> receiver, String path, Object defaultValue) {
return getByPathDispatch(receiver, splitPath(path), 0, () -> defaultValue);
} | static <K,V> Object function(Map<K,V> receiver, String path, Object defaultValue) { return getByPathDispatch(receiver, splitPath(path), 0, () -> defaultValue); } | /**
* Same as {@link #getByPath(List, String, Object)}, but for Map.
*/ | Same as <code>#getByPath(List, String, Object)</code>, but for Map | getByPath | {
"repo_name": "gingerwizard/elasticsearch",
"path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/api/Augmentation.java",
"license": "apache-2.0",
"size": 26655
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,019,630 |
public static <T extends Item> List<T> fromNameList(ItemGroup context, @Nonnull String list, @Nonnull Class<T> type) {
Jenkins hudson = Jenkins.getInstance();
List<T> r = new ArrayList<T>();
StringTokenizer tokens = new StringTokenizer(list,",");
while(tokens.hasMoreTokens()) {
String fullName = tokens.nextToken().trim();
T item = hudson.getItem(fullName, context, type);
if(item!=null)
r.add(item);
}
return r;
} | static <T extends Item> List<T> function(ItemGroup context, @Nonnull String list, @Nonnull Class<T> type) { Jenkins hudson = Jenkins.getInstance(); List<T> r = new ArrayList<T>(); StringTokenizer tokens = new StringTokenizer(list,","); while(tokens.hasMoreTokens()) { String fullName = tokens.nextToken().trim(); T item = hudson.getItem(fullName, context, type); if(item!=null) r.add(item); } return r; } | /**
* Does the opposite of {@link #toNameList(Collection)}.
*/ | Does the opposite of <code>#toNameList(Collection)</code> | fromNameList | {
"repo_name": "chbiel/jenkins",
"path": "core/src/main/java/hudson/model/Items.java",
"license": "mit",
"size": 17870
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.StringTokenizer",
"javax.annotation.Nonnull"
] | import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import javax.annotation.Nonnull; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 2,377,882 |
SystemData systemData(); | SystemData systemData(); | /**
* Gets the systemData property: The system metadata relating to this resource.
*
* @return the systemData value.
*/ | Gets the systemData property: The system metadata relating to this resource | systemData | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mediaservices/azure-resourcemanager-mediaservices/src/main/java/com/azure/resourcemanager/mediaservices/models/AccountFilter.java",
"license": "mit",
"size": 7542
} | [
"com.azure.core.management.SystemData"
] | import com.azure.core.management.SystemData; | import com.azure.core.management.*; | [
"com.azure.core"
] | com.azure.core; | 2,707,554 |
@ReflectiveMethod(name = "b", types = {NMSEntity.class, float.class})
public boolean b(NMSEntity entity, float f){
return (boolean) NMSWrapper.getInstance().exec(nmsObject, entity, f);
} | @ReflectiveMethod(name = "b", types = {NMSEntity.class, float.class}) boolean function(NMSEntity entity, float f){ return (boolean) NMSWrapper.getInstance().exec(nmsObject, entity, f); } | /**
* TODO Find correct name
* @see net.minecraft.server.v1_9_R1.PortalTravelAgent#b(net.minecraft.server.v1_9_R1.Entity, float)
*/ | TODO Find correct name | b | {
"repo_name": "Vilsol/NMSWrapper",
"path": "src/main/java/me/vilsol/nmswrapper/wraps/unparsed/NMSPortalTravelAgent.java",
"license": "apache-2.0",
"size": 3025
} | [
"me.vilsol.nmswrapper.NMSWrapper",
"me.vilsol.nmswrapper.reflections.ReflectiveMethod"
] | import me.vilsol.nmswrapper.NMSWrapper; import me.vilsol.nmswrapper.reflections.ReflectiveMethod; | import me.vilsol.nmswrapper.*; import me.vilsol.nmswrapper.reflections.*; | [
"me.vilsol.nmswrapper"
] | me.vilsol.nmswrapper; | 2,323,844 |
public final Class<? extends Attribute> getCategory() {
return JobMediaSheetsCompleted.class;
} | final Class<? extends Attribute> function() { return JobMediaSheetsCompleted.class; } | /**
* Get the printing attribute class which is to be used as the "category"
* for this printing attribute value.
* <P>
* For class JobMediaSheetsCompleted, the category is class
* JobMediaSheetsCompleted itself.
*
* @return Printing attribute class (category), an instance of class
* {@link java.lang.Class java.lang.Class}.
*/ | Get the printing attribute class which is to be used as the "category" for this printing attribute value. For class JobMediaSheetsCompleted, the category is class JobMediaSheetsCompleted itself | getCategory | {
"repo_name": "lostdj/Jaklin-OpenJDK-JDK",
"path": "src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java",
"license": "gpl-2.0",
"size": 4939
} | [
"javax.print.attribute.Attribute"
] | import javax.print.attribute.Attribute; | import javax.print.attribute.*; | [
"javax.print"
] | javax.print; | 1,852,509 |
final Process process = builder.start();
try {
process.getOutputStream().close();
dump(new InputStreamReader(process.getErrorStream()), err);
dump(new InputStreamReader(process.getInputStream()), out);
try {
process.waitFor();
} catch (InterruptedException e) {
IOException ioe = new InterruptedIOException();
ioe.initCause(e);
throw ioe;
}
} finally {
process.destroy();
}
} | final Process process = builder.start(); try { process.getOutputStream().close(); dump(new InputStreamReader(process.getErrorStream()), err); dump(new InputStreamReader(process.getInputStream()), out); try { process.waitFor(); } catch (InterruptedException e) { IOException ioe = new InterruptedIOException(); ioe.initCause(e); throw ioe; } } finally { process.destroy(); } } | /**
* Consume all the streams of the process. All the streams are redirected to a simple StringBuilder.
*
* @throws IOException I/O error
*/ | Consume all the streams of the process. All the streams are redirected to a simple StringBuilder | consume | {
"repo_name": "wichtounet/jtheque-utils",
"path": "src/main/java/org/jtheque/utils/io/SimpleApplicationConsumer.java",
"license": "apache-2.0",
"size": 4599
} | [
"java.io.IOException",
"java.io.InputStreamReader",
"java.io.InterruptedIOException"
] | import java.io.IOException; import java.io.InputStreamReader; import java.io.InterruptedIOException; | import java.io.*; | [
"java.io"
] | java.io; | 631,576 |
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException; | Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException; | /**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnIndex the column index
* @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int, Map)
*/ | Retrieve the value of the indicated column in the current row as an Object | getObject | {
"repo_name": "shivpun/spring-framework",
"path": "spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java",
"license": "apache-2.0",
"size": 18959
} | [
"java.util.Map",
"org.springframework.jdbc.InvalidResultSetAccessException"
] | import java.util.Map; import org.springframework.jdbc.InvalidResultSetAccessException; | import java.util.*; import org.springframework.jdbc.*; | [
"java.util",
"org.springframework.jdbc"
] | java.util; org.springframework.jdbc; | 1,062,353 |
public ProvisioningState provisioningState() {
return this.provisioningState;
} | ProvisioningState function() { return this.provisioningState; } | /**
* Get the provisioning state of the express route circuit peering resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'.
*
* @return the provisioningState value
*/ | Get the provisioning state of the express route circuit peering resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | provisioningState | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/ExpressRouteCircuitPeeringInner.java",
"license": "mit",
"size": 16663
} | [
"com.microsoft.azure.management.network.v2020_03_01.ProvisioningState"
] | import com.microsoft.azure.management.network.v2020_03_01.ProvisioningState; | import com.microsoft.azure.management.network.v2020_03_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,510,778 |
public ClusterUpdateSettingsRequest persistentSettings(Settings settings) {
this.persistentSettings = settings;
return this;
} | ClusterUpdateSettingsRequest function(Settings settings) { this.persistentSettings = settings; return this; } | /**
* Sets the persistent settings to be updated. They will get applied cross restarts
*/ | Sets the persistent settings to be updated. They will get applied cross restarts | persistentSettings | {
"repo_name": "nknize/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java",
"license": "apache-2.0",
"size": 6780
} | [
"org.elasticsearch.common.settings.Settings"
] | import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 775,306 |
private boolean start() {
InetSocketAddress socketAddr;
try {
InetAddress hostAddr = InetAddress.getByName(HOST);
socketAddr = new InetSocketAddress(hostAddr, mPort);
} catch (UnknownHostException e) {
return false;
}
try {
mSocketChannel = SocketChannel.open(socketAddr);
} catch (IOException e1) {
return false;
}
// read some stuff from it
readLines();
return true;
} | boolean function() { InetSocketAddress socketAddr; try { InetAddress hostAddr = InetAddress.getByName(HOST); socketAddr = new InetSocketAddress(hostAddr, mPort); } catch (UnknownHostException e) { return false; } try { mSocketChannel = SocketChannel.open(socketAddr); } catch (IOException e1) { return false; } readLines(); return true; } | /**
* Starts the connection of the console.
* @return true if success.
*/ | Starts the connection of the console | start | {
"repo_name": "lrscp/ControlAndroidDeviceFromPC",
"path": "src/com/android/ddmlib/EmulatorConsole.java",
"license": "apache-2.0",
"size": 25424
} | [
"java.io.IOException",
"java.net.InetAddress",
"java.net.InetSocketAddress",
"java.net.UnknownHostException",
"java.nio.channels.SocketChannel"
] | import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.nio.channels.SocketChannel; | import java.io.*; import java.net.*; import java.nio.channels.*; | [
"java.io",
"java.net",
"java.nio"
] | java.io; java.net; java.nio; | 1,758,161 |
public Builder useUDP() {
this.paramSupport.setParameter(SipParser.TRANSPORT, SipParser.UDP);
return this;
} | Builder function() { this.paramSupport.setParameter(SipParser.TRANSPORT, SipParser.UDP); return this; } | /**
* Use UDP as the transport.
*
* @return
*/ | Use UDP as the transport | useUDP | {
"repo_name": "aboutsip/pkts",
"path": "pkts-sip/src/main/java/io/pkts/packet/sip/address/SipURI.java",
"license": "mit",
"size": 21586
} | [
"io.pkts.packet.sip.impl.SipParser"
] | import io.pkts.packet.sip.impl.SipParser; | import io.pkts.packet.sip.impl.*; | [
"io.pkts.packet"
] | io.pkts.packet; | 292,722 |
@Test
public void testResponseWithMatchedDNAttribute()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput(
AuthResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
LdapResult ldapResult = bindResponse.getLdapResult();
assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", ldapResult.getMatchedDn().getNormName() );
} | void function() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( AuthResponseTest.class.getResource( STR ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = bindResponse.getLdapResult(); assertEquals( STR, ldapResult.getMatchedDn().getNormName() ); } | /**
* Test parsing of a response with MatchedDN attribute
*/ | Test parsing of a response with MatchedDN attribute | testResponseWithMatchedDNAttribute | {
"repo_name": "darranl/directory-shared",
"path": "dsml/parser/src/test/java/org/apache/directory/api/dsmlv2/authResponse/AuthResponseTest.java",
"license": "apache-2.0",
"size": 16037
} | [
"org.apache.directory.api.dsmlv2.Dsmlv2ResponseParser",
"org.apache.directory.api.ldap.model.message.BindResponse",
"org.apache.directory.api.ldap.model.message.LdapResult",
"org.junit.Assert"
] | import org.apache.directory.api.dsmlv2.Dsmlv2ResponseParser; import org.apache.directory.api.ldap.model.message.BindResponse; import org.apache.directory.api.ldap.model.message.LdapResult; import org.junit.Assert; | import org.apache.directory.api.dsmlv2.*; import org.apache.directory.api.ldap.model.message.*; import org.junit.*; | [
"org.apache.directory",
"org.junit"
] | org.apache.directory; org.junit; | 2,788,426 |
@Override
public int getC_SalesRegion_ID()
{
if (super.getC_SalesRegion_ID() != 0)
return super.getC_SalesRegion_ID();
//
if (m_docLine != null)
setC_SalesRegion_ID(m_docLine.getC_SalesRegion_ID());
if (m_doc != null)
{
if (super.getC_SalesRegion_ID() == 0)
setC_SalesRegion_ID(m_doc.getC_SalesRegion_ID());
if (super.getC_SalesRegion_ID() == 0 && m_doc.getBP_C_SalesRegion_ID() > 0)
setC_SalesRegion_ID(m_doc.getBP_C_SalesRegion_ID());
// derive SalesRegion if AcctSegment
if (super.getC_SalesRegion_ID() == 0
&& m_doc.getC_BPartner_Location_ID() != 0
&& m_doc.getBP_C_SalesRegion_ID() == -1) // never tried
// && m_acctSchema.isAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_SalesRegion))
{
String sql = "SELECT COALESCE(C_SalesRegion_ID,0) FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?";
setC_SalesRegion_ID(DB.getSQLValue(null,
sql, m_doc.getC_BPartner_Location_ID()));
if (super.getC_SalesRegion_ID() != 0) // save in VO
{
m_doc.setBP_C_SalesRegion_ID(super.getC_SalesRegion_ID());
log.debug("C_SalesRegion_ID=" + super.getC_SalesRegion_ID() + " (from BPL)");
}
else
// From Sales Rep of Document -> Sales Region
{
sql = "SELECT COALESCE(MAX(C_SalesRegion_ID),0) FROM C_SalesRegion WHERE SalesRep_ID=?";
setC_SalesRegion_ID(DB.getSQLValue(null,
sql, m_doc.getSalesRep_ID()));
if (super.getC_SalesRegion_ID() != 0) // save in VO
{
m_doc.setBP_C_SalesRegion_ID(super.getC_SalesRegion_ID());
log.debug("C_SalesRegion_ID=" + super.getC_SalesRegion_ID() + " (from SR)");
}
else
m_doc.setBP_C_SalesRegion_ID(-2); // don't try again
}
}
if (m_acct != null && super.getC_SalesRegion_ID() == 0)
setC_SalesRegion_ID(m_acct.getC_SalesRegion_ID());
}
//
// log.debug("C_SalesRegion_ID=" + super.getC_SalesRegion_ID()
// + ", C_BPartner_Location_ID=" + m_docVO.C_BPartner_Location_ID
// + ", BP_C_SalesRegion_ID=" + m_docVO.BP_C_SalesRegion_ID
// + ", SR=" + m_acctSchema.isAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_SalesRegion));
return super.getC_SalesRegion_ID();
} // getC_SalesRegion_ID | int function() { if (super.getC_SalesRegion_ID() != 0) return super.getC_SalesRegion_ID(); setC_SalesRegion_ID(m_docLine.getC_SalesRegion_ID()); if (m_doc != null) { if (super.getC_SalesRegion_ID() == 0) setC_SalesRegion_ID(m_doc.getC_SalesRegion_ID()); if (super.getC_SalesRegion_ID() == 0 && m_doc.getBP_C_SalesRegion_ID() > 0) setC_SalesRegion_ID(m_doc.getBP_C_SalesRegion_ID()); if (super.getC_SalesRegion_ID() == 0 && m_doc.getC_BPartner_Location_ID() != 0 && m_doc.getBP_C_SalesRegion_ID() == -1) { String sql = STR; setC_SalesRegion_ID(DB.getSQLValue(null, sql, m_doc.getC_BPartner_Location_ID())); if (super.getC_SalesRegion_ID() != 0) { m_doc.setBP_C_SalesRegion_ID(super.getC_SalesRegion_ID()); log.debug(STR + super.getC_SalesRegion_ID() + STR); } else { sql = STR; setC_SalesRegion_ID(DB.getSQLValue(null, sql, m_doc.getSalesRep_ID())); if (super.getC_SalesRegion_ID() != 0) { m_doc.setBP_C_SalesRegion_ID(super.getC_SalesRegion_ID()); log.debug(STR + super.getC_SalesRegion_ID() + STR); } else m_doc.setBP_C_SalesRegion_ID(-2); } } if (m_acct != null && super.getC_SalesRegion_ID() == 0) setC_SalesRegion_ID(m_acct.getC_SalesRegion_ID()); } return super.getC_SalesRegion_ID(); } | /**
* Get/derive Sales Region
*
* @return Sales Region
*/ | Get/derive Sales Region | getC_SalesRegion_ID | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.acct.base/src/main/java-legacy/org/compiere/acct/FactLine.java",
"license": "gpl-2.0",
"size": 42895
} | [
"org.compiere.util.DB"
] | import org.compiere.util.DB; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,055,713 |
public void setDefaultArtwork(@Nullable Drawable defaultArtwork) {
if (this.defaultArtwork != defaultArtwork) {
this.defaultArtwork = defaultArtwork;
updateForCurrentTrackSelections( false);
}
} | void function(@Nullable Drawable defaultArtwork) { if (this.defaultArtwork != defaultArtwork) { this.defaultArtwork = defaultArtwork; updateForCurrentTrackSelections( false); } } | /**
* Sets the default artwork to display if {@code useArtwork} is {@code true} and no artwork is
* present in the media.
*
* @param defaultArtwork the default artwork to display
*/ | Sets the default artwork to display if useArtwork is true and no artwork is present in the media | setDefaultArtwork | {
"repo_name": "amzn/exoplayer-amazon-port",
"path": "library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java",
"license": "apache-2.0",
"size": 65521
} | [
"android.graphics.drawable.Drawable",
"androidx.annotation.Nullable"
] | import android.graphics.drawable.Drawable; import androidx.annotation.Nullable; | import android.graphics.drawable.*; import androidx.annotation.*; | [
"android.graphics",
"androidx.annotation"
] | android.graphics; androidx.annotation; | 2,598,789 |
public void init(ExampleSet exampleSet) {
this.exampleSet = exampleSet;
int exampleSetSize = exampleSet.size();
if (exampleSetSize < 8000) {
this.cache = new FullCache(exampleSet, this);
} else {
this.cache = new MapBasedCache(exampleSetSize);
}
}
| void function(ExampleSet exampleSet) { this.exampleSet = exampleSet; int exampleSetSize = exampleSet.size(); if (exampleSetSize < 8000) { this.cache = new FullCache(exampleSet, this); } else { this.cache = new MapBasedCache(exampleSetSize); } } | /**
* Calculates all distances and store them in a matrix to speed up
* optimization.
*/ | Calculates all distances and store them in a matrix to speed up optimization | init | {
"repo_name": "aborg0/rapidminer-vega",
"path": "src/com/rapidminer/tools/math/kernels/Kernel.java",
"license": "agpl-3.0",
"size": 12599
} | [
"com.rapidminer.example.ExampleSet"
] | import com.rapidminer.example.ExampleSet; | import com.rapidminer.example.*; | [
"com.rapidminer.example"
] | com.rapidminer.example; | 1,016,089 |
@VisibleForTesting
static Map<byte[], Integer> createFamilyBlockSizeMap(Configuration conf) {
return HFileOutputFormat2.createFamilyBlockSizeMap(conf);
} | static Map<byte[], Integer> createFamilyBlockSizeMap(Configuration conf) { return HFileOutputFormat2.createFamilyBlockSizeMap(conf); } | /**
* Runs inside the task to deserialize column family to block size
* map from the configuration.
*
* @param conf to read the serialized values from
* @return a map from column family to the configured block size
*/ | Runs inside the task to deserialize column family to block size map from the configuration | createFamilyBlockSizeMap | {
"repo_name": "narendragoyal/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java",
"license": "apache-2.0",
"size": 8074
} | [
"java.util.Map",
"org.apache.hadoop.conf.Configuration"
] | import java.util.Map; import org.apache.hadoop.conf.Configuration; | import java.util.*; import org.apache.hadoop.conf.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,488,716 |
protected void emit_XImportDeclaration_SemicolonKeyword_2_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
| void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); } | /**
* Syntax:
* ';'?
*/ | Syntax: ';' | emit_XImportDeclaration_SemicolonKeyword_2_q | {
"repo_name": "lunifera/lunifera-dsl",
"path": "org.lunifera.dsl.dto.xtext/src-gen/org/lunifera/dsl/dto/xtext/serializer/AbstractDtoGrammarSyntacticSequencer.java",
"license": "epl-1.0",
"size": 8372
} | [
"java.util.List",
"org.eclipse.emf.ecore.EObject",
"org.eclipse.xtext.nodemodel.INode",
"org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider"
] | import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider; | import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.xtext"
] | java.util; org.eclipse.emf; org.eclipse.xtext; | 296,999 |
public Rule<T> to(T state, T... additionalStates) {
return new Rule<T>(rule.from, ImmutableSet.copyOf(Lists.asList(state, additionalStates)));
} | Rule<T> function(T state, T... additionalStates) { return new Rule<T>(rule.from, ImmutableSet.copyOf(Lists.asList(state, additionalStates))); } | /**
* Associates multiple transitions with this state.
*
* @param state An allowed transition state.
* @param additionalStates Additional states that may be transitioned to.
* @return A new rule that identical to the original, but only allowing a transition to the
* provided states.
*/ | Associates multiple transitions with this state | to | {
"repo_name": "foursquare/commons-old",
"path": "src/java/com/twitter/common/util/StateMachine.java",
"license": "apache-2.0",
"size": 18887
} | [
"com.google.common.collect.ImmutableSet",
"com.google.common.collect.Lists"
] | import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 777,373 |
protected Node deepExport(Node n, AbstractDocument d) {
AbstractProcessingInstruction p;
p = (AbstractProcessingInstruction)super.deepExport(n, d);
p.data = data;
return p;
} | Node function(Node n, AbstractDocument d) { AbstractProcessingInstruction p; p = (AbstractProcessingInstruction)super.deepExport(n, d); p.data = data; return p; } | /**
* Deeply exports this node to the given document.
*/ | Deeply exports this node to the given document | deepExport | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/AbstractProcessingInstruction.java",
"license": "apache-2.0",
"size": 4567
} | [
"org.w3c.dom.Node"
] | import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,031,937 |
static <T> LocalUniqueIndex<T> create( String name,
String workspaceName,
DB db,
Converter<T> converter,
BTreeKeySerializer<T> valueSerializer,
Serializer<T> rawSerializer ) {
return new LocalUniqueIndex<>(name, workspaceName, db, converter, valueSerializer, rawSerializer);
}
protected LocalUniqueIndex( String name,
String workspaceName,
DB db,
Converter<T> converter,
BTreeKeySerializer<T> valueSerializer,
Serializer<T> rawSerializer ) {
super(name, workspaceName, db, converter, valueSerializer, rawSerializer);
} | static <T> LocalUniqueIndex<T> create( String name, String workspaceName, DB db, Converter<T> converter, BTreeKeySerializer<T> valueSerializer, Serializer<T> rawSerializer ) { return new LocalUniqueIndex<>(name, workspaceName, db, converter, valueSerializer, rawSerializer); } protected LocalUniqueIndex( String name, String workspaceName, DB db, Converter<T> converter, BTreeKeySerializer<T> valueSerializer, Serializer<T> rawSerializer ) { super(name, workspaceName, db, converter, valueSerializer, rawSerializer); } | /**
* Create a new index that allows only a single value for each unique key.
*
* @param name the name of the index; may not be null or empty
* @param workspaceName the name of the workspace; may not be null
* @param db the database in which the index information is to be stored; may not be null
* @param converter the converter from {@link StaticOperand} to values being indexed; may not be null
* @param valueSerializer the serializer for the type of value being indexed; may not be null
* @param rawSerializer the raw value serializer for the type of value being indexed; may not be null
* @return the new index; never null
*/ | Create a new index that allows only a single value for each unique key | create | {
"repo_name": "phantomjinx/modeshape",
"path": "modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalUniqueIndex.java",
"license": "apache-2.0",
"size": 4556
} | [
"org.mapdb.BTreeKeySerializer",
"org.mapdb.Serializer",
"org.modeshape.jcr.index.local.IndexValues"
] | import org.mapdb.BTreeKeySerializer; import org.mapdb.Serializer; import org.modeshape.jcr.index.local.IndexValues; | import org.mapdb.*; import org.modeshape.jcr.index.local.*; | [
"org.mapdb",
"org.modeshape.jcr"
] | org.mapdb; org.modeshape.jcr; | 281,201 |
public void testInvokeAll1() throws InterruptedException {
final ExecutorService e = new DirectExecutorService();
try (PoolCleaner cleaner = cleaner(e)) {
try {
e.invokeAll(null);
shouldThrow();
} catch (NullPointerException success) {}
}
} | void function() throws InterruptedException { final ExecutorService e = new DirectExecutorService(); try (PoolCleaner cleaner = cleaner(e)) { try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) {} } } | /**
* invokeAll(null) throws NPE
*/ | invokeAll(null) throws NPE | testInvokeAll1 | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/test/java/util/concurrent/tck/AbstractExecutorServiceTest.java",
"license": "gpl-2.0",
"size": 23173
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 806,422 |
public JPopupMenu getChooseClassPopupMenu() {
updateObjectNames();
// create the tree, and find the path to the current class
m_treeNodeOfCurrentObject = null;
final JTree tree = createTree(m_ObjectNames);
if (m_treeNodeOfCurrentObject != null) {
tree.setSelectionPath(new TreePath(m_treeNodeOfCurrentObject.getPath()));
}
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
// create the popup
final JPopupMenu popup = new JTreePopupMenu(tree); | JPopupMenu function() { updateObjectNames(); m_treeNodeOfCurrentObject = null; final JTree tree = createTree(m_ObjectNames); if (m_treeNodeOfCurrentObject != null) { tree.setSelectionPath(new TreePath(m_treeNodeOfCurrentObject.getPath())); } tree.getSelectionModel().setSelectionMode (TreeSelectionModel.SINGLE_TREE_SELECTION); final JPopupMenu popup = new JTreePopupMenu(tree); | /**
* Returns a popup menu that allows the user to change
* the class of object.
*
* @return a JPopupMenu that when shown will let the user choose the class
*/ | Returns a popup menu that allows the user to change the class of object | getChooseClassPopupMenu | {
"repo_name": "dsibournemouth/autoweka",
"path": "weka-3.7.7/src/main/java/weka/gui/GenericObjectEditor.java",
"license": "gpl-3.0",
"size": 52493
} | [
"javax.swing.JPopupMenu",
"javax.swing.JTree",
"javax.swing.tree.TreePath",
"javax.swing.tree.TreeSelectionModel"
] | import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; | import javax.swing.*; import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 918,379 |
private void assertReadNothing(boolean formatRequired) {
clearFormatHolderAndInputBuffer();
int result = sampleQueue.read(formatHolder, inputBuffer, formatRequired, false, 0);
assertThat(result).isEqualTo(RESULT_NOTHING_READ);
// formatHolder should not be populated.
assertThat(formatHolder.format).isNull();
// inputBuffer should not be populated.
assertInputBufferContainsNoSampleData();
assertInputBufferHasNoDefaultFlagsSet();
} | void function(boolean formatRequired) { clearFormatHolderAndInputBuffer(); int result = sampleQueue.read(formatHolder, inputBuffer, formatRequired, false, 0); assertThat(result).isEqualTo(RESULT_NOTHING_READ); assertThat(formatHolder.format).isNull(); assertInputBufferContainsNoSampleData(); assertInputBufferHasNoDefaultFlagsSet(); } | /**
* Asserts {@link SampleQueue#read} returns {@link C#RESULT_NOTHING_READ}.
*
* @param formatRequired The value of {@code formatRequired} passed to readData.
*/ | Asserts <code>SampleQueue#read</code> returns <code>C#RESULT_NOTHING_READ</code> | assertReadNothing | {
"repo_name": "saki4510t/ExoPlayer",
"path": "library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java",
"license": "apache-2.0",
"size": 31701
} | [
"com.google.common.truth.Truth"
] | import com.google.common.truth.Truth; | import com.google.common.truth.*; | [
"com.google.common"
] | com.google.common; | 2,271,240 |
private final void cancelChunk() {
if (mCursor != null) {
if (mState == STATE_EDIT) {
// Put the original chunk text back into the database
mCursor.close();
mCursor = null;
ContentValues values = new ContentValues();
values.put(ChunkColumns.TASKNOTES, mOriginalTaskNotes);
values.put(ChunkColumns.TITLE, mOriginalTitle);
values.put(ChunkColumns.AUTHOR, mOriginalAuthor);
values.put(ChunkColumns.CLASSIFICATION, mOriginalClassification);
values.put(ChunkColumns.CITATION, mOriginalCitation);
values.put(ChunkColumns.CHUNKS, mOriginalChunks);
values.put(ChunkColumns.LAST_LISTENED_TIME, mOriginalLastListenedTime);
values.put(ChunkColumns.FILENAME, mOriginalFileName);
values.put(ChunkColumns.FULL_FILEPATH_AND_FILENAME, mOriginalFullFilePathAndFileName);
values.put(ChunkColumns.PUBLICATION_DATE, mOriginalPubDate);
values.put(ChunkColumns.THUMBNAIL, mOriginalThumbnail);
values.put(ChunkColumns.STARRED, mOriginalStarred);
getContentResolver().update(mUri, values, null, null);
} else if (mState == STATE_INSERT) {
// We inserted an empty chunk, make sure to delete it
deleteChunk();
}
}
setResult(RESULT_CANCELED);
finish();
} | final void function() { if (mCursor != null) { if (mState == STATE_EDIT) { mCursor.close(); mCursor = null; ContentValues values = new ContentValues(); values.put(ChunkColumns.TASKNOTES, mOriginalTaskNotes); values.put(ChunkColumns.TITLE, mOriginalTitle); values.put(ChunkColumns.AUTHOR, mOriginalAuthor); values.put(ChunkColumns.CLASSIFICATION, mOriginalClassification); values.put(ChunkColumns.CITATION, mOriginalCitation); values.put(ChunkColumns.CHUNKS, mOriginalChunks); values.put(ChunkColumns.LAST_LISTENED_TIME, mOriginalLastListenedTime); values.put(ChunkColumns.FILENAME, mOriginalFileName); values.put(ChunkColumns.FULL_FILEPATH_AND_FILENAME, mOriginalFullFilePathAndFileName); values.put(ChunkColumns.PUBLICATION_DATE, mOriginalPubDate); values.put(ChunkColumns.THUMBNAIL, mOriginalThumbnail); values.put(ChunkColumns.STARRED, mOriginalStarred); getContentResolver().update(mUri, values, null, null); } else if (mState == STATE_INSERT) { deleteChunk(); } } setResult(RESULT_CANCELED); finish(); } | /**
* Take care of canceling work on a chunk. Deletes the chunk if we
* had created it, otherwise reverts to the original text.
*/ | Take care of canceling work on a chunk. Deletes the chunk if we had created it, otherwise reverts to the original text | cancelChunk | {
"repo_name": "cesine/PDFtoAudioBook",
"path": "src/ca/openlanguage/pdftoaudiobook/ui/ChunksEditDetailActivity.java",
"license": "apache-2.0",
"size": 30296
} | [
"android.content.ContentValues",
"ca.openlanguage.pdftoaudiobook.provider.ChunkDatabase"
] | import android.content.ContentValues; import ca.openlanguage.pdftoaudiobook.provider.ChunkDatabase; | import android.content.*; import ca.openlanguage.pdftoaudiobook.provider.*; | [
"android.content",
"ca.openlanguage.pdftoaudiobook"
] | android.content; ca.openlanguage.pdftoaudiobook; | 391,670 |
void interactBlock(int x, int y, int z, Direction side); | void interactBlock(int x, int y, int z, Direction side); | /**
* Simulates the interaction with this object as if a player had done so.
*
* @param x The X position
* @param y The Y position
* @param z The Z position
* @param side The side of the block to interact with
*/ | Simulates the interaction with this object as if a player had done so | interactBlock | {
"repo_name": "jonk1993/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/Extent.java",
"license": "mit",
"size": 19459
} | [
"org.spongepowered.api.util.Direction"
] | import org.spongepowered.api.util.Direction; | import org.spongepowered.api.util.*; | [
"org.spongepowered.api"
] | org.spongepowered.api; | 999,842 |
public final CursorPage<DmAccount> queryPageByShippingCountry(java.lang.String shippingCountry,
int pageSize, String cursorString) {
final Filter filter = createEqualsFilter(COLUMN_NAME_SHIPPINGCOUNTRY, shippingCountry);
return queryPage(false, pageSize, null, null, null, false, null, false, cursorString, filter);
}
/**
* {@inheritDoc} | final CursorPage<DmAccount> function(java.lang.String shippingCountry, int pageSize, String cursorString) { final Filter filter = createEqualsFilter(COLUMN_NAME_SHIPPINGCOUNTRY, shippingCountry); return queryPage(false, pageSize, null, null, null, false, null, false, cursorString, filter); } /** * {@inheritDoc} | /**
* query-page-by method for field shippingCountry
* @param shippingCountry the specified attribute
* @param pageSize the number of domain entities in the page
* @param cursorString non-null if get next page
* @return a Page of DmAccounts for the specified shippingCountry
*/ | query-page-by method for field shippingCountry | queryPageByShippingCountry | {
"repo_name": "goldengekko/Meetr-Backend",
"path": "src/main/java/com/goldengekko/meetr/dao/GeneratedDmAccountDaoImpl.java",
"license": "gpl-3.0",
"size": 38969
} | [
"com.goldengekko.meetr.domain.DmAccount",
"net.sf.mardao.core.CursorPage",
"net.sf.mardao.core.Filter"
] | import com.goldengekko.meetr.domain.DmAccount; import net.sf.mardao.core.CursorPage; import net.sf.mardao.core.Filter; | import com.goldengekko.meetr.domain.*; import net.sf.mardao.core.*; | [
"com.goldengekko.meetr",
"net.sf.mardao"
] | com.goldengekko.meetr; net.sf.mardao; | 357,701 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualHubRouteTableV2Inner> createOrUpdateAsync(
String resourceGroupName,
String virtualHubName,
String routeTableName,
VirtualHubRouteTableV2Inner virtualHubRouteTableV2Parameters) {
return beginCreateOrUpdateAsync(
resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<VirtualHubRouteTableV2Inner> function( String resourceGroupName, String virtualHubName, String routeTableName, VirtualHubRouteTableV2Inner virtualHubRouteTableV2Parameters) { return beginCreateOrUpdateAsync( resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2.
*
* @param resourceGroupName The resource group name of the VirtualHub.
* @param virtualHubName The name of the VirtualHub.
* @param routeTableName The name of the VirtualHubRouteTableV2.
* @param virtualHubRouteTableV2Parameters VirtualHubRouteTableV2 Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return virtualHubRouteTableV2 Resource.
*/ | Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2 | createOrUpdateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VirtualHubRouteTableV2SClientImpl.java",
"license": "mit",
"size": 55664
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.network.fluent.models.VirtualHubRouteTableV2Inner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.VirtualHubRouteTableV2Inner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 589,659 |
private void checkSharedDimensionReference( PropertyDefn propDefn,
Object value ) throws SemanticException
{
if ( !ITabularDimensionModel.INTERNAL_DIMENSION_RFF_TYPE_PROP
.equalsIgnoreCase( propDefn.getName( ) ) )
return;
if ( value instanceof DesignElementHandle )
{
DesignElementHandle handle = (DesignElementHandle) value;
if ( !( handle.getContainer( ) instanceof ModuleHandle ) )
{
throw new SemanticError( element, new String[]{
element.getName( ), handle.getName( )},
SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF );
}
}
else if ( value instanceof DesignElement )
{
DesignElement refElement = (DesignElement) value;
if ( !( refElement.getContainer( ) instanceof Module ) )
{
throw new SemanticError( element, new String[]{
element.getName( ), refElement.getName( )},
SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF );
}
}
else if ( value instanceof ElementRefValue )
{
ElementRefValue refValue = (ElementRefValue) value;
if ( refValue.isResolved( )
&& !( refValue.getElement( ).getContainer( ) instanceof Module ) )
{
throw new SemanticError( element, new String[]{
element.getName( ), refValue.getName( )},
SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF );
}
}
} | void function( PropertyDefn propDefn, Object value ) throws SemanticException { if ( !ITabularDimensionModel.INTERNAL_DIMENSION_RFF_TYPE_PROP .equalsIgnoreCase( propDefn.getName( ) ) ) return; if ( value instanceof DesignElementHandle ) { DesignElementHandle handle = (DesignElementHandle) value; if ( !( handle.getContainer( ) instanceof ModuleHandle ) ) { throw new SemanticError( element, new String[]{ element.getName( ), handle.getName( )}, SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF ); } } else if ( value instanceof DesignElement ) { DesignElement refElement = (DesignElement) value; if ( !( refElement.getContainer( ) instanceof Module ) ) { throw new SemanticError( element, new String[]{ element.getName( ), refElement.getName( )}, SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF ); } } else if ( value instanceof ElementRefValue ) { ElementRefValue refValue = (ElementRefValue) value; if ( refValue.isResolved( ) && !( refValue.getElement( ).getContainer( ) instanceof Module ) ) { throw new SemanticError( element, new String[]{ element.getName( ), refValue.getName( )}, SemanticError.DESIGN_EXCEPTION_INVALID_DATA_BINDING_REF ); } } } | /**
* Checks the shared dimension reference. The dimension referred by cube
* dimension must be shared dimension.
*
* @param propDefn
* the property/member definition
* @param value
* element reference value
* @throws SemanticException
*/ | Checks the shared dimension reference. The dimension referred by cube dimension must be shared dimension | checkSharedDimensionReference | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/command/PropertyCommand.java",
"license": "epl-1.0",
"size": 41836
} | [
"org.eclipse.birt.report.model.api.DesignElementHandle",
"org.eclipse.birt.report.model.api.ModuleHandle",
"org.eclipse.birt.report.model.api.activity.SemanticException",
"org.eclipse.birt.report.model.api.elements.SemanticError",
"org.eclipse.birt.report.model.core.DesignElement",
"org.eclipse.birt.repor... | import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.ModuleHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.SemanticError; import org.eclipse.birt.report.model.core.DesignElement; import org.eclipse.birt.report.model.core.Module; import org.eclipse.birt.report.model.elements.interfaces.ITabularDimensionModel; import org.eclipse.birt.report.model.metadata.ElementRefValue; import org.eclipse.birt.report.model.metadata.PropertyDefn; | import org.eclipse.birt.report.model.api.*; import org.eclipse.birt.report.model.api.activity.*; import org.eclipse.birt.report.model.api.elements.*; import org.eclipse.birt.report.model.core.*; import org.eclipse.birt.report.model.elements.interfaces.*; import org.eclipse.birt.report.model.metadata.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 178,069 |
return new BookApplicationService();
}
| return new BookApplicationService(); } | /**
* Provides a new instance of <code>{@link BookApplicationService}</code>
* @return <code>{@link BookApplicationService}</code>
*/ | Provides a new instance of <code><code>BookApplicationService</code></code> | getBookService | {
"repo_name": "pablo-albaladejo/javaee",
"path": "Modulo8/BookstoreWS/src/java/ws/logic/service/ServiceFactoryImp.java",
"license": "gpl-3.0",
"size": 550
} | [
"ws.logic.book.BookApplicationService"
] | import ws.logic.book.BookApplicationService; | import ws.logic.book.*; | [
"ws.logic.book"
] | ws.logic.book; | 1,802,975 |
@Test
public void testDownloadGMLAsZipWithJSONError() throws Exception {
final String outputFormat = "gml";
final String[] serviceUrls = {
"http://localhost:8088/AuScope-Portal/doBoreholeFilter.do?&serviceUrl=http://nvclwebservices.vm.csiro.au:80/geoserverBH/wfs",
"http://localhost:8088/AuScope-Portal/doBoreholeFilter.do?&serviceUrl=http://www.mrt.tas.gov.au:80/web-services/wfs"};
final String dummyMessage = "hereisadummymessage";
final String dummyJSONResponse = "{\"msg\": '" + dummyMessage
+ "',\"success\":false}";
final String dummyJSONResponseNoMsg = "{\"success\":false}";
final MyServletOutputStream servletOutputStream = new MyServletOutputStream(dummyJSONResponseNoMsg.length());
final InputStream dummyJSONResponseNoMsgIS = new ByteArrayInputStream(dummyJSONResponseNoMsg.getBytes());
final InputStream dummyJSONResponseIS = new ByteArrayInputStream(dummyJSONResponse.getBytes());
context.checking(new Expectations() {
{
// setting of the headers for the return content
oneOf(mockHttpResponse).setContentType(with(any(String.class)));
oneOf(mockHttpResponse).setHeader(with(any(String.class)), with(any(String.class)));
oneOf(mockHttpResponse).getOutputStream();
will(returnValue(servletOutputStream));
// calling the service
oneOf(httpServiceCaller).getMethodResponseAsHttpResponse(with(any(HttpRequestBase.class)));
will(returnValue(new HttpClientResponse(new MyHttpResponse(dummyJSONResponseIS), null)));
oneOf(httpServiceCaller).getMethodResponseAsHttpResponse(with(any(HttpRequestBase.class)));
will(delayReturnValue(300, new HttpClientResponse(new MyHttpResponse(dummyJSONResponseNoMsgIS), null)));
allowing(mockServiceConfiguration).getServiceConfigurationItem(with(any(String.class)));
will(returnValue(null));
}
});
downloadController.downloadGMLAsZip(serviceUrls, mockHttpResponse,
threadPool, null, outputFormat);
Thread.sleep(500);
dummyJSONResponseNoMsgIS.close();
dummyJSONResponseIS.close();
// check that the zip file contains the correct data
ZipInputStream zipInputStream = servletOutputStream.getZipInputStream();
ZipEntry ze = zipInputStream.getNextEntry();
Assert.assertNotNull(ze);
String name = ze.getName();
Assert.assertTrue(name.equals("downloadInfo.txt"));
String error = "Unsuccessful JSON reply from: http://nvclwebservices.vm.csiro.au:80/geoserverBH/wfs\n" +
"hereisadummymessage\n\n" +
"Unsuccessful JSON reply from: http://www.mrt.tas.gov.au:80/web-services/wfs\n" +
"No error message\n\n";
byte[] uncompressedData = new byte[error.getBytes().length];
zipInputStream.read(uncompressedData);
String s = new String(uncompressedData);
Assert.assertTrue(s.contains("hereisadummymessage"));
Assert.assertTrue(s.contains("No error message"));
zipInputStream.close();
} | void function() throws Exception { final String outputFormat = "gml"; final String[] serviceUrls = { STRhttp: final String dummyMessage = STR; final String dummyJSONResponse = "{\"msg\STR + dummyMessage + "',\"success\STR; final String dummyJSONResponseNoMsg = "{\"success\STR; final MyServletOutputStream servletOutputStream = new MyServletOutputStream(dummyJSONResponseNoMsg.length()); final InputStream dummyJSONResponseNoMsgIS = new ByteArrayInputStream(dummyJSONResponseNoMsg.getBytes()); final InputStream dummyJSONResponseIS = new ByteArrayInputStream(dummyJSONResponse.getBytes()); context.checking(new Expectations() { { oneOf(mockHttpResponse).setContentType(with(any(String.class))); oneOf(mockHttpResponse).setHeader(with(any(String.class)), with(any(String.class))); oneOf(mockHttpResponse).getOutputStream(); will(returnValue(servletOutputStream)); oneOf(httpServiceCaller).getMethodResponseAsHttpResponse(with(any(HttpRequestBase.class))); will(returnValue(new HttpClientResponse(new MyHttpResponse(dummyJSONResponseIS), null))); oneOf(httpServiceCaller).getMethodResponseAsHttpResponse(with(any(HttpRequestBase.class))); will(delayReturnValue(300, new HttpClientResponse(new MyHttpResponse(dummyJSONResponseNoMsgIS), null))); allowing(mockServiceConfiguration).getServiceConfigurationItem(with(any(String.class))); will(returnValue(null)); } }); downloadController.downloadGMLAsZip(serviceUrls, mockHttpResponse, threadPool, null, outputFormat); Thread.sleep(500); dummyJSONResponseNoMsgIS.close(); dummyJSONResponseIS.close(); ZipInputStream zipInputStream = servletOutputStream.getZipInputStream(); ZipEntry ze = zipInputStream.getNextEntry(); Assert.assertNotNull(ze); String name = ze.getName(); Assert.assertTrue(name.equals(STR)); String error = STRhereisadummymessage\n\n" + STRNo error message\n\n"; byte[] uncompressedData = new byte[error.getBytes().length]; zipInputStream.read(uncompressedData); String s = new String(uncompressedData); Assert.assertTrue(s.contains(STR)); Assert.assertTrue(s.contains(STR)); zipInputStream.close(); } | /**
* Test that this function makes all of the approriate calls, and see if it returns gml given some dummy data
*
* This dummy data is missing the data element but contains a msg property (This added in response to JIRA AUS-1575)
*/ | Test that this function makes all of the approriate calls, and see if it returns gml given some dummy data This dummy data is missing the data element but contains a msg property (This added in response to JIRA AUS-1575) | testDownloadGMLAsZipWithJSONError | {
"repo_name": "GeoscienceAustralia/portal-core",
"path": "src/test/java/org/auscope/portal/core/server/controllers/TestDownloadController.java",
"license": "lgpl-3.0",
"size": 16973
} | [
"java.io.ByteArrayInputStream",
"java.io.InputStream",
"java.util.zip.ZipEntry",
"java.util.zip.ZipInputStream",
"org.apache.http.client.methods.HttpRequestBase",
"org.auscope.portal.core.server.http.HttpClientResponse",
"org.auscope.portal.core.server.http.download.MyHttpResponse",
"org.jmock.Expecta... | import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.http.client.methods.HttpRequestBase; import org.auscope.portal.core.server.http.HttpClientResponse; import org.auscope.portal.core.server.http.download.MyHttpResponse; import org.jmock.Expectations; import org.junit.Assert; | import java.io.*; import java.util.zip.*; import org.apache.http.client.methods.*; import org.auscope.portal.core.server.http.*; import org.auscope.portal.core.server.http.download.*; import org.jmock.*; import org.junit.*; | [
"java.io",
"java.util",
"org.apache.http",
"org.auscope.portal",
"org.jmock",
"org.junit"
] | java.io; java.util; org.apache.http; org.auscope.portal; org.jmock; org.junit; | 2,137,637 |
public static boolean[] getFileVisibilities(Configuration conf) {
return parseBooleans(conf.getStrings(JobContext.CACHE_FILE_VISIBILITIES));
} | static boolean[] function(Configuration conf) { return parseBooleans(conf.getStrings(JobContext.CACHE_FILE_VISIBILITIES)); } | /**
* Get the booleans on whether the files are public or not. Used by
* internal DistributedCache and MapReduce code.
* @param conf The configuration which stored the timestamps
* @return array of booleans
* @throws IOException
*/ | Get the booleans on whether the files are public or not. Used by internal DistributedCache and MapReduce code | getFileVisibilities | {
"repo_name": "wzhuo918/release-1.1.2-MDP",
"path": "src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java",
"license": "apache-2.0",
"size": 41899
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.mapreduce.JobContext"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.JobContext; | import org.apache.hadoop.conf.*; import org.apache.hadoop.mapreduce.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,689,746 |
public static boolean zipFiles(final Collection<File> srcFiles, final File zipFile)
throws IOException {
return zipFiles(srcFiles, zipFile, null);
} | static boolean function(final Collection<File> srcFiles, final File zipFile) throws IOException { return zipFiles(srcFiles, zipFile, null); } | /**
* Zip the files.
*
* @param srcFiles The source of files.
* @param zipFile The ZIP file.
* @return {@code true}: success<br>{@code false}: fail
* @throws IOException if an I/O error has occurred
*/ | Zip the files | zipFiles | {
"repo_name": "Blankj/AndroidUtilCode",
"path": "lib/utilcode/src/main/java/com/blankj/utilcode/util/ZipUtils.java",
"license": "apache-2.0",
"size": 14984
} | [
"java.io.File",
"java.io.IOException",
"java.util.Collection"
] | import java.io.File; import java.io.IOException; import java.util.Collection; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,905,638 |
public static BufferedImage trimmedImage(BufferedImage source) {
final int minAlpha = 1;
final int srcWidth = source.getWidth();
final int srcHeight = source.getHeight();
Raster raster = source.getRaster();
int l = srcWidth, t = srcHeight, r = 0, b = 0;
int alpha, x, y;
int[] pixel = new int[4];
for (y = 0; y < srcHeight; y++) {
for (x = 0; x < srcWidth; x++) {
raster.getPixel(x, y, pixel);
alpha = pixel[3];
if (alpha >= minAlpha) {
l = Math.min(x, l);
t = Math.min(y, t);
r = Math.max(x, r);
b = Math.max(y, b);
}
}
}
if (l > r || t > b) {
// No pixels, couldn't trim
return source;
}
return source.getSubimage(l, t, r - l + 1, b - t + 1);
} | static BufferedImage function(BufferedImage source) { final int minAlpha = 1; final int srcWidth = source.getWidth(); final int srcHeight = source.getHeight(); Raster raster = source.getRaster(); int l = srcWidth, t = srcHeight, r = 0, b = 0; int alpha, x, y; int[] pixel = new int[4]; for (y = 0; y < srcHeight; y++) { for (x = 0; x < srcWidth; x++) { raster.getPixel(x, y, pixel); alpha = pixel[3]; if (alpha >= minAlpha) { l = Math.min(x, l); t = Math.min(y, t); r = Math.max(x, r); b = Math.max(y, b); } } } if (l > r t > b) { return source; } return source.getSubimage(l, t, r - l + 1, b - t + 1); } | /**
* Trims the transparent pixels from the given {@link BufferedImage} (returns a sub-image).
*
* @param source The source image.
* @return A new, trimmed image, or the source image if no trim is performed.
*/ | Trims the transparent pixels from the given <code>BufferedImage</code> (returns a sub-image) | trimmedImage | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/assetstudio/src/com/android/assetstudiolib/Util.java",
"license": "gpl-2.0",
"size": 17424
} | [
"java.awt.image.BufferedImage",
"java.awt.image.Raster"
] | import java.awt.image.BufferedImage; import java.awt.image.Raster; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 1,535,678 |
private void writeAttributes (Attributes atts) throws IOException, SAXException {
int len = atts.getLength();
for (int i = 0; i < len; i++) {
char ch[] = atts.getValue(i).toCharArray();
write(' ');
writeName(atts.getURI(i), atts.getLocalName(i),
atts.getQName(i), false);
write("=\"");
writeEsc(ch, 0, ch.length, true);
write('"');
}
} | void function (Attributes atts) throws IOException, SAXException { int len = atts.getLength(); for (int i = 0; i < len; i++) { char ch[] = atts.getValue(i).toCharArray(); write(' '); writeName(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), false); write("=\"STR'); } } | /**
* Write out an attribute list, escaping values.
*
* The names will have prefixes added to them.
*
* @param atts The attribute list to write.
* @exception SAXException If there is an error writing
* the attribute list, this method will throw an
* IOException wrapped in a SAXException.
*/ | Write out an attribute list, escaping values. The names will have prefixes added to them | writeAttributes | {
"repo_name": "samskivert/ikvm-openjdk",
"path": "build/linux-amd64/impsrc/com/sun/xml/internal/txw2/output/XMLWriter.java",
"license": "gpl-2.0",
"size": 34954
} | [
"java.io.IOException",
"org.xml.sax.Attributes",
"org.xml.sax.SAXException"
] | import java.io.IOException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; | import java.io.*; import org.xml.sax.*; | [
"java.io",
"org.xml.sax"
] | java.io; org.xml.sax; | 1,090,051 |
public Map<McastRoleStoreKey, McastRole> getMcastRoles(IpAddress mcastIp,
ConnectPoint sourcecp) {
log.info("mcastRoles {}", mcastRoleStore.size());
if (mcastIp != null) {
Map<McastRoleStoreKey, McastRole> roles = mcastRoleStore.entrySet().stream()
.filter(mcastEntry -> mcastIp.equals(mcastEntry.getKey().mcastIp()))
.collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(),
entry.getKey().deviceId(), entry.getKey().source()), entry -> entry.getValue().value()));
if (sourcecp != null) {
roles = roles.entrySet().stream()
.filter(mcastEntry -> sourcecp.equals(mcastEntry.getKey().source()))
.collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(),
entry.getKey().deviceId(), entry.getKey().source()), Entry::getValue));
}
return roles;
}
return mcastRoleStore.entrySet().stream()
.collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(),
entry.getKey().deviceId(), entry.getKey().source()), entry -> entry.getValue().value()));
} | Map<McastRoleStoreKey, McastRole> function(IpAddress mcastIp, ConnectPoint sourcecp) { log.info(STR, mcastRoleStore.size()); if (mcastIp != null) { Map<McastRoleStoreKey, McastRole> roles = mcastRoleStore.entrySet().stream() .filter(mcastEntry -> mcastIp.equals(mcastEntry.getKey().mcastIp())) .collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(), entry.getKey().deviceId(), entry.getKey().source()), entry -> entry.getValue().value())); if (sourcecp != null) { roles = roles.entrySet().stream() .filter(mcastEntry -> sourcecp.equals(mcastEntry.getKey().source())) .collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(), entry.getKey().deviceId(), entry.getKey().source()), Entry::getValue)); } return roles; } return mcastRoleStore.entrySet().stream() .collect(Collectors.toMap(entry -> new McastRoleStoreKey(entry.getKey().mcastIp(), entry.getKey().deviceId(), entry.getKey().source()), entry -> entry.getValue().value())); } | /**
* Returns the associated roles to the mcast groups.
*
* @param mcastIp the group ip
* @param sourcecp the source connect point
* @return the mapping mcastIp-device to mcast role
*/ | Returns the associated roles to the mcast groups | getMcastRoles | {
"repo_name": "oplinkoms/onos",
"path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java",
"license": "apache-2.0",
"size": 103773
} | [
"java.util.Map",
"java.util.stream.Collectors",
"org.onlab.packet.IpAddress",
"org.onosproject.net.ConnectPoint"
] | import java.util.Map; import java.util.stream.Collectors; import org.onlab.packet.IpAddress; import org.onosproject.net.ConnectPoint; | import java.util.*; import java.util.stream.*; import org.onlab.packet.*; import org.onosproject.net.*; | [
"java.util",
"org.onlab.packet",
"org.onosproject.net"
] | java.util; org.onlab.packet; org.onosproject.net; | 1,684,977 |
public WebServiceEndpointConfiguration getEndpointConfiguration() {
return endpointConfiguration;
} | WebServiceEndpointConfiguration function() { return endpointConfiguration; } | /**
* Gets the endpoint configuration.
* @return
*/ | Gets the endpoint configuration | getEndpointConfiguration | {
"repo_name": "christophd/citrus",
"path": "endpoints/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java",
"license": "apache-2.0",
"size": 17846
} | [
"com.consol.citrus.ws.client.WebServiceEndpointConfiguration"
] | import com.consol.citrus.ws.client.WebServiceEndpointConfiguration; | import com.consol.citrus.ws.client.*; | [
"com.consol.citrus"
] | com.consol.citrus; | 186,355 |
ResponseInfo execute(RequestTemplate template, UUID requestId) throws Exception; | ResponseInfo execute(RequestTemplate template, UUID requestId) throws Exception; | /**
* Handles a request.
*
* @param template
* the request template
* @param requestId
* the unique request id
* @return a response info object
*/ | Handles a request | execute | {
"repo_name": "mgm-tp/perfload-core",
"path": "perfload-client/src/main/java/com/mgmtp/perfload/core/client/web/request/RequestHandler.java",
"license": "apache-2.0",
"size": 1921
} | [
"com.mgmtp.perfload.core.client.web.response.ResponseInfo",
"com.mgmtp.perfload.core.client.web.template.RequestTemplate"
] | import com.mgmtp.perfload.core.client.web.response.ResponseInfo; import com.mgmtp.perfload.core.client.web.template.RequestTemplate; | import com.mgmtp.perfload.core.client.web.response.*; import com.mgmtp.perfload.core.client.web.template.*; | [
"com.mgmtp.perfload"
] | com.mgmtp.perfload; | 2,108,429 |
public void checkAcceptability(Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException {
PropertyDescription[] props;
synchronized (this) {
if (m_state == Factory.INVALID) {
throw new MissingHandlerException(getMissingHandlers());
}
props = m_componentDesc.getProperties(); // Stack confinement.
// The property list is up to date, as the factory is valid.
}
// Check that the configuration does not override immutable properties.
for (int i = 0; i < props.length; i++) {
// Is the property immutable
if (props[i].isImmutable() && conf.get(props[i].getName()) != null) {
throw new UnacceptableConfiguration("The property " + props[i] + " cannot be overide : immutable property"); // The instance configuration tries to override an immutable property.
}
// Is the property required ?
if (props[i].isMandatory() && props[i].getValue() == null && conf.get(props[i].getName()) == null) {
throw new UnacceptableConfiguration("The mandatory property " + props[i].getName() + " is missing"); // The property must be set.
}
}
}
| void function(Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException { PropertyDescription[] props; synchronized (this) { if (m_state == Factory.INVALID) { throw new MissingHandlerException(getMissingHandlers()); } props = m_componentDesc.getProperties(); } for (int i = 0; i < props.length; i++) { if (props[i].isImmutable() && conf.get(props[i].getName()) != null) { throw new UnacceptableConfiguration(STR + props[i] + STR); } if (props[i].isMandatory() && props[i].getValue() == null && conf.get(props[i].getName()) == null) { throw new UnacceptableConfiguration(STR + props[i].getName() + STR); } } } | /**
* Checks if the configuration is acceptable.
* This method checks the following assertions:
* <li>All handlers can be creates</li>
* <li>The configuration does not override immutable properties</li>
* <li>The configuration contains a value for every unvalued property</li>
* @param conf the configuration to test.
* @throws UnacceptableConfiguration if the configuration is unacceptable.
* @throws MissingHandlerException if an handler is missing.
*/ | Checks if the configuration is acceptable. This method checks the following assertions: All handlers can be creates The configuration does not override immutable properties The configuration contains a value for every unvalued property | checkAcceptability | {
"repo_name": "boneman1231/org.apache.felix",
"path": "trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java",
"license": "apache-2.0",
"size": 39355
} | [
"java.util.Dictionary",
"org.apache.felix.ipojo.architecture.PropertyDescription"
] | import java.util.Dictionary; import org.apache.felix.ipojo.architecture.PropertyDescription; | import java.util.*; import org.apache.felix.ipojo.architecture.*; | [
"java.util",
"org.apache.felix"
] | java.util; org.apache.felix; | 2,101,453 |
public void delete( String pid ) throws IOException
{
cache.remove( pid );
pm.delete( pid );
}
| void function( String pid ) throws IOException { cache.remove( pid ); pm.delete( pid ); } | /**
* Remove the configuration with the given PID. This implementation removes
* the entry from the cache before calling the underlying persistence
* manager.
*/ | Remove the configuration with the given PID. This implementation removes the entry from the cache before calling the underlying persistence manager | delete | {
"repo_name": "boneman1231/org.apache.felix",
"path": "trunk/configadmin/src/main/java/org/apache/felix/cm/impl/CachingPersistenceManagerProxy.java",
"license": "apache-2.0",
"size": 6635
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,109,134 |
public static void reset(int totalParallelism) {
MockPMS.initCalled.set(false);
MockPMS.closeCalled.set(false);
MockPMS.receivedCloseError.set(null);
MockPS.closeCount.set(0);
MockPS.initCount.set(0);
MockPS.receivedCloseErrors.clear();
MockP.initCount.set(0);
MockP.closeCount.set(0);
MockP.saveToSnapshotCalled = false;
MockP.onSnapshotCompletedCalled = false;
NoOutputSourceP.proceedLatch = new CountDownLatch(1);
NoOutputSourceP.executionStarted = new CountDownLatch(totalParallelism);
NoOutputSourceP.initCount.set(0);
NoOutputSourceP.failure.set(null);
DummyStatefulP.parallelism = totalParallelism;
DummyStatefulP.wasRestored = true;
CollectPerProcessorSink.lists = null;
} | static void function(int totalParallelism) { MockPMS.initCalled.set(false); MockPMS.closeCalled.set(false); MockPMS.receivedCloseError.set(null); MockPS.closeCount.set(0); MockPS.initCount.set(0); MockPS.receivedCloseErrors.clear(); MockP.initCount.set(0); MockP.closeCount.set(0); MockP.saveToSnapshotCalled = false; MockP.onSnapshotCompletedCalled = false; NoOutputSourceP.proceedLatch = new CountDownLatch(1); NoOutputSourceP.executionStarted = new CountDownLatch(totalParallelism); NoOutputSourceP.initCount.set(0); NoOutputSourceP.failure.set(null); DummyStatefulP.parallelism = totalParallelism; DummyStatefulP.wasRestored = true; CollectPerProcessorSink.lists = null; } | /**
* Reset the static counters in test processors. Call before starting each
* test that uses them.
*/ | Reset the static counters in test processors. Call before starting each test that uses them | reset | {
"repo_name": "gurbuzali/hazelcast-jet",
"path": "hazelcast-jet-core/src/test/java/com/hazelcast/jet/core/TestProcessors.java",
"license": "apache-2.0",
"size": 19469
} | [
"java.util.concurrent.CountDownLatch"
] | import java.util.concurrent.CountDownLatch; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,837,340 |
public void setZoomLevel(@NonNull final Result result, float zoom) throws CameraAccessException {
final ZoomLevelFeature zoomLevel = cameraFeatures.getZoomLevel();
float maxZoom = zoomLevel.getMaximumZoomLevel();
float minZoom = zoomLevel.getMinimumZoomLevel();
if (zoom > maxZoom || zoom < minZoom) {
String errorMessage =
String.format(
Locale.ENGLISH,
"Zoom level out of bounds (zoom level should be between %f and %f).",
minZoom,
maxZoom);
result.error("ZOOM_ERROR", errorMessage, null);
return;
}
zoomLevel.setValue(zoom);
zoomLevel.updateBuilder(previewRequestBuilder);
refreshPreviewCaptureSession(
() -> result.success(null),
(code, message) -> result.error("setZoomLevelFailed", "Could not set zoom level.", null));
} | void function(@NonNull final Result result, float zoom) throws CameraAccessException { final ZoomLevelFeature zoomLevel = cameraFeatures.getZoomLevel(); float maxZoom = zoomLevel.getMaximumZoomLevel(); float minZoom = zoomLevel.getMinimumZoomLevel(); if (zoom > maxZoom zoom < minZoom) { String errorMessage = String.format( Locale.ENGLISH, STR, minZoom, maxZoom); result.error(STR, errorMessage, null); return; } zoomLevel.setValue(zoom); zoomLevel.updateBuilder(previewRequestBuilder); refreshPreviewCaptureSession( () -> result.success(null), (code, message) -> result.error(STR, STR, null)); } | /**
* Sets zoom level from dart.
*
* @param result Flutter result.
* @param zoom new value.
*/ | Sets zoom level from dart | setZoomLevel | {
"repo_name": "tvolkert/plugins",
"path": "packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java",
"license": "bsd-3-clause",
"size": 41067
} | [
"android.hardware.camera2.CameraAccessException",
"androidx.annotation.NonNull",
"io.flutter.plugin.common.MethodChannel",
"io.flutter.plugins.camera.features.zoomlevel.ZoomLevelFeature",
"java.util.Locale"
] | import android.hardware.camera2.CameraAccessException; import androidx.annotation.NonNull; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugins.camera.features.zoomlevel.ZoomLevelFeature; import java.util.Locale; | import android.hardware.camera2.*; import androidx.annotation.*; import io.flutter.plugin.common.*; import io.flutter.plugins.camera.features.zoomlevel.*; import java.util.*; | [
"android.hardware",
"androidx.annotation",
"io.flutter.plugin",
"io.flutter.plugins",
"java.util"
] | android.hardware; androidx.annotation; io.flutter.plugin; io.flutter.plugins; java.util; | 1,945,667 |
protected void addIndicatorOccurrencePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PremiseNumberType_indicatorOccurrence_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PremiseNumberType_indicatorOccurrence_feature", "_UI_PremiseNumberType_type"),
XALPackage.eINSTANCE.getPremiseNumberType_IndicatorOccurrence(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), XALPackage.eINSTANCE.getPremiseNumberType_IndicatorOccurrence(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Indicator Occurrence feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Indicator Occurrence feature. | addIndicatorOccurrencePropertyDescriptor | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/org/oasis/xAL/provider/PremiseNumberTypeItemProvider.java",
"license": "apache-2.0",
"size": 11487
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.oasis.xAL.XALPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.oasis.xAL.XALPackage; | import org.eclipse.emf.edit.provider.*; import org.oasis.*; | [
"org.eclipse.emf",
"org.oasis"
] | org.eclipse.emf; org.oasis; | 1,904,465 |
@Pure
Resource eResource(); | Resource eResource(); | /** Replies the resource to which the SarlBehavior is attached.
*/ | Replies the resource to which the SarlBehavior is attached | eResource | {
"repo_name": "jgfoster/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/ISarlBehaviorBuilder.java",
"license": "apache-2.0",
"size": 5157
} | [
"org.eclipse.emf.ecore.resource.Resource"
] | import org.eclipse.emf.ecore.resource.Resource; | import org.eclipse.emf.ecore.resource.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,406,696 |
public final Date getDate(String parameterName) throws SQLException {
throw Util.notImplemented();
} | final Date function(String parameterName) throws SQLException { throw Util.notImplemented(); } | /**
* JDBC 3.0
*
* Retrieves the value of a JDBC DATE parameter as a java.sql.Date object
*
* @param parameterName - the name of the parameter
* @return the parameter value. If the value is SQL NULL, the result is
* null.
* @exception SQLException Feature not implemented for now.
*/ | JDBC 3.0 Retrieves the value of a JDBC DATE parameter as a java.sql.Date object | getDate | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java",
"license": "apache-2.0",
"size": 62201
} | [
"java.sql.Date",
"java.sql.SQLException"
] | import java.sql.Date; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,352,742 |
public List<RegistryURLInfo> getAllRegistryUrls() {
return urlList;
}
| List<RegistryURLInfo> function() { return urlList; } | /**
* get all registryUrls
* @return
*/ | get all registryUrls | getAllRegistryUrls | {
"repo_name": "thiliniish/developer-studio",
"path": "registry/org.wso2.developerstudio.eclipse.greg.base/src/org/wso2/developerstudio/eclipse/greg/base/persistent/RegistryUrlStore.java",
"license": "apache-2.0",
"size": 7395
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 923,210 |
private JSONObject getStringToDate(JSONArray options)
throws GlobalizationError {
JSONObject obj = new JSONObject();
try {
// get formatting pattern from BB device
SimpleDateFormat fmt = new SimpleDateFormat(
Util.getBlackBerryDatePattern(options));
// Manually parse string based on user preferences or Locale default
String userDate = options.getJSONObject(0)
.get(Resources.DATESTRING).toString().trim();
Calendar date = Util.dateParserBB(userDate, fmt.toPattern());
if (date == null) { // date was unparsable
throw new Exception();
}
// return properties;
obj.put("year", date.get(Calendar.YEAR));
obj.put("month", date.get(Calendar.MONTH)); // returns 0-11
obj.put("day", date.get(Calendar.DAY_OF_MONTH));
obj.put("hour", date.get(Calendar.HOUR));
obj.put("minute", date.get(Calendar.MINUTE));
obj.put("second", date.get(Calendar.SECOND));
obj.put("millisecond", date.get(Calendar.MILLISECOND));
return obj;
} catch (Exception ge) {
throw new GlobalizationError(GlobalizationError.PARSING_ERROR);
}
} | JSONObject function(JSONArray options) throws GlobalizationError { JSONObject obj = new JSONObject(); try { SimpleDateFormat fmt = new SimpleDateFormat( Util.getBlackBerryDatePattern(options)); String userDate = options.getJSONObject(0) .get(Resources.DATESTRING).toString().trim(); Calendar date = Util.dateParserBB(userDate, fmt.toPattern()); if (date == null) { throw new Exception(); } obj.put("year", date.get(Calendar.YEAR)); obj.put("month", date.get(Calendar.MONTH)); obj.put("day", date.get(Calendar.DAY_OF_MONTH)); obj.put("hour", date.get(Calendar.HOUR)); obj.put(STR, date.get(Calendar.MINUTE)); obj.put(STR, date.get(Calendar.SECOND)); obj.put(STR, date.get(Calendar.MILLISECOND)); return obj; } catch (Exception ge) { throw new GlobalizationError(GlobalizationError.PARSING_ERROR); } } | /**
* Parses a date formatted as a string according to the client's user
* preferences and calendar using the time zone of the client and returns
* the corresponding date object
*
* @return JSONObject
* Object.year {Number}: The four digit year
* Object.month {Number}: The month from (0 - 11)
* Object.day {Number}: The day from (1 - 31)
* Object.hour {Number}: The hour from (0 - 23)
* Object.minute {Number}: The minute from (0 - 59)
* Object.second {Number}: The second from (0 - 59)
* Object.millisecond {Number}: The milliseconds (from 0 - 999),
* not available on all platforms
*
* @throws GlobalizationError.PARSING_ERROR
*/ | Parses a date formatted as a string according to the client's user preferences and calendar using the time zone of the client and returns the corresponding date object | getStringToDate | {
"repo_name": "OneMoreCheckin/mobile-app",
"path": "phonegap/2.6.0/blackberry/framework/ext/src/org/apache/cordova/globalization/Globalization.java",
"license": "mit",
"size": 24122
} | [
"java.util.Calendar",
"net.rim.device.api.i18n.SimpleDateFormat",
"org.apache.cordova.json4j.JSONArray",
"org.apache.cordova.json4j.JSONObject"
] | import java.util.Calendar; import net.rim.device.api.i18n.SimpleDateFormat; import org.apache.cordova.json4j.JSONArray; import org.apache.cordova.json4j.JSONObject; | import java.util.*; import net.rim.device.api.i18n.*; import org.apache.cordova.json4j.*; | [
"java.util",
"net.rim.device",
"org.apache.cordova"
] | java.util; net.rim.device; org.apache.cordova; | 2,685,463 |
public Object fromXML(Reader reader) {
return unmarshal(hierarchicalStreamDriver.createReader(reader), null);
} | Object function(Reader reader) { return unmarshal(hierarchicalStreamDriver.createReader(reader), null); } | /**
* Deserialize an object from an XML Reader.
*
* @throws XStreamException if the object cannot be deserialized
*/ | Deserialize an object from an XML Reader | fromXML | {
"repo_name": "Groostav/XStream-GG",
"path": "xstream/src/java/com/thoughtworks/xstream/XStream.java",
"license": "bsd-3-clause",
"size": 90964
} | [
"java.io.Reader"
] | import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 1,265,196 |
public Entity getMouseOver(World world, float reach) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.renderViewEntity != null) {
if (mc.theWorld != null) {
mc.pointedEntity = null;
double d0 = reach;
mc.objectMouseOver = mc.renderViewEntity.rayTrace(d0, reach);
double d1 = d0;
Vec3 vec3 = mc.renderViewEntity.getPosition(reach);
if (mc.objectMouseOver != null) {
d1 = mc.objectMouseOver.hitVec.distanceTo(vec3);
}
Vec3 vec31 = mc.renderViewEntity.getLook(reach);
Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
mc.pointedEntity = null;
Vec3 vec33 = null;
float f1 = 1.0F;
@SuppressWarnings("rawtypes")
List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.renderViewEntity,
mc.renderViewEntity.boundingBox.addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0)
.expand((double)f1, (double)f1, (double)f1));
double d2 = d1;
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity)list.get(i);
if (entity.canBeCollidedWith()) {
float f2 = entity.getCollisionBorderSize();
AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double)f2, (double)f2, (double)f2);
MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
if (axisalignedbb.isVecInside(vec3)) {
if (0.0D < d2 || d2 == 0.0D) {
mc.pointedEntity = entity;
vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
d2 = 0.0D;
}
}
else if (movingobjectposition != null) {
double d3 = vec3.distanceTo(movingobjectposition.hitVec);
if (d3 < d2 || d2 == 0.0D) {
if (entity == mc.renderViewEntity.ridingEntity && !entity.canRiderInteract()) {
if (d2 == 0.0D) {
mc.pointedEntity = entity;
vec33 = movingobjectposition.hitVec;
}
}
else {
mc.pointedEntity = entity;
vec33 = movingobjectposition.hitVec;
d2 = d3;
}
}
}
}
}
if (mc.pointedEntity != null && (d2 < d1 || mc.objectMouseOver == null)) {
mc.objectMouseOver = new MovingObjectPosition(mc.pointedEntity, vec33);
if (mc.pointedEntity instanceof EntityLivingBase || mc.pointedEntity instanceof EntityItemFrame) {
mc.pointedEntity = mc.pointedEntity;
}
}
}
}
return mc.pointedEntity;
} | Entity function(World world, float reach) { Minecraft mc = Minecraft.getMinecraft(); if (mc.renderViewEntity != null) { if (mc.theWorld != null) { mc.pointedEntity = null; double d0 = reach; mc.objectMouseOver = mc.renderViewEntity.rayTrace(d0, reach); double d1 = d0; Vec3 vec3 = mc.renderViewEntity.getPosition(reach); if (mc.objectMouseOver != null) { d1 = mc.objectMouseOver.hitVec.distanceTo(vec3); } Vec3 vec31 = mc.renderViewEntity.getLook(reach); Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); mc.pointedEntity = null; Vec3 vec33 = null; float f1 = 1.0F; @SuppressWarnings(STR) List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.renderViewEntity, mc.renderViewEntity.boundingBox.addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0) .expand((double)f1, (double)f1, (double)f1)); double d2 = d1; for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); if (entity.canBeCollidedWith()) { float f2 = entity.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double)f2, (double)f2, (double)f2); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); if (axisalignedbb.isVecInside(vec3)) { if (0.0D < d2 d2 == 0.0D) { mc.pointedEntity = entity; vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; d2 = 0.0D; } } else if (movingobjectposition != null) { double d3 = vec3.distanceTo(movingobjectposition.hitVec); if (d3 < d2 d2 == 0.0D) { if (entity == mc.renderViewEntity.ridingEntity && !entity.canRiderInteract()) { if (d2 == 0.0D) { mc.pointedEntity = entity; vec33 = movingobjectposition.hitVec; } } else { mc.pointedEntity = entity; vec33 = movingobjectposition.hitVec; d2 = d3; } } } } } if (mc.pointedEntity != null && (d2 < d1 mc.objectMouseOver == null)) { mc.objectMouseOver = new MovingObjectPosition(mc.pointedEntity, vec33); if (mc.pointedEntity instanceof EntityLivingBase mc.pointedEntity instanceof EntityItemFrame) { mc.pointedEntity = mc.pointedEntity; } } } } return mc.pointedEntity; } | /**
* Original function: Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime
*
* Now: Returns the closest entity you are looking at within a specified reach
*/ | Original function: Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime Now: Returns the closest entity you are looking at within a specified reach | getMouseOver | {
"repo_name": "DracoAnimus/Coding",
"path": "src/main/java/net/wildbill22/draco/items/weapons/staffs/ItemDragonStaff.java",
"license": "apache-2.0",
"size": 45140
} | [
"java.util.List",
"net.minecraft.client.Minecraft",
"net.minecraft.entity.Entity",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.entity.item.EntityItemFrame",
"net.minecraft.util.AxisAlignedBB",
"net.minecraft.util.MovingObjectPosition",
"net.minecraft.util.Vec3",
"net.minecraft.world.Worl... | import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; | import java.util.*; import net.minecraft.client.*; import net.minecraft.entity.*; import net.minecraft.entity.item.*; import net.minecraft.util.*; import net.minecraft.world.*; | [
"java.util",
"net.minecraft.client",
"net.minecraft.entity",
"net.minecraft.util",
"net.minecraft.world"
] | java.util; net.minecraft.client; net.minecraft.entity; net.minecraft.util; net.minecraft.world; | 2,519,591 |
@Override
public void send(String text) throws WebsocketNotConnectedException {
if (text == null)
throw new IllegalArgumentException("Cannot send 'null' data to a WebSocketImpl.");
send(draft.createFrames(text, role == Role.CLIENT));
} | void function(String text) throws WebsocketNotConnectedException { if (text == null) throw new IllegalArgumentException(STR); send(draft.createFrames(text, role == Role.CLIENT)); } | /**
* Send Text data to the other end.
*
* @throws IllegalArgumentException
* @throws NotYetConnectedException
*/ | Send Text data to the other end | send | {
"repo_name": "prasad79/SwarmPulse",
"path": "PulseServer/src/org/java_websocket/WebSocketImpl.java",
"license": "gpl-3.0",
"size": 25075
} | [
"org.java_websocket.exceptions.WebsocketNotConnectedException"
] | import org.java_websocket.exceptions.WebsocketNotConnectedException; | import org.java_websocket.exceptions.*; | [
"org.java_websocket.exceptions"
] | org.java_websocket.exceptions; | 2,791,759 |
public static boolean onPrint(Component component, boolean bPrintHeader)
{
PrinterJob job = PrinterJob.getPrinterJob();
ScreenPrinter fapp = new ScreenPrinter(component, bPrintHeader);
job.setPrintable(fapp);
if (job.printDialog ())
fapp.printJob(job);
return true;
} | static boolean function(Component component, boolean bPrintHeader) { PrinterJob job = PrinterJob.getPrinterJob(); ScreenPrinter fapp = new ScreenPrinter(component, bPrintHeader); job.setPrintable(fapp); if (job.printDialog ()) fapp.printJob(job); return true; } | /**
* Print the current screen.
* @return true.
*/ | Print the current screen | onPrint | {
"repo_name": "jbundle/jbundle",
"path": "thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java",
"license": "gpl-3.0",
"size": 9142
} | [
"java.awt.Component",
"java.awt.print.PrinterJob"
] | import java.awt.Component; import java.awt.print.PrinterJob; | import java.awt.*; import java.awt.print.*; | [
"java.awt"
] | java.awt; | 763,831 |
public static void set(Object obj,
long propertyId,
EntityId val,
int member,
int index)
{
switch(getPropertyMappingKind(obj.getTypeId(),propertyId,member))
{
case MappedToNull:
throw new ReadOnlyException("Property member is mapped to null");
case MappedToParameter:
throw new ReadOnlyException("Property member is mapped to parameter");
case MappedToMember:
{
int[] classMemberRef = getClassMemberReference(obj.getTypeId(),
propertyId,
member);
if (classMemberRef == null || classMemberRef.length == 0)
{
throw new SoftwareViolationException("Failed to get class member reference from dots_kernel");
}
ContainerBase container [] = new ContainerBase[1];
boolean parentIsChanged [] = new boolean [1];
parentIsChanged[0] = false;
dereferenceClassMemberReference(obj,
classMemberRef,
0,
index,
container,
parentIsChanged);
if (container[0] == null)
{
throw new ReadOnlyException("Unable to dereference property, some parent is null");
}
else
{
((EntityIdContainer)container[0]).setVal(val);
}
}
break;
}
} | static void function(Object obj, long propertyId, EntityId val, int member, int index) { switch(getPropertyMappingKind(obj.getTypeId(),propertyId,member)) { case MappedToNull: throw new ReadOnlyException(STR); case MappedToParameter: throw new ReadOnlyException(STR); case MappedToMember: { int[] classMemberRef = getClassMemberReference(obj.getTypeId(), propertyId, member); if (classMemberRef == null classMemberRef.length == 0) { throw new SoftwareViolationException(STR); } ContainerBase container [] = new ContainerBase[1]; boolean parentIsChanged [] = new boolean [1]; parentIsChanged[0] = false; dereferenceClassMemberReference(obj, classMemberRef, 0, index, container, parentIsChanged); if (container[0] == null) { throw new ReadOnlyException(STR); } else { ((EntityIdContainer)container[0]).setVal(val); } } break; } } | /**
* Set an EntityId property member in the object using a property.
*
* @param obj The object to modify.
* @param propertyId TypeId of the property to use.
* @param val The value to set the member to.
* @param member Index of the property member to modify.
* @param index Array index.
* @throws ReadOnlyException If the property member is read-only.
*/ | Set an EntityId property member in the object using a property | set | {
"repo_name": "SafirSDK/safir-sdk-core",
"path": "src/dots/dots_java.ss/src/com.saabgroup.safir.dob.typesystem/src/com/saabgroup/safir/dob/typesystem/Properties.java",
"license": "gpl-3.0",
"size": 83391
} | [
"com.saabgroup.safir.dob.typesystem.Object"
] | import com.saabgroup.safir.dob.typesystem.Object; | import com.saabgroup.safir.dob.typesystem.*; | [
"com.saabgroup.safir"
] | com.saabgroup.safir; | 1,592,734 |
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
public static ReportCalculationResults.Meta meta() {
return ReportCalculationResults.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(ReportCalculationResults.Meta.INSTANCE);
}
private ReportCalculationResults(
LocalDate valuationDate,
List<CalculationTarget> targets,
List<Column> columns,
Results calculationResults,
CalculationFunctions calculationFunctions,
ReferenceData referenceData) {
JodaBeanUtils.notNull(valuationDate, "valuationDate");
JodaBeanUtils.notNull(targets, "targets");
JodaBeanUtils.notNull(columns, "columns");
JodaBeanUtils.notNull(calculationResults, "calculationResults");
JodaBeanUtils.notNull(calculationFunctions, "calculationFunctions");
JodaBeanUtils.notNull(referenceData, "referenceData");
this.valuationDate = valuationDate;
this.targets = ImmutableList.copyOf(targets);
this.columns = ImmutableList.copyOf(columns);
this.calculationResults = calculationResults;
this.calculationFunctions = calculationFunctions;
this.referenceData = referenceData;
} | static ReportCalculationResults.Meta function() { return ReportCalculationResults.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ReportCalculationResults.Meta.INSTANCE); } private ReportCalculationResults( LocalDate valuationDate, List<CalculationTarget> targets, List<Column> columns, Results calculationResults, CalculationFunctions calculationFunctions, ReferenceData referenceData) { JodaBeanUtils.notNull(valuationDate, STR); JodaBeanUtils.notNull(targets, STR); JodaBeanUtils.notNull(columns, STR); JodaBeanUtils.notNull(calculationResults, STR); JodaBeanUtils.notNull(calculationFunctions, STR); JodaBeanUtils.notNull(referenceData, STR); this.valuationDate = valuationDate; this.targets = ImmutableList.copyOf(targets); this.columns = ImmutableList.copyOf(columns); this.calculationResults = calculationResults; this.calculationFunctions = calculationFunctions; this.referenceData = referenceData; } | /**
* The meta-bean for {@code ReportCalculationResults}.
* @return the meta-bean, not null
*/ | The meta-bean for ReportCalculationResults | meta | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/report/src/main/java/com/opengamma/strata/report/ReportCalculationResults.java",
"license": "apache-2.0",
"size": 19656
} | [
"com.google.common.collect.ImmutableList",
"com.opengamma.strata.basics.CalculationTarget",
"com.opengamma.strata.basics.ReferenceData",
"com.opengamma.strata.calc.Column",
"com.opengamma.strata.calc.Results",
"com.opengamma.strata.calc.runner.CalculationFunctions",
"java.time.LocalDate",
"java.util.L... | import com.google.common.collect.ImmutableList; import com.opengamma.strata.basics.CalculationTarget; import com.opengamma.strata.basics.ReferenceData; import com.opengamma.strata.calc.Column; import com.opengamma.strata.calc.Results; import com.opengamma.strata.calc.runner.CalculationFunctions; import java.time.LocalDate; import java.util.List; import org.joda.beans.JodaBeanUtils; | import com.google.common.collect.*; import com.opengamma.strata.basics.*; import com.opengamma.strata.calc.*; import com.opengamma.strata.calc.runner.*; import java.time.*; import java.util.*; import org.joda.beans.*; | [
"com.google.common",
"com.opengamma.strata",
"java.time",
"java.util",
"org.joda.beans"
] | com.google.common; com.opengamma.strata; java.time; java.util; org.joda.beans; | 2,772,593 |
public static Type getLongExtraType() {
return LongExtraType.instance();
} | static Type function() { return LongExtraType.instance(); } | /**
* Get the single instance of the "LongExtra" type.
*/ | Get the single instance of the "LongExtra" type | getLongExtraType | {
"repo_name": "spotbugs/spotbugs",
"path": "spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/TypeFrame.java",
"license": "lgpl-2.1",
"size": 5364
} | [
"org.apache.bcel.generic.Type"
] | import org.apache.bcel.generic.Type; | import org.apache.bcel.generic.*; | [
"org.apache.bcel"
] | org.apache.bcel; | 2,475,636 |
public static void setClassPath(String schemaName, String path)
throws SQLException {
if (schemaName == null || schemaName.length() == 0) {
schemaName = "public";
}
if ("public".equals(schemaName)) {
if (!AclId.getSessionUser().isSuperuser()) {
throw new SQLException(
"Permission denied. Only a super user can set the classpath of the public schema");
}
} else {
schemaName = schemaName.toLowerCase();
Oid schemaId = getSchemaId(schemaName);
if (schemaId == null) {
throw new SQLException("No such schema: " + schemaName);
}
if (!AclId.getSessionUser().hasSchemaCreatePermission(schemaId)) {
throw new SQLException(
"Permission denied. User must have create permission on the target schema in order to set the classpath");
}
}
PreparedStatement stmt;
ArrayList<Integer> entries = null;
if (path != null && path.length() > 0) {
// Collect and verify that all entries in the path represents a
// valid jar
//
entries = new ArrayList<Integer>();
stmt = SQLUtils.getDefaultConnection().prepareStatement("SELECT jarId FROM sqlj.jar_repository WHERE jarName = ?");
try {
for (;;) {
int colon = path.indexOf(':');
String jarName;
if (colon >= 0) {
jarName = path.substring(0, colon);
path = path.substring(colon + 1);
} else {
jarName = path;
}
int jarId = getJarId(stmt, jarName, null);
if (jarId < 0) {
throw new SQLException("No such jar: " + jarName);
}
entries.add(new Integer(jarId));
if (colon < 0) {
break;
}
}
} finally {
SQLUtils.close(stmt);
}
}
// Delete the old classpath
//
stmt = SQLUtils.getDefaultConnection().prepareStatement("DELETE FROM sqlj.classpath_entry WHERE schemaName = ?");
try {
stmt.setString(1, schemaName);
stmt.executeUpdate();
} finally {
SQLUtils.close(stmt);
}
if (entries != null) {
// Insert the new path.
//
stmt = SQLUtils.getDefaultConnection().prepareStatement("INSERT INTO sqlj.classpath_entry(schemaName, ordinal, jarId) VALUES(?, ?, ?)");
try {
int top = entries.size();
for (int idx = 0; idx < top; ++idx) {
int jarId = entries.get(idx).intValue();
stmt.setString(1, schemaName);
stmt.setInt(2, idx + 1);
stmt.setInt(3, jarId);
stmt.executeUpdate();
}
} finally {
SQLUtils.close(stmt);
}
}
Loader.clearSchemaLoaders();
} | static void function(String schemaName, String path) throws SQLException { if (schemaName == null schemaName.length() == 0) { schemaName = STR; } if (STR.equals(schemaName)) { if (!AclId.getSessionUser().isSuperuser()) { throw new SQLException( STR); } } else { schemaName = schemaName.toLowerCase(); Oid schemaId = getSchemaId(schemaName); if (schemaId == null) { throw new SQLException(STR + schemaName); } if (!AclId.getSessionUser().hasSchemaCreatePermission(schemaId)) { throw new SQLException( STR); } } PreparedStatement stmt; ArrayList<Integer> entries = null; if (path != null && path.length() > 0) { stmt = SQLUtils.getDefaultConnection().prepareStatement(STR); try { for (;;) { int colon = path.indexOf(':'); String jarName; if (colon >= 0) { jarName = path.substring(0, colon); path = path.substring(colon + 1); } else { jarName = path; } int jarId = getJarId(stmt, jarName, null); if (jarId < 0) { throw new SQLException(STR + jarName); } entries.add(new Integer(jarId)); if (colon < 0) { break; } } } finally { SQLUtils.close(stmt); } } try { stmt.setString(1, schemaName); stmt.executeUpdate(); } finally { SQLUtils.close(stmt); } if (entries != null) { try { int top = entries.size(); for (int idx = 0; idx < top; ++idx) { int jarId = entries.get(idx).intValue(); stmt.setString(1, schemaName); stmt.setInt(2, idx + 1); stmt.setInt(3, jarId); stmt.executeUpdate(); } } finally { SQLUtils.close(stmt); } } Loader.clearSchemaLoaders(); } | /**
* Define the class path to use for Java functions, triggers, and procedures
* that are created in the schema named <code>schemaName</code> This method
* is exposed in SQL as <code>sqlj.set_classpath(VARCHAR, VARCHAR)</code>.
*
* @param schemaName
* Name of the schema for which this path is valid.
* @param path
* Colon separated list of names. Each name must denote the name
* of a jar that is present in the jar repository.
* @throws SQLException
* If no schema can be found with the givene name, or if one or
* several names of the path denotes a nonexistant jar file.
*/ | Define the class path to use for Java functions, triggers, and procedures that are created in the schema named <code>schemaName</code> This method is exposed in SQL as <code>sqlj.set_classpath(VARCHAR, VARCHAR)</code> | setClassPath | {
"repo_name": "ChiralBehaviors/pljava",
"path": "pljava-jdbc/src/main/java/org/postgresql/pljava/management/Commands.java",
"license": "bsd-3-clause",
"size": 33881
} | [
"java.sql.PreparedStatement",
"java.sql.SQLException",
"java.util.ArrayList",
"org.postgresql.pljava.internal.AclId",
"org.postgresql.pljava.internal.Oid",
"org.postgresql.pljava.jdbc.SQLUtils",
"org.postgresql.pljava.sqlj.Loader"
] | import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; import org.postgresql.pljava.internal.AclId; import org.postgresql.pljava.internal.Oid; import org.postgresql.pljava.jdbc.SQLUtils; import org.postgresql.pljava.sqlj.Loader; | import java.sql.*; import java.util.*; import org.postgresql.pljava.internal.*; import org.postgresql.pljava.jdbc.*; import org.postgresql.pljava.sqlj.*; | [
"java.sql",
"java.util",
"org.postgresql.pljava"
] | java.sql; java.util; org.postgresql.pljava; | 926,575 |
final public List<BOp> args() {
return new NotifyingList<BOp>(this);
}
static private class NotifyingList<T> implements List<T> {
private final ModifiableBOpBase bop;
private final List<T> delegate;
@SuppressWarnings("unchecked")
NotifyingList(final ModifiableBOpBase bop) {
this(bop, (List<T>) bop.args);
}
NotifyingList(final ModifiableBOpBase bop, final List<T> subList) {
this.bop = bop;
this.delegate = subList;
}
| final List<BOp> function() { return new NotifyingList<BOp>(this); } static private class NotifyingList<T> implements List<T> { private final ModifiableBOpBase bop; private final List<T> delegate; @SuppressWarnings(STR) NotifyingList(final ModifiableBOpBase bop) { this(bop, (List<T>) bop.args); } NotifyingList(final ModifiableBOpBase bop, final List<T> subList) { this.bop = bop; this.delegate = subList; } | /**
* An unmodifiable view of the list of arguments (aka children) of this
* node.
* <p>
* Note: The view is not modifiable in order to preserve the contract that
* {@link #mutation()} will be invoked if there is change in the state of
* this {@link BOp}.
*/ | An unmodifiable view of the list of arguments (aka children) of this node. Note: The view is not modifiable in order to preserve the contract that <code>#mutation()</code> will be invoked if there is change in the state of this <code>BOp</code> | args | {
"repo_name": "smalyshev/blazegraph",
"path": "bigdata/src/java/com/bigdata/bop/ModifiableBOpBase.java",
"license": "gpl-2.0",
"size": 22580
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,288,168 |
public void initialize(CordovaInterface cordova, CordovaWebView view)
{
super.initialize(cordova, view);
_bluetooth = new BluetoothWrapper(cordova.getActivity().getBaseContext(), _handler);
_wasDiscoveryCanceled = false;
} | void function(CordovaInterface cordova, CordovaWebView view) { super.initialize(cordova, view); _bluetooth = new BluetoothWrapper(cordova.getActivity().getBaseContext(), _handler); _wasDiscoveryCanceled = false; } | /**
* Initialize the Plugin, Cordova handles this.
*
* @param cordova Used to get register Handler with the Context accessible from this interface
* @param view Passed straight to super's initialization.
*/ | Initialize the Plugin, Cordova handles this | initialize | {
"repo_name": "nadavelyashiv/metal-finder-new",
"path": "platforms/android/src/org/apache/cordova/bluetooth/BluetoothPlugin.java",
"license": "mit",
"size": 26410
} | [
"org.apache.cordova.CordovaInterface",
"org.apache.cordova.CordovaWebView"
] | import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaWebView; | import org.apache.cordova.*; | [
"org.apache.cordova"
] | org.apache.cordova; | 2,851,496 |
public RequestCtx makeRequestCtx(String request)
throws MelcoeXacmlException {
RequestCtx reqCtx = null;
try {
ByteArrayInputStream is =
new ByteArrayInputStream(request.getBytes());
reqCtx = RequestCtx.getInstance(is);
} catch (ParsingException pe) {
throw new MelcoeXacmlException("Error parsing response.", pe);
}
return reqCtx;
} | RequestCtx function(String request) throws MelcoeXacmlException { RequestCtx reqCtx = null; try { ByteArrayInputStream is = new ByteArrayInputStream(request.getBytes()); reqCtx = RequestCtx.getInstance(is); } catch (ParsingException pe) { throw new MelcoeXacmlException(STR, pe); } return reqCtx; } | /**
* Converts a string based request to a RequestCtx obejct.
*
* @param request
* the string request
* @return the RequestCtx object
* @throws MelcoeXacmlException
*/ | Converts a string based request to a RequestCtx obejct | makeRequestCtx | {
"repo_name": "DBCDK/fcrepo-3.5-patched",
"path": "fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java",
"license": "apache-2.0",
"size": 19085
} | [
"com.sun.xacml.ParsingException",
"com.sun.xacml.ctx.RequestCtx",
"java.io.ByteArrayInputStream",
"org.fcrepo.server.security.xacml.MelcoeXacmlException"
] | import com.sun.xacml.ParsingException; import com.sun.xacml.ctx.RequestCtx; import java.io.ByteArrayInputStream; import org.fcrepo.server.security.xacml.MelcoeXacmlException; | import com.sun.xacml.*; import com.sun.xacml.ctx.*; import java.io.*; import org.fcrepo.server.security.xacml.*; | [
"com.sun.xacml",
"java.io",
"org.fcrepo.server"
] | com.sun.xacml; java.io; org.fcrepo.server; | 72,754 |
public boolean leftclick(ICropTile crop, EntityPlayer player) {
return crop.pick(true);
} | boolean function(ICropTile crop, EntityPlayer player) { return crop.pick(true); } | /**
* Called when the plant is leftclicked by a player.
* Default action is picking the plant.
*
* Only called Serverside.
*
* @param crop reference to ICropTile
* @param player player leftclicked the crop
* @return Whether the plant has changed
*/ | Called when the plant is leftclicked by a player. Default action is picking the plant. Only called Serverside | leftclick | {
"repo_name": "Tankistodor/SSAraminta",
"path": "src/main/java/ic2/api/crops/CropCard.java",
"license": "gpl-2.0",
"size": 10426
} | [
"net.minecraft.entity.player.EntityPlayer"
] | import net.minecraft.entity.player.EntityPlayer; | import net.minecraft.entity.player.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 1,089,009 |
private boolean pingNode(UUID nodeId) {
assert prj instanceof IgniteCluster; // Can only be invoked on top-level cluster group.
return ((IgniteCluster)prj).pingNode(nodeId);
}
/**
* Gets a topology by version. Returns {@code null} if topology history storage doesn't contain
* specified topology version (history currently keeps last {@code 1000} snapshots).
*
* @param topVer Topology version.
* @return Collection of grid nodes which represented by specified topology version,
* if it is present in history storage, {@code null} otherwise.
* @throws UnsupportedOperationException If underlying SPI implementation does not support
* topology history. Currently only {@link TcpDiscoverySpi} | boolean function(UUID nodeId) { assert prj instanceof IgniteCluster; return ((IgniteCluster)prj).pingNode(nodeId); } /** * Gets a topology by version. Returns {@code null} if topology history storage doesn't contain * specified topology version (history currently keeps last {@code 1000} snapshots). * * @param topVer Topology version. * @return Collection of grid nodes which represented by specified topology version, * if it is present in history storage, {@code null} otherwise. * @throws UnsupportedOperationException If underlying SPI implementation does not support * topology history. Currently only {@link TcpDiscoverySpi} | /**
* Pings a remote node.
*/ | Pings a remote node | pingNode | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java",
"license": "apache-2.0",
"size": 21785
} | [
"java.util.Collection",
"org.apache.ignite.IgniteCluster",
"org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"
] | import java.util.Collection; import org.apache.ignite.IgniteCluster; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.spi.discovery.tcp.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,384,883 |
private void disconnect(String playerId) {
try {
MpdPlayerConfig playerConfig = playerConfigCache.get(playerId);
MPDStandAloneMonitor monitor = playerConfig.monitor;
if (monitor != null) {
monitor.stop();
}
MPD mpd = playerConfig.instance;
if (mpd != null) {
mpd.close();
}
} catch (MPDConnectionException ce) {
logger.warn("couldn't disconnect player {}", playerId);
} catch (MPDResponseException re) {
logger.warn("received response error {}", re.getLocalizedMessage());
}
}
| void function(String playerId) { try { MpdPlayerConfig playerConfig = playerConfigCache.get(playerId); MPDStandAloneMonitor monitor = playerConfig.monitor; if (monitor != null) { monitor.stop(); } MPD mpd = playerConfig.instance; if (mpd != null) { mpd.close(); } } catch (MPDConnectionException ce) { logger.warn(STR, playerId); } catch (MPDResponseException re) { logger.warn(STR, re.getLocalizedMessage()); } } | /**
* Disconnects the player <code>playerId</code>
*
* @param playerId the id of the player to disconnect from
*/ | Disconnects the player <code>playerId</code> | disconnect | {
"repo_name": "Cougar/mirror-openhab",
"path": "bundles/binding/org.openhab.binding.mpd/src/main/java/org/openhab/binding/mpd/internal/MpdBinding.java",
"license": "gpl-3.0",
"size": 16816
} | [
"org.bff.javampd.exception.MPDConnectionException",
"org.bff.javampd.exception.MPDResponseException",
"org.bff.javampd.monitor.MPDStandAloneMonitor"
] | import org.bff.javampd.exception.MPDConnectionException; import org.bff.javampd.exception.MPDResponseException; import org.bff.javampd.monitor.MPDStandAloneMonitor; | import org.bff.javampd.exception.*; import org.bff.javampd.monitor.*; | [
"org.bff.javampd"
] | org.bff.javampd; | 2,134,004 |
void addToPolyline(Point2D<?, ?>... pts); | void addToPolyline(Point2D<?, ?>... pts); | /**
* Add a point to the end of the polyline.
*
* @param pts the points
*/ | Add a point to the end of the polyline | addToPolyline | {
"repo_name": "gallandarakhneorg/afc",
"path": "advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValue.java",
"license": "apache-2.0",
"size": 17372
} | [
"org.arakhne.afc.math.geometry.d2.Point2D"
] | import org.arakhne.afc.math.geometry.d2.Point2D; | import org.arakhne.afc.math.geometry.d2.*; | [
"org.arakhne.afc"
] | org.arakhne.afc; | 414,593 |
public File getFileFromDataDir(CharSequence path) {
CharSequence storagePath = dataPathHelper.rewrite(path);
return new File(repoDir, storagePath.toString());
}
| File function(CharSequence path) { CharSequence storagePath = dataPathHelper.rewrite(path); return new File(repoDir, storagePath.toString()); } | /**
* Access files under ".hg/store/data", ".hg/store/dh/" or ".hg/data" according to settings in requires file.
* File not necessarily exists, this method is merely a factory for Files at specific, configuration-dependent location.
*
* @param name shall be normalized path, without .i or .d suffixes
*/ | Access files under ".hg/store/data", ".hg/store/dh/" or ".hg/data" according to settings in requires file. File not necessarily exists, this method is merely a factory for Files at specific, configuration-dependent location | getFileFromDataDir | {
"repo_name": "CharlieKuharski/hg4j",
"path": "src/org/tmatesoft/hg/internal/Internals.java",
"license": "gpl-2.0",
"size": 21048
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 724,232 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.