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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static ObjectFields getObjectFields(String pid, String[] fields)
throws IOException {
FieldSearchQuery query = new FieldSearchQuery();
Condition condition = new Condition();
condition.setProperty("pid");
condition.setOperator(ComparisonOperator.fromValue("eq"));
condition.setValue(pid);
FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
conds.getCondition().add(condition);
ObjectFactory factory = new ObjectFactory();
query.setConditions(factory.createFieldSearchQueryConditions(conds));
FieldSearchResult result =
Administrator.APIA
.findObjects(TypeUtility.convertStringtoAOS(fields),
new BigInteger("1"),
query);
ResultList resultList = result.getResultList();
if (resultList == null || resultList.getObjectFields() == null
&& resultList.getObjectFields().size() == 0) {
throw new IOException("Object not found in repository");
}
return resultList.getObjectFields().get(0);
} | static ObjectFields function(String pid, String[] fields) throws IOException { FieldSearchQuery query = new FieldSearchQuery(); Condition condition = new Condition(); condition.setProperty("pid"); condition.setOperator(ComparisonOperator.fromValue("eq")); condition.setValue(pid); FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions(); conds.getCondition().add(condition); ObjectFactory factory = new ObjectFactory(); query.setConditions(factory.createFieldSearchQueryConditions(conds)); FieldSearchResult result = Administrator.APIA .findObjects(TypeUtility.convertStringtoAOS(fields), new BigInteger("1"), query); ResultList resultList = result.getResultList(); if (resultList == null resultList.getObjectFields() == null && resultList.getObjectFields().size() == 0) { throw new IOException(STR); } return resultList.getObjectFields().get(0); } | /**
* Get the indicated fields of the indicated object from the repository.
*/ | Get the indicated fields of the indicated object from the repository | getObjectFields | {
"repo_name": "fcrepo4-archive/fcrepo",
"path": "fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/Util.java",
"license": "apache-2.0",
"size": 10544
} | [
"java.io.IOException",
"java.math.BigInteger",
"org.fcrepo.client.Administrator",
"org.fcrepo.server.types.gen.ComparisonOperator",
"org.fcrepo.server.types.gen.Condition",
"org.fcrepo.server.types.gen.FieldSearchQuery",
"org.fcrepo.server.types.gen.FieldSearchResult",
"org.fcrepo.server.types.gen.ObjectFactory",
"org.fcrepo.server.types.gen.ObjectFields",
"org.fcrepo.server.utilities.TypeUtility"
] | import java.io.IOException; import java.math.BigInteger; import org.fcrepo.client.Administrator; import org.fcrepo.server.types.gen.ComparisonOperator; import org.fcrepo.server.types.gen.Condition; import org.fcrepo.server.types.gen.FieldSearchQuery; import org.fcrepo.server.types.gen.FieldSearchResult; import org.fcrepo.server.types.gen.ObjectFactory; import org.fcrepo.server.types.gen.ObjectFields; import org.fcrepo.server.utilities.TypeUtility; | import java.io.*; import java.math.*; import org.fcrepo.client.*; import org.fcrepo.server.types.gen.*; import org.fcrepo.server.utilities.*; | [
"java.io",
"java.math",
"org.fcrepo.client",
"org.fcrepo.server"
] | java.io; java.math; org.fcrepo.client; org.fcrepo.server; | 1,156,497 |
@ApiModelProperty(
value = "The active threads for the NiFi on the node.",
accessMode = ApiModelProperty.AccessMode.READ_ONLY
)
public Integer getActiveThreadCount() {
return activeThreadCount;
} | @ApiModelProperty( value = STR, accessMode = ApiModelProperty.AccessMode.READ_ONLY ) Integer function() { return activeThreadCount; } | /**
* The active thread count.
*
* @return The active thread count
*/ | The active thread count | getActiveThreadCount | {
"repo_name": "MikeThomsen/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java",
"license": "apache-2.0",
"size": 5838
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,024,061 |
public DocumentHandler getDocumentHandler(MultivaluedMap<String, String> queryParams) throws Exception; | DocumentHandler function(MultivaluedMap<String, String> queryParams) throws Exception; | /**
* Gets the document hanlder.
*
* @param queryParams the query params
*
* @return the document hanlder
*
* @throws Exception the exception
*/ | Gets the document hanlder | getDocumentHandler | {
"repo_name": "cherryhill/collectionspace-services",
"path": "services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java",
"license": "apache-2.0",
"size": 10826
} | [
"javax.ws.rs.core.MultivaluedMap",
"org.collectionspace.services.common.document.DocumentHandler"
] | import javax.ws.rs.core.MultivaluedMap; import org.collectionspace.services.common.document.DocumentHandler; | import javax.ws.rs.core.*; import org.collectionspace.services.common.document.*; | [
"javax.ws",
"org.collectionspace.services"
] | javax.ws; org.collectionspace.services; | 2,580,626 |
public void doScrollStateChange(AbsListView view, int scrollState) {
mParent.removeCallbacks(this);
mNewState = scrollState;
mParent.postDelayed(this, SCROLL_CHANGE_DELAY);
} | void function(AbsListView view, int scrollState) { mParent.removeCallbacks(this); mNewState = scrollState; mParent.postDelayed(this, SCROLL_CHANGE_DELAY); } | /**
* Sets up the runnable with a short delay in case the scroll state
* immediately changes again.
*
* @param view The list view that changed state
* @param scrollState The new state it changed to
*/ | Sets up the runnable with a short delay in case the scroll state immediately changes again | doScrollStateChange | {
"repo_name": "tsdl2013/SublimePicker",
"path": "sublimepickerlibrary/src/main/java/com/appeaser/sublimepickerlibrary/datepicker/DayPickerView.java",
"license": "apache-2.0",
"size": 20097
} | [
"android.widget.AbsListView"
] | import android.widget.AbsListView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 434,132 |
public void setTarget(Notifier newTarget) {
this.target = newTarget;
}
| void function(Notifier newTarget) { this.target = newTarget; } | /**
* Sets the EObject that this adapter is attached to.
*/ | Sets the EObject that this adapter is attached to | setTarget | {
"repo_name": "HyVar/DarwinSPL",
"path": "plugins/eu.hyvar.mspl.manifest.resource.hymanifest/src-gen/eu/hyvar/mspl/manifest/resource/hymanifest/mopp/HymanifestLayoutInformationAdapter.java",
"license": "apache-2.0",
"size": 3131
} | [
"org.eclipse.emf.common.notify.Notifier"
] | import org.eclipse.emf.common.notify.Notifier; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,377,402 |
public List<T> findImplementations(IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.setTaskName(JavaElementImplementationHyperlink_search_implementors);
List<T> implementations = null;
if (javaElement instanceof IMethod) {
implementations = findMethodImplementations(monitor);
} else if (javaElement instanceof IType) {
implementations = findTypeImplementations(monitor);
}
return implementations == null ? Collections.emptyList() : Collections.unmodifiableList(implementations);
} | List<T> function(IProgressMonitor monitor) throws CoreException { if (monitor == null) { monitor = new NullProgressMonitor(); } monitor.setTaskName(JavaElementImplementationHyperlink_search_implementors); List<T> implementations = null; if (javaElement instanceof IMethod) { implementations = findMethodImplementations(monitor); } else if (javaElement instanceof IType) { implementations = findTypeImplementations(monitor); } return implementations == null ? Collections.emptyList() : Collections.unmodifiableList(implementations); } | /**
* Finds the implementations for the method or type.
*
* @return an unmodifiable {@link List} of T, never <code>null</code>.
*/ | Finds the implementations for the method or type | findImplementations | {
"repo_name": "gorkem/java-language-server",
"path": "org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/ImplementationCollector.java",
"license": "epl-1.0",
"size": 10924
} | [
"java.util.Collections",
"java.util.List",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IProgressMonitor",
"org.eclipse.core.runtime.NullProgressMonitor",
"org.eclipse.jdt.core.IMethod",
"org.eclipse.jdt.core.IType"
] | import java.util.Collections; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; | import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.jdt"
] | java.util; org.eclipse.core; org.eclipse.jdt; | 925,506 |
protected Class<? extends ExternalizableBusinessObject> getExternalizableBusinessObjectClass(Class boClass, String propertyName) {
try {
return PropertyUtils.getPropertyType(
boClass.newInstance(), StringUtils.substringBeforeLast( propertyName, "." ) );
} catch (Exception e) {
LOG.debug("Unable to determine type of property for " + boClass.getName() + "/" + propertyName, e );
}
return null;
} | Class<? extends ExternalizableBusinessObject> function(Class boClass, String propertyName) { try { return PropertyUtils.getPropertyType( boClass.newInstance(), StringUtils.substringBeforeLast( propertyName, "." ) ); } catch (Exception e) { LOG.debug(STR + boClass.getName() + "/" + propertyName, e ); } return null; } | /**
* Given an property on the main BO class, return the defined type of the ExternalizableBusinessObject. This will be used
* by other code to determine the correct module service to call for the lookup.
*
* @param boClass
* @param propertyName
* @return
*/ | Given an property on the main BO class, return the defined type of the ExternalizableBusinessObject. This will be used by other code to determine the correct module service to call for the lookup | getExternalizableBusinessObjectClass | {
"repo_name": "geothomasp/kualico-rice-kc",
"path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/lookup/KualiLookupableHelperServiceImpl.java",
"license": "apache-2.0",
"size": 20067
} | [
"org.apache.commons.beanutils.PropertyUtils",
"org.apache.commons.lang.StringUtils",
"org.kuali.rice.krad.bo.ExternalizableBusinessObject"
] | import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang.StringUtils; import org.kuali.rice.krad.bo.ExternalizableBusinessObject; | import org.apache.commons.beanutils.*; import org.apache.commons.lang.*; import org.kuali.rice.krad.bo.*; | [
"org.apache.commons",
"org.kuali.rice"
] | org.apache.commons; org.kuali.rice; | 1,261,186 |
public Date getCurrentDate() {
return currentDate;
} | Date function() { return currentDate; } | /**
* Gets the current date/time object.
*
* @return the current date
*/ | Gets the current date/time object | getCurrentDate | {
"repo_name": "gretchiemoran/pentaho-kettle",
"path": "engine/src/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 194677
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 602,812 |
EDataType getNatural(); | EDataType getNatural(); | /**
* Returns the meta object for data type '{@link java.lang.Long <em>Natural</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Natural</em>'.
* @see java.lang.Long
* @model instanceClass="java.lang.Long"
* @generated
*/ | Returns the meta object for data type '<code>java.lang.Long Natural</code>'. | getNatural | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PTNet/src/fr/lip6/move/pnml/ptnet/PtnetPackage.java",
"license": "epl-1.0",
"size": 146931
} | [
"org.eclipse.emf.ecore.EDataType"
] | import org.eclipse.emf.ecore.EDataType; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,556,580 |
private Map<String, Double> parseConstants(final byte[] first, final byte[] second, final String name) {
final Map<String, Double> map = new HashMap<String, Double>();
for (int i = 0; i < CONSTANTS_MAX_NUMBER; ++i) {
// Note: for extracting the strings from the binary file, it makes no difference
// if the file is stored in big-endian or little-endian notation
final String constantName = extractString(first, HEADER_CONSTANTS_NAMES_OFFSET + i * 6, 6);
if (constantName.length() == 0) {
// no more constants to read
break;
}
final double constantValue = extractDouble(second, HEADER_CONSTANTS_VALUES_OFFSET + 8 * i);
map.put(constantName, constantValue);
}
// INPOP files do not have constants for AU and EMRAT, thus extract them from
// the header record and create a constant for them to be consistent with JPL files
if (!map.containsKey(CONSTANT_AU)) {
map.put(CONSTANT_AU, extractDouble(first, HEADER_ASTRONOMICAL_UNIT_OFFSET));
}
if (!map.containsKey(CONSTANT_EMRAT)) {
map.put(CONSTANT_EMRAT, extractDouble(first, HEADER_EM_RATIO_OFFSET));
}
return map;
} | Map<String, Double> function(final byte[] first, final byte[] second, final String name) { final Map<String, Double> map = new HashMap<String, Double>(); for (int i = 0; i < CONSTANTS_MAX_NUMBER; ++i) { final String constantName = extractString(first, HEADER_CONSTANTS_NAMES_OFFSET + i * 6, 6); if (constantName.length() == 0) { break; } final double constantValue = extractDouble(second, HEADER_CONSTANTS_VALUES_OFFSET + 8 * i); map.put(constantName, constantValue); } if (!map.containsKey(CONSTANT_AU)) { map.put(CONSTANT_AU, extractDouble(first, HEADER_ASTRONOMICAL_UNIT_OFFSET)); } if (!map.containsKey(CONSTANT_EMRAT)) { map.put(CONSTANT_EMRAT, extractDouble(first, HEADER_EM_RATIO_OFFSET)); } return map; } | /** Parse constants from first two header records.
* @param first first header record
* @param second second header record
* @param name name of the file (or zip entry)
* @return map of parsed constants
*/ | Parse constants from first two header records | parseConstants | {
"repo_name": "treeform/orekit",
"path": "src/main/java/org/orekit/bodies/JPLEphemeridesLoader.java",
"license": "apache-2.0",
"size": 42093
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,588,783 |
public void setCurrency(Currency currency) {
throw new UnsupportedOperationException();
}
/**
* Sets whether this number format formats and parses numbers using a
* grouping separator.
*
* @param value
* {@code true} if a grouping separator is used; {@code false}
| void function(Currency currency) { throw new UnsupportedOperationException(); } /** * Sets whether this number format formats and parses numbers using a * grouping separator. * * @param value * {@code true} if a grouping separator is used; {@code false} | /**
* Sets the currency used by this number format when formatting currency
* values. The min and max fraction digits remain the same.
* <p>
* This implementation throws {@code UnsupportedOperationException},
* concrete subclasses should override this method if they support currency
* formatting.
*
* @param currency
* the new currency.
* @throws UnsupportedOperationException
*/ | Sets the currency used by this number format when formatting currency values. The min and max fraction digits remain the same. This implementation throws UnsupportedOperationException, concrete subclasses should override this method if they support currency formatting | setCurrency | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/text/src/main/java/java/text/NumberFormat.java",
"license": "gpl-2.0",
"size": 35215
} | [
"java.util.Currency"
] | import java.util.Currency; | import java.util.*; | [
"java.util"
] | java.util; | 1,959,216 |
Email save(Email email); | Email save(Email email); | /**
* saves queued email to DB
* @param email
* @return Email
*/ | saves queued email to DB | save | {
"repo_name": "aroychoudhury/innovista",
"path": "sharing-services/src/main/java/org/verizon/sharingservices/service/EmailRepository.java",
"license": "mit",
"size": 388
} | [
"org.verizon.sharingservices.model.Email"
] | import org.verizon.sharingservices.model.Email; | import org.verizon.sharingservices.model.*; | [
"org.verizon.sharingservices"
] | org.verizon.sharingservices; | 1,522,439 |
public ArrayAccessBuilder buildArrayIndexAccess(String aname, String iname) {
ArrayAccess access = getAST().newArrayAccess();
access.setArray(getAST().newSimpleName(aname));
access.setIndex(getAST().newSimpleName(iname));
return new ArrayAccessBuilder(this, access);
} | ArrayAccessBuilder function(String aname, String iname) { ArrayAccess access = getAST().newArrayAccess(); access.setArray(getAST().newSimpleName(aname)); access.setIndex(getAST().newSimpleName(iname)); return new ArrayAccessBuilder(this, access); } | /**
* Build array access expression for a named array variable and named index variable.
*
* @param aname
* @param iname
* @return array access
*/ | Build array access expression for a named array variable and named index variable | buildArrayIndexAccess | {
"repo_name": "vkorbut/jibx",
"path": "jibx/build/src/org/jibx/schema/codegen/ClassBuilder.java",
"license": "bsd-3-clause",
"size": 25431
} | [
"org.eclipse.jdt.core.dom.ArrayAccess"
] | import org.eclipse.jdt.core.dom.ArrayAccess; | import org.eclipse.jdt.core.dom.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 2,251,123 |
public List<String> getBackingIndexNames(Metadata metadata) {
ArrayList<String> matchingIndices = new ArrayList<>();
metadata.indices().keysIt().forEachRemaining(indexName -> {
if (this.characterRunAutomaton.run(indexName)) {
matchingIndices.add(indexName);
}
});
return Collections.unmodifiableList(matchingIndices);
} | List<String> function(Metadata metadata) { ArrayList<String> matchingIndices = new ArrayList<>(); metadata.indices().keysIt().forEachRemaining(indexName -> { if (this.characterRunAutomaton.run(indexName)) { matchingIndices.add(indexName); } }); return Collections.unmodifiableList(matchingIndices); } | /**
* Retrieve backing indices for this system data stream
* @param metadata Metadata in which to look for indices
* @return List of names of backing indices
*/ | Retrieve backing indices for this system data stream | getBackingIndexNames | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/indices/SystemDataStreamDescriptor.java",
"license": "apache-2.0",
"size": 6546
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.elasticsearch.cluster.metadata.Metadata"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.elasticsearch.cluster.metadata.Metadata; | import java.util.*; import org.elasticsearch.cluster.metadata.*; | [
"java.util",
"org.elasticsearch.cluster"
] | java.util; org.elasticsearch.cluster; | 2,892,636 |
public ApplicationGatewayOnDemandProbe withBackendAddressPool(SubResource backendAddressPool) {
this.backendAddressPool = backendAddressPool;
return this;
} | ApplicationGatewayOnDemandProbe function(SubResource backendAddressPool) { this.backendAddressPool = backendAddressPool; return this; } | /**
* Set reference of backend pool of application gateway to which probe request will be sent.
*
* @param backendAddressPool the backendAddressPool value to set
* @return the ApplicationGatewayOnDemandProbe object itself.
*/ | Set reference of backend pool of application gateway to which probe request will be sent | withBackendAddressPool | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/ApplicationGatewayOnDemandProbe.java",
"license": "mit",
"size": 7402
} | [
"com.microsoft.azure.SubResource"
] | import com.microsoft.azure.SubResource; | import com.microsoft.azure.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 624,850 |
public void setData(String data)
{
m_data = data;
}
private Task m_task;
private TaskField m_field;
private String m_data;
}
private ProjectFile m_projectFile;
private Task m_lastTask;
private Resource m_lastResource;
private ProjectCalendar m_lastResourceCalendar;
private ResourceAssignment m_lastResourceAssignment;
private ProjectCalendar m_lastBaseCalendar;
private boolean m_resourceTableDefinition;
private boolean m_taskTableDefinition;
private TaskModel m_taskModel;
private ResourceModel m_resourceModel;
private char m_delimiter;
private MPXJFormats m_formats;
private List<DeferredRelationship> m_deferredRelationships;
private List<ProjectListener> m_projectListeners;
private int m_baseOutlineLevel; | void function(String data) { m_data = data; } private Task m_task; private TaskField m_field; private String m_data; } private ProjectFile m_projectFile; private Task m_lastTask; private Resource m_lastResource; private ProjectCalendar m_lastResourceCalendar; private ResourceAssignment m_lastResourceAssignment; private ProjectCalendar m_lastBaseCalendar; private boolean m_resourceTableDefinition; private boolean m_taskTableDefinition; private TaskModel m_taskModel; private ResourceModel m_resourceModel; private char m_delimiter; private MPXJFormats m_formats; private List<DeferredRelationship> m_deferredRelationships; private List<ProjectListener> m_projectListeners; private int m_baseOutlineLevel; | /**
* Set the relationship data.
*
* @param data relationship data
*/ | Set the relationship data | setData | {
"repo_name": "tmyroadctfig/mpxj",
"path": "net/sf/mpxj/mpx/MPXReader.java",
"license": "lgpl-2.1",
"size": 46480
} | [
"java.util.List",
"net.sf.mpxj.ProjectCalendar",
"net.sf.mpxj.ProjectFile",
"net.sf.mpxj.Resource",
"net.sf.mpxj.ResourceAssignment",
"net.sf.mpxj.Task",
"net.sf.mpxj.TaskField",
"net.sf.mpxj.listener.ProjectListener",
"net.sf.mpxj.utility.MPXJFormats"
] | import java.util.List; import net.sf.mpxj.ProjectCalendar; import net.sf.mpxj.ProjectFile; import net.sf.mpxj.Resource; import net.sf.mpxj.ResourceAssignment; import net.sf.mpxj.Task; import net.sf.mpxj.TaskField; import net.sf.mpxj.listener.ProjectListener; import net.sf.mpxj.utility.MPXJFormats; | import java.util.*; import net.sf.mpxj.*; import net.sf.mpxj.listener.*; import net.sf.mpxj.utility.*; | [
"java.util",
"net.sf.mpxj"
] | java.util; net.sf.mpxj; | 624,172 |
public void generateUpdateWhere(CharBuffer cb)
{
generateInternalWhere(cb, false);
} | void function(CharBuffer cb) { generateInternalWhere(cb, false); } | /**
* Generates the (update) where expression.
*/ | Generates the (update) where expression | generateUpdateWhere | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/amber/expr/DependentEntityOneToOneExpr.java",
"license": "gpl-2.0",
"size": 6043
} | [
"com.caucho.util.CharBuffer"
] | import com.caucho.util.CharBuffer; | import com.caucho.util.*; | [
"com.caucho.util"
] | com.caucho.util; | 2,198,492 |
public void setOccurrences(Timing initialStartTime, Timing initialEndTime) throws IllegalValueException {
logger.info("Setting initial occurrence...");
this.occurrences.add(new RecurringTaskOccurrence(initialStartTime, initialEndTime));
if (isRecurring()) {
if (initialStartTime.timing == null || initialEndTime.timing == null) {
logger.severe("Start or End timing not specified for recurring task");
throw new IllegalValueException(MESSAGE_MISSING_TIMING);
}
String freqCharacter = frequency.getFrequencyCharacter();
switch (freqCharacter) {
case "d":
int dayLimit = RecurringFrequency.DAY_LIMIT;
int day = Calendar.DATE;
setOccurrences(initialStartTime, initialEndTime, dayLimit, day);
break;
case "m":
int monthLimit = RecurringFrequency.MONTH_LIMIT;
int month = Calendar.MONTH;
setOccurrences(initialStartTime, initialEndTime, monthLimit, month);
break;
case "y":
int yearLimit = RecurringFrequency.YEAR_LIMIT;
int year = Calendar.YEAR;
setOccurrences(initialStartTime, initialEndTime, yearLimit, year);
break;
default:
break;
}
}
} | void function(Timing initialStartTime, Timing initialEndTime) throws IllegalValueException { logger.info(STR); this.occurrences.add(new RecurringTaskOccurrence(initialStartTime, initialEndTime)); if (isRecurring()) { if (initialStartTime.timing == null initialEndTime.timing == null) { logger.severe(STR); throw new IllegalValueException(MESSAGE_MISSING_TIMING); } String freqCharacter = frequency.getFrequencyCharacter(); switch (freqCharacter) { case "d": int dayLimit = RecurringFrequency.DAY_LIMIT; int day = Calendar.DATE; setOccurrences(initialStartTime, initialEndTime, dayLimit, day); break; case "m": int monthLimit = RecurringFrequency.MONTH_LIMIT; int month = Calendar.MONTH; setOccurrences(initialStartTime, initialEndTime, monthLimit, month); break; case "y": int yearLimit = RecurringFrequency.YEAR_LIMIT; int year = Calendar.YEAR; setOccurrences(initialStartTime, initialEndTime, yearLimit, year); break; default: break; } } } | /** If frequency is in years - support up to 4 years
* If frequency is in days - support up to 60 days
* If frequency is in months - support up to 12 months
* @param startTime
* @param endTime
* @throws IllegalValueException
*/ | If frequency is in years - support up to 4 years If frequency is in days - support up to 60 days If frequency is in months - support up to 12 months | setOccurrences | {
"repo_name": "CS2103JAN2017-T11-B3/main",
"path": "src/main/java/seedu/task/model/task/Task.java",
"license": "mit",
"size": 14792
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 256,600 |
public MessageBytes addValue(char c[], int startN, int len)
{
MimeHeaderField mhf=createHeader();
mhf.getName().setChars(c, startN, len);
return mhf.getValue();
} | MessageBytes function(char c[], int startN, int len) { MimeHeaderField mhf=createHeader(); mhf.getName().setChars(c, startN, len); return mhf.getValue(); } | /** Create a new named header using translated char[].
*/ | Create a new named header using translated char[] | addValue | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/MimeHeaders.java",
"license": "mit",
"size": 14322
} | [
"org.apache.tomcat.util.buf.MessageBytes"
] | import org.apache.tomcat.util.buf.MessageBytes; | import org.apache.tomcat.util.buf.*; | [
"org.apache.tomcat"
] | org.apache.tomcat; | 2,295,240 |
public Map<Pair<Var, Concept>, Set<Answer>> getInverseAnswerMap(Q query, Set<Var> vars){
Map<Pair<Var, Concept>, Set<Answer>> inverseAnswerMap = new HashMap<>();
Set<Answer> answers = getAnswerStream(query).collect(Collectors.toSet());
answers.forEach(answer -> answer.entrySet().stream()
.filter(e -> vars.contains(e.getKey()))
.forEach(entry -> {
Pair<Var, Concept> key = new Pair<>(entry.getKey(), entry.getValue());
Set<Answer> match = inverseAnswerMap.get(key);
if (match != null){
match.add(answer);
} else {
Set<Answer> ans = new HashSet<>();
ans.add(answer);
inverseAnswerMap.put(key, ans);
}
}));
return inverseAnswerMap;
} | Map<Pair<Var, Concept>, Set<Answer>> function(Q query, Set<Var> vars){ Map<Pair<Var, Concept>, Set<Answer>> inverseAnswerMap = new HashMap<>(); Set<Answer> answers = getAnswerStream(query).collect(Collectors.toSet()); answers.forEach(answer -> answer.entrySet().stream() .filter(e -> vars.contains(e.getKey())) .forEach(entry -> { Pair<Var, Concept> key = new Pair<>(entry.getKey(), entry.getValue()); Set<Answer> match = inverseAnswerMap.get(key); if (match != null){ match.add(answer); } else { Set<Answer> ans = new HashSet<>(); ans.add(answer); inverseAnswerMap.put(key, ans); } })); return inverseAnswerMap; } | /**
* return an inverse answer map which is more suitable for operations involving concept comparison (joins, filtering, etc.)
* NB: consumes the underlying stream for the specified query
* @param query for answer are to be retrieved
* @param vars variable names of interest
* @return inverse answer map for specified query
*/ | return an inverse answer map which is more suitable for operations involving concept comparison (joins, filtering, etc.) | getInverseAnswerMap | {
"repo_name": "pluraliseseverythings/grakn",
"path": "grakn-graql/src/main/java/ai/grakn/graql/internal/reasoner/cache/Cache.java",
"license": "gpl-3.0",
"size": 5165
} | [
"ai.grakn.concept.Concept",
"ai.grakn.graql.Var",
"ai.grakn.graql.admin.Answer",
"ai.grakn.graql.internal.reasoner.utils.Pair",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.stream.Collectors"
] | import ai.grakn.concept.Concept; import ai.grakn.graql.Var; import ai.grakn.graql.admin.Answer; import ai.grakn.graql.internal.reasoner.utils.Pair; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; | import ai.grakn.concept.*; import ai.grakn.graql.*; import ai.grakn.graql.admin.*; import ai.grakn.graql.internal.reasoner.utils.*; import java.util.*; import java.util.stream.*; | [
"ai.grakn.concept",
"ai.grakn.graql",
"java.util"
] | ai.grakn.concept; ai.grakn.graql; java.util; | 933,389 |
public LinkedList<Diff> diff_main(String text1, String text2) {
return diff_main(text1, text2, true);
} | LinkedList<Diff> function(String text1, String text2) { return diff_main(text1, text2, true); } | /**
* Find the differences between two texts.
* Run a faster, slightly less optimal diff.
* This method allows the 'checklines' of diff_main() to be optional.
* Most of the time checklines is wanted, so default to true.
*
* @param text1 Old string to be diffed.
* @param text2 New string to be diffed.
* @return Linked List of Diff objects.
*/ | Find the differences between two texts. Run a faster, slightly less optimal diff. This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true | diff_main | {
"repo_name": "Cognifide/AET",
"path": "core/jobs/src/main/java/com/cognifide/aet/job/common/comparators/source/diff/DiffMatchPatch.java",
"license": "apache-2.0",
"size": 91233
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 1,144,172 |
void updateServiceLevelTransportParameters(String service, TransportParameter[] params,
boolean listener, ConfigurationContext cfgCtx) throws Exception;
| void updateServiceLevelTransportParameters(String service, TransportParameter[] params, boolean listener, ConfigurationContext cfgCtx) throws Exception; | /**
* Update the service level transport parameters
*
* @param service Name of the service
* @param params latest set of transport parameters
* @param listener transport listener or sender
* @param cfgCtx ConfigurationContext of the tenant
* @throws Exception on error
*/ | Update the service level transport parameters | updateServiceLevelTransportParameters | {
"repo_name": "maheshika/carbon4-kernel",
"path": "core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/transports/TransportService.java",
"license": "apache-2.0",
"size": 4687
} | [
"org.apache.axis2.context.ConfigurationContext",
"org.wso2.carbon.core.transports.util.TransportParameter"
] | import org.apache.axis2.context.ConfigurationContext; import org.wso2.carbon.core.transports.util.TransportParameter; | import org.apache.axis2.context.*; import org.wso2.carbon.core.transports.util.*; | [
"org.apache.axis2",
"org.wso2.carbon"
] | org.apache.axis2; org.wso2.carbon; | 512,178 |
public void setVariable(String name, Variable variable)
{
Preconditions.checkNotNull(name, "name is null");
Preconditions.checkNotNull(variable, "variable is null");
variables.put(name, variable);
} | void function(String name, Variable variable) { Preconditions.checkNotNull(name, STR); Preconditions.checkNotNull(variable, STR); variables.put(name, variable); } | /**
* BE VERY CAREFUL WITH THIS METHOD
*/ | BE VERY CAREFUL WITH THIS METHOD | setVariable | {
"repo_name": "rikima/presto-eclipse-env",
"path": "presto-main/src/main/java/com/facebook/presto/byteCode/CompilerContext.java",
"license": "apache-2.0",
"size": 6797
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 849,186 |
private void waitForTableToBecomeAvailable(String tableName) {
LOG.debug("Waiting for " + tableName + " to become available");
long startTime = System.currentTimeMillis();
long endTime = startTime + waitTime;
while (System.currentTimeMillis() < endTime) {
try {Thread.sleep(sleepTime);} catch (Exception e) {}
try {
DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
LOG.debug(tableName + " - current state: " + tableStatus);
if (tableStatus.equals(TableStatus.ACTIVE.toString())) return;
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == false) throw ase;
}
}
throw new RuntimeException("Table " + tableName + " never became active");
} | void function(String tableName) { LOG.debug(STR + tableName + STR); long startTime = System.currentTimeMillis(); long endTime = startTime + waitTime; while (System.currentTimeMillis() < endTime) { try {Thread.sleep(sleepTime);} catch (Exception e) {} try { DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName); TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable(); String tableStatus = tableDescription.getTableStatus(); LOG.debug(tableName + STR + tableStatus); if (tableStatus.equals(TableStatus.ACTIVE.toString())) return; } catch (AmazonServiceException ase) { if (ase.getErrorCode().equalsIgnoreCase(STR) == false) throw ase; } } throw new RuntimeException(STR + tableName + STR); } | /**
* Waits up to 6 minutes to confirm if a table has been created or not
* @param pTableName
*/ | Waits up to 6 minutes to confirm if a table has been created or not | waitForTableToBecomeAvailable | {
"repo_name": "infospace/gora",
"path": "gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java",
"license": "apache-2.0",
"size": 28006
} | [
"com.amazonaws.AmazonServiceException",
"com.amazonaws.services.dynamodb.model.DescribeTableRequest",
"com.amazonaws.services.dynamodb.model.TableDescription",
"com.amazonaws.services.dynamodb.model.TableStatus"
] | import com.amazonaws.AmazonServiceException; import com.amazonaws.services.dynamodb.model.DescribeTableRequest; import com.amazonaws.services.dynamodb.model.TableDescription; import com.amazonaws.services.dynamodb.model.TableStatus; | import com.amazonaws.*; import com.amazonaws.services.dynamodb.model.*; | [
"com.amazonaws",
"com.amazonaws.services"
] | com.amazonaws; com.amazonaws.services; | 2,853,430 |
public static void sendMPSE(Client client) throws IOException {
ByteBuffer rawBuf = allocBuffer(0);
JdwpPacket packet = new JdwpPacket(rawBuf);
ByteBuffer buf = getChunkDataBuf(rawBuf);
// no data
finishChunkPacket(packet, CHUNK_MPSE, buf.position());
Log.d("ddm-prof", "Sending " + name(CHUNK_MPSE));
client.sendAndConsume(packet, mInst);
} | static void function(Client client) throws IOException { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); finishChunkPacket(packet, CHUNK_MPSE, buf.position()); Log.d(STR, STR + name(CHUNK_MPSE)); client.sendAndConsume(packet, mInst); } | /**
* Send a MPSE (Method Profiling Streaming End) request to the client.
*/ | Send a MPSE (Method Profiling Streaming End) request to the client | sendMPSE | {
"repo_name": "i25ffz/screenshot",
"path": "src/com/android/ddmlib/HandleProfiling.java",
"license": "apache-2.0",
"size": 10453
} | [
"java.io.IOException",
"java.nio.ByteBuffer"
] | import java.io.IOException; import java.nio.ByteBuffer; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 127,989 |
private static void decodeCmasUserData(BearerData bData, int serviceCategory)
throws BitwiseInputStream.AccessException, CodingException {
BitwiseInputStream inStream = new BitwiseInputStream(bData.userData.payload);
if (inStream.available() < 8) {
throw new CodingException("emergency CB with no CMAE_protocol_version");
}
int protocolVersion = inStream.read(8);
if (protocolVersion != 0) {
throw new CodingException("unsupported CMAE_protocol_version " + protocolVersion);
}
int messageClass = serviceCategoryToCmasMessageClass(serviceCategory);
int category = SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN;
int responseType = SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN;
int severity = SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN;
int urgency = SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN;
int certainty = SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN;
while (inStream.available() >= 16) {
int recordType = inStream.read(8);
int recordLen = inStream.read(8);
switch (recordType) {
case 0: // Type 0 elements (Alert text)
UserData alertUserData = new UserData();
alertUserData.msgEncoding = inStream.read(5);
alertUserData.msgEncodingSet = true;
alertUserData.msgType = 0;
int numFields; // number of chars to decode
switch (alertUserData.msgEncoding) {
case UserData.ENCODING_OCTET:
case UserData.ENCODING_LATIN:
numFields = recordLen - 1; // subtract 1 byte for encoding
break;
case UserData.ENCODING_IA5:
case UserData.ENCODING_7BIT_ASCII:
case UserData.ENCODING_GSM_7BIT_ALPHABET:
numFields = ((recordLen * 8) - 5) / 7; // subtract 5 bits for encoding
break;
case UserData.ENCODING_UNICODE_16:
numFields = (recordLen - 1) / 2;
break;
default:
numFields = 0; // unsupported encoding
}
alertUserData.numFields = numFields;
alertUserData.payload = inStream.readByteArray(recordLen * 8 - 5);
decodeUserDataPayload(alertUserData, false);
bData.userData = alertUserData;
break;
case 1: // Type 1 elements
category = inStream.read(8);
responseType = inStream.read(8);
severity = inStream.read(4);
urgency = inStream.read(4);
certainty = inStream.read(4);
inStream.skip(recordLen * 8 - 28);
break;
default:
Rlog.w(LOG_TAG, "skipping unsupported CMAS record type " + recordType);
inStream.skip(recordLen * 8);
break;
}
}
bData.cmasWarningInfo = new SmsCbCmasInfo(messageClass, category, responseType, severity,
urgency, certainty);
} | static void function(BearerData bData, int serviceCategory) throws BitwiseInputStream.AccessException, CodingException { BitwiseInputStream inStream = new BitwiseInputStream(bData.userData.payload); if (inStream.available() < 8) { throw new CodingException(STR); } int protocolVersion = inStream.read(8); if (protocolVersion != 0) { throw new CodingException(STR + protocolVersion); } int messageClass = serviceCategoryToCmasMessageClass(serviceCategory); int category = SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN; int responseType = SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN; int severity = SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN; int urgency = SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN; int certainty = SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN; while (inStream.available() >= 16) { int recordType = inStream.read(8); int recordLen = inStream.read(8); switch (recordType) { case 0: UserData alertUserData = new UserData(); alertUserData.msgEncoding = inStream.read(5); alertUserData.msgEncodingSet = true; alertUserData.msgType = 0; int numFields; switch (alertUserData.msgEncoding) { case UserData.ENCODING_OCTET: case UserData.ENCODING_LATIN: numFields = recordLen - 1; break; case UserData.ENCODING_IA5: case UserData.ENCODING_7BIT_ASCII: case UserData.ENCODING_GSM_7BIT_ALPHABET: numFields = ((recordLen * 8) - 5) / 7; break; case UserData.ENCODING_UNICODE_16: numFields = (recordLen - 1) / 2; break; default: numFields = 0; } alertUserData.numFields = numFields; alertUserData.payload = inStream.readByteArray(recordLen * 8 - 5); decodeUserDataPayload(alertUserData, false); bData.userData = alertUserData; break; case 1: category = inStream.read(8); responseType = inStream.read(8); severity = inStream.read(4); urgency = inStream.read(4); certainty = inStream.read(4); inStream.skip(recordLen * 8 - 28); break; default: Rlog.w(LOG_TAG, STR + recordType); inStream.skip(recordLen * 8); break; } } bData.cmasWarningInfo = new SmsCbCmasInfo(messageClass, category, responseType, severity, urgency, certainty); } | /**
* CMAS message decoding.
* (See TIA-1149-0-1, CMAS over CDMA)
*
* @param serviceCategory is the service category from the SMS envelope
*/ | CMAS message decoding. (See TIA-1149-0-1, CMAS over CDMA) | decodeCmasUserData | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/com/android/internal/telephony/cdma/sms/BearerData.java",
"license": "gpl-3.0",
"size": 86438
} | [
"android.telephony.Rlog",
"android.telephony.SmsCbCmasInfo",
"com.android.internal.util.BitwiseInputStream"
] | import android.telephony.Rlog; import android.telephony.SmsCbCmasInfo; import com.android.internal.util.BitwiseInputStream; | import android.telephony.*; import com.android.internal.util.*; | [
"android.telephony",
"com.android.internal"
] | android.telephony; com.android.internal; | 2,223,364 |
private SpyDTO getSpyById(final int id) {
if (spyMap.containsKey(id)) {
return spyMap.get(id);
}
return null;
} | SpyDTO function(final int id) { if (spyMap.containsKey(id)) { return spyMap.get(id); } return null; } | /**
* Retrieve spy object based on identity.
*
* @param id the identity of the spy object.
* @return the spy object, or null if not found.
*/ | Retrieve spy object based on identity | getSpyById | {
"repo_name": "EaW1805/www",
"path": "src/main/java/com/eaw1805/www/controllers/remote/hotspot/SpyApplyChangesProcessor.java",
"license": "mit",
"size": 5586
} | [
"com.eaw1805.data.dto.web.army.SpyDTO"
] | import com.eaw1805.data.dto.web.army.SpyDTO; | import com.eaw1805.data.dto.web.army.*; | [
"com.eaw1805.data"
] | com.eaw1805.data; | 737,850 |
public AudioFileFormat getAudioFileFormat(URL url)
throws UnsupportedAudioFileException, IOException
{
if (TDebug.TraceAudioFileReader)
{
TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): begin");
}
long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED;
URLConnection conn = url.openConnection();
// Tell shoucast server (if any) that SPI support shoutcast stream.
conn.setRequestProperty("Icy-Metadata", "1");
InputStream inputStream = conn.getInputStream();
AudioFileFormat audioFileFormat = null;
try
{
audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
}
finally
{
inputStream.close();
}
if (TDebug.TraceAudioFileReader)
{
TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): end");
}
return audioFileFormat;
}
| AudioFileFormat function(URL url) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) { TDebug.out(STR); } long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; URLConnection conn = url.openConnection(); conn.setRequestProperty(STR, "1"); InputStream inputStream = conn.getInputStream(); AudioFileFormat audioFileFormat = null; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { inputStream.close(); } if (TDebug.TraceAudioFileReader) { TDebug.out(STR); } return audioFileFormat; } | /**
* Returns AudioFileFormat from URL.
*/ | Returns AudioFileFormat from URL | getAudioFileFormat | {
"repo_name": "casmi/minim-java",
"path": "src/main/java/ddf/minim/javasound/MpegAudioFileReader.java",
"license": "lgpl-3.0",
"size": 28095
} | [
"java.io.IOException",
"java.io.InputStream",
"java.net.URLConnection",
"javax.sound.sampled.AudioFileFormat",
"javax.sound.sampled.AudioSystem",
"javax.sound.sampled.UnsupportedAudioFileException",
"org.tritonus.share.TDebug"
] | import java.io.IOException; import java.io.InputStream; import java.net.URLConnection; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; | import java.io.*; import java.net.*; import javax.sound.sampled.*; import org.tritonus.share.*; | [
"java.io",
"java.net",
"javax.sound",
"org.tritonus.share"
] | java.io; java.net; javax.sound; org.tritonus.share; | 1,013,853 |
public static boolean isNetworkAvailable(Context appContext) {
boolean outcome = false;
if (appContext != null) {
ConnectivityManager cm = (ConnectivityManager) appContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] networkInfos = cm.getAllNetworkInfo();
for (NetworkInfo tempNetworkInfo : networkInfos) {
// Can also check if the user is in roaming
if (tempNetworkInfo.isConnected()) {
outcome = true;
break;
}
}
}
return outcome;
} | static boolean function(Context appContext) { boolean outcome = false; if (appContext != null) { ConnectivityManager cm = (ConnectivityManager) appContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] networkInfos = cm.getAllNetworkInfo(); for (NetworkInfo tempNetworkInfo : networkInfos) { if (tempNetworkInfo.isConnected()) { outcome = true; break; } } } return outcome; } | /**
* Checks if a internet connection is available. Note that the device can be connected
* to a network but not have internet access
*
* Requires <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
* in the manifest
*
* @param appContext
* @return
*/ | Checks if a internet connection is available. Note that the device can be connected to a network but not have internet access Requires in the manifest | isNetworkAvailable | {
"repo_name": "rainbowbreeze/rainbowlibs",
"path": "src/main/java/it/rainbowbreeze/libs/network/NetworkUtils.java",
"license": "apache-2.0",
"size": 1479
} | [
"android.content.Context",
"android.net.ConnectivityManager",
"android.net.NetworkInfo"
] | import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; | import android.content.*; import android.net.*; | [
"android.content",
"android.net"
] | android.content; android.net; | 12,632 |
public ArrayList<HashMap<String, String>> renderQA() {
return renderQA(null, "card");
} | ArrayList<HashMap<String, String>> function() { return renderQA(null, "card"); } | /**
* Q/A generation *********************************************************** ************************************
*/ | Q/A generation *********************************************************** | renderQA | {
"repo_name": "banxi1988/Anki-Android",
"path": "src/com/ichi2/libanki/Collection.java",
"license": "gpl-3.0",
"size": 53115
} | [
"java.util.ArrayList",
"java.util.HashMap"
] | import java.util.ArrayList; import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,461,171 |
public static boolean setLanguage(String localeCode) {
boolean languageChanged = false;
Configuration config = getInstance().getResources().getConfiguration();
Locale newLocale = LanguageUtil.getLocale(localeCode);
if (!config.locale.equals(newLocale)) {
languageChanged = true;
config.locale = newLocale;
getInstance().getResources().updateConfiguration(config, getInstance().getResources().getDisplayMetrics());
}
return languageChanged;
} | static boolean function(String localeCode) { boolean languageChanged = false; Configuration config = getInstance().getResources().getConfiguration(); Locale newLocale = LanguageUtil.getLocale(localeCode); if (!config.locale.equals(newLocale)) { languageChanged = true; config.locale = newLocale; getInstance().getResources().updateConfiguration(config, getInstance().getResources().getDisplayMetrics()); } return languageChanged; } | /**
* Sets the user language.
*
* @param localeCode The locale code of the language to set
* @return True if the language has changed, else false
*/ | Sets the user language | setLanguage | {
"repo_name": "timrae/Anki-Android",
"path": "AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java",
"license": "gpl-3.0",
"size": 18577
} | [
"android.content.res.Configuration",
"com.ichi2.utils.LanguageUtil",
"java.util.Locale"
] | import android.content.res.Configuration; import com.ichi2.utils.LanguageUtil; import java.util.Locale; | import android.content.res.*; import com.ichi2.utils.*; import java.util.*; | [
"android.content",
"com.ichi2.utils",
"java.util"
] | android.content; com.ichi2.utils; java.util; | 2,897,151 |
public void test_encodeDecodeCodeByte() {
assertEquals(ITermIndexCodes.TERM_CODE_URI, fixture
.value2Key(RDF.TYPE)[0]);
assertEquals(ITermIndexCodes.TERM_CODE_BND, fixture
.value2Key(new BNodeImpl("foo"))[0]);
assertEquals(ITermIndexCodes.TERM_CODE_LIT, fixture
.value2Key(new LiteralImpl("abc"))[0]);
assertEquals(ITermIndexCodes.TERM_CODE_LCL, fixture
.value2Key(new LiteralImpl("abc","en"))[0]);
assertEquals(ITermIndexCodes.TERM_CODE_DTL, fixture
.value2Key(new LiteralImpl("abc",XSD.BOOLEAN))[0]);
}
| void function() { assertEquals(ITermIndexCodes.TERM_CODE_URI, fixture .value2Key(RDF.TYPE)[0]); assertEquals(ITermIndexCodes.TERM_CODE_BND, fixture .value2Key(new BNodeImpl("foo"))[0]); assertEquals(ITermIndexCodes.TERM_CODE_LIT, fixture .value2Key(new LiteralImpl("abc"))[0]); assertEquals(ITermIndexCodes.TERM_CODE_LCL, fixture .value2Key(new LiteralImpl("abc","en"))[0]); assertEquals(ITermIndexCodes.TERM_CODE_DTL, fixture .value2Key(new LiteralImpl("abc",XSD.BOOLEAN))[0]); } | /**
* Tests encode of a key and the decode of its "code" byte.
*
* @see ITermIndexCodes
*/ | Tests encode of a key and the decode of its "code" byte | test_encodeDecodeCodeByte | {
"repo_name": "smalyshev/blazegraph",
"path": "bigdata-rdf/src/test/com/bigdata/rdf/lexicon/TestLexiconKeyBuilder.java",
"license": "gpl-2.0",
"size": 22607
} | [
"org.openrdf.model.impl.BNodeImpl",
"org.openrdf.model.impl.LiteralImpl"
] | import org.openrdf.model.impl.BNodeImpl; import org.openrdf.model.impl.LiteralImpl; | import org.openrdf.model.impl.*; | [
"org.openrdf.model"
] | org.openrdf.model; | 2,137,153 |
protected static SimpleResultSet createResultSet(boolean data) {
SimpleResultSet result = new SimpleResultSet();
if (data) {
result.addColumn(FullText.FIELD_SCHEMA, Types.VARCHAR, 0, 0);
result.addColumn(FullText.FIELD_TABLE, Types.VARCHAR, 0, 0);
result.addColumn(FullText.FIELD_COLUMNS, Types.ARRAY, 0, 0);
result.addColumn(FullText.FIELD_KEYS, Types.ARRAY, 0, 0);
} else {
result.addColumn(FullText.FIELD_QUERY, Types.VARCHAR, 0, 0);
}
result.addColumn(FullText.FIELD_SCORE, Types.FLOAT, 0, 0);
return result;
} | static SimpleResultSet function(boolean data) { SimpleResultSet result = new SimpleResultSet(); if (data) { result.addColumn(FullText.FIELD_SCHEMA, Types.VARCHAR, 0, 0); result.addColumn(FullText.FIELD_TABLE, Types.VARCHAR, 0, 0); result.addColumn(FullText.FIELD_COLUMNS, Types.ARRAY, 0, 0); result.addColumn(FullText.FIELD_KEYS, Types.ARRAY, 0, 0); } else { result.addColumn(FullText.FIELD_QUERY, Types.VARCHAR, 0, 0); } result.addColumn(FullText.FIELD_SCORE, Types.FLOAT, 0, 0); return result; } | /**
* Create an empty search result and initialize the columns.
*
* @param data true if the result set should contain the primary key data as
* an array.
* @return the empty result set
*/ | Create an empty search result and initialize the columns | createResultSet | {
"repo_name": "titus08/frostwire-desktop",
"path": "lib/jars-src/h2-1.3.164/org/h2/fulltext/FullText.java",
"license": "gpl-3.0",
"size": 40728
} | [
"java.sql.Types",
"org.h2.tools.SimpleResultSet"
] | import java.sql.Types; import org.h2.tools.SimpleResultSet; | import java.sql.*; import org.h2.tools.*; | [
"java.sql",
"org.h2.tools"
] | java.sql; org.h2.tools; | 665,918 |
public DefaultErrorHandlerBuilder loggingLevel(LoggingLevel level) {
getLogger().setLevel(level);
return this;
} | DefaultErrorHandlerBuilder function(LoggingLevel level) { getLogger().setLevel(level); return this; } | /**
* Sets the logging level of exceptions caught
*
* @param level the logging level
* @return the builder
*/ | Sets the logging level of exceptions caught | loggingLevel | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java",
"license": "apache-2.0",
"size": 20850
} | [
"org.apache.camel.LoggingLevel"
] | import org.apache.camel.LoggingLevel; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,382,601 |
public void testGetCapabilitiesKVPExamples()
throws Exception {
URL directoryURL = new URL( requestDir, "GetCapabilities/kvp" );
List<URL> exampleFiles = scanDirectory( directoryURL, "kvp" );
for ( URL example : exampleFiles ) {
LOG.logInfo( "Reading GetCapabilities KVP example '" + example + "'." );
Map<String, String> map = createKVPMap( example );
WFSGetCapabilities request = WFSGetCapabilities.create( map );
Object o = wfs.doService( request );
assertTrue( o instanceof WFSCapabilities );
WFSCapabilitiesDocument document = XMLFactory.export( (WFSCapabilities) o );
String outputFile = getResultFilename( example, outputDir );
document.write( new FileOutputStream( outputFile ) );
LOG.logInfo( "Wrote '" + outputFile + "'." );
}
}
| void function() throws Exception { URL directoryURL = new URL( requestDir, STR ); List<URL> exampleFiles = scanDirectory( directoryURL, "kvp" ); for ( URL example : exampleFiles ) { LOG.logInfo( STR + example + "'." ); Map<String, String> map = createKVPMap( example ); WFSGetCapabilities request = WFSGetCapabilities.create( map ); Object o = wfs.doService( request ); assertTrue( o instanceof WFSCapabilities ); WFSCapabilitiesDocument document = XMLFactory.export( (WFSCapabilities) o ); String outputFile = getResultFilename( example, outputDir ); document.write( new FileOutputStream( outputFile ) ); LOG.logInfo( STR + outputFile + "'." ); } } | /**
* Performs the <code>GetCapabilities</code> KVP requests from the example/deegree directory.
*
* @throws Exception
*/ | Performs the <code>GetCapabilities</code> KVP requests from the example/deegree directory | testGetCapabilitiesKVPExamples | {
"repo_name": "lat-lon/deegree2-base",
"path": "deegree2-core/src/test/java/org/deegree/ogcwebservices/wfs/WFServiceTest.java",
"license": "lgpl-2.1",
"size": 17622
} | [
"java.io.FileOutputStream",
"java.util.List",
"java.util.Map",
"org.deegree.ogcwebservices.wfs.capabilities.WFSCapabilities",
"org.deegree.ogcwebservices.wfs.capabilities.WFSCapabilitiesDocument",
"org.deegree.ogcwebservices.wfs.operation.WFSGetCapabilities"
] | import java.io.FileOutputStream; import java.util.List; import java.util.Map; import org.deegree.ogcwebservices.wfs.capabilities.WFSCapabilities; import org.deegree.ogcwebservices.wfs.capabilities.WFSCapabilitiesDocument; import org.deegree.ogcwebservices.wfs.operation.WFSGetCapabilities; | import java.io.*; import java.util.*; import org.deegree.ogcwebservices.wfs.capabilities.*; import org.deegree.ogcwebservices.wfs.operation.*; | [
"java.io",
"java.util",
"org.deegree.ogcwebservices"
] | java.io; java.util; org.deegree.ogcwebservices; | 747,025 |
public static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException {
long count = 0;
int n;
while (EOF != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
}
return count;
}
| static long function(Reader input, Writer output, char[] buffer) throws IOException { long count = 0; int n; while (EOF != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; } | /**
* Copy chars from a large (over 2GB) <code>Reader</code> to a <code>Writer</code>.
* <p/>
* This method uses the provided buffer, so there is no need to use a
* <code>BufferedReader</code>.
* <p/>
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to write to
* @param buffer the buffer to be used for the copy
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since 2.2
*/ | Copy chars from a large (over 2GB) <code>Reader</code> to a <code>Writer</code>. This method uses the provided buffer, so there is no need to use a <code>BufferedReader</code>. | copyLarge | {
"repo_name": "wzx54321/XinFramework",
"path": "app/src/main/java/com/xin/framework/xinframwork/utils/common/io/IOUtils.java",
"license": "apache-2.0",
"size": 100603
} | [
"java.io.IOException",
"java.io.Reader",
"java.io.Writer"
] | import java.io.IOException; import java.io.Reader; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,074,152 |
public Collection<IColumn> getReverseSortedColumns(); | Collection<IColumn> function(); | /**
* Returns the columns of this column map as a collection.
* The columns in the returned collection should be sorted in reverse
* order of the columns in this map.
*/ | Returns the columns of this column map as a collection. The columns in the returned collection should be sorted in reverse order of the columns in this map | getReverseSortedColumns | {
"repo_name": "bcoverston/apache-hosted-cassandra",
"path": "src/java/org/apache/cassandra/db/ISortedColumns.java",
"license": "apache-2.0",
"size": 6253
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,774,996 |
void update(final TPolicy policy); | void update(final TPolicy policy); | /**
* Updates a policy
*
* @param policy policy model
*/ | Updates a policy | update | {
"repo_name": "KromatikSolutions/dasshy",
"path": "dasshy-server/src/main/java/com/kromatik/dasshy/server/dao/PolicyDao.java",
"license": "gpl-3.0",
"size": 1619
} | [
"com.kromatik.dasshy.thrift.model.TPolicy"
] | import com.kromatik.dasshy.thrift.model.TPolicy; | import com.kromatik.dasshy.thrift.model.*; | [
"com.kromatik.dasshy"
] | com.kromatik.dasshy; | 1,719,919 |
protected void verifyPageList(Class classIn) {
verifyList(RequestContext.PAGE_LIST, classIn);
} | void function(Class classIn) { verifyList(RequestContext.PAGE_LIST, classIn); } | /**
* Verify that the attribute "pageList" is setup properly:
*
* 1) not null
* 2) size > 0
* 3) first item in list is instance of classIn
* @param classIn to check first item against.
*/ | Verify that the attribute "pageList" is setup properly: 1) not null 2) size > 0 3) first item in list is instance of classIn | verifyPageList | {
"repo_name": "dmacvicar/spacewalk",
"path": "java/code/src/com/redhat/rhn/testing/RhnMockStrutsTestCase.java",
"license": "gpl-2.0",
"size": 7911
} | [
"com.redhat.rhn.frontend.struts.RequestContext"
] | import com.redhat.rhn.frontend.struts.RequestContext; | import com.redhat.rhn.frontend.struts.*; | [
"com.redhat.rhn"
] | com.redhat.rhn; | 2,684,862 |
private void callJobListener(String jobName, JobState jobState, boolean runOnce) {
JobListener jobListener = runOnce ? this.jobListenerMap.remove(jobName) : this.jobListenerMap.get(jobName);
if (jobListener != null) {
jobListener.jobCompleted(jobState);
}
}
@DisallowConcurrentExecution
public static class GobblinJob implements Job { | void function(String jobName, JobState jobState, boolean runOnce) { JobListener jobListener = runOnce ? this.jobListenerMap.remove(jobName) : this.jobListenerMap.get(jobName); if (jobListener != null) { jobListener.jobCompleted(jobState); } } public static class GobblinJob implements Job { | /**
* Call {@link JobListener} associated with the job.
*/ | Call <code>JobListener</code> associated with the job | callJobListener | {
"repo_name": "WillCh/cs286A",
"path": "crawler/gobblin/gobblin-runtime/src/main/java/gobblin/runtime/local/LocalJobManager.java",
"license": "bsd-2-clause",
"size": 31196
} | [
"org.quartz.Job"
] | import org.quartz.Job; | import org.quartz.*; | [
"org.quartz"
] | org.quartz; | 2,562,859 |
public YangString getRegisterNameValue() throws JNCException {
return (YangString)getValue("register-name");
} | YangString function() throws JNCException { return (YangString)getValue(STR); } | /**
* Gets the value for child leaf "register-name".
* @return The value of the leaf.
*/ | Gets the value for child leaf "register-name" | getRegisterNameValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/statistics/s6/S6.java",
"license": "apache-2.0",
"size": 11274
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 2,836,580 |
public static void main(String[] args) {
CombinedXYPlotDemo1 demo = new CombinedXYPlotDemo1(
"JFreeChart : CombinedXYPlotDemo1");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
} | static void function(String[] args) { CombinedXYPlotDemo1 demo = new CombinedXYPlotDemo1( STR); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } | /**
* Starting point for the demonstration application.
*
* @param args ignored.
*/ | Starting point for the demonstration application | main | {
"repo_name": "JohnBrodie/visual-kanban",
"path": "lib/jfreechart-1.0.14/experimental/org/jfree/experimental/chart/demo/CombinedXYPlotDemo1.java",
"license": "mit",
"size": 10033
} | [
"org.jfree.ui.RefineryUtilities"
] | import org.jfree.ui.RefineryUtilities; | import org.jfree.ui.*; | [
"org.jfree.ui"
] | org.jfree.ui; | 627,903 |
protected RowState getRowState() {
return rowState;
} | RowState function() { return rowState; } | /**
* Returns the shared state of this row.
*
* @return the row state
*/ | Returns the shared state of this row | getRowState | {
"repo_name": "Darsstar/framework",
"path": "server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java",
"license": "apache-2.0",
"size": 27228
} | [
"com.vaadin.shared.ui.grid.SectionState"
] | import com.vaadin.shared.ui.grid.SectionState; | import com.vaadin.shared.ui.grid.*; | [
"com.vaadin.shared"
] | com.vaadin.shared; | 45,211 |
public void testInverseGetItem()
throws Exception
{
try
{
SCOCollectionTests.checkGetAt(pmf,
List2.class,
List2Item.class);
}
finally
{
clean(List2.class);
clean(List2Item.class);
}
}
| void function() throws Exception { try { SCOCollectionTests.checkGetAt(pmf, List2.class, List2Item.class); } finally { clean(List2.class); clean(List2Item.class); } } | /**
* Test case to test the use of get etc
**/ | Test case to test the use of get etc | testInverseGetItem | {
"repo_name": "hopecee/texsts",
"path": "jdo/identity/src/test/org/datanucleus/tests/types/ListTest.java",
"license": "apache-2.0",
"size": 12543
} | [
"org.jpox.samples.types.list.List2",
"org.jpox.samples.types.list.List2Item"
] | import org.jpox.samples.types.list.List2; import org.jpox.samples.types.list.List2Item; | import org.jpox.samples.types.list.*; | [
"org.jpox.samples"
] | org.jpox.samples; | 2,072,011 |
String xml = xmlToValidate;
errorHandler = new XMLValidatorErrorHandler();
try {
// `query.xsd` had to be edited to allow the `QueryType` to be exported. But this means
// that now a `<query>` has to have a namespace associated. Here we do a simply
// replacement to fake in the namespace of queries that are un-namespaced.
String[] parts = xmlSchemaUrl.split(Pattern.quote("/"));
if ("query.xsd".equals(parts[parts.length - 1])) {
xml = xml.replaceAll(Pattern.quote("<query"), QUERY_XMLNS);
xml = xml.replaceAll(Pattern.quote("</query>"), "</xsq:query>");
}
// changed to use baseURL instead of current URL because tomcat uses a different
// URL when in docker. There is no way this could not work.
LOG.info("Using the xmlSchemaUrl " + xmlSchemaUrl);
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
URL schemaLocation = new URL(xmlSchemaUrl);
Reader schemaReader = new InputStreamReader(schemaLocation.openStream());
Schema schema = factory.newSchema(new StreamSource(schemaReader));
Validator validator = schema.newValidator();
validator.setErrorHandler(errorHandler);
validator.validate(new StreamSource(new StringReader(xml)));
} catch (SAXParseException e) {
LOG.debug(e);
} catch (Exception e) {
throw new ServiceException("XML validation failed. " + xmlSchemaUrl, e);
}
} | String xml = xmlToValidate; errorHandler = new XMLValidatorErrorHandler(); try { String[] parts = xmlSchemaUrl.split(Pattern.quote("/")); if (STR.equals(parts[parts.length - 1])) { xml = xml.replaceAll(Pattern.quote(STR), QUERY_XMLNS); xml = xml.replaceAll(Pattern.quote(STR), STR); } LOG.info(STR + xmlSchemaUrl); SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaLocation = new URL(xmlSchemaUrl); Reader schemaReader = new InputStreamReader(schemaLocation.openStream()); Schema schema = factory.newSchema(new StreamSource(schemaReader)); Validator validator = schema.newValidator(); validator.setErrorHandler(errorHandler); validator.validate(new StreamSource(new StringReader(xml))); } catch (SAXParseException e) { LOG.debug(e); } catch (Exception e) { throw new ServiceException(STR + xmlSchemaUrl, e); } } | /**
* Validates an XML string according to an XML Schema at a given URL.
*
* @param xmlToValidate an XML string.
* @param xmlSchemaUrl the URL of an XML Schema.
*/ | Validates an XML string according to an XML Schema at a given URL | validate | {
"repo_name": "Arabidopsis-Information-Portal/intermine",
"path": "intermine/web/main/src/org/intermine/webservice/server/query/result/XMLValidator.java",
"license": "lgpl-2.1",
"size": 4089
} | [
"java.io.InputStreamReader",
"java.io.Reader",
"java.io.StringReader",
"java.util.regex.Pattern",
"javax.xml.XMLConstants",
"javax.xml.transform.stream.StreamSource",
"javax.xml.validation.Schema",
"javax.xml.validation.SchemaFactory",
"javax.xml.validation.Validator",
"org.intermine.webservice.server.exceptions.ServiceException",
"org.xml.sax.SAXParseException"
] | import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.util.regex.Pattern; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.intermine.webservice.server.exceptions.ServiceException; import org.xml.sax.SAXParseException; | import java.io.*; import java.util.regex.*; import javax.xml.*; import javax.xml.transform.stream.*; import javax.xml.validation.*; import org.intermine.webservice.server.exceptions.*; import org.xml.sax.*; | [
"java.io",
"java.util",
"javax.xml",
"org.intermine.webservice",
"org.xml.sax"
] | java.io; java.util; javax.xml; org.intermine.webservice; org.xml.sax; | 2,818,920 |
private Map<String, Set<HashMap<String, String>>> parseSetting(Collection<BlueprintSettingEntity> blueprintSetting) {
Map<String, Set<HashMap<String, String>>> properties = new HashMap<>();
Gson gson = new Gson();
for (BlueprintSettingEntity setting : blueprintSetting) {
String settingName = setting.getSettingName();
Set<HashMap<String, String>> settingProperties = gson.<Set<HashMap<String, String>>>fromJson(
setting.getSettingData(), Set.class);
properties.put(settingName, settingProperties);
}
return properties;
} | Map<String, Set<HashMap<String, String>>> function(Collection<BlueprintSettingEntity> blueprintSetting) { Map<String, Set<HashMap<String, String>>> properties = new HashMap<>(); Gson gson = new Gson(); for (BlueprintSettingEntity setting : blueprintSetting) { String settingName = setting.getSettingName(); Set<HashMap<String, String>> settingProperties = gson.<Set<HashMap<String, String>>>fromJson( setting.getSettingData(), Set.class); properties.put(settingName, settingProperties); } return properties; } | /**
* Deserialization: Obtain setting as a map of setting name to corresponding properties.
*
* @return map of setting name to map of properties
*/ | Deserialization: Obtain setting as a map of setting name to corresponding properties | parseSetting | {
"repo_name": "radicalbit/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java",
"license": "apache-2.0",
"size": 22942
} | [
"com.google.gson.Gson",
"java.util.Collection",
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"org.apache.ambari.server.orm.entities.BlueprintSettingEntity"
] | import com.google.gson.Gson; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apache.ambari.server.orm.entities.BlueprintSettingEntity; | import com.google.gson.*; import java.util.*; import org.apache.ambari.server.orm.entities.*; | [
"com.google.gson",
"java.util",
"org.apache.ambari"
] | com.google.gson; java.util; org.apache.ambari; | 1,687,306 |
public List<Integer> getHighlightedLineList() {
return new ArrayList<Integer>(highlightedLineList);
} | List<Integer> function() { return new ArrayList<Integer>(highlightedLineList); } | /**
* Get the list of highlighted lines.
* @return a copy of the list
*/ | Get the list of highlighted lines | getHighlightedLineList | {
"repo_name": "oddlespuddle/mishmafyer",
"path": "syntaxhighlight/JTextComponentRowHeader.java",
"license": "apache-2.0",
"size": 16917
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,951,194 |
@RequestMapping(method = RequestMethod.GET, value = "/getAccount")
public Object getAccount(
final @RequestParam(value="accountName") String accountName) {
LOG.debug("Account details Request came to AccountRestController.getAccount....."+accountName);
final JSONObject jsonObject = new JSONObject();
jsonObject.append("accountName", accountName);
return jsonObject;
}
| @RequestMapping(method = RequestMethod.GET, value = STR) Object function( final @RequestParam(value=STR) String accountName) { LOG.debug(STR+accountName); final JSONObject jsonObject = new JSONObject(); jsonObject.append(STR, accountName); return jsonObject; } | /**
* Fetch the account details of the account holder name passed.
*
* @param accountName
* @return accountHolderOutput
*/ | Fetch the account details of the account holder name passed | getAccount | {
"repo_name": "parthiban-samykutti/soapRestWebService",
"path": "springRestWsSecurity/src/main/java/com/parthi/spring/ws/rest/controller/AccountRestController.java",
"license": "gpl-3.0",
"size": 2690
} | [
"org.json.JSONObject",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.RequestParam"
] | import org.json.JSONObject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; | import org.json.*; import org.springframework.web.bind.annotation.*; | [
"org.json",
"org.springframework.web"
] | org.json; org.springframework.web; | 631,020 |
public void visitCHECKCAST(CHECKCAST c) {
Type t = c.getType(poolGen);
log.log(" instr(checkcast)=" + t, Project.MSG_DEBUG);
String type = t.toString();
design.checkClass(type);
} | void function(CHECKCAST c) { Type t = c.getType(poolGen); log.log(STR + t, Project.MSG_DEBUG); String type = t.toString(); design.checkClass(type); } | /**
* Method visitCHECKCAST.
*
* @param c CHECKCAST
* @see org.apache.bcel.generic.Visitor#visitCHECKCAST(CHECKCAST)
*/ | Method visitCHECKCAST | visitCHECKCAST | {
"repo_name": "antlibs/ant-contrib",
"path": "src/main/java/net/sf/antcontrib/design/InstructionVisitor.java",
"license": "apache-2.0",
"size": 5711
} | [
"org.apache.bcel.generic.Type",
"org.apache.tools.ant.Project"
] | import org.apache.bcel.generic.Type; import org.apache.tools.ant.Project; | import org.apache.bcel.generic.*; import org.apache.tools.ant.*; | [
"org.apache.bcel",
"org.apache.tools"
] | org.apache.bcel; org.apache.tools; | 1,514,351 |
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
{
return itemstack.getItem() instanceof ItemSlug;
}
| boolean function(int slot, ItemStack itemstack) { return itemstack.getItem() instanceof ItemSlug; } | /**
* This method doesn't seem to do what it claims to do, as
* items can still be left-clicked and placed in the inventory
* even when this returns false
*/ | This method doesn't seem to do what it claims to do, as items can still be left-clicked and placed in the inventory even when this returns false | isItemValidForSlot | {
"repo_name": "mpbagot/Slugterra-Mod",
"path": "main/java/com/slugterra/inventory/SlugRackInventory.java",
"license": "mit",
"size": 4126
} | [
"com.slugterra.item.slugs.ItemSlug",
"net.minecraft.item.ItemStack"
] | import com.slugterra.item.slugs.ItemSlug; import net.minecraft.item.ItemStack; | import com.slugterra.item.slugs.*; import net.minecraft.item.*; | [
"com.slugterra.item",
"net.minecraft.item"
] | com.slugterra.item; net.minecraft.item; | 1,762,196 |
public static ParticleRenderingInfo getInstance(BasicParticleType type, int number, int duration, float rgbRed,
float rgbGreen, float rgbBlue, double speed) {
return new DefaultParticleRenderingInfo(type, number, duration, rgbRed, rgbGreen, rgbBlue, speed);
}
| static ParticleRenderingInfo function(BasicParticleType type, int number, int duration, float rgbRed, float rgbGreen, float rgbBlue, double speed) { return new DefaultParticleRenderingInfo(type, number, duration, rgbRed, rgbGreen, rgbBlue, speed); } | /**
* Factory method for creation of a particle rendering info.
*
* @param type particle type.
* @param number number of particles to render per update.
* @param duration number of updates to render particles. Particle is removed
* when the number reaches zero. If the duration is negative
* then it is interpreted as an infinite duration.
* @param rgbRed red RGB color component of the particle.
* @param rgbGren green RGB color component of the particle.
* @param rgbBlue blue RGB color component of the particle.
* @param speed particle speed.
*
* @return particle rendering info.
*/ | Factory method for creation of a particle rendering info | getInstance | {
"repo_name": "athrane/bassebombecraft",
"path": "src/main/java/bassebombecraft/event/particle/DefaultParticleRenderingInfo.java",
"license": "gpl-3.0",
"size": 5926
} | [
"net.minecraft.particles.BasicParticleType"
] | import net.minecraft.particles.BasicParticleType; | import net.minecraft.particles.*; | [
"net.minecraft.particles"
] | net.minecraft.particles; | 1,812,265 |
public void deleteEntity(WorkingAgreement workingAgreement) {
workingAgreementDAO.delete(workingAgreement);
} | void function(WorkingAgreement workingAgreement) { workingAgreementDAO.delete(workingAgreement); } | /**
* Delete workingAgreement.
*/ | Delete workingAgreement | deleteEntity | {
"repo_name": "terrex/tntconcept-materials-testing",
"path": "src/main/java/com/autentia/intra/manager/admin/WorkingAgreementManager.java",
"license": "gpl-2.0",
"size": 3649
} | [
"com.autentia.intra.businessobject.WorkingAgreement"
] | import com.autentia.intra.businessobject.WorkingAgreement; | import com.autentia.intra.businessobject.*; | [
"com.autentia.intra"
] | com.autentia.intra; | 1,985,457 |
private String getAdditionalIncludeDirectories(final String baseDir,
final CommandLineCompilerConfiguration compilerConfig) {
File[] includePath = compilerConfig.getIncludePath();
StringBuilder includeDirs = new StringBuilder();
for (File file : includePath) {
String relPath = getRelativePath(baseDir, file);
includeDirs.append(toWindowsPath(relPath));
includeDirs.append(';');
}
if (includeDirs.length() > 0) {
includeDirs.setLength(includeDirs.length() - 1);
}
return includeDirs.toString();
} | String function(final String baseDir, final CommandLineCompilerConfiguration compilerConfig) { File[] includePath = compilerConfig.getIncludePath(); StringBuilder includeDirs = new StringBuilder(); for (File file : includePath) { String relPath = getRelativePath(baseDir, file); includeDirs.append(toWindowsPath(relPath)); includeDirs.append(';'); } if (includeDirs.length() > 0) { includeDirs.setLength(includeDirs.length() - 1); } return includeDirs.toString(); } | /**
* Get value of AdditionalIncludeDirectories property.
*
* @param compilerConfig compiler configuration.
* @param baseDir base for relative paths.
* @return value of AdditionalIncludeDirectories property.
*/ | Get value of AdditionalIncludeDirectories property | getAdditionalIncludeDirectories | {
"repo_name": "dougm/ant-contrib-cpptasks",
"path": "src/main/java/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java",
"license": "apache-2.0",
"size": 32716
} | [
"java.io.File",
"net.sf.antcontrib.cpptasks.CUtil",
"net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration"
] | import java.io.File; import net.sf.antcontrib.cpptasks.CUtil; import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration; | import java.io.*; import net.sf.antcontrib.cpptasks.*; import net.sf.antcontrib.cpptasks.compiler.*; | [
"java.io",
"net.sf.antcontrib"
] | java.io; net.sf.antcontrib; | 954,170 |
public static UserRepresentation exportUser(KeycloakSession session, RealmModel realm, UserModel user, ExportOptions options, boolean internal) {
UserRepresentation userRep = ModelToRepresentation.toRepresentation(session, realm, user);
// Social links
List<FederatedIdentityRepresentation> socialLinkReps = session.users().getFederatedIdentitiesStream(realm, user)
.map(ExportUtils::exportSocialLink).collect(Collectors.toList());
if (socialLinkReps.size() > 0) {
userRep.setFederatedIdentities(socialLinkReps);
}
// Role mappings
if (options.isGroupsAndRolesIncluded()) {
Set<RoleModel> roles = user.getRoleMappingsStream().collect(Collectors.toSet());
List<String> realmRoleNames = new ArrayList<>();
Map<String, List<String>> clientRoleNames = new HashMap<>();
for (RoleModel role : roles) {
if (role.getContainer() instanceof RealmModel) {
realmRoleNames.add(role.getName());
} else {
ClientModel client = (ClientModel)role.getContainer();
String clientId = client.getClientId();
List<String> currentClientRoles = clientRoleNames.get(clientId);
if (currentClientRoles == null) {
currentClientRoles = new ArrayList<>();
clientRoleNames.put(clientId, currentClientRoles);
}
currentClientRoles.add(role.getName());
}
}
if (realmRoleNames.size() > 0) {
userRep.setRealmRoles(realmRoleNames);
}
if (clientRoleNames.size() > 0) {
userRep.setClientRoles(clientRoleNames);
}
}
// Credentials - extra security, do not export credentials if service accounts
if (internal) {
List<CredentialRepresentation> credReps = session.userCredentialManager().getStoredCredentialsStream(realm, user)
.map(ExportUtils::exportCredential).collect(Collectors.toList());
userRep.setCredentials(credReps);
}
userRep.setFederationLink(user.getFederationLink());
// Grants
List<UserConsentRepresentation> consentReps = session.users().getConsentsStream(realm, user.getId())
.map(ModelToRepresentation::toRepresentation).collect(Collectors.toList());
if (consentReps.size() > 0) {
userRep.setClientConsents(consentReps);
}
// Not Before
int notBefore = session.users().getNotBeforeOfUser(realm, user);
userRep.setNotBefore(notBefore);
// Service account
if (user.getServiceAccountClientLink() != null) {
String clientInternalId = user.getServiceAccountClientLink();
ClientModel client = realm.getClientById(clientInternalId);
if (client != null) {
userRep.setServiceAccountClientId(client.getClientId());
}
}
if (options.isGroupsAndRolesIncluded()) {
List<String> groups = user.getGroupsStream().map(ModelToRepresentation::buildGroupPath).collect(Collectors.toList());
userRep.setGroups(groups);
}
return userRep;
} | static UserRepresentation function(KeycloakSession session, RealmModel realm, UserModel user, ExportOptions options, boolean internal) { UserRepresentation userRep = ModelToRepresentation.toRepresentation(session, realm, user); List<FederatedIdentityRepresentation> socialLinkReps = session.users().getFederatedIdentitiesStream(realm, user) .map(ExportUtils::exportSocialLink).collect(Collectors.toList()); if (socialLinkReps.size() > 0) { userRep.setFederatedIdentities(socialLinkReps); } if (options.isGroupsAndRolesIncluded()) { Set<RoleModel> roles = user.getRoleMappingsStream().collect(Collectors.toSet()); List<String> realmRoleNames = new ArrayList<>(); Map<String, List<String>> clientRoleNames = new HashMap<>(); for (RoleModel role : roles) { if (role.getContainer() instanceof RealmModel) { realmRoleNames.add(role.getName()); } else { ClientModel client = (ClientModel)role.getContainer(); String clientId = client.getClientId(); List<String> currentClientRoles = clientRoleNames.get(clientId); if (currentClientRoles == null) { currentClientRoles = new ArrayList<>(); clientRoleNames.put(clientId, currentClientRoles); } currentClientRoles.add(role.getName()); } } if (realmRoleNames.size() > 0) { userRep.setRealmRoles(realmRoleNames); } if (clientRoleNames.size() > 0) { userRep.setClientRoles(clientRoleNames); } } if (internal) { List<CredentialRepresentation> credReps = session.userCredentialManager().getStoredCredentialsStream(realm, user) .map(ExportUtils::exportCredential).collect(Collectors.toList()); userRep.setCredentials(credReps); } userRep.setFederationLink(user.getFederationLink()); List<UserConsentRepresentation> consentReps = session.users().getConsentsStream(realm, user.getId()) .map(ModelToRepresentation::toRepresentation).collect(Collectors.toList()); if (consentReps.size() > 0) { userRep.setClientConsents(consentReps); } int notBefore = session.users().getNotBeforeOfUser(realm, user); userRep.setNotBefore(notBefore); if (user.getServiceAccountClientLink() != null) { String clientInternalId = user.getServiceAccountClientLink(); ClientModel client = realm.getClientById(clientInternalId); if (client != null) { userRep.setServiceAccountClientId(client.getClientId()); } } if (options.isGroupsAndRolesIncluded()) { List<String> groups = user.getGroupsStream().map(ModelToRepresentation::buildGroupPath).collect(Collectors.toList()); userRep.setGroups(groups); } return userRep; } | /**
* Full export of user (including role mappings and credentials)
*
* @param user
* @return fully exported user representation
*/ | Full export of user (including role mappings and credentials) | exportUser | {
"repo_name": "abstractj/keycloak",
"path": "services/src/main/java/org/keycloak/exportimport/util/ExportUtils.java",
"license": "apache-2.0",
"size": 31550
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.Set",
"java.util.stream.Collectors",
"org.keycloak.models.ClientModel",
"org.keycloak.models.KeycloakSession",
"org.keycloak.models.RealmModel",
"org.keycloak.models.RoleModel",
"org.keycloak.models.UserModel",
"org.keycloak.models.utils.ModelToRepresentation",
"org.keycloak.representations.idm.CredentialRepresentation",
"org.keycloak.representations.idm.FederatedIdentityRepresentation",
"org.keycloak.representations.idm.UserConsentRepresentation",
"org.keycloak.representations.idm.UserRepresentation"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; import org.keycloak.models.UserModel; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.representations.idm.CredentialRepresentation; import org.keycloak.representations.idm.FederatedIdentityRepresentation; import org.keycloak.representations.idm.UserConsentRepresentation; import org.keycloak.representations.idm.UserRepresentation; | import java.util.*; import java.util.stream.*; import org.keycloak.models.*; import org.keycloak.models.utils.*; import org.keycloak.representations.idm.*; | [
"java.util",
"org.keycloak.models",
"org.keycloak.representations"
] | java.util; org.keycloak.models; org.keycloak.representations; | 570,876 |
@Test
public void testRetryFurtherForUntrackedMessageId() {
// construct manager
final int expectedMaxRetries = 2;
final long expectedMinRetryTimeMs = 1000;
// Build config.
Map<String, Object> stormConfig = getDefaultConfig(expectedMaxRetries, expectedMinRetryTimeMs, null, null);
// Create instance, inject our mock clock, and call open.
ExponentialBackoffRetryManager retryManager = new ExponentialBackoffRetryManager();
retryManager.setClock(mockClock);
retryManager.open(stormConfig);
final DefaultVirtualSpoutIdentifier consumerId = new DefaultVirtualSpoutIdentifier("MyConsumerId");
// Define our tuple message id
final MessageId messageId = new MessageId("MyTopic", 0, 100L, consumerId);
assertTrue(retryManager.retryFurther(messageId), "Should always be true because its untracked");
assertTrue(retryManager.retryFurther(messageId), "Should always be true because its untracked");
assertTrue(retryManager.retryFurther(messageId), "Should always be true because its untracked");
} | void function() { final int expectedMaxRetries = 2; final long expectedMinRetryTimeMs = 1000; Map<String, Object> stormConfig = getDefaultConfig(expectedMaxRetries, expectedMinRetryTimeMs, null, null); ExponentialBackoffRetryManager retryManager = new ExponentialBackoffRetryManager(); retryManager.setClock(mockClock); retryManager.open(stormConfig); final DefaultVirtualSpoutIdentifier consumerId = new DefaultVirtualSpoutIdentifier(STR); final MessageId messageId = new MessageId(STR, 0, 100L, consumerId); assertTrue(retryManager.retryFurther(messageId), STR); assertTrue(retryManager.retryFurther(messageId), STR); assertTrue(retryManager.retryFurther(messageId), STR); } | /**
* Tests that all previously un-tracked messageIds should be retried.
*/ | Tests that all previously un-tracked messageIds should be retried | testRetryFurtherForUntrackedMessageId | {
"repo_name": "salesforce/storm-dynamic-spout",
"path": "src/test/java/com/salesforce/storm/spout/dynamic/retry/ExponentialBackoffRetryManagerTest.java",
"license": "bsd-3-clause",
"size": 31606
} | [
"com.salesforce.storm.spout.dynamic.DefaultVirtualSpoutIdentifier",
"com.salesforce.storm.spout.dynamic.MessageId",
"java.util.Map",
"org.junit.jupiter.api.Assertions"
] | import com.salesforce.storm.spout.dynamic.DefaultVirtualSpoutIdentifier; import com.salesforce.storm.spout.dynamic.MessageId; import java.util.Map; import org.junit.jupiter.api.Assertions; | import com.salesforce.storm.spout.dynamic.*; import java.util.*; import org.junit.jupiter.api.*; | [
"com.salesforce.storm",
"java.util",
"org.junit.jupiter"
] | com.salesforce.storm; java.util; org.junit.jupiter; | 2,118,882 |
private static FormData createDefaultFormData(Button button, int width, int margin, Control lastControl) {
FormData formData = new FormData();
if (lastControl != null) {
formData.top = new FormAttachment(lastControl, margin * 3);
} else {
formData.bottom = new FormAttachment(100, 0);
}
formData.right = new FormAttachment(button, width + margin);
return formData;
} | static FormData function(Button button, int width, int margin, Control lastControl) { FormData formData = new FormData(); if (lastControl != null) { formData.top = new FormAttachment(lastControl, margin * 3); } else { formData.bottom = new FormAttachment(100, 0); } formData.right = new FormAttachment(button, width + margin); return formData; } | /**
* Creats a default FormData object with the top / bottom / and left set (this is done to
* cut down on repetative code lines
* @param button the button to which this form data will be applied
* @param width the width of the button
* @param margin the margin between buttons
* @param lastControl the last control above the buttons
* @return the newly created FormData object
*/ | Creats a default FormData object with the top / bottom / and left set (this is done to cut down on repetative code lines | createDefaultFormData | {
"repo_name": "yintaoxue/read-open-source-code",
"path": "kettle4.3/src/org/pentaho/di/ui/trans/step/BaseStepDialog.java",
"license": "apache-2.0",
"size": 32540
} | [
"org.eclipse.swt.layout.FormAttachment",
"org.eclipse.swt.layout.FormData",
"org.eclipse.swt.widgets.Button",
"org.eclipse.swt.widgets.Control"
] | import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Control; | import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,306,969 |
ConnectionDescription getDescription(); | ConnectionDescription getDescription(); | /**
* Gets the description of the connection.
*
* @return the connection description
*/ | Gets the description of the connection | getDescription | {
"repo_name": "rozza/mongo-java-driver",
"path": "driver-core/src/main/com/mongodb/internal/connection/Connection.java",
"license": "apache-2.0",
"size": 8403
} | [
"com.mongodb.connection.ConnectionDescription"
] | import com.mongodb.connection.ConnectionDescription; | import com.mongodb.connection.*; | [
"com.mongodb.connection"
] | com.mongodb.connection; | 2,319,504 |
public Identity getIdentity() throws TimeoutException, NotConnectedException {
ByteBuffer bb = ipcon.createRequestPacket((byte)8, FUNCTION_GET_IDENTITY, this);
byte[] response = sendRequest(bb.array());
bb = ByteBuffer.wrap(response, 8, response.length - 8);
bb.order(ByteOrder.LITTLE_ENDIAN);
Identity obj = new Identity();
obj.uid = IPConnection.string(bb, 8);
obj.connectedUid = IPConnection.string(bb, 8);
obj.position = (char)(bb.get());
for(int i = 0; i < 3; i++) {
obj.hardwareVersion[i] = IPConnection.unsignedByte(bb.get());
}
for(int i = 0; i < 3; i++) {
obj.firmwareVersion[i] = IPConnection.unsignedByte(bb.get());
}
obj.deviceIdentifier = IPConnection.unsignedShort(bb.getShort());
return obj;
} | Identity function() throws TimeoutException, NotConnectedException { ByteBuffer bb = ipcon.createRequestPacket((byte)8, FUNCTION_GET_IDENTITY, this); byte[] response = sendRequest(bb.array()); bb = ByteBuffer.wrap(response, 8, response.length - 8); bb.order(ByteOrder.LITTLE_ENDIAN); Identity obj = new Identity(); obj.uid = IPConnection.string(bb, 8); obj.connectedUid = IPConnection.string(bb, 8); obj.position = (char)(bb.get()); for(int i = 0; i < 3; i++) { obj.hardwareVersion[i] = IPConnection.unsignedByte(bb.get()); } for(int i = 0; i < 3; i++) { obj.firmwareVersion[i] = IPConnection.unsignedByte(bb.get()); } obj.deviceIdentifier = IPConnection.unsignedShort(bb.getShort()); return obj; } | /**
* Returns the UID, the UID where the Brick is connected to,
* the position, the hardware and firmware version as well as the
* device identifier.
*
* The position can be '0'-'8' (stack position).
*
* The device identifiers can be found :ref:`here <device_identifier>`.
*
* .. versionadded:: 2.0.0~(Firmware)
*/ | Returns the UID, the UID where the Brick is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be '0'-'8' (stack position). The device identifiers can be found :ref:`here `. .. versionadded:: 2.0.0~(Firmware) | getIdentity | {
"repo_name": "jaggr2/ch.bfh.fbi.mobiComp.17herz",
"path": "com.tinkerforge/src/com/tinkerforge/BrickIMU.java",
"license": "apache-2.0",
"size": 43495
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,639,532 |
public static void deleteOutput(Connection conn, Output output) throws SQLException {
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement("DELETE FROM outputs WHERE transaction_hash=?");
stmt.setString(1, output.getHash());
stmt.execute();
} finally {
if(stmt != null) stmt.close();
}
}
| static void function(Connection conn, Output output) throws SQLException { PreparedStatement stmt = null; try { stmt = conn.prepareStatement(STR); stmt.setString(1, output.getHash()); stmt.execute(); } finally { if(stmt != null) stmt.close(); } } | /**
* Delete up one specific Output
*
* @param conn
* @param output
* @throws SQLException
*/ | Delete up one specific Output | deleteOutput | {
"repo_name": "martindale/thundernetwork",
"path": "thunder-client/src/main/java/network/thunder/client/database/MySQLConnection.java",
"license": "agpl-3.0",
"size": 77132
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"network.thunder.client.database.objects.Output"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import network.thunder.client.database.objects.Output; | import java.sql.*; import network.thunder.client.database.objects.*; | [
"java.sql",
"network.thunder.client"
] | java.sql; network.thunder.client; | 1,161,148 |
public static PemX509Certificate valueOf(ByteBuf key) {
return new PemX509Certificate(key);
}
private final ByteBuf content;
private PemX509Certificate(ByteBuf content) {
this.content = requireNonNull(content, "content");
} | static PemX509Certificate function(ByteBuf key) { return new PemX509Certificate(key); } private final ByteBuf content; private PemX509Certificate(ByteBuf content) { this.content = requireNonNull(content, STR); } | /**
* Creates a {@link PemX509Certificate} from raw {@code ByteBuf}.
*
* ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value.
* No input validation is performed to validate it.
*/ | Creates a <code>PemX509Certificate</code> from raw ByteBuf. No input validation is performed to validate it | valueOf | {
"repo_name": "gerdriesselmann/netty",
"path": "handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java",
"license": "apache-2.0",
"size": 11636
} | [
"io.netty.buffer.ByteBuf",
"java.util.Objects"
] | import io.netty.buffer.ByteBuf; import java.util.Objects; | import io.netty.buffer.*; import java.util.*; | [
"io.netty.buffer",
"java.util"
] | io.netty.buffer; java.util; | 2,706,094 |
List<E> hits = new ArrayList<E>();
for (int i = 0; i < list.size(); i++) {
if (clazz.isInstance(list.get(i))) {
hits.add(list.get(i));
}
}
return hits;
} | List<E> hits = new ArrayList<E>(); for (int i = 0; i < list.size(); i++) { if (clazz.isInstance(list.get(i))) { hits.add(list.get(i)); } } return hits; } | /**
* Checks whether the given list contains an instance of the
* given class. If true, then a list containing the entries
* of the given list is returned. Otherwise, the list will be empty
*
* @param list The list to check for entries
* @param clazz The class to check for occurrence
*
* @return A list containing all hits found for the given class
*/ | Checks whether the given list contains an instance of the given class. If true, then a list containing the entries of the given list is returned. Otherwise, the list will be empty | getInstances | {
"repo_name": "p2p-sync/commons",
"path": "src/main/java/org/rmatil/sync/commons/list/Lists.java",
"license": "apache-2.0",
"size": 867
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,309,262 |
private void enable(MenuItem menuItem) {
menuItem.removeStyleName("okm-MenuItem-strike");
} | void function(MenuItem menuItem) { menuItem.removeStyleName(STR); } | /**
* Enables menu item
*
* @param menuItem The menu item
*/ | Enables menu item | enable | {
"repo_name": "Beau-M/document-management-system",
"path": "src/main/java/com/openkm/extension/frontend/client/widget/htmleditor/SubMenuHTMLEditor.java",
"license": "gpl-2.0",
"size": 3967
} | [
"com.google.gwt.user.client.ui.MenuItem"
] | import com.google.gwt.user.client.ui.MenuItem; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,993,351 |
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
public static ManageableHistoricalTimeSeries.Meta meta() {
return ManageableHistoricalTimeSeries.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(ManageableHistoricalTimeSeries.Meta.INSTANCE);
} | static ManageableHistoricalTimeSeries.Meta function() { return ManageableHistoricalTimeSeries.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ManageableHistoricalTimeSeries.Meta.INSTANCE); } | /**
* The meta-bean for {@code ManageableHistoricalTimeSeries}.
* @return the meta-bean, not null
*/ | The meta-bean for ManageableHistoricalTimeSeries | meta | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Master/src/main/java/com/opengamma/master/historicaltimeseries/ManageableHistoricalTimeSeries.java",
"license": "apache-2.0",
"size": 13449
} | [
"org.joda.beans.JodaBeanUtils"
] | import org.joda.beans.JodaBeanUtils; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 937,139 |
public String getToolTipText(int series, int item) {
String result = null;
if (series < getListCount()) {
List<String> tooltips = this.toolTipSeries.get(series);
if (tooltips != null) {
if (item < tooltips.size()) {
result = tooltips.get(item);
}
}
}
return result;
} | String function(int series, int item) { String result = null; if (series < getListCount()) { List<String> tooltips = this.toolTipSeries.get(series); if (tooltips != null) { if (item < tooltips.size()) { result = tooltips.get(item); } } } return result; } | /**
* Returns the tool tip text for an item.
*
* @param series the series index.
* @param item the item index.
*
* @return The tool tip text.
*/ | Returns the tool tip text for an item | getToolTipText | {
"repo_name": "akardapolov/ASH-Viewer",
"path": "jfreechart-fse/src/main/java/org/jfree/chart/labels/CustomXYToolTipGenerator.java",
"license": "gpl-3.0",
"size": 6191
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,511,446 |
public static void invalidateAllFrameBuffers (Application app) {
if (Gdx.graphics.getGL20() == null) return;
Array<FrameBuffer> bufferArray = buffers.get(app);
if (bufferArray == null) return;
for (int i = 0; i < bufferArray.size; i++) {
bufferArray.get(i).build();
}
}
| static void function (Application app) { if (Gdx.graphics.getGL20() == null) return; Array<FrameBuffer> bufferArray = buffers.get(app); if (bufferArray == null) return; for (int i = 0; i < bufferArray.size; i++) { bufferArray.get(i).build(); } } | /** Invalidates all frame buffers. This can be used when the OpenGL context is lost to rebuild all managed frame buffers. This
* assumes that the texture attached to this buffer has already been rebuild! Use with care. */ | Invalidates all frame buffers. This can be used when the OpenGL context is lost to rebuild all managed frame buffers. This | invalidateAllFrameBuffers | {
"repo_name": "ryoenji/libgdx",
"path": "gdx/src/com/badlogic/gdx/graphics/glutils/FrameBuffer.java",
"license": "apache-2.0",
"size": 11186
} | [
"com.badlogic.gdx.Application",
"com.badlogic.gdx.Gdx",
"com.badlogic.gdx.utils.Array"
] | import com.badlogic.gdx.Application; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Array; | import com.badlogic.gdx.*; import com.badlogic.gdx.utils.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 2,830,389 |
static byte[] toIntegerBytes(final BigInteger bigInt) {
int bitlen = bigInt.bitLength();
// round bitlen
bitlen = ((bitlen + 7) >> 3) << 3;
final byte[] bigBytes = bigInt.toByteArray();
if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) {
return bigBytes;
}
// set up params for copying everything but sign bit
int startSrc = 0;
int len = bigBytes.length;
// if bigInt is exactly byte-aligned, just skip signbit in copy
if ((bigInt.bitLength() % 8) == 0) {
startSrc = 1;
len--;
}
final int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec
final byte[] resizedBytes = new byte[bitlen / 8];
System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len);
return resizedBytes;
} | static byte[] toIntegerBytes(final BigInteger bigInt) { int bitlen = bigInt.bitLength(); bitlen = ((bitlen + 7) >> 3) << 3; final byte[] bigBytes = bigInt.toByteArray(); if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) { return bigBytes; } int startSrc = 0; int len = bigBytes.length; if ((bigInt.bitLength() % 8) == 0) { startSrc = 1; len--; } final int startDst = bitlen / 8 - len; final byte[] resizedBytes = new byte[bitlen / 8]; System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len); return resizedBytes; } | /**
* Returns a byte-array representation of a <code>BigInteger</code> without sign bit.
*
* @param bigInt
* <code>BigInteger</code> to be converted
* @return a byte array representation of the BigInteger parameter
*/ | Returns a byte-array representation of a <code>BigInteger</code> without sign bit | toIntegerBytes | {
"repo_name": "cloudera/cdk",
"path": "cdk-morphlines/cdk-morphlines-core/src/main/java/com/cloudera/cdk/morphline/shaded/org/apache/commons/codec/binary/binary/Base64.java",
"license": "apache-2.0",
"size": 33457
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 641,800 |
protected void setTo(Mail newMail, InternetAddress[] to, Mail originalMail) throws MessagingException {
if (to != null) {
newMail.getMessage().setRecipients(Message.RecipientType.TO, to);
if (isDebug) {
log("apparentlyTo set to: " + arrayToString(to));
}
}
} | void function(Mail newMail, InternetAddress[] to, Mail originalMail) throws MessagingException { if (to != null) { newMail.getMessage().setRecipients(Message.RecipientType.TO, to); if (isDebug) { log(STR + arrayToString(to)); } } } | /**
* Sets the "To:" header of <i>newMail</i> to <i>to</i>. If the requested
* value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.
*/ | Sets the "To:" header of newMail to to. If the requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method | setTo | {
"repo_name": "imatin/James",
"path": "mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java",
"license": "apache-2.0",
"size": 67386
} | [
"javax.mail.Message",
"javax.mail.MessagingException",
"javax.mail.internet.InternetAddress",
"org.apache.mailet.Mail"
] | import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; import org.apache.mailet.Mail; | import javax.mail.*; import javax.mail.internet.*; import org.apache.mailet.*; | [
"javax.mail",
"org.apache.mailet"
] | javax.mail; org.apache.mailet; | 1,728,240 |
public static Iterator<Byte> iterator(final DataInputStream self) {
return new Iterator<Byte>() {
Byte nextVal;
boolean nextMustRead = true;
boolean hasNext = true; | static Iterator<Byte> function(final DataInputStream self) { return new Iterator<Byte>() { Byte nextVal; boolean nextMustRead = true; boolean hasNext = true; | /**
* Standard iterator for a data input stream which iterates through the
* stream content a Byte at a time.
*
* @param self a DataInputStream object
* @return an Iterator for the DataInputStream
* @since 1.5.0
*/ | Standard iterator for a data input stream which iterates through the stream content a Byte at a time | iterator | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"java.io.DataInputStream",
"java.util.Iterator"
] | import java.io.DataInputStream; import java.util.Iterator; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,565,944 |
public Set<AllocationScenario> getAllocationScenarios() {
return allocationScenarios;
} | Set<AllocationScenario> function() { return allocationScenarios; } | /**
* Gets the allocation scenarios.
*
* @return the allocation scenarios
*/ | Gets the allocation scenarios | getAllocationScenarios | {
"repo_name": "AURIN/online-whatif",
"path": "src/main/java/au/org/aurin/wif/model/WifProject.java",
"license": "mit",
"size": 34306
} | [
"au.org.aurin.wif.model.allocation.AllocationScenario",
"java.util.Set"
] | import au.org.aurin.wif.model.allocation.AllocationScenario; import java.util.Set; | import au.org.aurin.wif.model.allocation.*; import java.util.*; | [
"au.org.aurin",
"java.util"
] | au.org.aurin; java.util; | 479,143 |
public int find(String what, int start) {
try {
ByteBuffer src = ByteBuffer.wrap(this.bytes,0,this.length);
ByteBuffer tgt = encode(what);
byte b = tgt.get();
src.position(start);
while (src.hasRemaining()) {
if (b == src.get()) { // matching first byte
src.mark(); // save position in loop
tgt.mark(); // save position in target
boolean found = true;
int pos = src.position()-1;
while (tgt.hasRemaining()) {
if (!src.hasRemaining()) { // src expired first
tgt.reset();
src.reset();
found = false;
break;
}
if (!(tgt.get() == src.get())) {
tgt.reset();
src.reset();
found = false;
break; // no match
}
}
if (found) return pos;
}
}
return -1; // not found
} catch (CharacterCodingException e) {
// can't get here
e.printStackTrace();
return -1;
}
} | int function(String what, int start) { try { ByteBuffer src = ByteBuffer.wrap(this.bytes,0,this.length); ByteBuffer tgt = encode(what); byte b = tgt.get(); src.position(start); while (src.hasRemaining()) { if (b == src.get()) { src.mark(); tgt.mark(); boolean found = true; int pos = src.position()-1; while (tgt.hasRemaining()) { if (!src.hasRemaining()) { tgt.reset(); src.reset(); found = false; break; } if (!(tgt.get() == src.get())) { tgt.reset(); src.reset(); found = false; break; } } if (found) return pos; } } return -1; } catch (CharacterCodingException e) { e.printStackTrace(); return -1; } } | /**
* Finds any occurence of <code>what</code> in the backing
* buffer, starting as position <code>start</code>. The starting
* position is measured in bytes and the return value is in
* terms of byte position in the buffer. The backing buffer is
* not converted to a string for this operation.
* @return byte position of the first occurence of the search
* string in the UTF-8 buffer or -1 if not found
*/ | Finds any occurence of <code>what</code> in the backing buffer, starting as position <code>start</code>. The starting position is measured in bytes and the return value is in terms of byte position in the buffer. The backing buffer is not converted to a string for this operation | find | {
"repo_name": "vierja/hadoop-per-mare",
"path": "src/core/org/apache/hadoop/io/Text.java",
"license": "apache-2.0",
"size": 19145
} | [
"java.nio.ByteBuffer",
"java.nio.charset.CharacterCodingException"
] | import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; | import java.nio.*; import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 1,263,045 |
@LogMessage(level = INFO)
@Message(id = 49, value = "%s starting")
void serverStarting(String prettyVersion); | @LogMessage(level = INFO) @Message(id = 49, value = STR) void serverStarting(String prettyVersion); | /**
* Logs an informational message indicating the server is starting.
*
* @param prettyVersion the server version.
*/ | Logs an informational message indicating the server is starting | serverStarting | {
"repo_name": "yersan/wildfly-core",
"path": "server/src/main/java/org/jboss/as/server/logging/ServerLogger.java",
"license": "lgpl-2.1",
"size": 69275
} | [
"org.jboss.logging.annotations.LogMessage",
"org.jboss.logging.annotations.Message"
] | import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message; | import org.jboss.logging.annotations.*; | [
"org.jboss.logging"
] | org.jboss.logging; | 1,882,011 |
public void addDictionary(Reader reader) {
try {
addDictionaryAux(reader);
} catch (IOException e) {
throw new GrokCompilationException(e);
} finally {
IOUtils.closeQuietly(reader);
}
} | void function(Reader reader) { try { addDictionaryAux(reader); } catch (IOException e) { throw new GrokCompilationException(e); } finally { IOUtils.closeQuietly(reader); } } | /**
* Adds a dictionary entry via a Reader object
*
* @param reader
*/ | Adds a dictionary entry via a Reader object | addDictionary | {
"repo_name": "kunickiaj/datacollector",
"path": "common/src/main/java/com/streamsets/pipeline/lib/parser/shaded/org/aicer/grok/dictionary/GrokDictionary.java",
"license": "apache-2.0",
"size": 9184
} | [
"com.streamsets.pipeline.lib.parser.shaded.org.aicer.grok.exception.GrokCompilationException",
"java.io.IOException",
"java.io.Reader",
"org.apache.commons.io.IOUtils"
] | import com.streamsets.pipeline.lib.parser.shaded.org.aicer.grok.exception.GrokCompilationException; import java.io.IOException; import java.io.Reader; import org.apache.commons.io.IOUtils; | import com.streamsets.pipeline.lib.parser.shaded.org.aicer.grok.exception.*; import java.io.*; import org.apache.commons.io.*; | [
"com.streamsets.pipeline",
"java.io",
"org.apache.commons"
] | com.streamsets.pipeline; java.io; org.apache.commons; | 1,362,195 |
LightwaveRfItemDirection getDirection(String itemName); | LightwaveRfItemDirection getDirection(String itemName); | /**
* Get the direction for the given itemName.
* @param itemName
* @return
*/ | Get the direction for the given itemName | getDirection | {
"repo_name": "robbyb67/openhab",
"path": "bundles/binding/org.openhab.binding.lightwaverf/src/main/java/org/openhab/binding/lightwaverf/LightwaveRfBindingProvider.java",
"license": "epl-1.0",
"size": 2158
} | [
"org.openhab.binding.lightwaverf.internal.LightwaveRfItemDirection"
] | import org.openhab.binding.lightwaverf.internal.LightwaveRfItemDirection; | import org.openhab.binding.lightwaverf.internal.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,597,685 |
public RepositoryTree getRepositoryTree() {
return tree;
}
public static final String REPOSITORY_BROWSER_DOCK_KEY = "repository_browser";
private final DockKey DOCK_KEY = new ResourceDockKey(REPOSITORY_BROWSER_DOCK_KEY);
{
DOCK_KEY.setDockGroup(MainFrame.DOCK_GROUP_ROOT);
}
| RepositoryTree function() { return tree; } public static final String REPOSITORY_BROWSER_DOCK_KEY = STR; private final DockKey DOCK_KEY = new ResourceDockKey(REPOSITORY_BROWSER_DOCK_KEY); { DOCK_KEY.setDockGroup(MainFrame.DOCK_GROUP_ROOT); } | /**
* Returns the {@link RepositoryTree} managed by this browser.
*
* @return the repository tree
* @since 7.0.0
*/ | Returns the <code>RepositoryTree</code> managed by this browser | getRepositoryTree | {
"repo_name": "boob-sbcm/3838438",
"path": "src/main/java/com/rapidminer/repository/gui/RepositoryBrowser.java",
"license": "agpl-3.0",
"size": 6385
} | [
"com.rapidminer.gui.MainFrame",
"com.rapidminer.gui.tools.ResourceDockKey",
"com.vlsolutions.swing.docking.DockKey"
] | import com.rapidminer.gui.MainFrame; import com.rapidminer.gui.tools.ResourceDockKey; import com.vlsolutions.swing.docking.DockKey; | import com.rapidminer.gui.*; import com.rapidminer.gui.tools.*; import com.vlsolutions.swing.docking.*; | [
"com.rapidminer.gui",
"com.vlsolutions.swing"
] | com.rapidminer.gui; com.vlsolutions.swing; | 1,927,055 |
static KnownFilesType fromFileKnown(TskData.FileKnown fileKnown) {
if (fileKnown == null) {
return null;
}
return Stream.of(KnownFilesType.values())
.filter((type) -> type.getFileKnown() == fileKnown)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unknown TskData.FileKnown type: " + fileKnown));
}
}
public enum Event {
INDEXING_DONE
} | static KnownFilesType fromFileKnown(TskData.FileKnown fileKnown) { if (fileKnown == null) { return null; } return Stream.of(KnownFilesType.values()) .filter((type) -> type.getFileKnown() == fileKnown) .findFirst() .orElseThrow(() -> new IllegalArgumentException(STR + fileKnown)); } } public enum Event { INDEXING_DONE } | /**
* Converts a TskData.FileKnown to the corresponding KnownFilesType.
*
* @param fileKnown The TskData.FileKnown type.
*
* @return The corresponding KnownFilesType.
*/ | Converts a TskData.FileKnown to the corresponding KnownFilesType | fromFileKnown | {
"repo_name": "eugene7646/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java",
"license": "apache-2.0",
"size": 72013
} | [
"java.util.stream.Stream",
"org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager",
"org.sleuthkit.datamodel.TskData"
] | import java.util.stream.Stream; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager; import org.sleuthkit.datamodel.TskData; | import java.util.stream.*; import org.sleuthkit.autopsy.modules.hashdatabase.*; import org.sleuthkit.datamodel.*; | [
"java.util",
"org.sleuthkit.autopsy",
"org.sleuthkit.datamodel"
] | java.util; org.sleuthkit.autopsy; org.sleuthkit.datamodel; | 627,068 |
public ArrayList<String> getHeaders(){
int i;
int j;
ArrayList<String> headers = new ArrayList<String>();
String currentHeader;
try{
for (i=0; i < msg.getRESPONSE().getORDER_OBSERVATIONReps(); i++){
for (j=0; j < msg.getRESPONSE().getORDER_OBSERVATION(i).getOBSERVATIONReps(); j++){
// only check the obx segment for a header if it is one that will be displayed
if (!getOBXName(i, j).equals("")){
currentHeader = getObservationHeader(i, j);
if (!headers.contains(currentHeader)){
logger.info("Adding header: '"+currentHeader+"' to list");
headers.add(currentHeader);
}
}
}
}
return(headers);
}catch(Exception e){
logger.error("Could not create header list", e);
return(null);
}
} | ArrayList<String> function(){ int i; int j; ArrayList<String> headers = new ArrayList<String>(); String currentHeader; try{ for (i=0; i < msg.getRESPONSE().getORDER_OBSERVATIONReps(); i++){ for (j=0; j < msg.getRESPONSE().getORDER_OBSERVATION(i).getOBSERVATIONReps(); j++){ if (!getOBXName(i, j).equals(STRAdding header: 'STR' to listSTRCould not create header list", e); return(null); } } | /**
* Retrieve the possible segment headers from the OBX fields
*/ | Retrieve the possible segment headers from the OBX fields | getHeaders | {
"repo_name": "scoophealth/oscar",
"path": "src/main/java/oscar/oscarLab/ca/all/parsers/CDLHandler.java",
"license": "gpl-2.0",
"size": 20503
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 668,182 |
@Override
public void setDueDate(java.util.Date dueDate) {
_todo.setDueDate(dueDate);
} | void function(java.util.Date dueDate) { _todo.setDueDate(dueDate); } | /**
* Sets the due date of this todo.
*
* @param dueDate the due date of this todo
*/ | Sets the due date of this todo | setDueDate | {
"repo_name": "gamerson/liferay-projects",
"path": "todo/todo-portlet-service/src/main/java/com/liferay/ide/projects/todo/model/TodoWrapper.java",
"license": "lgpl-2.1",
"size": 12847
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 849,834 |
public String scanNmtoken() throws IOException {
if (DEBUG_BUFFER) {
System.out.print("(scanNmtoken: ");
XMLEntityManager.print(fCurrentEntity);
System.out.println();
}
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true);
}
// scan nmtoken
int offset = fCurrentEntity.position;
while (XMLChar.isName(fCurrentEntity.ch[fCurrentEntity.position])) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
System.arraycopy(fCurrentEntity.ch, offset,
tmp, 0, length);
fCurrentEntity.ch = tmp;
}
else {
System.arraycopy(fCurrentEntity.ch, offset,
fCurrentEntity.ch, 0, length);
}
offset = 0;
if (load(length, false)) {
break;
}
}
}
int length = fCurrentEntity.position - offset;
fCurrentEntity.columnNumber += length;
// return nmtoken
String symbol = null;
if (length > 0) {
symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, offset, length);
}
if (DEBUG_BUFFER) {
System.out.print(")scanNmtoken: ");
XMLEntityManager.print(fCurrentEntity);
System.out.println(" -> "+String.valueOf(symbol));
}
return symbol;
} // scanNmtoken():String | String function() throws IOException { if (DEBUG_BUFFER) { System.out.print(STR); XMLEntityManager.print(fCurrentEntity); System.out.println(); } if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true); } int offset = fCurrentEntity.position; while (XMLChar.isName(fCurrentEntity.ch[fCurrentEntity.position])) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; if (length == fCurrentEntity.ch.length) { char[] tmp = new char[fCurrentEntity.ch.length << 1]; System.arraycopy(fCurrentEntity.ch, offset, tmp, 0, length); fCurrentEntity.ch = tmp; } else { System.arraycopy(fCurrentEntity.ch, offset, fCurrentEntity.ch, 0, length); } offset = 0; if (load(length, false)) { break; } } } int length = fCurrentEntity.position - offset; fCurrentEntity.columnNumber += length; String symbol = null; if (length > 0) { symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, offset, length); } if (DEBUG_BUFFER) { System.out.print(STR); XMLEntityManager.print(fCurrentEntity); System.out.println(STR+String.valueOf(symbol)); } return symbol; } | /**
* Returns a string matching the NMTOKEN production appearing immediately
* on the input as a symbol, or null if NMTOKEN Name string is present.
* <p>
* <strong>Note:</strong> The NMTOKEN characters are consumed.
* <p>
* <strong>Note:</strong> The string returned must be a symbol. The
* SymbolTable can be used for this purpose.
*
* @throws IOException Thrown if i/o error occurs.
* @throws EOFException Thrown on end of file.
*
* @see org.apache.xerces.util.SymbolTable
* @see org.apache.xerces.util.XMLChar#isName
*/ | Returns a string matching the NMTOKEN production appearing immediately on the input as a symbol, or null if NMTOKEN Name string is present. Note: The NMTOKEN characters are consumed. Note: The string returned must be a symbol. The SymbolTable can be used for this purpose | scanNmtoken | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/xerces/src/org/apache/xerces/impl/XMLEntityScanner.java",
"license": "gpl-2.0",
"size": 70493
} | [
"java.io.IOException",
"org.apache.xerces.util.XMLChar"
] | import java.io.IOException; import org.apache.xerces.util.XMLChar; | import java.io.*; import org.apache.xerces.util.*; | [
"java.io",
"org.apache.xerces"
] | java.io; org.apache.xerces; | 2,380,755 |
public void reset(String goal,
String search,
List<String> errors,
int useRetryCount)
{
goalWord = goal;
searchWord = search;
similarity = UNKNOWN;
try {
urlSafeGoal = URLEncoder.encode(goalWord, "UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException("Encoding failed for word: "
+ goalWord);
}
try {
urlSafeSearch =
URLEncoder.encode(searchWord, "UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException("Encoding failed for word: "
+ searchWord);
}
reset(errors, useRetryCount);
} | void function(String goal, String search, List<String> errors, int useRetryCount) { goalWord = goal; searchWord = search; similarity = UNKNOWN; try { urlSafeGoal = URLEncoder.encode(goalWord, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(STR + goalWord); } try { urlSafeSearch = URLEncoder.encode(searchWord, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(STR + searchWord); } reset(errors, useRetryCount); } | /**
* To allow an instance of this processor to act as a "singleton",
* the code that wishes to fetch a word-pair similarity using LSA@PARC
* should reset the parameters used for the fetch.
*
* The given words will be used in the URL to LSA@PARC.
*/ | To allow an instance of this processor to act as a "singleton", the code that wishes to fetch a word-pair similarity using LSA@PARC should reset the parameters used for the fetch. The given words will be used in the URL to LSA@PARC | reset | {
"repo_name": "cogtool/cogtool",
"path": "java/edu/cmu/cs/hcii/cogtool/model/LSASimilarity.java",
"license": "lgpl-2.1",
"size": 18260
} | [
"java.io.UnsupportedEncodingException",
"java.net.URLEncoder",
"java.util.List"
] | import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.List; | import java.io.*; import java.net.*; import java.util.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 2,568,512 |
return new EffectCharacter<Minion>() { | return new EffectCharacter<Minion>() { | /**
* Battlecry: Destroy the minions on either side of this minion and gain their Attack and Health.
*/ | Battlecry: Destroy the minions on either side of this minion and gain their Attack and Health | getBattlecryEffect | {
"repo_name": "relimited/HearthSim",
"path": "src/main/java/com/hearthsim/card/classic/minion/rare/VoidTerror.java",
"license": "mit",
"size": 1482
} | [
"com.hearthsim.card.minion.Minion",
"com.hearthsim.event.effect.EffectCharacter"
] | import com.hearthsim.card.minion.Minion; import com.hearthsim.event.effect.EffectCharacter; | import com.hearthsim.card.minion.*; import com.hearthsim.event.effect.*; | [
"com.hearthsim.card",
"com.hearthsim.event"
] | com.hearthsim.card; com.hearthsim.event; | 2,324,824 |
public static boolean writeFile(String filePath, InputStream stream, boolean append) {
return writeFile(filePath != null ? new File(filePath) : null, stream,
append);
} | static boolean function(String filePath, InputStream stream, boolean append) { return writeFile(filePath != null ? new File(filePath) : null, stream, append); } | /**
* write file
*
* @param filePath 路径
* @param stream the input stream
* @param append if <code>true</code>, then bytes will be written to the
* end
* of the file rather than the beginning
* @return return true
* FileOutputStream
*/ | write file | writeFile | {
"repo_name": "cskun/OpenNews",
"path": "lib-common/src/main/java/me/jinkun/common/utils/FileUtil.java",
"license": "apache-2.0",
"size": 29325
} | [
"java.io.File",
"java.io.InputStream"
] | import java.io.File; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 250,748 |
private Color getFillColor(Object annotationType, boolean temporary) {
return getColor(annotationType, temporary && fIsTemporaryAnnotationDiscolored ? 0.9 : 0.75);
} | Color function(Object annotationType, boolean temporary) { return getColor(annotationType, temporary && fIsTemporaryAnnotationDiscolored ? 0.9 : 0.75); } | /**
* Returns the fill color for the given annotation type and characteristics.
*
* @param annotationType the annotation type
* @param temporary <code>true</code> if for temporary annotations
* @return the fill color
*/ | Returns the fill color for the given annotation type and characteristics | getFillColor | {
"repo_name": "aptana/Pydev",
"path": "bundles/org.python.pydev.shared_ui/src_overview_ruler/org/python/pydev/overview_ruler/CopiedOverviewRuler.java",
"license": "epl-1.0",
"size": 46624
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,754,574 |
public void setNegativeItemLabelPosition(ItemLabelPosition position,
boolean notify);
| void function(ItemLabelPosition position, boolean notify); | /**
* Sets the item label position for negative values in ALL series and (if
* requested) sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param position the position (<code>null</code> permitted).
* @param notify notify registered listeners?
*
* @deprecated This method should no longer be used (as of version 1.0.6).
* It is sufficient to rely on
* {@link #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition,
* boolean)} and {@link #setBaseNegativeItemLabelPosition(
* ItemLabelPosition, boolean)}.
*/ | Sets the item label position for negative values in ALL series and (if requested) sends a <code>RendererChangeEvent</code> to all registered listeners | setNegativeItemLabelPosition | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/chart/renderer/xy/XYItemRenderer.java",
"license": "lgpl-3.0",
"size": 64436
} | [
"org.jfree.chart.labels.ItemLabelPosition"
] | import org.jfree.chart.labels.ItemLabelPosition; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,960,081 |
public static <T1, T2, R> Mono<R> zip(Mono<? extends T1> mono, Iterable<? extends T2> app,
BiFunction<? super T1, ? super T2, ? extends R> fn) {
return Mono.from(Future.of(mono.toFuture())
.zip(app, fn));
} | static <T1, T2, R> Mono<R> function(Mono<? extends T1> mono, Iterable<? extends T2> app, BiFunction<? super T1, ? super T2, ? extends R> fn) { return Mono.from(Future.of(mono.toFuture()) .zip(app, fn)); } | /**
* Combine the provided Mono with the first element (if present) in the provided Iterable using the provided BiFunction
*
* @param mono Mono to combine with an Iterable
* @param app Iterable to combine with a Mono
* @param fn Combining function
* @return Combined Mono
*/ | Combine the provided Mono with the first element (if present) in the provided Iterable using the provided BiFunction | zip | {
"repo_name": "aol/cyclops",
"path": "cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java",
"license": "apache-2.0",
"size": 13270
} | [
"java.util.function.BiFunction"
] | import java.util.function.BiFunction; | import java.util.function.*; | [
"java.util"
] | java.util; | 2,535,152 |
public static void render(JRExporter exporter, JasperPrint print, Writer writer)
throws JRException {
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, writer);
exporter.exportReport();
}
| static void function(JRExporter exporter, JasperPrint print, Writer writer) throws JRException { exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, writer); exporter.exportReport(); } | /**
* Render the supplied <code>JasperPrint</code> instance using the
* supplied <code>JRAbstractExporter</code> instance and write the results
* to the supplied <code>Writer</code>.
* <p>Make sure that the <code>JRAbstractExporter</code> implementation
* you supply is capable of writing to a <code>Writer</code>.
* @param exporter the <code>JRAbstractExporter</code> to use to render the report
* @param print the <code>JasperPrint</code> instance to render
* @param writer the <code>Writer</code> to write the result to
* @throws JRException if rendering failed
*/ | Render the supplied <code>JasperPrint</code> instance using the supplied <code>JRAbstractExporter</code> instance and write the results to the supplied <code>Writer</code>. Make sure that the <code>JRAbstractExporter</code> implementation you supply is capable of writing to a <code>Writer</code> | render | {
"repo_name": "besom/bbossgroups-mvn",
"path": "bboss_mvc/src/main/java/org/frameworkset/ui/jasperreports/JasperReportsUtils.java",
"license": "apache-2.0",
"size": 12844
} | [
"java.io.Writer",
"net.sf.jasperreports.engine.JRException",
"net.sf.jasperreports.engine.JRExporter",
"net.sf.jasperreports.engine.JRExporterParameter",
"net.sf.jasperreports.engine.JasperPrint"
] | import java.io.Writer; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporter; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperPrint; | import java.io.*; import net.sf.jasperreports.engine.*; | [
"java.io",
"net.sf.jasperreports"
] | java.io; net.sf.jasperreports; | 427,537 |
public String getValue (String name)
{
return getValue(names.indexOf(name));
}
////////////////////////////////////////////////////////////////////
// Internal state.
////////////////////////////////////////////////////////////////////
Vector names = new Vector();
Vector types = new Vector();
Vector values = new Vector();
} | String function (String name) { return getValue(names.indexOf(name)); } Vector names = new Vector(); Vector types = new Vector(); Vector values = new Vector(); } | /**
* Get the value of an attribute (by name).
*
* @param name The attribute name.
* @see org.xml.sax.AttributeList#getValue(java.lang.String)
*/ | Get the value of an attribute (by name) | getValue | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/org/xml/sax/helpers/AttributeListImpl.java",
"license": "apache-2.0",
"size": 9207
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,972,629 |
JScrollPane getPane(){
return pane;
}
| JScrollPane getPane(){ return pane; } | /**
* Gets the pane.
*
* @return the pane
*/ | Gets the pane | getPane | {
"repo_name": "spatialsimulator/XitoSBML",
"path": "src/main/java/jp/ac/keio/bio/fun/xitosbml/pane/SBaseTable.java",
"license": "apache-2.0",
"size": 5479
} | [
"javax.swing.JScrollPane"
] | import javax.swing.JScrollPane; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,888,255 |
@XmlElement(name = "body")
public byte[] getBody(); | @XmlElement(name = "body") byte[] function(); | /**
* Get the command input body
*
* @return
*/ | Get the command input body | getBody | {
"repo_name": "cbaerikebc/kapua",
"path": "service/device/command/api/src/main/java/org/eclipse/kapua/service/device/management/command/DeviceCommandInput.java",
"license": "epl-1.0",
"size": 3959
} | [
"javax.xml.bind.annotation.XmlElement"
] | import javax.xml.bind.annotation.XmlElement; | import javax.xml.bind.annotation.*; | [
"javax.xml"
] | javax.xml; | 1,472,411 |
@Nonnull Context send(@Nonnull StatusCode statusCode); | @Nonnull Context send(@Nonnull StatusCode statusCode); | /**
* Send an empty response with the given status code.
*
* @param statusCode Status code.
* @return This context.
*/ | Send an empty response with the given status code | send | {
"repo_name": "jooby-project/jooby",
"path": "jooby/src/main/java/io/jooby/Context.java",
"license": "apache-2.0",
"size": 41138
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,850,314 |
public static GrantAchievementEvent.TargetPlayer createGrantAchievementEventTargetPlayer(Game game, Cause cause, Text originalMessage, Text message, MessageSink originalSink, MessageSink sink, Achievement achievement, Player targetEntity) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("cause", cause);
values.put("originalMessage", originalMessage);
values.put("message", message);
values.put("originalSink", originalSink);
values.put("sink", sink);
values.put("achievement", achievement);
values.put("targetEntity", targetEntity);
return SpongeEventFactoryUtils.createEventImpl(GrantAchievementEvent.TargetPlayer.class, values);
} | static GrantAchievementEvent.TargetPlayer function(Game game, Cause cause, Text originalMessage, Text message, MessageSink originalSink, MessageSink sink, Achievement achievement, Player targetEntity) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("cause", cause); values.put(STR, originalMessage); values.put(STR, message); values.put(STR, originalSink); values.put("sink", sink); values.put(STR, achievement); values.put(STR, targetEntity); return SpongeEventFactoryUtils.createEventImpl(GrantAchievementEvent.TargetPlayer.class, values); } | /**
* AUTOMATICALLY GENERATED, DO NOT EDIT.
* Creates a new instance of
* {@link org.spongepowered.api.event.achievement.GrantAchievementEvent.TargetPlayer}.
*
* @param game The game
* @param cause The cause
* @param originalMessage The original message
* @param message The message
* @param originalSink The original sink
* @param sink The sink
* @param achievement The achievement
* @param targetEntity The target entity
* @return A new target player grant achievement event
*/ | AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.achievement.GrantAchievementEvent.TargetPlayer</code> | createGrantAchievementEventTargetPlayer | {
"repo_name": "jamierocks/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java",
"license": "mit",
"size": 196993
} | [
"com.google.common.collect.Maps",
"java.util.Map",
"org.spongepowered.api.Game",
"org.spongepowered.api.entity.living.player.Player",
"org.spongepowered.api.event.achievement.GrantAchievementEvent",
"org.spongepowered.api.event.cause.Cause",
"org.spongepowered.api.statistic.achievement.Achievement",
"org.spongepowered.api.text.Text",
"org.spongepowered.api.text.sink.MessageSink"
] | import com.google.common.collect.Maps; import java.util.Map; import org.spongepowered.api.Game; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.achievement.GrantAchievementEvent; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.statistic.achievement.Achievement; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.sink.MessageSink; | import com.google.common.collect.*; import java.util.*; import org.spongepowered.api.*; import org.spongepowered.api.entity.living.player.*; import org.spongepowered.api.event.achievement.*; import org.spongepowered.api.event.cause.*; import org.spongepowered.api.statistic.achievement.*; import org.spongepowered.api.text.*; import org.spongepowered.api.text.sink.*; | [
"com.google.common",
"java.util",
"org.spongepowered.api"
] | com.google.common; java.util; org.spongepowered.api; | 2,173,133 |
public boolean shouldExecute()
{
if (!this.mustUpdate)
{
if (this.entity.getAge() >= 100)
{
return false;
}
if (this.entity.getRNG().nextInt(this.executionChance) != 0)
{
return false;
}
}
Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);
if (vec3d == null)
{
return false;
}
else
{
this.xPosition = vec3d.xCoord;
this.yPosition = vec3d.yCoord;
this.zPosition = vec3d.zCoord;
this.mustUpdate = false;
return true;
}
} | boolean function() { if (!this.mustUpdate) { if (this.entity.getAge() >= 100) { return false; } if (this.entity.getRNG().nextInt(this.executionChance) != 0) { return false; } } Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7); if (vec3d == null) { return false; } else { this.xPosition = vec3d.xCoord; this.yPosition = vec3d.yCoord; this.zPosition = vec3d.zCoord; this.mustUpdate = false; return true; } } | /**
* Returns whether the EntityAIBase should begin execution.
*/ | Returns whether the EntityAIBase should begin execution | shouldExecute | {
"repo_name": "boredherobrine13/morefuelsmod-1.10",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/ai/EntityAIWander.java",
"license": "lgpl-2.1",
"size": 2278
} | [
"net.minecraft.util.math.Vec3d"
] | import net.minecraft.util.math.Vec3d; | import net.minecraft.util.math.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 997,477 |
public List<com.cellarhq.generated.tables.pojos.Category> fetchByBreweryDbLastUpdated(LocalDateTime... values) {
return fetch(Category.CATEGORY.BREWERY_DB_LAST_UPDATED, values);
} | List<com.cellarhq.generated.tables.pojos.Category> function(LocalDateTime... values) { return fetch(Category.CATEGORY.BREWERY_DB_LAST_UPDATED, values); } | /**
* Fetch records that have <code>brewery_db_last_updated IN (values)</code>
*/ | Fetch records that have <code>brewery_db_last_updated IN (values)</code> | fetchByBreweryDbLastUpdated | {
"repo_name": "CellarHQ/cellarhq.com",
"path": "model/src/main/generated/com/cellarhq/generated/tables/daos/CategoryDao.java",
"license": "mit",
"size": 7484
} | [
"com.cellarhq.generated.tables.Category",
"java.time.LocalDateTime",
"java.util.List"
] | import com.cellarhq.generated.tables.Category; import java.time.LocalDateTime; import java.util.List; | import com.cellarhq.generated.tables.*; import java.time.*; import java.util.*; | [
"com.cellarhq.generated",
"java.time",
"java.util"
] | com.cellarhq.generated; java.time; java.util; | 1,287,988 |
public void snowball(final Player player) {
Snowball snowball = player.launchProjectile(Snowball.class);
snowball.setVelocity(snowball.getVelocity().multiply(2));
snowball.setShooter(player);
}
| void function(final Player player) { Snowball snowball = player.launchProjectile(Snowball.class); snowball.setVelocity(snowball.getVelocity().multiply(2)); snowball.setShooter(player); } | /**
* Launches a pea (snowball) like in the game
* @param player the player who is launching the snowball
*/ | Launches a pea (snowball) like in the game | snowball | {
"repo_name": "Lactem/PvZ",
"path": "src/java/me/lactem/pvz/ability/PlantAbility.java",
"license": "mit",
"size": 5132
} | [
"org.bukkit.entity.Player",
"org.bukkit.entity.Snowball"
] | import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 598,601 |
void rootProject(Action<? super Project> action); | void rootProject(Action<? super Project> action); | /**
* Adds an action to execute against the root project of this build.
*
* If the root project is already available, the action
* is executed immediately. Otherwise, the action is executed when the root project becomes available.
*
* @param action The action to execute.
*/ | Adds an action to execute against the root project of this build. If the root project is already available, the action is executed immediately. Otherwise, the action is executed when the root project becomes available | rootProject | {
"repo_name": "HenryHarper/Acquire-Reboot",
"path": "gradle/src/core/org/gradle/api/invocation/Gradle.java",
"license": "mit",
"size": 9940
} | [
"org.gradle.api.Action",
"org.gradle.api.Project"
] | import org.gradle.api.Action; import org.gradle.api.Project; | import org.gradle.api.*; | [
"org.gradle.api"
] | org.gradle.api; | 2,601,368 |
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Get src and dest types from request code
int srcType = (requestCode / 16) - 1;
int destType = (requestCode % 16) - 1;
// If CAMERA
if (srcType == CAMERA) {
// If image available
if (resultCode == Activity.RESULT_OK) {
try {
this.processResultFromCamera(destType, intent);
} catch (IOException e) {
e.printStackTrace();
this.failPicture("Error capturing image.");
}
}
// If cancelled
else if (resultCode == Activity.RESULT_CANCELED) {
this.failPicture("Camera cancelled.");
}
// If something else
else {
this.failPicture("Did not complete!");
}
}
// If retrieving photo from library
else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
if (resultCode == Activity.RESULT_OK) {
this.processResultFromGallery(destType, intent);
}
else if (resultCode == Activity.RESULT_CANCELED) {
this.failPicture("Selection cancelled.");
}
else {
this.failPicture("Selection did not complete!");
}
}
//裁切图片完成 Add By ZhuShunqing
else if(requestCode == 1){
this.callbackContext.success(this.tmpfile);
}
} | void function(int requestCode, int resultCode, Intent intent) { int srcType = (requestCode / 16) - 1; int destType = (requestCode % 16) - 1; if (srcType == CAMERA) { if (resultCode == Activity.RESULT_OK) { try { this.processResultFromCamera(destType, intent); } catch (IOException e) { e.printStackTrace(); this.failPicture(STR); } } else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture(STR); } else { this.failPicture(STR); } } else if ((srcType == PHOTOLIBRARY) (srcType == SAVEDPHOTOALBUM)) { if (resultCode == Activity.RESULT_OK) { this.processResultFromGallery(destType, intent); } else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture(STR); } else { this.failPicture(STR); } } else if(requestCode == 1){ this.callbackContext.success(this.tmpfile); } } | /**
* Called when the camera view exits.
*
* @param requestCode The request code originally supplied to startActivityForResult(),
* allowing you to identify who this result came from.
* @param resultCode The integer result code returned by the child activity through its setResult().
* @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
*/ | Called when the camera view exits | onActivityResult | {
"repo_name": "zhushunqing/cordova-camera-android-crop-available",
"path": "src/android/CameraLauncher.java",
"license": "apache-2.0",
"size": 39069
} | [
"android.app.Activity",
"android.content.Intent",
"java.io.IOException"
] | import android.app.Activity; import android.content.Intent; import java.io.IOException; | import android.app.*; import android.content.*; import java.io.*; | [
"android.app",
"android.content",
"java.io"
] | android.app; android.content; java.io; | 1,213,197 |
EAttribute getTestIndentation_Semi(); | EAttribute getTestIndentation_Semi(); | /**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.parsetree.formatter.formattertestlanguage.TestIndentation#isSemi <em>Semi</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Semi</em>'.
* @see org.eclipse.xtext.parsetree.formatter.formattertestlanguage.TestIndentation#isSemi()
* @see #getTestIndentation()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclipse.xtext.parsetree.formatter.formattertestlanguage.TestIndentation#isSemi Semi</code>'. | getTestIndentation_Semi | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parsetree/formatter/formattertestlanguage/FormattertestlanguagePackage.java",
"license": "epl-1.0",
"size": 56203
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 37,254 |
protected void buildMetadataRenderers(Context context, Handler mainHandler,
@ExtensionRendererMode int extensionRendererMode, MetadataRenderer.Output output,
ArrayList<Renderer> out) {
out.add(new MetadataRenderer(output, mainHandler.getLooper()));
} | void function(Context context, Handler mainHandler, @ExtensionRendererMode int extensionRendererMode, MetadataRenderer.Output output, ArrayList<Renderer> out) { out.add(new MetadataRenderer(output, mainHandler.getLooper())); } | /**
* Builds metadata renderers for use by the player.
*
* @param context The {@link Context} associated with the player.
* @param mainHandler A handler associated with the main thread's looper.
* @param extensionRendererMode The extension renderer mode.
* @param output An output for the renderers.
* @param out An array to which the built renderers should be appended.
*/ | Builds metadata renderers for use by the player | buildMetadataRenderers | {
"repo_name": "YouKim/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java",
"license": "apache-2.0",
"size": 34834
} | [
"android.content.Context",
"android.os.Handler",
"com.google.android.exoplayer2.metadata.MetadataRenderer",
"java.util.ArrayList"
] | import android.content.Context; import android.os.Handler; import com.google.android.exoplayer2.metadata.MetadataRenderer; import java.util.ArrayList; | import android.content.*; import android.os.*; import com.google.android.exoplayer2.metadata.*; import java.util.*; | [
"android.content",
"android.os",
"com.google.android",
"java.util"
] | android.content; android.os; com.google.android; java.util; | 683,463 |
@Override
public DataSourcePropertiesInterface getDataConnectorProperties() {
return null;
} | DataSourcePropertiesInterface function() { return null; } | /**
* Gets the data connector properties.
*
* @return the data connector properties
*/ | Gets the data connector properties | getDataConnectorProperties | {
"repo_name": "robward-scisys/sldeditor",
"path": "modules/application/src/test/java/com/sldeditor/test/unit/ui/detail/config/FieldConfigDSPropertiesTest.java",
"license": "gpl-3.0",
"size": 21291
} | [
"com.sldeditor.common.DataSourcePropertiesInterface"
] | import com.sldeditor.common.DataSourcePropertiesInterface; | import com.sldeditor.common.*; | [
"com.sldeditor.common"
] | com.sldeditor.common; | 2,368,847 |
void advanceOrThrow(final Throwable attemptException, final BiFunction<Throwable, Throwable, Throwable> exceptionTransformer,
final BiPredicate<RetryState, Throwable> retryPredicate) throws Throwable {
doAdvanceOrThrow(attemptException, exceptionTransformer, retryPredicate, false);
} | void advanceOrThrow(final Throwable attemptException, final BiFunction<Throwable, Throwable, Throwable> exceptionTransformer, final BiPredicate<RetryState, Throwable> retryPredicate) throws Throwable { doAdvanceOrThrow(attemptException, exceptionTransformer, retryPredicate, false); } | /**
* This method is intended to be used by code that generally handles all {@link Throwable} types explicitly,
* which is usually asynchronous code.
*
* @see #advanceOrThrow(RuntimeException, BiFunction, BiPredicate)
*/ | This method is intended to be used by code that generally handles all <code>Throwable</code> types explicitly, which is usually asynchronous code | advanceOrThrow | {
"repo_name": "rozza/mongo-java-driver",
"path": "driver-core/src/main/com/mongodb/internal/async/function/RetryState.java",
"license": "apache-2.0",
"size": 17851
} | [
"java.util.function.BiFunction",
"java.util.function.BiPredicate"
] | import java.util.function.BiFunction; import java.util.function.BiPredicate; | import java.util.function.*; | [
"java.util"
] | java.util; | 91,288 |
public HttpResponse subscribeToAPI(SubscriptionRequest subscriptionRequest)
throws APIManagerIntegrationTestException {
//This method do the same functionality as subscribe(), except this method always returns the response object
//regardless of the response code. But subscribe() returns the response object only if the response code is
// 200 or else it will return an Exception.
try {
checkAuthentication();
return HTTPSClientUtils.doPost(new URL(backendURL +
"/store/site/blocks/subscription/subscription-add/ajax/subscription-add.jag")
, subscriptionRequest.generateRequestParameters(), requestHeaders);
} catch (Exception ex) {
throw new APIManagerIntegrationTestException("Exception when Subscribing to a API"
+ ". Error: " + ex.getMessage(), ex);
}
}
//
//
// public HttpResponse getAPIStorePageAsAnonymousUser(String storeTenantDomain) throws APIManagerIntegrationTestException {
// try {
// return HttpRequestUtil.doGet(
// backendURL + "store/?tenant=" + storeTenantDomain, requestHeaders);
// } catch (Exception ioE) {
// throw new APIManagerIntegrationTestException(
// "Exception when retrieve the API store page as anonymous user", ioE);
// }
// } | HttpResponse function(SubscriptionRequest subscriptionRequest) throws APIManagerIntegrationTestException { try { checkAuthentication(); return HTTPSClientUtils.doPost(new URL(backendURL + STR) , subscriptionRequest.generateRequestParameters(), requestHeaders); } catch (Exception ex) { throw new APIManagerIntegrationTestException(STR + STR + ex.getMessage(), ex); } } | /**
* Subscribe and API. This method return the response of the subscription server REST call.
*
* @param subscriptionRequest -SubscriptionRequest request instance with API subscription information.
* @return HttpResponse - Response f the subscription server REST call
* @throws APIManagerIntegrationTestException - Exception throws when check the Authentication and
* HTTPSClientUtils.doPost() method call.
*/ | Subscribe and API. This method return the response of the subscription server REST call | subscribeToAPI | {
"repo_name": "irhamiqbal/product-apim",
"path": "modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/clients/APIStoreRestClient.java",
"license": "apache-2.0",
"size": 54601
} | [
"org.wso2.am.integration.test.utils.APIManagerIntegrationTestException",
"org.wso2.am.integration.test.utils.bean.SubscriptionRequest",
"org.wso2.am.integration.test.utils.http.HTTPSClientUtils",
"org.wso2.carbon.automation.test.utils.http.client.HttpResponse"
] | import org.wso2.am.integration.test.utils.APIManagerIntegrationTestException; import org.wso2.am.integration.test.utils.bean.SubscriptionRequest; import org.wso2.am.integration.test.utils.http.HTTPSClientUtils; import org.wso2.carbon.automation.test.utils.http.client.HttpResponse; | import org.wso2.am.integration.test.utils.*; import org.wso2.am.integration.test.utils.bean.*; import org.wso2.am.integration.test.utils.http.*; import org.wso2.carbon.automation.test.utils.http.client.*; | [
"org.wso2.am",
"org.wso2.carbon"
] | org.wso2.am; org.wso2.carbon; | 106,395 |
Subsets and Splits