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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
boolean addProblemFactChange(ProblemFactChange problemFactChange); | boolean addProblemFactChange(ProblemFactChange problemFactChange); | /**
* Schedules a {@link ProblemFactChange} to be processed.
* <p/>
* As a side-effect, this restarts the {@link Solver}, effectively resetting all {@link Termination}s,
* but not {@link #terminateEarly()}.
* <p/>
* This method is thread-safe.
* Follows specifications of {@link BlockingQueue#add(Object)} with by default
* a capacity of {@link Integer#MAX_VALUE}.
* @param problemFactChange never null
* @return true (as specified by {@link Collection#add})
*/ | Schedules a <code>ProblemFactChange</code> to be processed. As a side-effect, this restarts the <code>Solver</code>, effectively resetting all <code>Termination</code>s, but not <code>#terminateEarly()</code>. This method is thread-safe. Follows specifications of <code>BlockingQueue#add(Object)</code> with by default a capacity of <code>Integer#MAX_VALUE</code> | addProblemFactChange | {
"repo_name": "cyberdrcarr/optaplanner",
"path": "drools-planner-core/src/main/java/org/drools/planner/core/Solver.java",
"license": "apache-2.0",
"size": 4030
} | [
"org.drools.planner.core.solver.ProblemFactChange"
] | import org.drools.planner.core.solver.ProblemFactChange; | import org.drools.planner.core.solver.*; | [
"org.drools.planner"
] | org.drools.planner; | 56,038 |
protected void addAccountTransferAmount(Map<String, KualiDecimal> accountPeriodTransfer, ExpenseTransferAccountingLine transferLine, EffortCertificationReport effortReport) {
String transferKey = StringUtils.join(new Object[]{transferLine.getPayrollEndDateFiscalYear(), transferLine.getPayrollEndDateFiscalPeriodCode(), transferLine.getChartOfAccountsCode(), transferLine.getAccountNumber(), effortReport.getUniversityFiscalYear() + "-" + effortReport.getEffortCertificationReportNumber()}, ",");
KualiDecimal transferAmount = transferLine.getAmount().abs();
if (transferLine instanceof ExpenseTransferSourceAccountingLine) {
transferAmount = transferAmount.negated();
}
if (accountPeriodTransfer.containsKey(transferKey)) {
transferAmount = transferAmount.add(accountPeriodTransfer.get(transferKey));
}
accountPeriodTransfer.put(transferKey, transferAmount);
} | void function(Map<String, KualiDecimal> accountPeriodTransfer, ExpenseTransferAccountingLine transferLine, EffortCertificationReport effortReport) { String transferKey = StringUtils.join(new Object[]{transferLine.getPayrollEndDateFiscalYear(), transferLine.getPayrollEndDateFiscalPeriodCode(), transferLine.getChartOfAccountsCode(), transferLine.getAccountNumber(), effortReport.getUniversityFiscalYear() + "-" + effortReport.getEffortCertificationReportNumber()}, ","); KualiDecimal transferAmount = transferLine.getAmount().abs(); if (transferLine instanceof ExpenseTransferSourceAccountingLine) { transferAmount = transferAmount.negated(); } if (accountPeriodTransfer.containsKey(transferKey)) { transferAmount = transferAmount.add(accountPeriodTransfer.get(transferKey)); } accountPeriodTransfer.put(transferKey, transferAmount); } | /**
* Adds the line amount to the given map that contains the total transfer amount for the account and period.
*
* @param accountPeriodTransfer - map holding the total transfers
* @param effortReport - open report for transfer line
* @param transferLine - line with amount to add
*/ | Adds the line amount to the given map that contains the total transfer amount for the account and period | addAccountTransferAmount | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/document/service/impl/SalaryTransferPeriodValidationServiceImpl.java",
"license": "agpl-3.0",
"size": 16448
} | [
"java.util.Map",
"org.apache.commons.lang.StringUtils",
"org.kuali.kfs.integration.ec.EffortCertificationReport",
"org.kuali.kfs.module.ld.businessobject.ExpenseTransferAccountingLine",
"org.kuali.kfs.module.ld.businessobject.ExpenseTransferSourceAccountingLine",
"org.kuali.rice.core.api.util.type.KualiDe... | import java.util.Map; import org.apache.commons.lang.StringUtils; import org.kuali.kfs.integration.ec.EffortCertificationReport; import org.kuali.kfs.module.ld.businessobject.ExpenseTransferAccountingLine; import org.kuali.kfs.module.ld.businessobject.ExpenseTransferSourceAccountingLine; import org.kuali.rice.core.api.util.type.KualiDecimal; | import java.util.*; import org.apache.commons.lang.*; import org.kuali.kfs.integration.ec.*; import org.kuali.kfs.module.ld.businessobject.*; import org.kuali.rice.core.api.util.type.*; | [
"java.util",
"org.apache.commons",
"org.kuali.kfs",
"org.kuali.rice"
] | java.util; org.apache.commons; org.kuali.kfs; org.kuali.rice; | 451,901 |
private static void checkThatFileDoesntExist(File file) throws IOException {
if (file.exists()) {
throw new IOException("File '" + file.getPath()
+ "' already exists.");
}
} | static void function(File file) throws IOException { if (file.exists()) { throw new IOException(STR + file.getPath() + STR); } } | /**
* If we're trying to rename to a file that already exists, we'll throw an
* exception. Make sure that the same thing happens if the rename is
* accomplished by copying.
*
* @throws IOException
* if the file exists.
*/ | If we're trying to rename to a file that already exists, we'll throw an exception. Make sure that the same thing happens if the rename is accomplished by copying | checkThatFileDoesntExist | {
"repo_name": "fcrepo3/fcrepo",
"path": "fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/FileMovingUtil.java",
"license": "apache-2.0",
"size": 4863
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 372,966 |
public void addChatMessage(ITextComponent component)
{
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(component);
} | void function(ITextComponent component) { Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(component); } | /**
* Send a chat message to the CommandSender
*/ | Send a chat message to the CommandSender | addChatMessage | {
"repo_name": "MartyParty21/AwakenDreamsClient",
"path": "mcp/src/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java",
"license": "gpl-3.0",
"size": 5423
} | [
"net.minecraft.client.Minecraft",
"net.minecraft.util.text.ITextComponent"
] | import net.minecraft.client.Minecraft; import net.minecraft.util.text.ITextComponent; | import net.minecraft.client.*; import net.minecraft.util.text.*; | [
"net.minecraft.client",
"net.minecraft.util"
] | net.minecraft.client; net.minecraft.util; | 1,644,120 |
EClass getResult();
| EClass getResult(); | /**
* Returns the meta object for class '{@link org.openhealthtools.mdht.uml.cda.hitsp.Result <em>Result</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Result</em>'.
* @see org.openhealthtools.mdht.uml.cda.hitsp.Result
* @generated
*/ | Returns the meta object for class '<code>org.openhealthtools.mdht.uml.cda.hitsp.Result Result</code>'. | getResult | {
"repo_name": "drbgfc/mdht",
"path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.hitsp/src/org/openhealthtools/mdht/uml/cda/hitsp/HITSPPackage.java",
"license": "epl-1.0",
"size": 366422
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 271,913 |
public ExecRow makeEmptyRow() throws StandardException
{
return this.makeRow(null, null);
} | ExecRow function() throws StandardException { return this.makeRow(null, null); } | /**
* Return an empty row for this conglomerate.
*/ | Return an empty row for this conglomerate | makeEmptyRow | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java",
"license": "apache-2.0",
"size": 10556
} | [
"org.apache.derby.iapi.sql.execute.ExecRow",
"org.apache.derby.shared.common.error.StandardException"
] | import org.apache.derby.iapi.sql.execute.ExecRow; import org.apache.derby.shared.common.error.StandardException; | import org.apache.derby.iapi.sql.execute.*; import org.apache.derby.shared.common.error.*; | [
"org.apache.derby"
] | org.apache.derby; | 1,019,666 |
protected QueryKey getLeafQueryKeyFor(DatabaseQuery query, Expression expression, ClassDescriptor rootDescriptor, AbstractSession session) throws QueryException {
// Check for database field expressions or place holder
if ((expression == null) || (expression.isFieldExpression())) {
return null;
}
if (!(expression.isQueryKeyExpression())) {
return null;
}
QueryKeyExpression qkExpression = (QueryKeyExpression)expression;
Expression baseExpression = qkExpression.getBaseExpression();
ClassDescriptor descriptor = baseExpression.getLeafDescriptor(query, rootDescriptor, session);
return descriptor.getQueryKeyNamed(qkExpression.getName());
} | QueryKey function(DatabaseQuery query, Expression expression, ClassDescriptor rootDescriptor, AbstractSession session) throws QueryException { if ((expression == null) (expression.isFieldExpression())) { return null; } if (!(expression.isQueryKeyExpression())) { return null; } QueryKeyExpression qkExpression = (QueryKeyExpression)expression; Expression baseExpression = qkExpression.getBaseExpression(); ClassDescriptor descriptor = baseExpression.getLeafDescriptor(query, rootDescriptor, session); return descriptor.getQueryKeyNamed(qkExpression.getName()); } | /**
* INTERNAL:
* Lookup the query key for this item.
* If an aggregate of foreign mapping is found it is traversed.
*/ | Lookup the query key for this item. If an aggregate of foreign mapping is found it is traversed | getLeafQueryKeyFor | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/expressions/FunctionExpression.java",
"license": "epl-1.0",
"size": 41605
} | [
"org.eclipse.persistence.descriptors.ClassDescriptor",
"org.eclipse.persistence.exceptions.QueryException",
"org.eclipse.persistence.expressions.Expression",
"org.eclipse.persistence.internal.sessions.AbstractSession",
"org.eclipse.persistence.mappings.querykeys.QueryKey",
"org.eclipse.persistence.queries... | import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.exceptions.QueryException; import org.eclipse.persistence.expressions.Expression; import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.mappings.querykeys.QueryKey; import org.eclipse.persistence.queries.DatabaseQuery; | import org.eclipse.persistence.descriptors.*; import org.eclipse.persistence.exceptions.*; import org.eclipse.persistence.expressions.*; import org.eclipse.persistence.internal.sessions.*; import org.eclipse.persistence.mappings.querykeys.*; import org.eclipse.persistence.queries.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 1,364,676 |
public ProvisioningState provisioningState() {
return this.provisioningState;
} | ProvisioningState function() { return this.provisioningState; } | /**
* Get the provisioning state of the private link service resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'.
*
* @return the provisioningState value
*/ | Get the provisioning state of the private link service resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | provisioningState | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/PrivateLinkServiceInner.java",
"license": "mit",
"size": 8862
} | [
"com.microsoft.azure.management.network.v2019_11_01.ProvisioningState"
] | import com.microsoft.azure.management.network.v2019_11_01.ProvisioningState; | import com.microsoft.azure.management.network.v2019_11_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,901,018 |
public static Map<String, String> getMediationPolicyAttributes(String policyName, int tenantId, String direction,
APIIdentifier identifier) throws APIManagementException {
org.wso2.carbon.registry.api.Collection seqCollection = null;
String seqCollectionPath = "";
Map<String, String> mediationPolicyAttributes = new HashMap<>(3);
try {
UserRegistry registry = ServiceReferenceHolder.getInstance().getRegistryService()
.getGovernanceSystemRegistry(tenantId);
if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_IN.equals(direction)) {
seqCollection = (org.wso2.carbon.registry.api.Collection) registry
.get(APIConstants.API_CUSTOM_SEQUENCE_LOCATION + "/" +
APIConstants.API_CUSTOM_SEQUENCE_TYPE_IN);
} else if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_OUT.equals(direction)) {
seqCollection = (org.wso2.carbon.registry.api.Collection) registry
.get(APIConstants.API_CUSTOM_SEQUENCE_LOCATION + "/" +
APIConstants.API_CUSTOM_SEQUENCE_TYPE_OUT);
} else if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_FAULT.equals(direction)) {
seqCollection = (org.wso2.carbon.registry.api.Collection) registry
.get(APIConstants.API_CUSTOM_SEQUENCE_LOCATION + "/" +
APIConstants.API_CUSTOM_SEQUENCE_TYPE_FAULT);
}
if (seqCollection == null) {
seqCollection = (org.wso2.carbon.registry.api.Collection) registry.get
(getSequencePath(identifier,
direction));
}
if (seqCollection != null) {
String[] childPaths = seqCollection.getChildren();
for (String childPath : childPaths) {
Resource mediationPolicy = registry.get(childPath);
OMElement seqElment = APIUtil.buildOMElement(mediationPolicy.getContentStream());
String seqElmentName = seqElment.getAttributeValue(new QName("name"));
if (policyName.equals(seqElmentName)) {
mediationPolicyAttributes.put("path", childPath);
mediationPolicyAttributes.put("uuid", mediationPolicy.getUUID());
mediationPolicyAttributes.put("name", policyName);
return mediationPolicyAttributes;
}
}
}
// If the sequence not found the default sequences, check in custom sequences
seqCollection = (org.wso2.carbon.registry.api.Collection) registry.get
(getSequencePath(identifier, direction));
if (seqCollection != null) {
String[] childPaths = seqCollection.getChildren();
for (String childPath : childPaths) {
Resource mediationPolicy = registry.get(childPath);
OMElement seqElment = APIUtil.buildOMElement(mediationPolicy.getContentStream());
if (policyName.equals(seqElment.getAttributeValue(new QName("name")))) {
mediationPolicyAttributes.put("path", childPath);
mediationPolicyAttributes.put("uuid", mediationPolicy.getUUID());
mediationPolicyAttributes.put("name", policyName);
return mediationPolicyAttributes;
}
}
}
} catch (Exception e) {
String msg = "Issue is in accessing the Registry";
log.error(msg);
throw new APIManagementException(msg, e);
}
return mediationPolicyAttributes;
} | static Map<String, String> function(String policyName, int tenantId, String direction, APIIdentifier identifier) throws APIManagementException { org.wso2.carbon.registry.api.Collection seqCollection = null; String seqCollectionPath = STR/STR/STR/STRnameSTRpathSTRuuidSTRnameSTRnameSTRpathSTRuuidSTRnameSTRIssue is in accessing the Registry"; log.error(msg); throw new APIManagementException(msg, e); } return mediationPolicyAttributes; } | /**
* Returns attributes correspond to the given mediation policy name and direction
*
* @param policyName name of the sequence
* @param tenantId logged in user's tenantId
* @param direction in/out/fault
* @param identifier API identifier
* @return attributes(path, uuid) of the given mediation sequence or null
* @throws APIManagementException If failed to get the uuid of the mediation sequence
*/ | Returns attributes correspond to the given mediation policy name and direction | getMediationPolicyAttributes | {
"repo_name": "ruks/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java",
"license": "apache-2.0",
"size": 564037
} | [
"java.util.Collection",
"java.util.Map",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.APIIdentifier",
"org.wso2.carbon.registry.core.Registry"
] | import java.util.Collection; import java.util.Map; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.registry.core.Registry; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.registry.core.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 889,338 |
public HttpRequest receive(final PrintStream output)
throws HttpRequestException {
return receive((OutputStream) output);
} | HttpRequest function(final PrintStream output) throws HttpRequestException { return receive((OutputStream) output); } | /**
* Stream response to given print stream
*
* @param output
* @return this request
* @throws HttpRequestException
*/ | Stream response to given print stream | receive | {
"repo_name": "xeon90/Geeksone",
"path": "geeksone/src/main/java/com/cheese/geeksone/lib/HttpRequest.java",
"license": "gpl-3.0",
"size": 86954
} | [
"java.io.OutputStream",
"java.io.PrintStream"
] | import java.io.OutputStream; import java.io.PrintStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,147,698 |
public Collection<ServiceCalendar> getAllCalendars(); | Collection<ServiceCalendar> function(); | /****
* {@link ServiceCalendar} Methods
****/ | <code>ServiceCalendar</code> Methods | getAllCalendars | {
"repo_name": "kagix/infotranspub-backend",
"path": "modules/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/services/GtfsDao.java",
"license": "apache-2.0",
"size": 3700
} | [
"java.util.Collection",
"org.onebusaway.gtfs.model.ServiceCalendar"
] | import java.util.Collection; import org.onebusaway.gtfs.model.ServiceCalendar; | import java.util.*; import org.onebusaway.gtfs.model.*; | [
"java.util",
"org.onebusaway.gtfs"
] | java.util; org.onebusaway.gtfs; | 2,357,750 |
public void flushAll(boolean waitForAllToFinish) {
Log.v(Log.TAG_BATCHER, "%s: flushing all objects (wait=%b)", this, waitForAllToFinish);
synchronized (mutex) {
isFlushing = true;
unschedule();
}
while (true) {
ScheduledFuture future = null;
synchronized (mutex) {
if (inbox.size() == 0)
break; // Nothing to do | void function(boolean waitForAllToFinish) { Log.v(Log.TAG_BATCHER, STR, this, waitForAllToFinish); synchronized (mutex) { isFlushing = true; unschedule(); } while (true) { ScheduledFuture future = null; synchronized (mutex) { if (inbox.size() == 0) break; | /**
* Sends _all_ the queued objects at once to the processor block.
* After this method returns, all inbox objects will be processed.
*
* @param waitForAllToFinish wait until all objects are processed. If set to True,
* need to make sure not to call flushAll in the same
* WorkExecutor used by the batcher as it will result to
* deadlock.
*/ | Sends _all_ the queued objects at once to the processor block. After this method returns, all inbox objects will be processed | flushAll | {
"repo_name": "couchbase/couchbase-lite-java-core",
"path": "src/main/java/com/couchbase/lite/support/Batcher.java",
"license": "apache-2.0",
"size": 15827
} | [
"com.couchbase.lite.util.Log",
"java.util.concurrent.ScheduledFuture"
] | import com.couchbase.lite.util.Log; import java.util.concurrent.ScheduledFuture; | import com.couchbase.lite.util.*; import java.util.concurrent.*; | [
"com.couchbase.lite",
"java.util"
] | com.couchbase.lite; java.util; | 171,101 |
public void upperBound(byte[] key) throws IOException {
upperBound(key, 0, key.length);
} | void function(byte[] key) throws IOException { upperBound(key, 0, key.length); } | /**
* Move the cursor to the first entry whose key is strictly greater than the input key. Synonymous to upperBound(key, 0, key.length). The entry returned
* by the previous entry() call will be invalid.
*
* @param key
* The input key
*/ | Move the cursor to the first entry whose key is strictly greater than the input key. Synonymous to upperBound(key, 0, key.length). The entry returned by the previous entry() call will be invalid | upperBound | {
"repo_name": "phrocker/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFile.java",
"license": "apache-2.0",
"size": 70532
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,910,114 |
private Dimension getSourceImageDimensions() {
boolean isVerticalOrientation = (degreesOfRotation % 180 == 0);
return (isVerticalOrientation ? sourceSizeWhenVertical : sourceSizeWhenHorizontal);
} | Dimension function() { boolean isVerticalOrientation = (degreesOfRotation % 180 == 0); return (isVerticalOrientation ? sourceSizeWhenVertical : sourceSizeWhenHorizontal); } | /**
* The width and height of the image depend on its orientation.
*/ | The width and height of the image depend on its orientation | getSourceImageDimensions | {
"repo_name": "magarena/magarena",
"path": "src/magic/ui/widget/ImagePanel.java",
"license": "gpl-3.0",
"size": 7756
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 223,058 |
public static Map<String, Float> fetchPoints(List respconditions, int type) {
final Map<String, Float> points = new HashMap<String, Float>();
for (Iterator i = respconditions.iterator(); i.hasNext();) {
Element el_resp_condition = (Element) i.next();
// /todo
float fPoints = 0;
try {
Element el_setvar = el_resp_condition.element("setvar");
if (el_setvar == null) continue;
if (!el_setvar.attributeValue("action").equals("Add") && !el_setvar.attributeValue("action").equals("Subtract")
&& !el_setvar.attributeValue("action").equals("Set")) continue;
fPoints = new Float(el_setvar.getTextTrim()).floatValue();
if (el_setvar.attributeValue("action").equals("Subtract")) fPoints = fPoints * -1;
} catch (NumberFormatException nfe) {
continue;
}
if (fPoints != 0) {
// this code has been reworked for http://bugs.olat.org/jira/browse/OLAT-6672
Element conditionvar = el_resp_condition.element("conditionvar");
if (type == Question.TYPE_SC) {
// see ChoiceQuestion#buildRespconditionSC_mastery
final Element el_varequal = (Element) conditionvar.selectNodes(".//varequal").get(0);
points.put(el_varequal.getTextTrim(), new Float(fPoints));
} else if (type == Question.TYPE_MC) {
// see ChoiceQuestion#buildRespconditionMCSingle_mastery
final Element el_and = conditionvar.element("and");
final Element el_not = conditionvar.element("not");
List<Element> tmp_points = new ArrayList<Element>();
if (el_and != null || el_not != null) {
// this is "singleCorrect" MCQ => select all nodes under <and> tag
if (el_and != null) {
tmp_points = el_and.selectNodes(".//varequal");
}
} else {
tmp_points = conditionvar.selectNodes(".//varequal");
}
for (Iterator iter = tmp_points.iterator(); iter.hasNext();) {
Element el_varequal = (Element) iter.next();
points.put(el_varequal.getTextTrim(), new Float(fPoints));
}
} else {
// left this part of the code (KPRIM and FIB) unchained in order to avoid collateral damage ...
Element and = conditionvar.element("and");
List tmp_points = (and == null) ? conditionvar.selectNodes(".//varequal") : and.selectNodes(".//varequal");
for (Iterator iter = tmp_points.iterator(); iter.hasNext();) {
Element el_varequal = (Element) iter.next();
if (type == Question.TYPE_KPRIM) {
points.put(el_varequal.getTextTrim(), new Float(fPoints));
} else if (type == Question.TYPE_FIB) {
points.put(el_varequal.attributeValue("respident"), new Float(fPoints));
}
}
}
}
}
return points;
} | static Map<String, Float> function(List respconditions, int type) { final Map<String, Float> points = new HashMap<String, Float>(); for (Iterator i = respconditions.iterator(); i.hasNext();) { Element el_resp_condition = (Element) i.next(); float fPoints = 0; try { Element el_setvar = el_resp_condition.element(STR); if (el_setvar == null) continue; if (!el_setvar.attributeValue(STR).equals("Add") && !el_setvar.attributeValue(STR).equals(STR) && !el_setvar.attributeValue(STR).equals("Set")) continue; fPoints = new Float(el_setvar.getTextTrim()).floatValue(); if (el_setvar.attributeValue(STR).equals(STR)) fPoints = fPoints * -1; } catch (NumberFormatException nfe) { continue; } if (fPoints != 0) { Element conditionvar = el_resp_condition.element(STR); if (type == Question.TYPE_SC) { final Element el_varequal = (Element) conditionvar.selectNodes(STRandSTRnotSTR. } } else { tmp_points = conditionvar.selectNodes(STRandSTR. for (Iterator iter = tmp_points.iterator(); iter.hasNext();) { Element el_varequal = (Element) iter.next(); if (type == Question.TYPE_KPRIM) { points.put(el_varequal.getTextTrim(), new Float(fPoints)); } else if (type == Question.TYPE_FIB) { points.put(el_varequal.attributeValue(STR), new Float(fPoints)); } } } } } return points; } | /**
* Returns a hasmap with responselabel_idents as keys and points as values.
*
* @param respconditions
* @param type
* @return hasmap with responselabel_idents as keys and points as values.
*/ | Returns a hasmap with responselabel_idents as keys and points as values | fetchPoints | {
"repo_name": "huihoo/olat",
"path": "OLAT-LMS/src/main/java/org/olat/lms/ims/qti/editor/QTIEditHelperEBL.java",
"license": "apache-2.0",
"size": 35428
} | [
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.dom4j.Element",
"org.olat.lms.ims.qti.objects.Question"
] | import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.dom4j.Element; import org.olat.lms.ims.qti.objects.Question; | import java.util.*; import org.dom4j.*; import org.olat.lms.ims.qti.objects.*; | [
"java.util",
"org.dom4j",
"org.olat.lms"
] | java.util; org.dom4j; org.olat.lms; | 1,654,934 |
private static <T> void batchCount(T[] array, int start, int end, CountProcedure<T> castProcedure)
{
for (int i = start; i < end; i++)
{
castProcedure.value(array[i]);
}
} | static <T> void function(T[] array, int start, int end, CountProcedure<T> castProcedure) { for (int i = start; i < end; i++) { castProcedure.value(array[i]); } } | /**
* Implemented to avoid megamorphic call on castProcedure.
*/ | Implemented to avoid megamorphic call on castProcedure | batchCount | {
"repo_name": "bhav0904/eclipse-collections",
"path": "eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/internal/InternalArrayIterate.java",
"license": "bsd-3-clause",
"size": 35166
} | [
"org.eclipse.collections.impl.block.procedure.CountProcedure"
] | import org.eclipse.collections.impl.block.procedure.CountProcedure; | import org.eclipse.collections.impl.block.procedure.*; | [
"org.eclipse.collections"
] | org.eclipse.collections; | 1,609,723 |
public final void setSPO() {
setDefaultPushoutApproach(PushoutApproach.SPO);
} | final void function() { setDefaultPushoutApproach(PushoutApproach.SPO); } | /**
* Sets the pushout approach to single pushout (see {@link PushoutApproach}).
*/ | Sets the pushout approach to single pushout (see <code>PushoutApproach</code>) | setSPO | {
"repo_name": "eMoflon/emoflon-ibex",
"path": "org.emoflon.ibex.gt/src/org/emoflon/ibex/gt/api/GraphTransformationAPI.java",
"license": "gpl-3.0",
"size": 8301
} | [
"org.emoflon.ibex.common.operational.PushoutApproach"
] | import org.emoflon.ibex.common.operational.PushoutApproach; | import org.emoflon.ibex.common.operational.*; | [
"org.emoflon.ibex"
] | org.emoflon.ibex; | 1,682,144 |
@ServiceMethod(returns = ReturnType.SINGLE)
MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName); | @ServiceMethod(returns = ReturnType.SINGLE) MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName); | /**
* Get a tag rule set for a given monitor resource.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param monitorName Monitor resource name.
* @param ruleSetName The ruleSetName parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a tag rule set for a given monitor resource.
*/ | Get a tag rule set for a given monitor resource | get | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/TagRulesClient.java",
"license": "mit",
"size": 7383
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.logz.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,063,511 |
@Override
public EffectCharacter getTargetableEffect() {
return EffectCharacter.DESTROY;
} | EffectCharacter function() { return EffectCharacter.DESTROY; } | /**
*
* Use the card on the given target
*
* This card destroys an enemy minion.
*
*
*
* @param side
* @param boardState The BoardState before this card has performed its action. It will be manipulated and returned.
*
* @return The boardState is manipulated and returned
*/ | Use the card on the given target This card destroys an enemy minion | getTargetableEffect | {
"repo_name": "relimited/HearthSim",
"path": "src/main/java/com/hearthsim/card/basic/spell/Assassinate.java",
"license": "mit",
"size": 1275
} | [
"com.hearthsim.event.effect.EffectCharacter"
] | import com.hearthsim.event.effect.EffectCharacter; | import com.hearthsim.event.effect.*; | [
"com.hearthsim.event"
] | com.hearthsim.event; | 1,292,003 |
public CoordinateSequence transform(CoordinateSequence sequence, MathTransform transform)
throws TransformException; | CoordinateSequence function(CoordinateSequence sequence, MathTransform transform) throws TransformException; | /**
* Returns a transformed coordinate sequence.
*
* @param sequence The sequence to transform.
* @param transform The transformation to apply.
* @throws TransformException if at least one coordinate can't be transformed.
*/ | Returns a transformed coordinate sequence | transform | {
"repo_name": "geotools/geotools",
"path": "modules/library/main/src/main/java/org/geotools/geometry/jts/CoordinateSequenceTransformer.java",
"license": "lgpl-2.1",
"size": 1543
} | [
"org.locationtech.jts.geom.CoordinateSequence",
"org.opengis.referencing.operation.MathTransform",
"org.opengis.referencing.operation.TransformException"
] | import org.locationtech.jts.geom.CoordinateSequence; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; | import org.locationtech.jts.geom.*; import org.opengis.referencing.operation.*; | [
"org.locationtech.jts",
"org.opengis.referencing"
] | org.locationtech.jts; org.opengis.referencing; | 2,003,675 |
private void handleInsert(ASTNode whenNotMatchedClause, StringBuilder rewrittenQueryStr, ASTNode target,
ASTNode onClause, Table targetTable, String targetTableNameInSourceQuery, String onClauseAsString,
String hintStr) throws SemanticException {
ASTNode whenClauseOperation = getWhenClauseOperation(whenNotMatchedClause);
assert whenNotMatchedClause.getType() == HiveParser.TOK_NOT_MATCHED;
assert whenClauseOperation.getType() == HiveParser.TOK_INSERT;
// identify the node that contains the values to insert and the optional column list node
List<Node> children = whenClauseOperation.getChildren();
ASTNode valuesNode =
(ASTNode)children.stream().filter(n -> ((ASTNode)n).getType() == HiveParser.TOK_FUNCTION).findFirst().get();
ASTNode columnListNode =
(ASTNode)children.stream().filter(n -> ((ASTNode)n).getType() == HiveParser.TOK_TABCOLNAME).findFirst()
.orElse(null);
// if column list is specified, then it has to have the same number of elements as the values
// valuesNode has a child for struct, the rest are the columns
if (columnListNode != null && columnListNode.getChildCount() != (valuesNode.getChildCount() - 1)) {
throw new SemanticException(String.format("Column schema must have the same length as values (%d vs %d)",
columnListNode.getChildCount(), valuesNode.getChildCount() - 1));
}
rewrittenQueryStr.append("INSERT INTO ").append(getFullTableNameForSQL(target));
if (columnListNode != null) {
rewrittenQueryStr.append(' ').append(getMatchedText(columnListNode));
}
addPartitionColsToInsert(targetTable.getPartCols(), rewrittenQueryStr);
rewrittenQueryStr.append(" -- insert clause\n SELECT ");
if (hintStr != null) {
rewrittenQueryStr.append(hintStr);
}
OnClauseAnalyzer oca = new OnClauseAnalyzer(onClause, targetTable, targetTableNameInSourceQuery,
conf, onClauseAsString);
oca.analyze();
String valuesClause = getMatchedText(valuesNode);
valuesClause = valuesClause.substring(1, valuesClause.length() - 1); //strip '(' and ')'
valuesClause = replaceDefaultKeywordForMerge(valuesClause, targetTable, columnListNode);
rewrittenQueryStr.append(valuesClause).append("\n WHERE ").append(oca.getPredicate());
String extraPredicate = getWhenClausePredicate(whenNotMatchedClause);
if (extraPredicate != null) {
//we have WHEN NOT MATCHED AND <boolean expr> THEN INSERT
rewrittenQueryStr.append(" AND ")
.append(getMatchedText(((ASTNode)whenNotMatchedClause.getChild(1))));
}
rewrittenQueryStr.append('\n');
} | void function(ASTNode whenNotMatchedClause, StringBuilder rewrittenQueryStr, ASTNode target, ASTNode onClause, Table targetTable, String targetTableNameInSourceQuery, String onClauseAsString, String hintStr) throws SemanticException { ASTNode whenClauseOperation = getWhenClauseOperation(whenNotMatchedClause); assert whenNotMatchedClause.getType() == HiveParser.TOK_NOT_MATCHED; assert whenClauseOperation.getType() == HiveParser.TOK_INSERT; List<Node> children = whenClauseOperation.getChildren(); ASTNode valuesNode = (ASTNode)children.stream().filter(n -> ((ASTNode)n).getType() == HiveParser.TOK_FUNCTION).findFirst().get(); ASTNode columnListNode = (ASTNode)children.stream().filter(n -> ((ASTNode)n).getType() == HiveParser.TOK_TABCOLNAME).findFirst() .orElse(null); if (columnListNode != null && columnListNode.getChildCount() != (valuesNode.getChildCount() - 1)) { throw new SemanticException(String.format(STR, columnListNode.getChildCount(), valuesNode.getChildCount() - 1)); } rewrittenQueryStr.append(STR).append(getFullTableNameForSQL(target)); if (columnListNode != null) { rewrittenQueryStr.append(' ').append(getMatchedText(columnListNode)); } addPartitionColsToInsert(targetTable.getPartCols(), rewrittenQueryStr); rewrittenQueryStr.append(STR); if (hintStr != null) { rewrittenQueryStr.append(hintStr); } OnClauseAnalyzer oca = new OnClauseAnalyzer(onClause, targetTable, targetTableNameInSourceQuery, conf, onClauseAsString); oca.analyze(); String valuesClause = getMatchedText(valuesNode); valuesClause = valuesClause.substring(1, valuesClause.length() - 1); valuesClause = replaceDefaultKeywordForMerge(valuesClause, targetTable, columnListNode); rewrittenQueryStr.append(valuesClause).append(STR).append(oca.getPredicate()); String extraPredicate = getWhenClausePredicate(whenNotMatchedClause); if (extraPredicate != null) { rewrittenQueryStr.append(STR) .append(getMatchedText(((ASTNode)whenNotMatchedClause.getChild(1)))); } rewrittenQueryStr.append('\n'); } | /**
* Generates the Insert leg of the multi-insert SQL to represent WHEN NOT MATCHED THEN INSERT clause.
* @param targetTableNameInSourceQuery - simple name/alias
* @throws SemanticException
*/ | Generates the Insert leg of the multi-insert SQL to represent WHEN NOT MATCHED THEN INSERT clause | handleInsert | {
"repo_name": "jcamachor/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/parse/MergeSemanticAnalyzer.java",
"license": "apache-2.0",
"size": 36434
} | [
"java.util.List",
"org.apache.hadoop.hive.ql.lib.Node",
"org.apache.hadoop.hive.ql.metadata.Table"
] | import java.util.List; import org.apache.hadoop.hive.ql.lib.Node; import org.apache.hadoop.hive.ql.metadata.Table; | import java.util.*; import org.apache.hadoop.hive.ql.lib.*; import org.apache.hadoop.hive.ql.metadata.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,298,555 |
private int chooseFile(JFileChooser dialog, String dialogTitle) {
int outcome = dialog.showDialog(this, dialogTitle);
return updateCurrentDirectoryFromDialog(dialog, outcome);
} | int function(JFileChooser dialog, String dialogTitle) { int outcome = dialog.showDialog(this, dialogTitle); return updateCurrentDirectoryFromDialog(dialog, outcome); } | /**
* Run a file chooser dialog.
* If a file is chosen, then the current directory is updated.
*
* @param dialog the file chooser dialog
* @param dialogTitle the dialog title
* @return the outcome
*/ | Run a file chooser dialog. If a file is chosen, then the current directory is updated | chooseFile | {
"repo_name": "optivo-org/fingbugs-1.3.9-optivo",
"path": "src/java/edu/umd/cs/findbugs/gui/FindBugsFrame.java",
"license": "lgpl-2.1",
"size": 146480
} | [
"javax.swing.JFileChooser"
] | import javax.swing.JFileChooser; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,060,873 |
@Override
protected void destroyStatusItem(final BaseStatus baseStatus) {
gui.getMarkers().removeMarker((Trackable) baseStatus.getContent(),
Markers.Type.INTERNAL);
} | void function(final BaseStatus baseStatus) { gui.getMarkers().removeMarker((Trackable) baseStatus.getContent(), Markers.Type.INTERNAL); } | /**
* Destroy this status item, which involves removing the marks associated
* to it.
*
* @param baseStatus the status item to destroy
*/ | Destroy this status item, which involves removing the marks associated to it | destroyStatusItem | {
"repo_name": "bhenne/MoSP-Siafu",
"path": "Siafu/src/de/uni_hannover/dcsec/siafu/graphics/controlpanel/PlacesPanel.java",
"license": "gpl-2.0",
"size": 5877
} | [
"de.uni_hannover.dcsec.siafu.graphics.Markers",
"de.uni_hannover.dcsec.siafu.model.Trackable"
] | import de.uni_hannover.dcsec.siafu.graphics.Markers; import de.uni_hannover.dcsec.siafu.model.Trackable; | import de.uni_hannover.dcsec.siafu.graphics.*; import de.uni_hannover.dcsec.siafu.model.*; | [
"de.uni_hannover.dcsec"
] | de.uni_hannover.dcsec; | 2,154,212 |
@Test(expected = InvalidGroupedInfixOperatorException.class)
public void testConflictingAssociativities() {
GroupedInfixOperator gio = new GroupedInfixOperator(new InfixOperatorStub(OperatorAssociativity.LEFT),
new InfixOperatorStub(OperatorAssociativity.RIGHT));
} | @Test(expected = InvalidGroupedInfixOperatorException.class) void function() { GroupedInfixOperator gio = new GroupedInfixOperator(new InfixOperatorStub(OperatorAssociativity.LEFT), new InfixOperatorStub(OperatorAssociativity.RIGHT)); } | /**
* When a GroupedInfixOperator is created with InfixOperators with conflicting associativities, a
* InvalidGroupedInfixOperatorException should be thrown.
*/ | When a GroupedInfixOperator is created with InfixOperators with conflicting associativities, a InvalidGroupedInfixOperatorException should be thrown | testConflictingAssociativities | {
"repo_name": "gerritdrost/mathie",
"path": "src/test/java/gerritdrost/com/libs/mathie/operator/GroupedInfixOperatorTest.java",
"license": "mit",
"size": 3452
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 872,014 |
public StatementBuilder withValue(Value value) {
this.mainValue = value;
return getThis();
} | StatementBuilder function(Value value) { this.mainValue = value; return getThis(); } | /**
* Sets the main value for the constructed statement.
*
* @param value
* the main value of the statement
* @return builder object to continue construction
*/ | Sets the main value for the constructed statement | withValue | {
"repo_name": "Wikidata/Wikidata-Toolkit",
"path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/StatementBuilder.java",
"license": "apache-2.0",
"size": 8851
} | [
"org.wikidata.wdtk.datamodel.interfaces.Value"
] | import org.wikidata.wdtk.datamodel.interfaces.Value; | import org.wikidata.wdtk.datamodel.interfaces.*; | [
"org.wikidata.wdtk"
] | org.wikidata.wdtk; | 1,239,010 |
public void testCreateExchangeItemsFromFile() throws Exception {
//currently only wdm.dll (32 bit) available, so only run this test on win32.
if (!BBUtils.RUNNING_ON_WINDOWS || BBUtils.RUNNING_ON_64bit) {
System.out.println("testCreateExchangeItemsFromFile: wdm.dll only available for win32.");
return;
}
//first copy input wdm files to directory openda_public/opendaTestRuns before running the test.
//working directory (testRunDataDir) is openda_public/opendaTestRuns/model_hspf/org/openda/model_hspf
String inputFileName = "wdmUtilsTest/POINT.wdm";
File inputFile = new File(testRunDataDir, inputFileName);
//working directory (testRunDataDir) is openda_public/opendaTestRuns/model_hspf/org/openda/model_hspf
String relativeWdmDllPath = "../../../../../model_hspf/native_bin/win32_gfortran/wdm.dll";
File wdmDllFile = new File(testRunDataDir, relativeWdmDllPath);
WdmDll.initialize(wdmDllFile);
WdmDll wdmDll = WdmDll.getInstance();
//open wdm file.
int wdmFileNumber = WdmUtils.generateUniqueFortranFileUnitNumber();
//working directory (testRunDataDir) is openda_public/opendaTestRuns/model_hspf/org/openda/model_hspf
String relativeWdmMessageFilePath = "../../../../../model_hspf/native_bin/MESSAGE.WDM";
File wdmMessageFile = new File(testRunDataDir, relativeWdmMessageFilePath);
WdmUtils.openWdmFile(wdmDll, wdmFileNumber, inputFile.getAbsolutePath(), wdmMessageFile.getAbsolutePath());
List<WdmTimeSeriesExchangeItem> exchangeItems = WdmUtils.createExchangeItemsFromFile(wdmDll, wdmFileNumber, IExchangeItem.Role.Input);
//close wdm file.
WdmUtils.closeWdmFile(wdmDll, wdmFileNumber);
assertEquals(923, exchangeItems.size());
WdmTimeSeriesExchangeItem exchangeItem = exchangeItems.get(42);
assertEquals(IExchangeItem.Role.Input, exchangeItem.getRole());
assertEquals("48A0341.FLOW", exchangeItem.getId());
assertEquals("48A0341", exchangeItem.getLocation());
assertEquals("FLOW", exchangeItem.getQuantityId());
} | void function() throws Exception { if (!BBUtils.RUNNING_ON_WINDOWS BBUtils.RUNNING_ON_64bit) { System.out.println(STR); return; } String inputFileName = STR; File inputFile = new File(testRunDataDir, inputFileName); String relativeWdmDllPath = STR; File wdmDllFile = new File(testRunDataDir, relativeWdmDllPath); WdmDll.initialize(wdmDllFile); WdmDll wdmDll = WdmDll.getInstance(); int wdmFileNumber = WdmUtils.generateUniqueFortranFileUnitNumber(); String relativeWdmMessageFilePath = STR; File wdmMessageFile = new File(testRunDataDir, relativeWdmMessageFilePath); WdmUtils.openWdmFile(wdmDll, wdmFileNumber, inputFile.getAbsolutePath(), wdmMessageFile.getAbsolutePath()); List<WdmTimeSeriesExchangeItem> exchangeItems = WdmUtils.createExchangeItemsFromFile(wdmDll, wdmFileNumber, IExchangeItem.Role.Input); WdmUtils.closeWdmFile(wdmDll, wdmFileNumber); assertEquals(923, exchangeItems.size()); WdmTimeSeriesExchangeItem exchangeItem = exchangeItems.get(42); assertEquals(IExchangeItem.Role.Input, exchangeItem.getRole()); assertEquals(STR, exchangeItem.getId()); assertEquals(STR, exchangeItem.getLocation()); assertEquals("FLOW", exchangeItem.getQuantityId()); } | /**
* Tests method WdmUtils.createExchangeItemsFromFile.
*/ | Tests method WdmUtils.createExchangeItemsFromFile | testCreateExchangeItemsFromFile | {
"repo_name": "OpenDA-Association/OpenDA",
"path": "model_hspf/java/test/org/openda/model_hspf/WdmUtilsTest.java",
"license": "lgpl-3.0",
"size": 11871
} | [
"java.io.File",
"java.util.List",
"org.openda.blackbox.config.BBUtils",
"org.openda.interfaces.IExchangeItem"
] | import java.io.File; import java.util.List; import org.openda.blackbox.config.BBUtils; import org.openda.interfaces.IExchangeItem; | import java.io.*; import java.util.*; import org.openda.blackbox.config.*; import org.openda.interfaces.*; | [
"java.io",
"java.util",
"org.openda.blackbox",
"org.openda.interfaces"
] | java.io; java.util; org.openda.blackbox; org.openda.interfaces; | 2,478,219 |
@Test
public void getTripTest() {
TripEntity entity = data.get(0);
TripEntity newEntity = tripPersistence.find(entity.getAgency().getId(), entity.getId());
Assert.assertNotNull(newEntity);
Assert.assertEquals(entity.getName(), newEntity.getName());
Assert.assertEquals(entity.getImage(), newEntity.getImage());
Assert.assertEquals(entity.getPrice(), newEntity.getPrice());
Assert.assertEquals(new SimpleDateFormat("dd/MM/yyyy").format(entity.getDepartureDate()), new SimpleDateFormat("dd/MM/yyyy").format(newEntity.getDepartureDate()));
Assert.assertEquals(entity.getDestination(), newEntity.getDestination());
Assert.assertEquals(entity.getQuota(), newEntity.getQuota());
Assert.assertEquals(entity.getDuration(), newEntity.getDuration());
Assert.assertEquals(entity.getTransport(), newEntity.getTransport());
Assert.assertEquals(entity.getPromotion(), newEntity.getPromotion());
Assert.assertEquals(entity.getDiscountRate(), newEntity.getDiscountRate());
Assert.assertEquals(entity.getConditions(), newEntity.getConditions());
} | void function() { TripEntity entity = data.get(0); TripEntity newEntity = tripPersistence.find(entity.getAgency().getId(), entity.getId()); Assert.assertNotNull(newEntity); Assert.assertEquals(entity.getName(), newEntity.getName()); Assert.assertEquals(entity.getImage(), newEntity.getImage()); Assert.assertEquals(entity.getPrice(), newEntity.getPrice()); Assert.assertEquals(new SimpleDateFormat(STR).format(entity.getDepartureDate()), new SimpleDateFormat(STR).format(newEntity.getDepartureDate())); Assert.assertEquals(entity.getDestination(), newEntity.getDestination()); Assert.assertEquals(entity.getQuota(), newEntity.getQuota()); Assert.assertEquals(entity.getDuration(), newEntity.getDuration()); Assert.assertEquals(entity.getTransport(), newEntity.getTransport()); Assert.assertEquals(entity.getPromotion(), newEntity.getPromotion()); Assert.assertEquals(entity.getDiscountRate(), newEntity.getDiscountRate()); Assert.assertEquals(entity.getConditions(), newEntity.getConditions()); } | /**
* Prueba para consultar un Trip.
*
* @generated
*/ | Prueba para consultar un Trip | getTripTest | {
"repo_name": "Uniandes-MISO4203/turism-201620-2",
"path": "turism-logic/src/test/java/co/edu/uniandes/csw/turism/test/persistence/TripPersistenceTest.java",
"license": "mit",
"size": 9184
} | [
"co.edu.uniandes.csw.turism.entities.TripEntity",
"java.text.SimpleDateFormat",
"org.junit.Assert"
] | import co.edu.uniandes.csw.turism.entities.TripEntity; import java.text.SimpleDateFormat; import org.junit.Assert; | import co.edu.uniandes.csw.turism.entities.*; import java.text.*; import org.junit.*; | [
"co.edu.uniandes",
"java.text",
"org.junit"
] | co.edu.uniandes; java.text; org.junit; | 2,092,011 |
ObjectMapper mapper = StreamsTwitterMapper.getInstance();
activity.setActor(buildActor(tweet));
activity.setId(formatId(activity.getVerb(),
Optional.fromNullable(
tweet.getIdStr())
.or(Optional.of(tweet.getId().toString()))
.orNull()));
if(tweet instanceof Retweet) {
updateActivityContent(activity, ((Retweet) tweet).getRetweetedStatus(), "share");
} else {
updateActivityContent(activity, tweet, "post");
}
if(Strings.isNullOrEmpty(activity.getId()))
throw new ActivitySerializerException("Unable to determine activity id");
try {
activity.setPublished(tweet.getCreatedAt());
} catch( Exception e ) {
throw new ActivitySerializerException("Unable to determine publishedDate", e);
}
activity.setTarget(buildTarget(tweet));
activity.setProvider(getProvider());
activity.setUrl(String.format("http://twitter.com/%s/%s/%s", tweet.getUser().getScreenName(),"/status/",tweet.getIdStr()));
addTwitterExtension(activity, mapper.convertValue(tweet, ObjectNode.class));
} | ObjectMapper mapper = StreamsTwitterMapper.getInstance(); activity.setActor(buildActor(tweet)); activity.setId(formatId(activity.getVerb(), Optional.fromNullable( tweet.getIdStr()) .or(Optional.of(tweet.getId().toString())) .orNull())); if(tweet instanceof Retweet) { updateActivityContent(activity, ((Retweet) tweet).getRetweetedStatus(), "share"); } else { updateActivityContent(activity, tweet, "post"); } if(Strings.isNullOrEmpty(activity.getId())) throw new ActivitySerializerException(STR); try { activity.setPublished(tweet.getCreatedAt()); } catch( Exception e ) { throw new ActivitySerializerException(STR, e); } activity.setTarget(buildTarget(tweet)); activity.setProvider(getProvider()); activity.setUrl(String.format("http: addTwitterExtension(activity, mapper.convertValue(tweet, ObjectNode.class)); } | /**
* Updates the given Activity object with the values from the Tweet
* @param tweet the object to use as the source
* @param activity the target of the updates. Will receive all values from the tweet.
* @throws ActivitySerializerException
*/ | Updates the given Activity object with the values from the Tweet | updateActivity | {
"repo_name": "w2ogroup/incubator-streams",
"path": "streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/util/TwitterActivityUtil.java",
"license": "apache-2.0",
"size": 14145
} | [
"com.fasterxml.jackson.databind.ObjectMapper",
"com.fasterxml.jackson.databind.node.ObjectNode",
"com.google.common.base.Optional",
"com.google.common.base.Strings",
"org.apache.streams.exceptions.ActivitySerializerException",
"org.apache.streams.twitter.pojo.Retweet",
"org.apache.streams.twitter.serial... | import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Optional; import com.google.common.base.Strings; import org.apache.streams.exceptions.ActivitySerializerException; import org.apache.streams.twitter.pojo.Retweet; import org.apache.streams.twitter.serializer.StreamsTwitterMapper; | import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import com.google.common.base.*; import org.apache.streams.exceptions.*; import org.apache.streams.twitter.pojo.*; import org.apache.streams.twitter.serializer.*; | [
"com.fasterxml.jackson",
"com.google.common",
"org.apache.streams"
] | com.fasterxml.jackson; com.google.common; org.apache.streams; | 2,706,609 |
public void before(Map<String, Object> runningContext); | void function(Map<String, Object> runningContext); | /**
* Before trigger - called before decorators started work
*
* @param runningContext
*/ | Before trigger - called before decorators started work | before | {
"repo_name": "ceskaexpedice/kramerius",
"path": "rest/src/main/java/cz/incad/kramerius/rest/api/k5/client/JSONDecorator.java",
"license": "gpl-3.0",
"size": 2175
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,365,431 |
@Test
public void testDumpJPacket() {
JMemoryPacket packet = new JMemoryPacket(Ethernet.ID, data);
dumper.dump(packet);
checkFileSize();
} | void function() { JMemoryPacket packet = new JMemoryPacket(Ethernet.ID, data); dumper.dump(packet); checkFileSize(); } | /**
* Test method for {@link org.jnetpcap.PcapDumper#dump(org.jnetpcap.packet.JMemoryPacket)}.
*/ | Test method for <code>org.jnetpcap.PcapDumper#dump(org.jnetpcap.packet.JMemoryPacket)</code> | testDumpJPacket | {
"repo_name": "pvenne/jgoose",
"path": "libs/JNetPcap_1_4/tests/java1.5/org/jnetpcap/TestPcapDumper.java",
"license": "gpl-3.0",
"size": 4737
} | [
"org.jnetpcap.packet.JMemoryPacket",
"org.jnetpcap.protocol.lan.Ethernet"
] | import org.jnetpcap.packet.JMemoryPacket; import org.jnetpcap.protocol.lan.Ethernet; | import org.jnetpcap.packet.*; import org.jnetpcap.protocol.lan.*; | [
"org.jnetpcap.packet",
"org.jnetpcap.protocol"
] | org.jnetpcap.packet; org.jnetpcap.protocol; | 1,004,618 |
public List<BSPTree<S>> getCloseCuts(final Point<S> point, final double maxOffset) {
final List<BSPTree<S>> close = new ArrayList<>();
recurseCloseCuts(point, maxOffset, close);
return close;
} | List<BSPTree<S>> function(final Point<S> point, final double maxOffset) { final List<BSPTree<S>> close = new ArrayList<>(); recurseCloseCuts(point, maxOffset, close); return close; } | /** Get the cells whose cut sub-hyperplanes are close to the point.
* @param point point to check
* @param maxOffset offset below which a cut sub-hyperplane is considered
* close to the point (in absolute value)
* @return close cells (may be empty if all cut sub-hyperplanes are farther
* than maxOffset from the point)
*/ | Get the cells whose cut sub-hyperplanes are close to the point | getCloseCuts | {
"repo_name": "sdinot/hipparchus",
"path": "hipparchus-geometry/src/main/java/org/hipparchus/geometry/partitioning/BSPTree.java",
"license": "apache-2.0",
"size": 32625
} | [
"java.util.ArrayList",
"java.util.List",
"org.hipparchus.geometry.Point"
] | import java.util.ArrayList; import java.util.List; import org.hipparchus.geometry.Point; | import java.util.*; import org.hipparchus.geometry.*; | [
"java.util",
"org.hipparchus.geometry"
] | java.util; org.hipparchus.geometry; | 1,910,826 |
public void addListener(IPropertyChangeListener listener) {
addListenerObject(listener);
}
| void function(IPropertyChangeListener listener) { addListenerObject(listener); } | /**
* Adds a property change listener to this <code>ColorSelector</code>.
* Events are fired when the color in the control changes via the user
* clicking an selecting a new one in the color dialog. No event is fired in
* the case where <code>setColorValue(RGB)</code> is invoked.
*
* @param listener
* a property change listener
*/ | Adds a property change listener to this <code>ColorSelector</code>. Events are fired when the color in the control changes via the user clicking an selecting a new one in the color dialog. No event is fired in the case where <code>setColorValue(RGB)</code> is invoked | addListener | {
"repo_name": "archimatetool/archi",
"path": "com.archimatetool.editor/src/com/archimatetool/editor/ui/components/FontChooser.java",
"license": "mit",
"size": 11054
} | [
"org.eclipse.jface.util.IPropertyChangeListener"
] | import org.eclipse.jface.util.IPropertyChangeListener; | import org.eclipse.jface.util.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 518,096 |
private static XmlFile getConfigFile() {
return new XmlFile(new File(Jenkins.getInstance().getRootDir(),"nodeMonitors.xml"));
} | static XmlFile function() { return new XmlFile(new File(Jenkins.getInstance().getRootDir(),STR)); } | /**
* {@link NodeMonitor}s are persisted in this file.
*/ | <code>NodeMonitor</code>s are persisted in this file | getConfigFile | {
"repo_name": "sumitk1/jenkins",
"path": "core/src/main/java/hudson/model/ComputerSet.java",
"license": "mit",
"size": 13021
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 199,256 |
public ShadowGenerator getShadowGenerator() {
return this.shadowGenerator;
} | ShadowGenerator function() { return this.shadowGenerator; } | /**
* Returns the shadow generator for the plot, if any.
*
* @return The shadow generator (possibly {@code null}).
*
* @since 1.0.14
*/ | Returns the shadow generator for the plot, if any | getShadowGenerator | {
"repo_name": "GitoMat/jfreechart",
"path": "src/main/java/org/jfree/chart/plot/XYPlot.java",
"license": "lgpl-2.1",
"size": 197216
} | [
"org.jfree.chart.util.ShadowGenerator"
] | import org.jfree.chart.util.ShadowGenerator; | import org.jfree.chart.util.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,415,426 |
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Acquire the resources that we need
HttpSession session = request.getSession();
Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
if (resources == null) {
resources = getServlet().getResources();
}
// Acquire a reference to the MBeanServer containing our MBeans
try {
mBServer = ((ApplicationServlet) getServlet()).getServer();
} catch (Throwable t) {
throw new ServletException
("Cannot acquire MBeanServer reference", t);
}
String serviceName = request.getParameter("serviceName");
// Set up a form bean containing the currently selected
// objects to be deleted
HostsForm hostsForm = new HostsForm();
String select = request.getParameter("select");
if (select != null) {
String hosts[] = new String[1];
hosts[0] = select;
hostsForm.setHosts(hosts);
// get the service Name this selected host belongs to
try {
serviceName = (new ObjectName(select)).getKeyProperty("service");
} catch (Exception e) {
throw new ServletException
("Error extracting service name from the host to be deleted", e);
}
}
request.setAttribute("hostsForm", hostsForm);
// Accumulate a list of all available hosts
ArrayList list = new ArrayList();
try {
String pattern = TomcatTreeBuilder.HOST_TYPE +
TomcatTreeBuilder.WILDCARD;
// get all available hosts only for this service
if (serviceName!= null)
pattern = pattern.concat(",service=" + serviceName);
Iterator items =
mBServer.queryNames(new ObjectName(pattern), null).iterator();
while (items.hasNext()) {
list.add(items.next().toString());
}
} catch (Exception e) {
getServlet().log
(resources.getMessage(locale, "users.error.select"));
response.sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
resources.getMessage(locale, "users.error.select"));
return (null);
}
Collections.sort(list);
request.setAttribute("hostsList", list);
// Forward to the list display page
return (mapping.findForward("Hosts"));
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY); if (resources == null) { resources = getServlet().getResources(); } try { mBServer = ((ApplicationServlet) getServlet()).getServer(); } catch (Throwable t) { throw new ServletException (STR, t); } String serviceName = request.getParameter(STR); HostsForm hostsForm = new HostsForm(); String select = request.getParameter(STR); if (select != null) { String hosts[] = new String[1]; hosts[0] = select; hostsForm.setHosts(hosts); try { serviceName = (new ObjectName(select)).getKeyProperty(STR); } catch (Exception e) { throw new ServletException (STR, e); } } request.setAttribute(STR, hostsForm); ArrayList list = new ArrayList(); try { String pattern = TomcatTreeBuilder.HOST_TYPE + TomcatTreeBuilder.WILDCARD; if (serviceName!= null) pattern = pattern.concat(STR + serviceName); Iterator items = mBServer.queryNames(new ObjectName(pattern), null).iterator(); while (items.hasNext()) { list.add(items.next().toString()); } } catch (Exception e) { getServlet().log (resources.getMessage(locale, STR)); response.sendError (HttpServletResponse.SC_INTERNAL_SERVER_ERROR, resources.getMessage(locale, STR)); return (null); } Collections.sort(list); request.setAttribute(STR, list); return (mapping.findForward("Hosts")); } | /**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/ | Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an <code>ActionForward</code> instance describing where and how control should be forwarded, or <code>null</code> if the response has already been completed | perform | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-4.1.12-src/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java",
"license": "apache-2.0",
"size": 8095
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Collections",
"java.util.Iterator",
"java.util.Locale",
"javax.management.ObjectName",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.servlet.http.HttpSession",
"... | import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.Locale; import javax.management.ObjectName; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.webapp.admin.ApplicationServlet; import org.apache.webapp.admin.TomcatTreeBuilder; | import java.io.*; import java.util.*; import javax.management.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.struts.action.*; import org.apache.webapp.admin.*; | [
"java.io",
"java.util",
"javax.management",
"javax.servlet",
"org.apache.struts",
"org.apache.webapp"
] | java.io; java.util; javax.management; javax.servlet; org.apache.struts; org.apache.webapp; | 2,628,425 |
protected Node exitHexadecimalValue(Production node)
throws ParseException {
return node;
} | Node function(Production node) throws ParseException { return node; } | /**
* Called when exiting a parse tree node.
*
* @param node the node being exited
*
* @return the node to add to the parse tree, or
* null if no parse tree should be created
*
* @throws ParseException if the node analysis discovered errors
*/ | Called when exiting a parse tree node | exitHexadecimalValue | {
"repo_name": "richb-hanover/mibble-2.9.2",
"path": "src/java/net/percederberg/mibble/asn1/Asn1Analyzer.java",
"license": "gpl-2.0",
"size": 275483
} | [
"net.percederberg.grammatica.parser.Node",
"net.percederberg.grammatica.parser.ParseException",
"net.percederberg.grammatica.parser.Production"
] | import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.ParseException; import net.percederberg.grammatica.parser.Production; | import net.percederberg.grammatica.parser.*; | [
"net.percederberg.grammatica"
] | net.percederberg.grammatica; | 447,733 |
public static String getPropertyName(Method method) {
String propertyName = method.getName();
if (propertyName.startsWith("set") && method.getParameterTypes().length == 1) {
propertyName = propertyName.substring(3, 4).toLowerCase(Locale.ENGLISH) + propertyName.substring(4);
}
return propertyName;
} | static String function(Method method) { String propertyName = method.getName(); if (propertyName.startsWith("set") && method.getParameterTypes().length == 1) { propertyName = propertyName.substring(3, 4).toLowerCase(Locale.ENGLISH) + propertyName.substring(4); } return propertyName; } | /**
* Returns the Java Bean property name of the given method, if it is a
* setter
*/ | Returns the Java Bean property name of the given method, if it is a setter | getPropertyName | {
"repo_name": "RohanHart/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java",
"license": "apache-2.0",
"size": 73945
} | [
"java.lang.reflect.Method",
"java.util.Locale"
] | import java.lang.reflect.Method; import java.util.Locale; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,675,493 |
private void addIndirectCostRecoveryAccount(Account newAccount) {
IndirectCostRecoveryAccount icr = new IndirectCostRecoveryAccount();
icr.setIndirectCostRecoveryAccountNumber(Accounts.AccountNumber.GOOD1);
icr.setIndirectCostRecoveryFinCoaCode(Accounts.ChartCode.GOOD1);
newAccount.getIndirectCostRecoveryAccounts().add(icr);
}
| void function(Account newAccount) { IndirectCostRecoveryAccount icr = new IndirectCostRecoveryAccount(); icr.setIndirectCostRecoveryAccountNumber(Accounts.AccountNumber.GOOD1); icr.setIndirectCostRecoveryFinCoaCode(Accounts.ChartCode.GOOD1); newAccount.getIndirectCostRecoveryAccounts().add(icr); } | /**
* Set IndirectCostRecovery Account
*
* @param newAccount
*/ | Set IndirectCostRecovery Account | addIndirectCostRecoveryAccount | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "test/unit/src/org/kuali/kfs/coa/document/validation/impl/AccountRuleTest.java",
"license": "agpl-3.0",
"size": 67833
} | [
"org.kuali.kfs.coa.businessobject.Account",
"org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount"
] | import org.kuali.kfs.coa.businessobject.Account; import org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,096,005 |
public int getMode() {
double max = -1;
int maxIndex = -1;
int index = 0;
for (Map.Entry<String, NominalStats.Count> e : m_counts.entrySet()) {
if (e.getValue().m_count > max) {
max = e.getValue().m_count;
maxIndex = index;
}
index++;
}
return maxIndex;
} | int function() { double max = -1; int maxIndex = -1; int index = 0; for (Map.Entry<String, NominalStats.Count> e : m_counts.entrySet()) { if (e.getValue().m_count > max) { max = e.getValue().m_count; maxIndex = index; } index++; } return maxIndex; } | /**
* Get the index of the mode
*
* @return the index (in the sorted list of labels) of the mode
*/ | Get the index of the mode | getMode | {
"repo_name": "mydzigear/weka.kmeanspp.silhouette_score",
"path": "wekafiles/packages/distributedWekaBase/src/main/java/weka/core/stats/NominalStats.java",
"license": "gpl-3.0",
"size": 6001
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,482,848 |
public void setValueAsEnum(T theValue) {
getCoding().clear();
if (theValue == null) {
return;
}
getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue)));
} | void function(T theValue) { getCoding().clear(); if (theValue == null) { return; } getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue))); } | /**
* Sets the {@link #getCoding()} to contain a coding with the code and
* system defined by the given enumerated type, AND clearing any existing
* codings first. If theValue is null, existing codings are cleared and no
* codings are added.
*
* @param theValue
* The value to add, or <code>null</code>
*/ | Sets the <code>#getCoding()</code> to contain a coding with the code and system defined by the given enumerated type, AND clearing any existing codings first. If theValue is null, existing codings are cleared and no codings are added | setValueAsEnum | {
"repo_name": "gajen0981/FHIR-Server",
"path": "hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/primitive/BoundCodeableConceptDt.java",
"license": "apache-2.0",
"size": 3879
} | [
"ca.uhn.fhir.model.dstu.composite.CodingDt"
] | import ca.uhn.fhir.model.dstu.composite.CodingDt; | import ca.uhn.fhir.model.dstu.composite.*; | [
"ca.uhn.fhir"
] | ca.uhn.fhir; | 625,691 |
public static String getDefaultJavaCharset() {
String charset = SessionUtil.getProperty("mail.mime.charset");
if (charset != null) {
return javaCharset(charset);
}
return SessionUtil.getProperty("file.encoding", "8859_1");
} | static String function() { String charset = SessionUtil.getProperty(STR); if (charset != null) { return javaCharset(charset); } return SessionUtil.getProperty(STR, STR); } | /**
* Get the default character set to use, in Java name format.
* This either be the value set with the mail.mime.charset
* system property or obtained from the file.encoding system
* property. If neither of these is set, we fall back to
* 8859_1 (basically US-ASCII).
*
* @return The character string value of the default character set.
*/ | Get the default character set to use, in Java name format. This either be the value set with the mail.mime.charset system property or obtained from the file.encoding system property. If neither of these is set, we fall back to 8859_1 (basically US-ASCII) | getDefaultJavaCharset | {
"repo_name": "salyh/javamailspec",
"path": "geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/MimeUtility.java",
"license": "apache-2.0",
"size": 55648
} | [
"org.apache.geronimo.mail.util.SessionUtil"
] | import org.apache.geronimo.mail.util.SessionUtil; | import org.apache.geronimo.mail.util.*; | [
"org.apache.geronimo"
] | org.apache.geronimo; | 2,818,268 |
private interface InjectCallback {
RuntimeException inject(InjectableElement element, Object value);
}
private class SetFieldCallback implements InjectCallback {
private final Object object;
private SetFieldCallback(Object object) {
this.object = object;
} | interface InjectCallback { RuntimeException function(InjectableElement element, Object value); } private class SetFieldCallback implements InjectCallback { private final Object object; private SetFieldCallback(Object object) { this.object = object; } | /**
* Is called each time when the given value should be injected into the given element
* @param element
* @param value
* @return an InjectionResult
*/ | Is called each time when the given value should be injected into the given element | inject | {
"repo_name": "cleliameneghin/sling",
"path": "bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java",
"license": "apache-2.0",
"size": 55518
} | [
"org.apache.sling.models.impl.model.InjectableElement"
] | import org.apache.sling.models.impl.model.InjectableElement; | import org.apache.sling.models.impl.model.*; | [
"org.apache.sling"
] | org.apache.sling; | 1,002,988 |
// ! The color of the node.
public Color getColor() {
return m_node.getColor();
} | Color function() { return m_node.getColor(); } | /**
* Returns the current background color of the node.
*
* @return The current background color of the node.
*/ | Returns the current background color of the node | getColor | {
"repo_name": "AmesianX/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/API/disassembly/ViewNode.java",
"license": "apache-2.0",
"size": 11586
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 187,459 |
public static IteratorSetting getCopyToolSplitTimeRegExFilterSetting() {
final IteratorSetting regex = new IteratorSetting(32, COPY_TOOL_SPLIT_TIME_LOCAL_NAME + "_regex", RegExFilter.class);
RegExFilter.setRegexs(regex, "(.*)urn:(.*)#" + COPY_TOOL_SPLIT_TIME_LOCAL_NAME + "[\u0000|\u0001](.*)", null, null, null, false);
Filter.setNegate(regex, true);
return regex;
} | static IteratorSetting function() { final IteratorSetting regex = new IteratorSetting(32, COPY_TOOL_SPLIT_TIME_LOCAL_NAME + STR, RegExFilter.class); RegExFilter.setRegexs(regex, STR + COPY_TOOL_SPLIT_TIME_LOCAL_NAME + STR, null, null, null, false); Filter.setNegate(regex, true); return regex; } | /**
* Creates a {@link RegExFilter} setting to ignore the copy tool split time row in a table.
* @return the {@link RegExFilter} {@link IteratorSetting}.
*/ | Creates a <code>RegExFilter</code> setting to ignore the copy tool split time row in a table | getCopyToolSplitTimeRegExFilterSetting | {
"repo_name": "kchilton2/incubator-rya",
"path": "extras/rya.merger/src/main/java/org/apache/rya/accumulo/mr/merge/util/AccumuloRyaUtils.java",
"license": "apache-2.0",
"size": 30873
} | [
"org.apache.accumulo.core.client.IteratorSetting",
"org.apache.accumulo.core.iterators.Filter",
"org.apache.accumulo.core.iterators.user.RegExFilter"
] | import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.iterators.Filter; import org.apache.accumulo.core.iterators.user.RegExFilter; | import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.iterators.*; import org.apache.accumulo.core.iterators.user.*; | [
"org.apache.accumulo"
] | org.apache.accumulo; | 20,538 |
private synchronized boolean attemptTaskLaunchForUser(String lastExecutedTaskRequestId,
String lastExecutedTaskId, String user) {
Queue<TaskSpec> considering = userQueues.get(user);
TaskSpec nextTask = considering.poll();
if (nextTask != null) {
LOG.debug("Task for user " + user + ", request " + nextTask.requestId +
" now runnable.");
nextTask.previousRequestId = lastExecutedTaskRequestId;
nextTask.previousTaskId = lastExecutedTaskId;
makeTaskRunnable(nextTask);
numQueuedReservations--;
return true;
}
LOG.debug("Skipping user " + user + " that has no runnable tasks.");
return false;
} | synchronized boolean function(String lastExecutedTaskRequestId, String lastExecutedTaskId, String user) { Queue<TaskSpec> considering = userQueues.get(user); TaskSpec nextTask = considering.poll(); if (nextTask != null) { LOG.debug(STR + user + STR + nextTask.requestId + STR); nextTask.previousRequestId = lastExecutedTaskRequestId; nextTask.previousTaskId = lastExecutedTaskId; makeTaskRunnable(nextTask); numQueuedReservations--; return true; } LOG.debug(STR + user + STR); return false; } | /**
* Launches a task for the given user, if that user has any tasks queued.
*
* Returns true if a task was launched for the given user. This method must be synchronized to
* avoid concurrent concurrent modification to {@link userQueues} in
* {@link handleSubmitTaskReservation}.
*/ | Launches a task for the given user, if that user has any tasks queued. Returns true if a task was launched for the given user. This method must be synchronized to avoid concurrent concurrent modification to <code>userQueues</code> in <code>handleSubmitTaskReservation</code> | attemptTaskLaunchForUser | {
"repo_name": "ThomasDq/sparrowBenchmark",
"path": "src/main/java/edu/berkeley/sparrow/daemon/nodemonitor/RoundRobinTaskScheduler.java",
"license": "apache-2.0",
"size": 7767
} | [
"java.util.Queue"
] | import java.util.Queue; | import java.util.*; | [
"java.util"
] | java.util; | 212,614 |
private void applyScript(SQLiteDatabase db, String script) {
String[] items = null;
try {
BufferedReader reader = new BufferedReader( new InputStreamReader(NotationApplication.getContext().getAssets().open( "database/" + script) ), 8192 );
StringBuffer sql = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null) {
sql.append(line);
sql.append("\n");
}
// Split the DDL file by semi-colons anchored to EOL
Pattern myPattern = Pattern.compile(";$", Pattern.MULTILINE);
items = myPattern.split(sql.toString());
} catch (IOException ioe) {
ioe.printStackTrace();
items = new String[] {};
}
for (String item : items) {
if (item.trim().length() != 0) {
try {
db.execSQL(item + ";");
} catch (SQLException se) {
se.printStackTrace();
}
}
}
}
private class DBUpgradeTask extends AsyncTask<String, Void, Void> {
private SQLiteDatabase db;
public DBUpgradeTask(SQLiteDatabase db) {
this.db = db;
} | void function(SQLiteDatabase db, String script) { String[] items = null; try { BufferedReader reader = new BufferedReader( new InputStreamReader(NotationApplication.getContext().getAssets().open( STR + script) ), 8192 ); StringBuffer sql = new StringBuffer(); String line = null; while ((line = reader.readLine()) != null) { sql.append(line); sql.append("\n"); } Pattern myPattern = Pattern.compile(";$", Pattern.MULTILINE); items = myPattern.split(sql.toString()); } catch (IOException ioe) { ioe.printStackTrace(); items = new String[] {}; } for (String item : items) { if (item.trim().length() != 0) { try { db.execSQL(item + ";"); } catch (SQLException se) { se.printStackTrace(); } } } } private class DBUpgradeTask extends AsyncTask<String, Void, Void> { private SQLiteDatabase db; public DBUpgradeTask(SQLiteDatabase db) { this.db = db; } | /**
* Applies a changescript to the database.
*/ | Applies a changescript to the database | applyScript | {
"repo_name": "angry-glass-studios/notation-android",
"path": "src/main/java/com/angry_glass_studios/notation/daos/DatabaseHelper.java",
"license": "mit",
"size": 12494
} | [
"android.database.SQLException",
"android.database.sqlite.SQLiteDatabase",
"android.os.AsyncTask",
"com.angry_glass_studios.notation.NotationApplication",
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.util.regex.Pattern"
] | import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.os.AsyncTask; import com.angry_glass_studios.notation.NotationApplication; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Pattern; | import android.database.*; import android.database.sqlite.*; import android.os.*; import com.angry_glass_studios.notation.*; import java.io.*; import java.util.regex.*; | [
"android.database",
"android.os",
"com.angry_glass_studios.notation",
"java.io",
"java.util"
] | android.database; android.os; com.angry_glass_studios.notation; java.io; java.util; | 1,348,391 |
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction,
final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "cmp");
Preconditions.checkArgument(instruction.getOperands().size() == 2,
"Error: Argument instruction is not a cmp instruction (invalid number of operands)");
final long baseOffset = instruction.getAddress().toLong() * 0x100;
long offset = baseOffset;
final List<? extends IOperandTree> operands = instruction.getOperands();
final IOperandTree targetOperand = operands.get(0);
final IOperandTree sourceOperand = operands.get(1);
// Load first operand.
final TranslationResult firstResult =
Helpers.translateOperand(environment, offset, targetOperand, true);
instructions.addAll(firstResult.getInstructions());
// Adjust the offset of the next REIL instruction.
offset = baseOffset + instructions.size();
// Load second operand.
final TranslationResult secondResult =
Helpers.translateOperand(environment, offset, sourceOperand, true);
instructions.addAll(secondResult.getInstructions());
// Adjust the offset of the next REIL instruction.
offset = baseOffset + instructions.size();
final String firstRegister = firstResult.getRegister();
final String secondRegister = secondResult.getRegister();
final OperandSize size = firstResult.getSize();
// CMP = SUB without writing the result back into the target operand
Helpers.generateSub(environment, offset, size, firstRegister, secondRegister, instructions);
} | void function(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "cmp"); Preconditions.checkArgument(instruction.getOperands().size() == 2, STR); final long baseOffset = instruction.getAddress().toLong() * 0x100; long offset = baseOffset; final List<? extends IOperandTree> operands = instruction.getOperands(); final IOperandTree targetOperand = operands.get(0); final IOperandTree sourceOperand = operands.get(1); final TranslationResult firstResult = Helpers.translateOperand(environment, offset, targetOperand, true); instructions.addAll(firstResult.getInstructions()); offset = baseOffset + instructions.size(); final TranslationResult secondResult = Helpers.translateOperand(environment, offset, sourceOperand, true); instructions.addAll(secondResult.getInstructions()); offset = baseOffset + instructions.size(); final String firstRegister = firstResult.getRegister(); final String secondRegister = secondResult.getRegister(); final OperandSize size = firstResult.getSize(); Helpers.generateSub(environment, offset, size, firstRegister, secondRegister, instructions); } | /**
* Translates a CMP instruction to REIL code.
*
* @param environment A valid translation environment.
* @param instruction The CMP instruction to translate.
* @param instructions The generated REIL code will be added to this list
*
* @throws InternalTranslationException if any of the arguments are null the passed instruction is
* not a CMP instruction
*/ | Translates a CMP instruction to REIL code | translate | {
"repo_name": "mayl8822/binnavi",
"path": "src/main/java/com/google/security/zynamics/reil/translators/x86/CmpTranslator.java",
"license": "apache-2.0",
"size": 3582
} | [
"com.google.common.base.Preconditions",
"com.google.security.zynamics.reil.OperandSize",
"com.google.security.zynamics.reil.ReilInstruction",
"com.google.security.zynamics.reil.translators.ITranslationEnvironment",
"com.google.security.zynamics.reil.translators.InternalTranslationException",
"com.google.s... | import com.google.common.base.Preconditions; import com.google.security.zynamics.reil.OperandSize; import com.google.security.zynamics.reil.ReilInstruction; import com.google.security.zynamics.reil.translators.ITranslationEnvironment; import com.google.security.zynamics.reil.translators.InternalTranslationException; import com.google.security.zynamics.reil.translators.TranslationHelpers; import com.google.security.zynamics.reil.translators.TranslationResult; import com.google.security.zynamics.zylib.disassembly.IInstruction; import com.google.security.zynamics.zylib.disassembly.IOperandTree; import java.util.List; | import com.google.common.base.*; import com.google.security.zynamics.reil.*; import com.google.security.zynamics.reil.translators.*; import com.google.security.zynamics.zylib.disassembly.*; import java.util.*; | [
"com.google.common",
"com.google.security",
"java.util"
] | com.google.common; com.google.security; java.util; | 2,504,962 |
public void browserWindowResized(BrowserWindowResizeEvent event);
}
public static class BrowserWindowResizeEvent extends EventObject {
private final int width;
private final int height;
public BrowserWindowResizeEvent(Page source, int width, int height) {
super(source);
this.width = width;
this.height = height;
} | void function(BrowserWindowResizeEvent event); } public static class BrowserWindowResizeEvent extends EventObject { private final int width; private final int height; public BrowserWindowResizeEvent(Page source, int width, int height) { super(source); this.width = width; this.height = height; } | /**
* Invoked when the browser window containing a UI has been resized.
*
* @param event
* a browser window resize event
*/ | Invoked when the browser window containing a UI has been resized | browserWindowResized | {
"repo_name": "peterl1084/framework",
"path": "server/src/main/java/com/vaadin/server/Page.java",
"license": "apache-2.0",
"size": 49984
} | [
"java.util.EventObject"
] | import java.util.EventObject; | import java.util.*; | [
"java.util"
] | java.util; | 397,036 |
@Nonnull
public static <ELEMENTTYPE> Enumeration <ELEMENTTYPE> getCombinedEnumeration (@Nullable final Enumeration <? extends ELEMENTTYPE> aEnum1,
@Nullable final Enumeration <? extends ELEMENTTYPE> aEnum2)
{
return new CombinedEnumeration <ELEMENTTYPE> (aEnum1, aEnum2);
} | static <ELEMENTTYPE> Enumeration <ELEMENTTYPE> function (@Nullable final Enumeration <? extends ELEMENTTYPE> aEnum1, @Nullable final Enumeration <? extends ELEMENTTYPE> aEnum2) { return new CombinedEnumeration <ELEMENTTYPE> (aEnum1, aEnum2); } | /**
* Get a merged enumeration of both enumeration. The first enumeration is
* enumerated first, the second one afterwards.
*
* @param <ELEMENTTYPE>
* The type of elements to be enumerated.
* @param aEnum1
* First enumeration. May be <code>null</code>.
* @param aEnum2
* Second enumeration. May be <code>null</code>.
* @return The merged enumeration. Never <code>null</code>.
*/ | Get a merged enumeration of both enumeration. The first enumeration is enumerated first, the second one afterwards | getCombinedEnumeration | {
"repo_name": "lsimons/phloc-schematron-standalone",
"path": "phloc-commons/src/main/java/com/phloc/commons/collections/ContainerHelper.java",
"license": "apache-2.0",
"size": 126718
} | [
"com.phloc.commons.collections.iterate.CombinedEnumeration",
"java.util.Enumeration",
"javax.annotation.Nullable"
] | import com.phloc.commons.collections.iterate.CombinedEnumeration; import java.util.Enumeration; import javax.annotation.Nullable; | import com.phloc.commons.collections.iterate.*; import java.util.*; import javax.annotation.*; | [
"com.phloc.commons",
"java.util",
"javax.annotation"
] | com.phloc.commons; java.util; javax.annotation; | 2,364,933 |
@Test(dependsOnMethods = "init")
public void getPreference() throws Exception {
final PreferenceQueryService preferenceQueryService =
getPreferenceQueryService();
final JSONObject preference = preferenceQueryService.getPreference();
Assert.assertEquals(preference.getString(Preference.BLOG_TITLE),
Preference.Default.DEFAULT_BLOG_TITLE);
}
| @Test(dependsOnMethods = "init") void function() throws Exception { final PreferenceQueryService preferenceQueryService = getPreferenceQueryService(); final JSONObject preference = preferenceQueryService.getPreference(); Assert.assertEquals(preference.getString(Preference.BLOG_TITLE), Preference.Default.DEFAULT_BLOG_TITLE); } | /**
* Get Preference.
*
* @throws Exception exception
*/ | Get Preference | getPreference | {
"repo_name": "zhourongyu/b3log-solo",
"path": "core/src/test/java/org/b3log/solo/service/PreferenceQueryServiceTestCase.java",
"license": "apache-2.0",
"size": 2961
} | [
"org.b3log.solo.model.Preference",
"org.json.JSONObject",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import org.b3log.solo.model.Preference; import org.json.JSONObject; import org.testng.Assert; import org.testng.annotations.Test; | import org.b3log.solo.model.*; import org.json.*; import org.testng.*; import org.testng.annotations.*; | [
"org.b3log.solo",
"org.json",
"org.testng",
"org.testng.annotations"
] | org.b3log.solo; org.json; org.testng; org.testng.annotations; | 1,078,454 |
@Override
public void setParent(final java.util.logging.Logger parent) {
// we don't care about parents
} | void function(final java.util.logging.Logger parent) { } | /**
* DOCUMENT ME!
*
* @param parent DOCUMENT ME!
*/ | DOCUMENT ME | setParent | {
"repo_name": "cismet/simple-rest-server",
"path": "src/main/java/de/cismet/commons/simplerestserver/container/GrizzlyRESTContainer.java",
"license": "lgpl-3.0",
"size": 22530
} | [
"org.apache.log4j.Logger"
] | import org.apache.log4j.Logger; | import org.apache.log4j.*; | [
"org.apache.log4j"
] | org.apache.log4j; | 610,938 |
@Test
public void testGetUnits() {
Size instance = new Size(0.0, SizeUnits.PX);
SizeUnits expResult = SizeUnits.PX;
SizeUnits result = instance.getUnits();
assertEquals(expResult, result);
} | void function() { Size instance = new Size(0.0, SizeUnits.PX); SizeUnits expResult = SizeUnits.PX; SizeUnits result = instance.getUnits(); assertEquals(expResult, result); } | /**
* Test of getUnits method, of class Size.
*/ | Test of getUnits method, of class Size | testGetUnits | {
"repo_name": "teamfx/openjfx-8u-dev-rt",
"path": "modules/graphics/src/test/java/com/sun/javafx/css/SizeTest.java",
"license": "gpl-2.0",
"size": 8632
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,928,251 |
public void begin(ODatabaseDocumentInternal iDatabase);
| void function(ODatabaseDocumentInternal iDatabase); | /**
* Activate the intent.
*
* @param iDatabase
* Database where to activate it
*/ | Activate the intent | begin | {
"repo_name": "wouterv/orientdb",
"path": "core/src/main/java/com/orientechnologies/orient/core/intent/OIntent.java",
"license": "apache-2.0",
"size": 1440
} | [
"com.orientechnologies.orient.core.db.ODatabaseDocumentInternal"
] | import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; | import com.orientechnologies.orient.core.db.*; | [
"com.orientechnologies.orient"
] | com.orientechnologies.orient; | 1,213,426 |
public static Optional<Aspect> fromCharacter(String character) {
return fromSource(Aspect::getCharacter, character);
} | static Optional<Aspect> function(String character) { return fromSource(Aspect::getCharacter, character); } | /**
* Return Aspect that that has the target character.
* @param character the Aspect name expressed as one character.
@return matching Aspect as Optional, or empty Optional if no match.
*/ | Return Aspect that that has the target character | fromCharacter | {
"repo_name": "ebi-uniprot/QuickGOBE",
"path": "common/src/main/java/uk/ac/ebi/quickgo/common/model/Aspect.java",
"license": "apache-2.0",
"size": 2715
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,543,338 |
protected String readLine() throws IOException {
decodedIndex = 0;
// get an accumulator for the data
final StringBuffer buffer = new StringBuffer();
// now process a character at a time.
int ch = in.read();
while (ch != -1) {
// a naked new line completes the line.
if (ch == '\n') {
break;
}
// a carriage return by itself is ignored...we're going to assume that this is followed
// by a new line because we really don't have the capability of pushing this back .
else if (ch == '\r') {
;
}
else {
// add this to our buffer
buffer.append((char)ch);
}
ch = in.read();
}
// if we didn't get any data at all, return nothing
if (ch == -1 && buffer.length() == 0) {
return null;
}
// convert this into a string.
return buffer.toString();
} | String function() throws IOException { decodedIndex = 0; final StringBuffer buffer = new StringBuffer(); int ch = in.read(); while (ch != -1) { if (ch == '\n') { break; } else if (ch == '\r') { ; } else { buffer.append((char)ch); } ch = in.read(); } if (ch == -1 && buffer.length() == 0) { return null; } return buffer.toString(); } | /**
* Read a line of data. Returns null if there is an EOF.
*
* @return The next line read from the stream. Returns null if we
* hit the end of the stream.
* @exception IOException
*/ | Read a line of data. Returns null if there is an EOF | readLine | {
"repo_name": "salyh/geronimo-specs",
"path": "geronimo-javamail_1.5_spec/src/main/java/org/apache/geronimo/mail/util/UUDecoderStream.java",
"license": "apache-2.0",
"size": 8786
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 961,327 |
public T getFirstRight() {
for (T dataSet : mDataSets) {
if (dataSet.getAxisDependency() == YAxis.AxisDependency.RIGHT)
return dataSet;
}
return null;
} | T function() { for (T dataSet : mDataSets) { if (dataSet.getAxisDependency() == YAxis.AxisDependency.RIGHT) return dataSet; } return null; } | /**
* Returns the first DataSet from the datasets-array that has it's dependency on the right axis.
* Returns null if no DataSet with right dependency could be found.
*
* @return
*/ | Returns the first DataSet from the datasets-array that has it's dependency on the right axis. Returns null if no DataSet with right dependency could be found | getFirstRight | {
"repo_name": "muyoumumumu/QuShuChe",
"path": "MPChartLib/src/com/github/mikephil/charting/data/ChartData.java",
"license": "apache-2.0",
"size": 25281
} | [
"com.github.mikephil.charting.components.YAxis"
] | import com.github.mikephil.charting.components.YAxis; | import com.github.mikephil.charting.components.*; | [
"com.github.mikephil"
] | com.github.mikephil; | 2,903,036 |
public Observable<ServiceResponse<Product>> putNonRetry400WithServiceResponseAsync() {
final Product product = null;
Observable<Response<ResponseBody>> observable = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<Product>() { }.getType());
} | Observable<ServiceResponse<Product>> function() { final Product product = null; Observable<Response<ResponseBody>> observable = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<Product>() { }.getType()); } | /**
* Long running put request, service returns a 400 to the initial request.
*
* @return the observable for the request
*/ | Long running put request, service returns a 400 to the initial request | putNonRetry400WithServiceResponseAsync | {
"repo_name": "tbombach/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/lro/implementation/LROSADsImpl.java",
"license": "mit",
"size": 288876
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.rest.ServiceResponse"
] | import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; | import com.google.common.reflect.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.rest"
] | com.google.common; com.microsoft.rest; | 1,266,198 |
private static List<org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion> transformECFV(
List<EventClassFamilyVersion> ecfVersions) {
List<org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion> ecfvThL = new ArrayList<>();
if (ecfVersions != null) {
for (EventClassFamilyVersion ecfv : ecfVersions) {
org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion ecfvTh = new org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion();
ecfvTh.setEndpointClassFamilyId(ecfv.getEcfId());
ecfvTh.setEndpointClassFamilyVersion(ecfv.getVersion());
ecfvThL.add(ecfvTh);
}
}
return ecfvThL;
} | static List<org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion> function( List<EventClassFamilyVersion> ecfVersions) { List<org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion> ecfvThL = new ArrayList<>(); if (ecfVersions != null) { for (EventClassFamilyVersion ecfv : ecfVersions) { org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion ecfvTh = new org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion(); ecfvTh.setEndpointClassFamilyId(ecfv.getEcfId()); ecfvTh.setEndpointClassFamilyVersion(ecfv.getVersion()); ecfvThL.add(ecfvTh); } } return ecfvThL; } | /**
* Transform List<EventClassFamilyVersion> into Thrift
* List<EventClassFamilyVersion>
*
* @param ecfVersions
* List<EventClassFamilyVersion>
* @return thrift List<EventClassFamilyVersion>
*/ | Transform List into Thrift List | transformECFV | {
"repo_name": "forGGe/kaa",
"path": "server/node/src/main/java/org/kaaproject/kaa/server/operations/service/event/DefaultEventService.java",
"license": "apache-2.0",
"size": 28181
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,270,686 |
public String getExcludedUsers() {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_excludedUsers)) {
getToNames();
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_excludedUsers)) {
return "";
}
return m_excludedUsers;
} | String function() { if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_excludedUsers)) { getToNames(); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_excludedUsers)) { return ""; } return m_excludedUsers; } | /**
* Returns a warning if users have been excluded.<p>
*
* @return a warning
*/ | Returns a warning if users have been excluded | getExcludedUsers | {
"repo_name": "victos/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/workplace/broadcast/CmsSendEmailGroupsDialog.java",
"license": "lgpl-2.1",
"size": 13737
} | [
"org.opencms.util.CmsStringUtil"
] | import org.opencms.util.CmsStringUtil; | import org.opencms.util.*; | [
"org.opencms.util"
] | org.opencms.util; | 1,168,903 |
Map<String, Object> getMetricsData(); | Map<String, Object> getMetricsData(); | /**
* Metrics capturing call rate, and mean execution time.
*
* @return Map of key,value pairs for metrics
*/ | Metrics capturing call rate, and mean execution time | getMetricsData | {
"repo_name": "raviperi/storm",
"path": "external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/core/IEventHubReceiver.java",
"license": "apache-2.0",
"size": 2400
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 731,652 |
public void write(OFMessage m) throws java.io.IOException; | void function(OFMessage m) throws java.io.IOException; | /**
* Write an OpenFlow message to the stream
* @param m An OF Message
*/ | Write an OpenFlow message to the stream | write | {
"repo_name": "Syn-Flow/Controller",
"path": "src/main/java/org/openflow/io/OFMessageOutStream.java",
"license": "apache-2.0",
"size": 1077
} | [
"org.openflow.protocol.OFMessage"
] | import org.openflow.protocol.OFMessage; | import org.openflow.protocol.*; | [
"org.openflow.protocol"
] | org.openflow.protocol; | 1,727,546 |
public void addToLog(int frame_no, String value_name, String value) {
parameter_set.add(value_name);
if (!log_map.containsKey(frame_no))
log_map.put(frame_no, new LinkedHashMap<>());
// This prevents overwriting batched outputs that have already been
// logged. This may occur, for example, when the controller is working
// faster than the logger.
LinkedHashMap<String, Object> currFrame = log_map.get(frame_no);
if (!currFrame.containsKey(value_name))
currFrame.put(value_name, value);
} | void function(int frame_no, String value_name, String value) { parameter_set.add(value_name); if (!log_map.containsKey(frame_no)) log_map.put(frame_no, new LinkedHashMap<>()); LinkedHashMap<String, Object> currFrame = log_map.get(frame_no); if (!currFrame.containsKey(value_name)) currFrame.put(value_name, value); } | /**
* Add a parameter into log
* @param frame_no
* @param value_name name of parameter
* @param value value of parameter
*/ | Add a parameter into log | addToLog | {
"repo_name": "MStefko/ALICA",
"path": "src/main/java/ch/epfl/leb/alica/AlicaLogger.java",
"license": "gpl-3.0",
"size": 9461
} | [
"java.util.LinkedHashMap"
] | import java.util.LinkedHashMap; | import java.util.*; | [
"java.util"
] | java.util; | 761,746 |
public Map<K, V> getAll(Set<? extends K> keys) throws ClientException; | Map<K, V> function(Set<? extends K> keys) throws ClientException; | /**
* Gets a collection of entries from the {@link ClientCache}, returning them as
* {@link Map} of the values associated with the set of keys requested.
*
* @param keys The keys whose associated values are to be returned.
* @return A map of entries that were found for the given keys. Keys not found
* in the cache are not in the returned map.
*/ | Gets a collection of entries from the <code>ClientCache</code>, returning them as <code>Map</code> of the values associated with the set of keys requested | getAll | {
"repo_name": "SomeFire/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/client/ClientCache.java",
"license": "apache-2.0",
"size": 13855
} | [
"java.util.Map",
"java.util.Set"
] | import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,723,295 |
private OzoneKey getKeyInfo(String key) {
try {
return bucket.getKey(key);
} catch (IOException e) {
LOG.trace("Key:{} does not exists", key);
return null;
}
} | OzoneKey function(String key) { try { return bucket.getKey(key); } catch (IOException e) { LOG.trace(STR, key); return null; } } | /**
* Helper method to fetch the key metadata info.
* @param key key whose metadata information needs to be fetched
* @return metadata info of the key
*/ | Helper method to fetch the key metadata info | getKeyInfo | {
"repo_name": "xiao-chen/hadoop",
"path": "hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneFileSystem.java",
"license": "apache-2.0",
"size": 23474
} | [
"java.io.IOException",
"org.apache.hadoop.ozone.client.OzoneKey"
] | import java.io.IOException; import org.apache.hadoop.ozone.client.OzoneKey; | import java.io.*; import org.apache.hadoop.ozone.client.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,910,817 |
@Test
public void testCopyFromProjection() {
final String destination = serverAddress + "copy-" + getRandomUniqueId() + "-ds1";
final String source = serverAddress + "files/FileSystem1/ds1";
// ensure the source is present
assertEquals(OK.getStatusCode(), getStatus(new HttpGet(source)));
// copy to repository
final HttpCopy request = new HttpCopy(source);
request.addHeader("Destination", destination);
assertEquals(CREATED.getStatusCode(), getStatus(request));
// repository copy should now exist
assertEquals(OK.getStatusCode(), getStatus(new HttpGet(destination)));
assertEquals(OK.getStatusCode(), getStatus(new HttpGet(source)));
} | void function() { final String destination = serverAddress + "copy-" + getRandomUniqueId() + "-ds1"; final String source = serverAddress + STR; assertEquals(OK.getStatusCode(), getStatus(new HttpGet(source))); final HttpCopy request = new HttpCopy(source); request.addHeader(STR, destination); assertEquals(CREATED.getStatusCode(), getStatus(request)); assertEquals(OK.getStatusCode(), getStatus(new HttpGet(destination))); assertEquals(OK.getStatusCode(), getStatus(new HttpGet(source))); } | /**
* I should be able to copy objects from a federated filesystem to the repository.
**/ | I should be able to copy objects from a federated filesystem to the repository | testCopyFromProjection | {
"repo_name": "ruebot/fcrepo4",
"path": "fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/FedoraNodesIT.java",
"license": "apache-2.0",
"size": 10285
} | [
"javax.ws.rs.core.Response",
"org.apache.http.client.methods.HttpGet",
"org.junit.Assert"
] | import javax.ws.rs.core.Response; import org.apache.http.client.methods.HttpGet; import org.junit.Assert; | import javax.ws.rs.core.*; import org.apache.http.client.methods.*; import org.junit.*; | [
"javax.ws",
"org.apache.http",
"org.junit"
] | javax.ws; org.apache.http; org.junit; | 617,905 |
ExpressableType getInferableType(); | ExpressableType getInferableType(); | /**
* Obtain reference to the type, or {@code null}, for this expression that can be used
* to infer the "implied type" of related expressions. Not all expressions can act as the
* source of an inferred type, in which case the method would return {@code null}.
*
* @return The inferable type
*
* @see ImpliedTypeSqmExpression#impliedType
*/ | Obtain reference to the type, or null, for this expression that can be used to infer the "implied type" of related expressions. Not all expressions can act as the source of an inferred type, in which case the method would return null | getInferableType | {
"repo_name": "hibernate/hibernate-semantic-query",
"path": "src/main/java/org/hibernate/query/sqm/tree/expression/SqmExpression.java",
"license": "apache-2.0",
"size": 1489
} | [
"org.hibernate.persister.queryable.spi.ExpressableType"
] | import org.hibernate.persister.queryable.spi.ExpressableType; | import org.hibernate.persister.queryable.spi.*; | [
"org.hibernate.persister"
] | org.hibernate.persister; | 1,311,557 |
@Test
public void testIsEmpty()
{
assertTrue(new ImmutableDimension3d(0, 0, 1).isEmpty());
assertTrue(new ImmutableDimension3d(0, 1, 1).isEmpty());
assertTrue(new ImmutableDimension3d(1, 0, 1).isEmpty());
assertTrue(new ImmutableDimension3d(1, -1, 1).isEmpty());
assertTrue(new ImmutableDimension3d(-1, 1, 1).isEmpty());
assertFalse(new ImmutableDimension3d(1, 1, 1).isEmpty());
assertTrue(new ImmutableDimension3d(0, 0, 0).isEmpty());
assertTrue(new ImmutableDimension3d(0, 0, 1).isEmpty());
assertTrue(new ImmutableDimension3d(1, 1, -1).isEmpty());
} | void function() { assertTrue(new ImmutableDimension3d(0, 0, 1).isEmpty()); assertTrue(new ImmutableDimension3d(0, 1, 1).isEmpty()); assertTrue(new ImmutableDimension3d(1, 0, 1).isEmpty()); assertTrue(new ImmutableDimension3d(1, -1, 1).isEmpty()); assertTrue(new ImmutableDimension3d(-1, 1, 1).isEmpty()); assertFalse(new ImmutableDimension3d(1, 1, 1).isEmpty()); assertTrue(new ImmutableDimension3d(0, 0, 0).isEmpty()); assertTrue(new ImmutableDimension3d(0, 0, 1).isEmpty()); assertTrue(new ImmutableDimension3d(1, 1, -1).isEmpty()); } | /**
* Tests the isEmpty() method.
*/ | Tests the isEmpty() method | testIsEmpty | {
"repo_name": "kayahr/gramath",
"path": "src/test/java/de/ailis/gramath/Dimension3dTest.java",
"license": "mit",
"size": 4304
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,665,308 |
private StringTuple toStringTuple(Object item)
{
if (item == null || item instanceof StringTuple) {
return (StringTuple) item;
} else if (item instanceof String) {
return StringTuple.create((String) item);
} else if (item instanceof String[]) {
return StringTuple.create((String[]) item);
} else if (item instanceof List) {
return StringTuple.create((String[]) ((List) item).toArray(new String[0]));
} else {
throw new IAE("Item must either be a String or StringTuple");
}
} | StringTuple function(Object item) { if (item == null item instanceof StringTuple) { return (StringTuple) item; } else if (item instanceof String) { return StringTuple.create((String) item); } else if (item instanceof String[]) { return StringTuple.create((String[]) item); } else if (item instanceof List) { return StringTuple.create((String[]) ((List) item).toArray(new String[0])); } else { throw new IAE(STR); } } | /**
* Converts the given item to a StringTuple.
*/ | Converts the given item to a StringTuple | toStringTuple | {
"repo_name": "nishantmonu51/druid",
"path": "core/src/main/java/org/apache/druid/timeline/partition/PartitionBoundaries.java",
"license": "apache-2.0",
"size": 4555
} | [
"java.util.List",
"org.apache.druid.data.input.StringTuple"
] | import java.util.List; import org.apache.druid.data.input.StringTuple; | import java.util.*; import org.apache.druid.data.input.*; | [
"java.util",
"org.apache.druid"
] | java.util; org.apache.druid; | 52,593 |
public GridClientConfiguration setExecutorService(ExecutorService executor) {
this.executor = executor;
return this;
} | GridClientConfiguration function(ExecutorService executor) { this.executor = executor; return this; } | /**
* Sets executor service.
*
* @param executor Executor service to use in client.
* @return {@code this} for chaining.
*/ | Sets executor service | setExecutorService | {
"repo_name": "ascherbakoff/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java",
"license": "apache-2.0",
"size": 32976
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 427,498 |
@Deprecated
@NonNull
public static Date localDateTimeToDate(@NonNull LocalDateTime localDateTime) {
//noinspection deprecation
return localDateTimeToDate(localDateTime, ZoneId.systemDefault());
} | static Date function(@NonNull LocalDateTime localDateTime) { return localDateTimeToDate(localDateTime, ZoneId.systemDefault()); } | /**
* Convert an instance of the <code>LocalDateTime</code> Java 8 Time backport to a <code>Date</code> instance.
*
* @param localDateTime the date to be converted.
* @return a new <code>Date</code> instance representing the same date as <code>localDateTime</code>.
* @deprecated Use it only for third party libraries.
*/ | Convert an instance of the <code>LocalDateTime</code> Java 8 Time backport to a <code>Date</code> instance | localDateTimeToDate | {
"repo_name": "chacaa/DoApp",
"path": "app/src/main/java/com/xmartlabs/scasas/doapp/helper/DateHelper.java",
"license": "apache-2.0",
"size": 15541
} | [
"android.support.annotation.NonNull",
"java.util.Date",
"org.threeten.bp.LocalDateTime",
"org.threeten.bp.ZoneId"
] | import android.support.annotation.NonNull; import java.util.Date; import org.threeten.bp.LocalDateTime; import org.threeten.bp.ZoneId; | import android.support.annotation.*; import java.util.*; import org.threeten.bp.*; | [
"android.support",
"java.util",
"org.threeten.bp"
] | android.support; java.util; org.threeten.bp; | 1,080,403 |
TerminalSize getPreferredSize(Table<V> table, V cell, int columnIndex, int rowIndex); | TerminalSize getPreferredSize(Table<V> table, V cell, int columnIndex, int rowIndex); | /**
* Called by the table when it wants to know how big a particular table cell should be
* @param table Table containing the cell
* @param cell Data stored in the cell
* @param columnIndex Column index of the cell
* @param rowIndex Row index of the cell
* @return Size this renderer would like the cell to have
*/ | Called by the table when it wants to know how big a particular table cell should be | getPreferredSize | {
"repo_name": "mabe02/lanterna",
"path": "src/main/java/com/googlecode/lanterna/gui2/table/TableCellRenderer.java",
"license": "lgpl-3.0",
"size": 2196
} | [
"com.googlecode.lanterna.TerminalSize"
] | import com.googlecode.lanterna.TerminalSize; | import com.googlecode.lanterna.*; | [
"com.googlecode.lanterna"
] | com.googlecode.lanterna; | 153,764 |
@Nonnull
public ObservableActionListener registerWith(@Nonnull Object component) {
return SwingObservables.invoke(component, "add", ActionListener.class, this);
} | @Nonnull ObservableActionListener function(@Nonnull Object component) { return SwingObservables.invoke(component, "add", ActionListener.class, this); } | /**
* Convenience method to register this observable with the target component which must have a public <code>addActionListener(ActionListener)</code> method.
* @param component the target component
* @return this
*/ | Convenience method to register this observable with the target component which must have a public <code>addActionListener(ActionListener)</code> method | registerWith | {
"repo_name": "akarnokd/reactive4java",
"path": "src/main/java/hu/akarnokd/reactive4java/swing/ObservableActionListener.java",
"license": "apache-2.0",
"size": 2503
} | [
"java.awt.event.ActionListener",
"javax.annotation.Nonnull"
] | import java.awt.event.ActionListener; import javax.annotation.Nonnull; | import java.awt.event.*; import javax.annotation.*; | [
"java.awt",
"javax.annotation"
] | java.awt; javax.annotation; | 2,006,365 |
public void getDataFromCms(User user) throws UnauthorizedException, IOException {
if (user == null || !isAllowed(user)) {
throw new UnauthorizedException("Invalid credentials");
}
// everything ok, let's update
StringBuilder summary = new StringBuilder();
JsonObject contents = new JsonObject();
JsonDataSources sources = new VendorDynamicInput().fetchAllDataSources();
for (String entity: sources) {
JsonArray array = new JsonArray();
JsonDataSource source = sources.getSource(entity);
for (JsonObject obj: source) {
array.add(obj);
}
summary.append(entity).append(": ").append(source.size()).append("\n");
contents.add(entity, array);
}
// Fetch new images and set up serving URLs.
new ImageUpdater().run(sources);
// Write file to cloud storage
CloudFileManager fileManager = new CloudFileManager();
fileManager.createOrUpdate("__raw_session_data.json", contents, true);
} | void function(User user) throws UnauthorizedException, IOException { if (user == null !isAllowed(user)) { throw new UnauthorizedException(STR); } StringBuilder summary = new StringBuilder(); JsonObject contents = new JsonObject(); JsonDataSources sources = new VendorDynamicInput().fetchAllDataSources(); for (String entity: sources) { JsonArray array = new JsonArray(); JsonDataSource source = sources.getSource(entity); for (JsonObject obj: source) { array.add(obj); } summary.append(entity).append(STR).append(source.size()).append("\n"); contents.add(entity, array); } new ImageUpdater().run(sources); CloudFileManager fileManager = new CloudFileManager(); fileManager.createOrUpdate(STR, contents, true); } | /**
* Retrieve session data from CMS and make it ready for processing.
*
* @param user User making the request (injected by Endpoints)
* @throws UnauthorizedException
* @throws IOException
*/ | Retrieve session data from CMS and make it ready for processing | getDataFromCms | {
"repo_name": "WeRockStar/iosched",
"path": "server/src/main/java/com/google/samples/apps/iosched/server/schedule/server/CmsUpdateEndpoint.java",
"license": "apache-2.0",
"size": 4038
} | [
"com.google.api.server.spi.auth.common.User",
"com.google.api.server.spi.response.UnauthorizedException",
"com.google.gson.JsonArray",
"com.google.gson.JsonObject",
"com.google.samples.apps.iosched.server.schedule.model.JsonDataSource",
"com.google.samples.apps.iosched.server.schedule.model.JsonDataSource... | import com.google.api.server.spi.auth.common.User; import com.google.api.server.spi.response.UnauthorizedException; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.samples.apps.iosched.server.schedule.model.JsonDataSource; import com.google.samples.apps.iosched.server.schedule.model.JsonDataSources; import com.google.samples.apps.iosched.server.schedule.server.cloudstorage.CloudFileManager; import com.google.samples.apps.iosched.server.schedule.server.image.ImageUpdater; import com.google.samples.apps.iosched.server.schedule.server.input.VendorDynamicInput; import java.io.IOException; | import com.google.api.server.spi.auth.common.*; import com.google.api.server.spi.response.*; import com.google.gson.*; import com.google.samples.apps.iosched.server.schedule.model.*; import com.google.samples.apps.iosched.server.schedule.server.cloudstorage.*; import com.google.samples.apps.iosched.server.schedule.server.image.*; import com.google.samples.apps.iosched.server.schedule.server.input.*; import java.io.*; | [
"com.google.api",
"com.google.gson",
"com.google.samples",
"java.io"
] | com.google.api; com.google.gson; com.google.samples; java.io; | 1,695,057 |
public void setCategory(Category category)
{
this.category = category;
} | void function(Category category) { this.category = category; } | /**
* set category
* @param category The category to set.
*/ | set category | setCategory | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "help/help-component-shared/src/java/org/sakaiproject/component/app/help/model/ResourceBean.java",
"license": "apache-2.0",
"size": 6605
} | [
"org.sakaiproject.api.app.help.Category"
] | import org.sakaiproject.api.app.help.Category; | import org.sakaiproject.api.app.help.*; | [
"org.sakaiproject.api"
] | org.sakaiproject.api; | 390,147 |
private ExtensionPane clickAndWaitForConfirmationOrJobDone(WebElement button)
{
return clickAndWaitForConfirmationOrJobDone(button, getDriver().getTimeout());
} | ExtensionPane function(WebElement button) { return clickAndWaitForConfirmationOrJobDone(button, getDriver().getTimeout()); } | /**
* Clicks on the given button and waits for a confirmation or for the job/action to be done.
*
* @param button the button to be clicked
* @return the extension pane showing the confirmation or the job log
*/ | Clicks on the given button and waits for a confirmation or for the job/action to be done | clickAndWaitForConfirmationOrJobDone | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-pageobjects/src/main/java/org/xwiki/extension/test/po/ExtensionPane.java",
"license": "lgpl-2.1",
"size": 14780
} | [
"org.openqa.selenium.WebElement"
] | import org.openqa.selenium.WebElement; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 1,341,944 |
EEnum getPortKind(); | EEnum getPortKind(); | /**
* Returns the meta object for enum '{@link ernest.architecture.types.PortKind <em>Port Kind</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for enum '<em>Port Kind</em>'.
* @see ernest.architecture.types.PortKind
* @generated
*/ | Returns the meta object for enum '<code>ernest.architecture.types.PortKind Port Kind</code>'. | getPortKind | {
"repo_name": "FraunhoferESK/ernest-eclipse-integration",
"path": "de.fraunhofer.esk.ernest.core.analysismodel/src/ernest/architecture/types/TypesPackage.java",
"license": "epl-1.0",
"size": 7817
} | [
"org.eclipse.emf.ecore.EEnum"
] | import org.eclipse.emf.ecore.EEnum; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,215,845 |
private List<Dbms> constructAllDbms(NodeList dbmsNodes) {
ArrayList<Dbms> dbmsList = new ArrayList<>();
for (int i = 0; i < dbmsNodes.getLength(); i++) {
Dbms dbms = constructDbms((Element) dbmsNodes.item(i));
dbmsList.add(dbms);
}
return dbmsList;
} | List<Dbms> function(NodeList dbmsNodes) { ArrayList<Dbms> dbmsList = new ArrayList<>(); for (int i = 0; i < dbmsNodes.getLength(); i++) { Dbms dbms = constructDbms((Element) dbmsNodes.item(i)); dbmsList.add(dbms); } return dbmsList; } | /**
* Constructs all DBMS from DOM
*
* @param dbmsNodes
* @return
*/ | Constructs all DBMS from DOM | constructAllDbms | {
"repo_name": "Talend/components",
"path": "core/components-common/src/main/java/org/talend/components/common/config/jdbc/MappingFileLoader.java",
"license": "apache-2.0",
"size": 10313
} | [
"java.util.ArrayList",
"java.util.List",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import java.util.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 337,034 |
@Override
public void add(@NonNull Node node) {
if (!mGraph.containsKey(node)) {
mGraph.put(node, null);
topologyChanged = true;
}
} | void function(@NonNull Node node) { if (!mGraph.containsKey(node)) { mGraph.put(node, null); topologyChanged = true; } } | /**
* Add a node to the graph.
*
* <p>If the node already exists in the graph then this method is a no-op.</p>
*
* @param node the node to add
*/ | Add a node to the graph. If the node already exists in the graph then this method is a no-op | add | {
"repo_name": "saantiaguilera/android-api-graph_flow",
"path": "core/src/main/java/com/u/core/graph/DirectedAcyclicGraph.java",
"license": "gpl-3.0",
"size": 6600
} | [
"android.support.annotation.NonNull",
"com.u.core.node.Node"
] | import android.support.annotation.NonNull; import com.u.core.node.Node; | import android.support.annotation.*; import com.u.core.node.*; | [
"android.support",
"com.u.core"
] | android.support; com.u.core; | 2,491,846 |
public Entity entityBy(int id) {
return entities.get(id);
} | Entity function(int id) { return entities.get(id); } | /**
* Gets the entity with the given ID
*
* @param id the ID to find the entity by
* @return the entity with the ID specified
*/ | Gets the entity with the given ID | entityBy | {
"repo_name": "PizzaCrust/Trident",
"path": "src/main/java/net/tridentsdk/server/entity/EntityHandler.java",
"license": "apache-2.0",
"size": 3087
} | [
"net.tridentsdk.entity.Entity"
] | import net.tridentsdk.entity.Entity; | import net.tridentsdk.entity.*; | [
"net.tridentsdk.entity"
] | net.tridentsdk.entity; | 1,833,424 |
public static Result parse(Object options, String... args) {
OptionHandlerRegistry.getRegistry().registerHandler(boolean.class, BooleanOptionHandler.class);
OptionHandlerRegistry.getRegistry().registerHandler(Boolean.class, BooleanOptionHandler.class);
ParserProperties parserProperties =
ParserProperties
.defaults()
// The @ syntax here is global, @argfile alone is a file one or more options in it.
// The jar-tool traditionally accepted limited @argfile switch values, ie: -f=@argfile,
// and the contents of the argfile was the single option's value.
// As such we turn off args4j @ syntax explicitly and implement a custom OptionHandler
// to retain the traditional jar-tool @ semantics.
.withAtSyntax(false)
.withOptionValueDelimiter("=")
.withShowDefaults(true);
// Args4j expects positional arguments come 1st whereas pants traditionally expects them to come
// last. Fixup the order to suit Args4j if needed.
// NB: This only works because we set the option value delimiter to non-whitespace above!
List<String> arguments = Lists.newArrayList(args);
if (arguments.size() > 1) {
List<String> positionalArgs = Lists.newArrayList();
Iterator<String> reverseArgIterator = Lists.reverse(arguments).iterator();
while (reverseArgIterator.hasNext()) {
String arg = reverseArgIterator.next();
if (!arg.startsWith("-")) {
reverseArgIterator.remove();
positionalArgs.add(arg);
} else {
break;
}
}
arguments.addAll(0, Lists.reverse(positionalArgs));
}
CmdLineParser cmdLineParser = new CmdLineParser(options, parserProperties);
try {
cmdLineParser.parseArgument(arguments);
return Result.success(cmdLineParser);
} catch (CmdLineException e) {
return Result.failure(cmdLineParser, "Invalid command line:\n\t%s", e.getLocalizedMessage());
} catch (InvalidCmdLineArgumentException e) {
return Result.failure(cmdLineParser, "Invalid command line parameter:\n\t%s", e.getMessage());
} finally {
// Unregister our custom CmdLineParser handlers because the OptionHandlerRegistry
// is a global singleton and we don't want to affect other users of CmdLineParser.
// This is most common when multiple tests are run at the same time.
OptionHandlerRegistry.getRegistry().registerHandler(
boolean.class, org.kohsuke.args4j.spi.BooleanOptionHandler.class);
OptionHandlerRegistry.getRegistry().registerHandler(
Boolean.class, org.kohsuke.args4j.spi.BooleanOptionHandler.class);
}
} | static Result function(Object options, String... args) { OptionHandlerRegistry.getRegistry().registerHandler(boolean.class, BooleanOptionHandler.class); OptionHandlerRegistry.getRegistry().registerHandler(Boolean.class, BooleanOptionHandler.class); ParserProperties parserProperties = ParserProperties .defaults() .withAtSyntax(false) .withOptionValueDelimiter("=") .withShowDefaults(true); List<String> arguments = Lists.newArrayList(args); if (arguments.size() > 1) { List<String> positionalArgs = Lists.newArrayList(); Iterator<String> reverseArgIterator = Lists.reverse(arguments).iterator(); while (reverseArgIterator.hasNext()) { String arg = reverseArgIterator.next(); if (!arg.startsWith("-")) { reverseArgIterator.remove(); positionalArgs.add(arg); } else { break; } } arguments.addAll(0, Lists.reverse(positionalArgs)); } CmdLineParser cmdLineParser = new CmdLineParser(options, parserProperties); try { cmdLineParser.parseArgument(arguments); return Result.success(cmdLineParser); } catch (CmdLineException e) { return Result.failure(cmdLineParser, STR, e.getLocalizedMessage()); } catch (InvalidCmdLineArgumentException e) { return Result.failure(cmdLineParser, STR, e.getMessage()); } finally { OptionHandlerRegistry.getRegistry().registerHandler( boolean.class, org.kohsuke.args4j.spi.BooleanOptionHandler.class); OptionHandlerRegistry.getRegistry().registerHandler( Boolean.class, org.kohsuke.args4j.spi.BooleanOptionHandler.class); } } | /**
* Parses command line arguments and populates the given {@code option} bean with the values if
* the parse is successful.
*
* @param options The options bean to populate with the parsed command line options.
* @param args The command line arguments to parse.
* @return The result of the parse.
*/ | Parses command line arguments and populates the given option bean with the values if the parse is successful | parse | {
"repo_name": "cevaris/pants",
"path": "src/java/org/pantsbuild/args4j/Parser.java",
"license": "apache-2.0",
"size": 5250
} | [
"com.google.common.collect.Lists",
"java.util.Iterator",
"java.util.List",
"org.kohsuke.args4j.CmdLineException",
"org.kohsuke.args4j.CmdLineParser",
"org.kohsuke.args4j.OptionHandlerRegistry",
"org.kohsuke.args4j.ParserProperties"
] | import com.google.common.collect.Lists; import java.util.Iterator; import java.util.List; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.OptionHandlerRegistry; import org.kohsuke.args4j.ParserProperties; | import com.google.common.collect.*; import java.util.*; import org.kohsuke.args4j.*; | [
"com.google.common",
"java.util",
"org.kohsuke.args4j"
] | com.google.common; java.util; org.kohsuke.args4j; | 1,967,244 |
public ScriptedMetricAggregationBuilder params(Map<String, Object> params) {
if (params == null) {
throw new IllegalArgumentException("[params] must not be null: [" + name + "]");
}
this.params = params;
return this;
} | ScriptedMetricAggregationBuilder function(Map<String, Object> params) { if (params == null) { throw new IllegalArgumentException(STR + name + "]"); } this.params = params; return this; } | /**
* Set parameters that will be available in the {@code init},
* {@code map} and {@code combine} phases.
*/ | Set parameters that will be available in the init, map and combine phases | params | {
"repo_name": "robin13/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricAggregationBuilder.java",
"license": "apache-2.0",
"size": 10857
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,892,807 |
public void readGameRulesFromNBT(NBTTagCompound nbt) {
Set var2 = nbt.getKeySet();
Iterator var3 = var2.iterator();
while (var3.hasNext()) {
String var4 = (String) var3.next();
String var6 = nbt.getString(var4);
this.setOrCreateGameRule(var4, var6);
}
} | void function(NBTTagCompound nbt) { Set var2 = nbt.getKeySet(); Iterator var3 = var2.iterator(); while (var3.hasNext()) { String var4 = (String) var3.next(); String var6 = nbt.getString(var4); this.setOrCreateGameRule(var4, var6); } } | /**
* Set defined game rules from NBT.
*/ | Set defined game rules from NBT | readGameRulesFromNBT | {
"repo_name": "KubaKaszycki/FreeCraft",
"path": "src/main/java/kk/freecraft/world/GameRules.java",
"license": "gpl-3.0",
"size": 5110
} | [
"java.util.Iterator",
"java.util.Set"
] | import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,906,120 |
public void declareSkyframeDependencies(SkyFunction.Environment env) {
for (Fragment fragment : fragments.values()) {
fragment.declareSkyframeDependencies(env);
}
} | void function(SkyFunction.Environment env) { for (Fragment fragment : fragments.values()) { fragment.declareSkyframeDependencies(env); } } | /**
* Declares dependencies on any relevant Skyframe values (for example, relevant FileValues).
*/ | Declares dependencies on any relevant Skyframe values (for example, relevant FileValues) | declareSkyframeDependencies | {
"repo_name": "rohitsaboo/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java",
"license": "apache-2.0",
"size": 95388
} | [
"com.google.devtools.build.skyframe.SkyFunction"
] | import com.google.devtools.build.skyframe.SkyFunction; | import com.google.devtools.build.skyframe.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,940,465 |
private void flushInternal()
throws Exception
{
// Do not flush within merge() or while loading an entity.
if (! _isFlushAllowed)
return;
// We avoid breaking FK constraints:
//
// 1. Assume _txEntities has the following order: A <- B <- C
// XXX: Make sure priorities are handled based on owning sides
// even when there are cycles in a graph.
//
// 2. Persist is done in ascending order: A(0) <- B(1) <- C(2)
//
// 3. Delete is done in descending order: C(2) -> B(1) -> A(0)
// Persists in ascending order.
for (int i = 0; i < _txEntitiesTop; i++) {
Entity entity = _txEntities[i];
if (entity.__caucho_getEntityState().isPersist()) {
try {
entity.__caucho_flush();
} catch (SQLException e) {
throwPersistException(e, entity);
}
}
}
// jpa/0h25
// Deletes in descending order.
for (int i = _txEntitiesTop - 1; i >= 0; i--) {
Entity entity = _txEntities[i];
if (! entity.__caucho_getEntityState().isPersist()) {
entity.__caucho_flush();
}
}
if (! isInTransaction()) {
if (_completionList.size() > 0) {
_persistenceUnit.complete(_completionList);
}
_completionList.clear();
for (int i = 0; i < _txEntitiesTop; i++) {
Entity entity = _txEntities[i];
entity.__caucho_afterCommit();
}
_txEntitiesTop = 0;
}
} | void function() throws Exception { if (! _isFlushAllowed) return; for (int i = 0; i < _txEntitiesTop; i++) { Entity entity = _txEntities[i]; if (entity.__caucho_getEntityState().isPersist()) { try { entity.__caucho_flush(); } catch (SQLException e) { throwPersistException(e, entity); } } } for (int i = _txEntitiesTop - 1; i >= 0; i--) { Entity entity = _txEntities[i]; if (! entity.__caucho_getEntityState().isPersist()) { entity.__caucho_flush(); } } if (! isInTransaction()) { if (_completionList.size() > 0) { _persistenceUnit.complete(_completionList); } _completionList.clear(); for (int i = 0; i < _txEntitiesTop; i++) { Entity entity = _txEntities[i]; entity.__caucho_afterCommit(); } _txEntitiesTop = 0; } } | /**
* Flush managed entities.
*/ | Flush managed entities | flushInternal | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/amber/manager/AmberConnection.java",
"license": "gpl-2.0",
"size": 89822
} | [
"com.caucho.amber.entity.Entity",
"java.sql.SQLException"
] | import com.caucho.amber.entity.Entity; import java.sql.SQLException; | import com.caucho.amber.entity.*; import java.sql.*; | [
"com.caucho.amber",
"java.sql"
] | com.caucho.amber; java.sql; | 2,310,824 |
public X3DNode getGeoOrigin() {
if ( geoOrigin == null ) {
geoOrigin = (SFNode)getField( "geoOrigin" );
}
return( geoOrigin.getValue( ) );
} | X3DNode function() { if ( geoOrigin == null ) { geoOrigin = (SFNode)getField( STR ); } return( geoOrigin.getValue( ) ); } | /** Return the geoOrigin X3DNode value.
* @return The geoOrigin X3DNode value. */ | Return the geoOrigin X3DNode value | getGeoOrigin | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/internal/node/geospatial/SAIGeoElevationGrid.java",
"license": "gpl-2.0",
"size": 12438
} | [
"org.web3d.x3d.sai.SFNode",
"org.web3d.x3d.sai.X3DNode"
] | import org.web3d.x3d.sai.SFNode; import org.web3d.x3d.sai.X3DNode; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 2,034,897 |
@Implementation
public View findViewById(int id) {
return getWindow().findViewById(id);
} | View function(int id) { return getWindow().findViewById(id); } | /**
* Checks to ensure that the{@code contentView} has been set
*
* @param id ID of the view to find
* @return the view
* @throws RuntimeException if the {@code contentView} has not been called first
*/ | Checks to ensure that thecontentView has been set | findViewById | {
"repo_name": "ocadotechnology/robolectric",
"path": "shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivity.java",
"license": "mit",
"size": 16680
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,540,105 |
public final void closedSession (final Session session) {
try {
initiator.removeSession(session);
} catch (NoSuchSessionException e) {
// DO NOTHING
}
} | final void function (final Session session) { try { initiator.removeSession(session); } catch (NoSuchSessionException e) { } } | /**
* Adds a dying <code>Session</code> instance to the Queue.
*
* @param session The name of the session, which instance you want.
*/ | Adds a dying <code>Session</code> instance to the Queue | closedSession | {
"repo_name": "sebastiangraf/jSCSI",
"path": "bundles/initiator/src/main/java/org/jscsi/initiator/LinkFactory.java",
"license": "bsd-3-clause",
"size": 5447
} | [
"org.jscsi.exception.NoSuchSessionException",
"org.jscsi.initiator.connection.Session"
] | import org.jscsi.exception.NoSuchSessionException; import org.jscsi.initiator.connection.Session; | import org.jscsi.exception.*; import org.jscsi.initiator.connection.*; | [
"org.jscsi.exception",
"org.jscsi.initiator"
] | org.jscsi.exception; org.jscsi.initiator; | 363,324 |
@JsonProperty("stop")
public Boolean getStop() {
return stop;
} | @JsonProperty("stop") Boolean function() { return stop; } | /**
* Get stop
* @return stop
**/ | Get stop | getStop | {
"repo_name": "cliffano/swaggy-jenkins",
"path": "clients/jaxrs-cxf-client/generated/src/gen/java/org/openapitools/model/BranchImplpermissions.java",
"license": "mit",
"size": 2870
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 296,914 |
public static MozuClient<com.mozu.api.contracts.sitesettings.general.TaxableTerritory> addTaxableTerritoryClient(com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory) throws Exception
{
return addTaxableTerritoryClient( taxableTerritory, null);
}
| static MozuClient<com.mozu.api.contracts.sitesettings.general.TaxableTerritory> function(com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory) throws Exception { return addTaxableTerritoryClient( taxableTerritory, null); } | /**
*
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.sitesettings.general.TaxableTerritory> mozuClient=AddTaxableTerritoryClient( taxableTerritory);
* client.setBaseAddress(url);
* client.executeRequest();
* TaxableTerritory taxableTerritory = client.Result();
* </code></pre></p>
* @param taxableTerritory Properties of the territory which is subject to sales tax.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.sitesettings.general.TaxableTerritory>
* @see com.mozu.api.contracts.sitesettings.general.TaxableTerritory
* @see com.mozu.api.contracts.sitesettings.general.TaxableTerritory
*/ | <code><code> MozuClient mozuClient=AddTaxableTerritoryClient( taxableTerritory); client.setBaseAddress(url); client.executeRequest(); TaxableTerritory taxableTerritory = client.Result(); </code></code> | addTaxableTerritoryClient | {
"repo_name": "Mozu/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/settings/general/TaxableTerritoryClient.java",
"license": "mit",
"size": 6161
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 118,108 |
String getCreateSQLText(int style) throws DataSourceException; | String getCreateSQLText(int style) throws DataSourceException; | /**
* Returns the CREATE TABLE statement for this database table.
* This will be table column (plus data type) definitions only,
* this does not include constraint meta data.
*/ | Returns the CREATE TABLE statement for this database table. This will be table column (plus data type) definitions only, this does not include constraint meta data | getCreateSQLText | {
"repo_name": "redsoftbiz/executequery",
"path": "src/org/executequery/databaseobjects/DatabaseTable.java",
"license": "gpl-3.0",
"size": 5163
} | [
"org.underworldlabs.jdbc.DataSourceException"
] | import org.underworldlabs.jdbc.DataSourceException; | import org.underworldlabs.jdbc.*; | [
"org.underworldlabs.jdbc"
] | org.underworldlabs.jdbc; | 1,292,776 |
ChatMessage sendMessage(Message message) throws ConnectionException; | ChatMessage sendMessage(Message message) throws ConnectionException; | /**
* Sends a formatted message to this chat.
*
* @param message The rich text to send
* @return The {@link ChatMessage} object representing the message
* @throws ConnectionException If an error occurs while connecting to the endpoint
* @throws NotLoadedException If the chat has not yet been loaded
*/ | Sends a formatted message to this chat | sendMessage | {
"repo_name": "yar229/Skype4J",
"path": "src/main/java/com/samczsun/skype4j/chat/Chat.java",
"license": "gpl-3.0",
"size": 3237
} | [
"com.samczsun.skype4j.chat.messages.ChatMessage",
"com.samczsun.skype4j.exceptions.ConnectionException",
"com.samczsun.skype4j.formatting.Message"
] | import com.samczsun.skype4j.chat.messages.ChatMessage; import com.samczsun.skype4j.exceptions.ConnectionException; import com.samczsun.skype4j.formatting.Message; | import com.samczsun.skype4j.chat.messages.*; import com.samczsun.skype4j.exceptions.*; import com.samczsun.skype4j.formatting.*; | [
"com.samczsun.skype4j"
] | com.samczsun.skype4j; | 2,436,822 |
private void parseGeomAttr(GeometryGroup geom, QName name, String localPart) throws XMLStreamException {
if (ALTITUDE_MODE.equals(localPart)) {
// Note: handle kml:altitudeMode and gx:altitudeMode
// if have both forms then use one from KML namespace as done in handleElementExtension()
if (geom.altitudeMode == null || ms_kml_ns.contains(name.getNamespaceURI())) {
geom.altitudeMode = getNonEmptyElementText();
} else {
// e.g. qName = {http://www.google.com/kml/ext/2.2}altitudeMode
log.debug("Skip duplicate value for {}", name);
}
} else if (EXTRUDE.equals(localPart)) {
if (isTrue(stream.getElementText())) {
geom.extrude = Boolean.TRUE; // default=false
}
} else if (TESSELLATE.equals(localPart)) {
if (isTrue(stream.getElementText())) {
geom.tessellate = Boolean.TRUE; // default=false
}
} else if (DRAW_ORDER.equals(localPart)) {
// handle gx:drawOrder (default=0)
if (NS_GOOGLE_KML_EXT.equals(name.getNamespaceURI())) {
String value = getNonEmptyElementText();
if (value != null) {
try {
geom.drawOrder = Integer.valueOf(value);
} catch (NumberFormatException nfe) {
log.warn("Invalid drawOrder value: " + value);
}
}
} else {
log.warn("invalid namespace for drawOrder: {}", name);
skipNextElement(stream, name);
}
}
} | void function(GeometryGroup geom, QName name, String localPart) throws XMLStreamException { if (ALTITUDE_MODE.equals(localPart)) { if (geom.altitudeMode == null ms_kml_ns.contains(name.getNamespaceURI())) { geom.altitudeMode = getNonEmptyElementText(); } else { log.debug(STR, name); } } else if (EXTRUDE.equals(localPart)) { if (isTrue(stream.getElementText())) { geom.extrude = Boolean.TRUE; } } else if (TESSELLATE.equals(localPart)) { if (isTrue(stream.getElementText())) { geom.tessellate = Boolean.TRUE; } } else if (DRAW_ORDER.equals(localPart)) { if (NS_GOOGLE_KML_EXT.equals(name.getNamespaceURI())) { String value = getNonEmptyElementText(); if (value != null) { try { geom.drawOrder = Integer.valueOf(value); } catch (NumberFormatException nfe) { log.warn(STR + value); } } } else { log.warn(STR, name); skipNextElement(stream, name); } } } | /**
* Parse elements of non-point geometry (line, ring. polygon) such as
* altitudeMode, extrude, tesselate, and gx:drawOrder.
*
* @param geom
* @param name
* @param localPart
* @throws XMLStreamException
*/ | Parse elements of non-point geometry (line, ring. polygon) such as altitudeMode, extrude, tesselate, and gx:drawOrder | parseGeomAttr | {
"repo_name": "automenta/climatenet",
"path": "src/main/java/automenta/climatenet/data/gis/KmlInputStream.java",
"license": "agpl-3.0",
"size": 131581
} | [
"javax.xml.namespace.QName",
"javax.xml.stream.XMLStreamException"
] | import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; | import javax.xml.namespace.*; import javax.xml.stream.*; | [
"javax.xml"
] | javax.xml; | 288,428 |
@Test
public void testInterval()
throws PropertyVetoException, IOException {
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(5.0),
new DynamicStringImpl("[4, 7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(5.0),
new DynamicStringImpl("[4.0, 7.7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicFloatImpl(5.0f),
new DynamicStringImpl("[4, 7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicFloatImpl(5.0f),
new DynamicStringImpl("[4.0, 7.7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicLongImpl(5l),
new DynamicStringImpl("[4, 7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicLongImpl(5l),
new DynamicStringImpl("[4.0, 7.7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5),
new DynamicStringImpl("[4, 7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5),
new DynamicStringImpl("[4.0, 7.7]"),
-1));
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE),
new DynamicStringImpl("[4.0, 7.7]"),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE),
new DynamicStringImpl("[4.0,2147483647]"),
-1));
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE),
new DynamicStringImpl(" [4.0 , 2147483647) "),
-1));
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(Double.MIN_VALUE),
new DynamicStringImpl(" [4.0 , 2147483647) "),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MIN_VALUE),
new DynamicStringImpl(" [-2147483648 , 2147483647) "),
-1));
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MIN_VALUE),
new DynamicStringImpl(" (-2147483648 , 2147483647) "),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5),
new DynamicStringImpl(" (4 , ) "),
-1));
Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5),
new DynamicStringImpl(" (4 ,]"),
-1));
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(3),
new DynamicStringImpl(" (4 , ) "),
-1));
try {
Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(3),
new DynamicStringImpl(" (6 ,4) "),
-1));
Assert.fail("Should have been an exception");
} catch (final Exception e) {
// expected
}
} | void function() throws PropertyVetoException, IOException { Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(5.0), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(5.0), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicFloatImpl(5.0f), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicFloatImpl(5.0f), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicLongImpl(5l), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicLongImpl(5l), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5), new DynamicStringImpl(STR), -1)); Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MAX_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicDoubleImpl(Double.MIN_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MIN_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(Integer.MIN_VALUE), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5), new DynamicStringImpl(STR), -1)); Assert.assertTrue(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(5), new DynamicStringImpl(STR), -1)); Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(3), new DynamicStringImpl(STR), -1)); try { Assert.assertFalse(DynamicValidatorType.INTERVAL.passesValidator(new DynamicIntegerImpl(3), new DynamicStringImpl(STR), -1)); Assert.fail(STR); } catch (final Exception e) { } } | /**
* Test interval.
*
* @throws PropertyVetoException the property veto exception
* @throws IOException Signals that an I/O exception has occurred.
*/ | Test interval | testInterval | {
"repo_name": "OSEHRA/ISAAC",
"path": "core/model/src/test/java/sh/isaac/model/semantic/DynamicSemanticValidatorTypeImplTest.java",
"license": "apache-2.0",
"size": 16006
} | [
"java.beans.PropertyVetoException",
"java.io.IOException",
"org.junit.Assert",
"sh.isaac.api.component.semantic.version.dynamic.DynamicValidatorType",
"sh.isaac.model.semantic.types.DynamicDoubleImpl",
"sh.isaac.model.semantic.types.DynamicFloatImpl",
"sh.isaac.model.semantic.types.DynamicIntegerImpl",
... | import java.beans.PropertyVetoException; import java.io.IOException; import org.junit.Assert; import sh.isaac.api.component.semantic.version.dynamic.DynamicValidatorType; import sh.isaac.model.semantic.types.DynamicDoubleImpl; import sh.isaac.model.semantic.types.DynamicFloatImpl; import sh.isaac.model.semantic.types.DynamicIntegerImpl; import sh.isaac.model.semantic.types.DynamicLongImpl; import sh.isaac.model.semantic.types.DynamicStringImpl; | import java.beans.*; import java.io.*; import org.junit.*; import sh.isaac.api.component.semantic.version.dynamic.*; import sh.isaac.model.semantic.types.*; | [
"java.beans",
"java.io",
"org.junit",
"sh.isaac.api",
"sh.isaac.model"
] | java.beans; java.io; org.junit; sh.isaac.api; sh.isaac.model; | 1,370,120 |
private final JPanel contentPanel = new JPanel();
| private final JPanel contentPanel = new JPanel(); | /**
* Launch the application.
*/ | Launch the application | main | {
"repo_name": "ZagasTales/HistoriasdeZagas",
"path": "src Graf/es/thesinsprods/zagastales/juegozagas/ayuda/jugar/master/AyudaPartidaVentanaMaster.java",
"license": "cc0-1.0",
"size": 8540
} | [
"javax.swing.JPanel"
] | import javax.swing.JPanel; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,075,795 |
public ServiceFuture<Void> pauseDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(pauseDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String serverName, String databaseName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(pauseDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); } | /**
* Pause an Azure SQL Data Warehouse database.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the Azure SQL server.
* @param databaseName The name of the Azure SQL Data Warehouse database to pause.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Pause an Azure SQL Data Warehouse database | pauseDataWarehouseAsync | {
"repo_name": "anudeepsharma/azure-sdk-for-java",
"path": "azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java",
"license": "mit",
"size": 166183
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,326,655 |
public Builder addExpand(String element) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.add(element);
return this;
} | Builder function(String element) { if (this.expand == null) { this.expand = new ArrayList<>(); } this.expand.add(element); return this; } | /**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* ValueListListParams#expand} for the field documentation.
*/ | Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See <code>ValueListListParams#expand</code> for the field documentation | addExpand | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/radar/ValueListListParams.java",
"license": "mit",
"size": 10366
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 991,548 |
public Collection<ClusterNode> serverTopologyNodes(long topVer) {
return F.view(topology(topVer), F.not(FILTER_CLI), FILTER_NOT_DAEMON);
} | Collection<ClusterNode> function(long topVer) { return F.view(topology(topVer), F.not(FILTER_CLI), FILTER_NOT_DAEMON); } | /**
* Gets server nodes topology by specified version from snapshots history storage.
*
* @param topVer Topology version.
* @return Server topology nodes.
*/ | Gets server nodes topology by specified version from snapshots history storage | serverTopologyNodes | {
"repo_name": "psadusumilli/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java",
"license": "apache-2.0",
"size": 115443
} | [
"java.util.Collection",
"org.apache.ignite.cluster.ClusterNode",
"org.apache.ignite.internal.util.typedef.F"
] | import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.typedef.F; | import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.typedef.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 676,356 |
public CmsObject getCmsObject() {
return m_cms;
}
| CmsObject function() { return m_cms; } | /**
* Gets the CMS context.<p>
*
* @return the CMS context
*/ | Gets the CMS context | getCmsObject | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java",
"license": "lgpl-2.1",
"size": 26156
} | [
"org.opencms.file.CmsObject"
] | import org.opencms.file.CmsObject; | import org.opencms.file.*; | [
"org.opencms.file"
] | org.opencms.file; | 1,295,815 |
protected JComponent renderReasons(DNF disjunction) {
if (disjunction.size() == 1) { // if it's just size one
// then reduce to simply a conjunction
return renderReason(disjunction.get(0));
}
// to put lists in
JTabbedPane tabbedPane = new JTabbedPane();
int i = 0;
for (Reason reason : disjunction) {
JComponent trace = renderReason(reason);
tabbedPane.addTab("Reason " + ++i, trace);
}
return tabbedPane;
}
| JComponent function(DNF disjunction) { if (disjunction.size() == 1) { return renderReason(disjunction.get(0)); } JTabbedPane tabbedPane = new JTabbedPane(); int i = 0; for (Reason reason : disjunction) { JComponent trace = renderReason(reason); tabbedPane.addTab(STR + ++i, trace); } return tabbedPane; } | /**
* E.g. for multiple traces of Why Not and How To.
* @param disjunction
*/ | E.g. for multiple traces of Why Not and How To | renderReasons | {
"repo_name": "hungyao/context-toolkit",
"path": "src/main/java/context/arch/intelligibility/presenters/TablePanelPresenter.java",
"license": "gpl-3.0",
"size": 17560
} | [
"javax.swing.JComponent",
"javax.swing.JTabbedPane"
] | import javax.swing.JComponent; import javax.swing.JTabbedPane; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 613,038 |
public T findItem(T item, Comparator<T> c, IndexUpdater indexUpdater) {
T result = null;
Object[] itemsArray = items;
int arrayIndex;
if (c != null) {
arrayIndex = Arrays.binarySearch(itemsArray, item, (Comparator) c);
} else {
arrayIndex = Arrays.binarySearch(itemsArray, item);
}
int index = -1;
if (arrayIndex < 0) {
synchronized (this) {
Object [] itemsArray1 = items;
if (itemsArray1 != itemsArray) {
itemsArray = itemsArray1;
if (c != null) {
arrayIndex = Arrays.binarySearch(itemsArray, item, (Comparator) c);
} else {
arrayIndex = Arrays.binarySearch(itemsArray, item);
}
}
if (arrayIndex < 0) {
index = itemsArray.length;
itemsArray = new Object[index + 1];
int i = -arrayIndex - 1;
System.arraycopy(itemsArray1, 0, itemsArray, 0, i);
itemsArray[i] = item;
System.arraycopy(itemsArray1, i, itemsArray, i + 1, index - i);
if (indexUpdater != null) {
indexUpdater.updateIndex(index);
}
items = itemsArray;
result = item;
}
}
}
if (arrayIndex >= 0) {
result = (T) itemsArray[arrayIndex];
}
return result;
}
| T function(T item, Comparator<T> c, IndexUpdater indexUpdater) { T result = null; Object[] itemsArray = items; int arrayIndex; if (c != null) { arrayIndex = Arrays.binarySearch(itemsArray, item, (Comparator) c); } else { arrayIndex = Arrays.binarySearch(itemsArray, item); } int index = -1; if (arrayIndex < 0) { synchronized (this) { Object [] itemsArray1 = items; if (itemsArray1 != itemsArray) { itemsArray = itemsArray1; if (c != null) { arrayIndex = Arrays.binarySearch(itemsArray, item, (Comparator) c); } else { arrayIndex = Arrays.binarySearch(itemsArray, item); } } if (arrayIndex < 0) { index = itemsArray.length; itemsArray = new Object[index + 1]; int i = -arrayIndex - 1; System.arraycopy(itemsArray1, 0, itemsArray, 0, i); itemsArray[i] = item; System.arraycopy(itemsArray1, i, itemsArray, i + 1, index - i); if (indexUpdater != null) { indexUpdater.updateIndex(index); } items = itemsArray; result = item; } } } if (arrayIndex >= 0) { result = (T) itemsArray[arrayIndex]; } return result; } | /**
* Finds an item or creates it.
* @param item item to find
* @param c Comparator to use to search sorted array
* @param indexUpdater Index Updater to use to update new index in case item was not found
* @return An existing item if found or the passed item if it was created
*/ | Finds an item or creates it | findItem | {
"repo_name": "buaazp/libuq",
"path": "juq/src/main/java/org/aredis/util/SortedArray.java",
"license": "bsd-3-clause",
"size": 4046
} | [
"java.util.Arrays",
"java.util.Comparator"
] | import java.util.Arrays; import java.util.Comparator; | import java.util.*; | [
"java.util"
] | java.util; | 810,707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.