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 String getProperty(String property) {
Project currentProject = getProject();
if (currentProject != null) {
return currentProject.getProperty(property);
} else {
return properties.getProperty(property);
}
} | String function(String property) { Project currentProject = getProject(); if (currentProject != null) { return currentProject.getProperty(property); } else { return properties.getProperty(property); } } | /**
* Get Property
* @param property name
* @return The property value
*/ | Get Property | getProperty | {
"repo_name": "SourceStudyNotes/Tomcat8",
"path": "src/main/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java",
"license": "apache-2.0",
"size": 22357
} | [
"org.apache.tools.ant.Project"
] | import org.apache.tools.ant.Project; | import org.apache.tools.ant.*; | [
"org.apache.tools"
] | org.apache.tools; | 1,051,643 |
@Validate
private void start() throws ServletException, NamespaceException, Exception {
httpService.registerServlet(SERVLET_ALIAS, this, null, null);
LOG.info(getClass().getName() + "::Start");
} | void function() throws ServletException, NamespaceException, Exception { httpService.registerServlet(SERVLET_ALIAS, this, null, null); LOG.info(getClass().getName() + STR); } | /**
* Called on bundle startup.
*
* @throws NamespaceException
* if the registration fails because the alias is already in use
* @throws ServletException
* if the servlet's init method throws an exception,
* or the given servlet object has already been registered at a different alias
*/ | Called on bundle startup | start | {
"repo_name": "hnunner/osgi-servlet",
"path": "ipojo/instantiate/src/main/java/com/adviser/osgi/servlet/ipojo/instantiate/IpojoServletInstantiate.java",
"license": "apache-2.0",
"size": 2345
} | [
"javax.servlet.ServletException",
"org.osgi.service.http.NamespaceException"
] | import javax.servlet.ServletException; import org.osgi.service.http.NamespaceException; | import javax.servlet.*; import org.osgi.service.http.*; | [
"javax.servlet",
"org.osgi.service"
] | javax.servlet; org.osgi.service; | 1,704,141 |
public void addTags(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "network.add_tags";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
} | void function(Connection c, String value) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; Map response = c.dispatch(method_call, method_params); return; } | /**
* Add the given value to the tags field of the given network. If the value is already in that Set, then do nothing.
*
* @param value New value to add
*/ | Add the given value to the tags field of the given network. If the value is already in that Set, then do nothing | addTags | {
"repo_name": "mufaddalq/cloudstack-datera-driver",
"path": "deps/XenServerJava/src/com/xensource/xenapi/Network.java",
"license": "apache-2.0",
"size": 30009
} | [
"com.xensource.xenapi.Types",
"java.util.Map",
"org.apache.xmlrpc.XmlRpcException"
] | import com.xensource.xenapi.Types; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; | import com.xensource.xenapi.*; import java.util.*; import org.apache.xmlrpc.*; | [
"com.xensource.xenapi",
"java.util",
"org.apache.xmlrpc"
] | com.xensource.xenapi; java.util; org.apache.xmlrpc; | 2,336,341 |
@Indexable(type = IndexableType.REINDEX)
public Entitlement updateEntitlement(Entitlement entitlement, boolean merge)
throws SystemException {
entitlement.setNew(false);
return entitlementPersistence.update(entitlement, merge);
} | @Indexable(type = IndexableType.REINDEX) Entitlement function(Entitlement entitlement, boolean merge) throws SystemException { entitlement.setNew(false); return entitlementPersistence.update(entitlement, merge); } | /**
* Updates the entitlement in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
*
* @param entitlement the entitlement
* @param merge whether to merge the entitlement with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
* @return the entitlement that was updated
* @throws SystemException if a system exception occurred
*/ | Updates the entitlement in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners | updateEntitlement | {
"repo_name": "fraunhoferfokus/govapps",
"path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/base/EntitlementLocalServiceBaseImpl.java",
"license": "bsd-3-clause",
"size": 42460
} | [
"com.liferay.portal.kernel.exception.SystemException",
"com.liferay.portal.kernel.search.Indexable",
"com.liferay.portal.kernel.search.IndexableType",
"de.fraunhofer.fokus.movepla.model.Entitlement"
] | import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.search.Indexable; import com.liferay.portal.kernel.search.IndexableType; import de.fraunhofer.fokus.movepla.model.Entitlement; | import com.liferay.portal.kernel.exception.*; import com.liferay.portal.kernel.search.*; import de.fraunhofer.fokus.movepla.model.*; | [
"com.liferay.portal",
"de.fraunhofer.fokus"
] | com.liferay.portal; de.fraunhofer.fokus; | 2,476,669 |
private static void copyPerSnippetInfo(SnippetSheet snippetSheet,
SpdxDocument analysis, Map<String, SpdxFile> fileIdToFile) throws InvalidSPDXAnalysisException, SpreadsheetException {
int i = snippetSheet.getFirstDataRow();
SpdxSnippet snippet = snippetSheet.getSnippet(i, analysis.getDocumentContainer());
while (snippet != null) {
analysis.getDocumentContainer().addElement(snippet);
i = i + 1;
snippet = snippetSheet.getSnippet(i, analysis.getDocumentContainer());
}
} | static void function(SnippetSheet snippetSheet, SpdxDocument analysis, Map<String, SpdxFile> fileIdToFile) throws InvalidSPDXAnalysisException, SpreadsheetException { int i = snippetSheet.getFirstDataRow(); SpdxSnippet snippet = snippetSheet.getSnippet(i, analysis.getDocumentContainer()); while (snippet != null) { analysis.getDocumentContainer().addElement(snippet); i = i + 1; snippet = snippetSheet.getSnippet(i, analysis.getDocumentContainer()); } } | /**
* Copy snippet information from the spreadsheet to the analysis document
* @param snippetSheet
* @param analysis
* @param fileIdToFile
* @throws InvalidSPDXAnalysisException
* @throws SpreadsheetException
*/ | Copy snippet information from the spreadsheet to the analysis document | copyPerSnippetInfo | {
"repo_name": "spdx/tools",
"path": "src/org/spdx/tools/SpreadsheetToRDF.java",
"license": "apache-2.0",
"size": 15840
} | [
"java.util.Map",
"org.spdx.rdfparser.InvalidSPDXAnalysisException",
"org.spdx.rdfparser.model.SpdxDocument",
"org.spdx.rdfparser.model.SpdxFile",
"org.spdx.rdfparser.model.SpdxSnippet",
"org.spdx.spdxspreadsheet.SnippetSheet",
"org.spdx.spdxspreadsheet.SpreadsheetException"
] | import java.util.Map; import org.spdx.rdfparser.InvalidSPDXAnalysisException; import org.spdx.rdfparser.model.SpdxDocument; import org.spdx.rdfparser.model.SpdxFile; import org.spdx.rdfparser.model.SpdxSnippet; import org.spdx.spdxspreadsheet.SnippetSheet; import org.spdx.spdxspreadsheet.SpreadsheetException; | import java.util.*; import org.spdx.rdfparser.*; import org.spdx.rdfparser.model.*; import org.spdx.spdxspreadsheet.*; | [
"java.util",
"org.spdx.rdfparser",
"org.spdx.spdxspreadsheet"
] | java.util; org.spdx.rdfparser; org.spdx.spdxspreadsheet; | 2,421,463 |
public double checkMark(File stegoFile, File origSigFile) throws OpenStegoException
{
if(!this.plugin.getPurposes().contains(OpenStegoPlugin.Purpose.WATERMARKING))
{
throw new OpenStegoException(null, OpenStego.NAMESPACE, OpenStegoException.PLUGIN_DOES_NOT_SUPPORT_WM);
}
double correl = checkMark(CommonUtil.getFileBytes(stegoFile), stegoFile.getName(),
CommonUtil.getFileBytes(origSigFile));
if(Double.isNaN(correl))
{
correl = 0.0;
}
return correl;
}
| double function(File stegoFile, File origSigFile) throws OpenStegoException { if(!this.plugin.getPurposes().contains(OpenStegoPlugin.Purpose.WATERMARKING)) { throw new OpenStegoException(null, OpenStego.NAMESPACE, OpenStegoException.PLUGIN_DOES_NOT_SUPPORT_WM); } double correl = checkMark(CommonUtil.getFileBytes(stegoFile), stegoFile.getName(), CommonUtil.getFileBytes(origSigFile)); if(Double.isNaN(correl)) { correl = 0.0; } return correl; } | /**
* Method to check the correlation for the given image and the original signature (alternate API)
*
* @param stegoFile Stego file from which watermark needs to be extracted
* @param origSigFile Original signature file
* @return Correlation
* @throws OpenStegoException
*/ | Method to check the correlation for the given image and the original signature (alternate API) | checkMark | {
"repo_name": "seglo/openstego",
"path": "src/net/sourceforge/openstego/OpenStego.java",
"license": "gpl-2.0",
"size": 18801
} | [
"java.io.File",
"net.sourceforge.openstego.util.CommonUtil"
] | import java.io.File; import net.sourceforge.openstego.util.CommonUtil; | import java.io.*; import net.sourceforge.openstego.util.*; | [
"java.io",
"net.sourceforge.openstego"
] | java.io; net.sourceforge.openstego; | 1,763,484 |
void setZ(INDArray z); | void setZ(INDArray z); | /**
* set z (the solution ndarray)
* @param z
*/ | set z (the solution ndarray) | setZ | {
"repo_name": "smarthi/nd4j",
"path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/Op.java",
"license": "apache-2.0",
"size": 4862
} | [
"org.nd4j.linalg.api.ndarray.INDArray"
] | import org.nd4j.linalg.api.ndarray.INDArray; | import org.nd4j.linalg.api.ndarray.*; | [
"org.nd4j.linalg"
] | org.nd4j.linalg; | 1,559,537 |
private void handleSearchedWeatherData(List<WeatherData> results)
{
if ((null == results) || results.size() == 0 || null == results.get(0))
{
displayInformation("No Result Found");
return;
}
// retrieve the result and cache it.
WeatherData weatherData = results.get(0);
cacheWeatherData(weatherData);
displayWeatherData(weatherData);
} | void function(List<WeatherData> results) { if ((null == results) results.size() == 0 null == results.get(0)) { displayInformation(STR); return; } WeatherData weatherData = results.get(0); cacheWeatherData(weatherData); displayWeatherData(weatherData); } | /**
* Handle searched Weather Data from Sync / Async Service
*
* @param results
*/ | Handle searched Weather Data from Sync / Async Service | handleSearchedWeatherData | {
"repo_name": "marastu/Weather-Service-",
"path": "src/com/weatherservice/operations/WeatherOpImp.java",
"license": "mit",
"size": 11514
} | [
"com.weather.aidl.WeatherData",
"java.util.List"
] | import com.weather.aidl.WeatherData; import java.util.List; | import com.weather.aidl.*; import java.util.*; | [
"com.weather.aidl",
"java.util"
] | com.weather.aidl; java.util; | 388,062 |
void checkStatementEligibleForBatching(String sql) throws SQLException {
SqlCommand nativeCmd = null;
if (isEligibleForNativeParsing(sql))
nativeCmd = tryParseNative(sql);
if (nativeCmd != null) {
assert nativeCmd instanceof SqlSetStreamingCommand;
throw new SQLException("Streaming control commands must be executed explicitly - " +
"either via Statement.execute(String), or via using prepared statements.",
SqlStateCode.UNSUPPORTED_OPERATION);
}
} | void checkStatementEligibleForBatching(String sql) throws SQLException { SqlCommand nativeCmd = null; if (isEligibleForNativeParsing(sql)) nativeCmd = tryParseNative(sql); if (nativeCmd != null) { assert nativeCmd instanceof SqlSetStreamingCommand; throw new SQLException(STR + STR, SqlStateCode.UNSUPPORTED_OPERATION); } } | /**
* Check that we're not trying to add to connection's batch a native command (it should be executed explicitly).
* @param sql SQL command.
* @throws SQLException if there's an attempt to add a native command to JDBC batch.
*/ | Check that we're not trying to add to connection's batch a native command (it should be executed explicitly) | checkStatementEligibleForBatching | {
"repo_name": "amirakhmedov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java",
"license": "apache-2.0",
"size": 26957
} | [
"java.sql.SQLException",
"org.apache.ignite.internal.processors.odbc.SqlStateCode",
"org.apache.ignite.internal.sql.command.SqlCommand",
"org.apache.ignite.internal.sql.command.SqlSetStreamingCommand"
] | import java.sql.SQLException; import org.apache.ignite.internal.processors.odbc.SqlStateCode; import org.apache.ignite.internal.sql.command.SqlCommand; import org.apache.ignite.internal.sql.command.SqlSetStreamingCommand; | import java.sql.*; import org.apache.ignite.internal.processors.odbc.*; import org.apache.ignite.internal.sql.command.*; | [
"java.sql",
"org.apache.ignite"
] | java.sql; org.apache.ignite; | 2,386,539 |
public Set<GedcomIndividual> getChildrenOfIndividual(GedcomIndividual individual) {
return getChildrenOfIndividual(individual.getId());
}
| Set<GedcomIndividual> function(GedcomIndividual individual) { return getChildrenOfIndividual(individual.getId()); } | /**
*
*
* <b>Note:</b> Depends on the collection of information through {@link #buildFamilyRelations()}.
* Calls {@link #buildFamilyRelations()} before returning the
* result if any structures have been added or removed after the last call
* to {@link #buildFamilyRelations()}, thus calling this method repeatedly
* after adding/removing structures is very inefficient.
*
* @param individual
* @return
*/ | Note: Depends on the collection of information through <code>#buildFamilyRelations()</code>. Calls <code>#buildFamilyRelations()</code> before returning the result if any structures have been added or removed after the last call to <code>#buildFamilyRelations()</code>, thus calling this method repeatedly after adding/removing structures is very inefficient | getChildrenOfIndividual | {
"repo_name": "thnaeff/GedcomCreator",
"path": "src/main/java/ch/thn/gedcom/creator/GedcomCreatorStructureStorage.java",
"license": "apache-2.0",
"size": 30388
} | [
"ch.thn.gedcom.creator.structures.GedcomIndividual",
"java.util.Set"
] | import ch.thn.gedcom.creator.structures.GedcomIndividual; import java.util.Set; | import ch.thn.gedcom.creator.structures.*; import java.util.*; | [
"ch.thn.gedcom",
"java.util"
] | ch.thn.gedcom; java.util; | 514,772 |
protected void addComponent(XMLComponent component) {
// don't add a component more than once
if (fComponents.contains(component)) {
return;
}
fComponents.add(component);
addRecognizedParamsAndSetDefaults(component);
} // addComponent(XMLComponent) | void function(XMLComponent component) { if (fComponents.contains(component)) { return; } fComponents.add(component); addRecognizedParamsAndSetDefaults(component); } | /**
* Adds a component to the parser configuration. This method will
* also add all of the component's recognized features and properties
* to the list of default recognized features and properties.
*
* @param component The component to add.
*/ | Adds a component to the parser configuration. This method will also add all of the component's recognized features and properties to the list of default recognized features and properties | addComponent | {
"repo_name": "itgeeker/jdk",
"path": "src/com/sun/org/apache/xerces/internal/parsers/XML11NonValidatingConfiguration.java",
"license": "apache-2.0",
"size": 48061
} | [
"com.sun.org.apache.xerces.internal.xni.parser.XMLComponent"
] | import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; | import com.sun.org.apache.xerces.internal.xni.parser.*; | [
"com.sun.org"
] | com.sun.org; | 2,712,933 |
@Override
public void endPrefixMapping(String prefix) throws SAXException {
println("endPrefixMapping...\n" + "prefix: " + prefix);
} | void function(String prefix) throws SAXException { println(STR + STR + prefix); } | /**
* Write endPrefixMapping tag along with prefix to the file when meet
* endPrefixMapping event.
* @throws IOException error happen when writing file.
*/ | Write endPrefixMapping tag along with prefix to the file when meet endPrefixMapping event | endPrefixMapping | {
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java",
"license": "gpl-2.0",
"size": 8901
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 2,246,381 |
public ServiceSpecification serviceSpecification() {
return this.serviceSpecification;
} | ServiceSpecification function() { return this.serviceSpecification; } | /**
* Get the serviceSpecification property: Service specification.
*
* @return the serviceSpecification value.
*/ | Get the serviceSpecification property: Service specification | serviceSpecification | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/databoxedge/azure-resourcemanager-databoxedge/src/main/java/com/azure/resourcemanager/databoxedge/fluent/models/OperationInner.java",
"license": "mit",
"size": 3702
} | [
"com.azure.resourcemanager.databoxedge.models.ServiceSpecification"
] | import com.azure.resourcemanager.databoxedge.models.ServiceSpecification; | import com.azure.resourcemanager.databoxedge.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,211,278 |
public boolean hasPanelAccess(Panel panel, User user, DelfoiActionName actionName) {
if (panel == null) {
logger.warn("Panel was null when checking panel access");
return false;
}
if (user == null) {
logger.warn("User was null when checking panel access");
return false;
}
if (isSuperUser(user)) {
return true;
}
UserRole userRole = getPanelRole(user, panel);
if (userRole == null) {
return false;
}
DelfoiAction action = delfoiActionDAO.findByActionName(actionName.toString());
if (action == null) {
logger.info(String.format("ActionUtils.hasDelfoiAccess - undefined action: '%s'", actionName));
return false;
}
return hasPanelAccess(panel, action, userRole);
} | boolean function(Panel panel, User user, DelfoiActionName actionName) { if (panel == null) { logger.warn(STR); return false; } if (user == null) { logger.warn(STR); return false; } if (isSuperUser(user)) { return true; } UserRole userRole = getPanelRole(user, panel); if (userRole == null) { return false; } DelfoiAction action = delfoiActionDAO.findByActionName(actionName.toString()); if (action == null) { logger.info(String.format(STR, actionName)); return false; } return hasPanelAccess(panel, action, userRole); } | /**
* Returns whether user has required panel action access
*
* @param panel panel
* @param user user
* @param actionName action
* @return whether user role required action access
*/ | Returns whether user has required panel action access | hasPanelAccess | {
"repo_name": "Metatavu/edelphi",
"path": "rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java",
"license": "gpl-3.0",
"size": 5541
} | [
"fi.metatavu.edelphi.domainmodel.actions.DelfoiAction",
"fi.metatavu.edelphi.domainmodel.panels.Panel",
"fi.metatavu.edelphi.domainmodel.users.User",
"fi.metatavu.edelphi.domainmodel.users.UserRole"
] | import fi.metatavu.edelphi.domainmodel.actions.DelfoiAction; import fi.metatavu.edelphi.domainmodel.panels.Panel; import fi.metatavu.edelphi.domainmodel.users.User; import fi.metatavu.edelphi.domainmodel.users.UserRole; | import fi.metatavu.edelphi.domainmodel.actions.*; import fi.metatavu.edelphi.domainmodel.panels.*; import fi.metatavu.edelphi.domainmodel.users.*; | [
"fi.metatavu.edelphi"
] | fi.metatavu.edelphi; | 1,912,397 |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LABEL;
}
} // inner class AccessibleAWTLabel | AccessibleRole function() { return AccessibleRole.LABEL; } } | /**
* Get the role of this object.
*
* @return an instance of AccessibleRole describing the role of the object
* @see AccessibleRole
*/ | Get the role of this object | getAccessibleRole | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/java/awt/Label.java",
"license": "apache-2.0",
"size": 11881
} | [
"javax.accessibility.AccessibleRole"
] | import javax.accessibility.AccessibleRole; | import javax.accessibility.*; | [
"javax.accessibility"
] | javax.accessibility; | 2,433,848 |
@Authorized( { PrivilegeConstants.PURGE_PERSONS })
public void purgePerson(Person person) throws APIException;
| @Authorized( { PrivilegeConstants.PURGE_PERSONS }) void function(Person person) throws APIException; | /**
* Purges a person from the database (cannot be undone)
*
* @param person person to be purged from the database
* @throws APIException
* @should delete person from the database
*/ | Purges a person from the database (cannot be undone) | purgePerson | {
"repo_name": "Bhamni/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/PersonService.java",
"license": "mpl-2.0",
"size": 41991
} | [
"org.openmrs.Person",
"org.openmrs.annotation.Authorized",
"org.openmrs.util.PrivilegeConstants"
] | import org.openmrs.Person; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants; | import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*; | [
"org.openmrs",
"org.openmrs.annotation",
"org.openmrs.util"
] | org.openmrs; org.openmrs.annotation; org.openmrs.util; | 1,998,986 |
public UUID getCommandId() {
return Preconditions.checkNotNull(commandId);
} | UUID function() { return Preconditions.checkNotNull(commandId); } | /**
* Returns the UUID that Blaze uses to identify everything logged from the current build command.
* It's also used to invalidate Skyframe nodes that are specific to a certain invocation, such as
* the build info.
*/ | Returns the UUID that Blaze uses to identify everything logged from the current build command. It's also used to invalidate Skyframe nodes that are specific to a certain invocation, such as the build info | getCommandId | {
"repo_name": "spxtr/bazel",
"path": "src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java",
"license": "apache-2.0",
"size": 23235
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 452,380 |
public String getOutputFormatClassName() {
return getClass(
PAMapReduceFrameworkProperties
.getPropertyAsString(PAMapReduceFrameworkProperties.HADOOP_OUTPUT_FORMAT_CLASS_PROPERTY_NAME
.getKey()), TextOutputFormat.class).getName();
} | String function() { return getClass( PAMapReduceFrameworkProperties .getPropertyAsString(PAMapReduceFrameworkProperties.HADOOP_OUTPUT_FORMAT_CLASS_PROPERTY_NAME .getKey()), TextOutputFormat.class).getName(); } | /**
* Retrieve the {@link OutputFormat} class for the Hadoop job
*
* @return the {@link OutputFormat} class
*/ | Retrieve the <code>OutputFormat</code> class for the Hadoop job | getOutputFormatClassName | {
"repo_name": "acontes/scheduling",
"path": "src/scheduler/src/org/ow2/proactive/scheduler/ext/mapreduce/PAHadoopJobConfiguration.java",
"license": "agpl-3.0",
"size": 16286
} | [
"org.apache.hadoop.mapreduce.lib.output.TextOutputFormat"
] | import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; | import org.apache.hadoop.mapreduce.lib.output.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 243,453 |
public String getDefaultString(JaamSimModel simModel) {
if (defValue == null)
return "";
return defValue.toString();
} | String function(JaamSimModel simModel) { if (defValue == null) return ""; return defValue.toString(); } | /**
* Returns a string representing the default value for the input using the preferred units
* specified for the simulation model.
* @param simModel - simulation model
* @return string representing the default value
*/ | Returns a string representing the default value for the input using the preferred units specified for the simulation model | getDefaultString | {
"repo_name": "jaamsim/jaamsim",
"path": "src/main/java/com/jaamsim/input/Input.java",
"license": "apache-2.0",
"size": 63708
} | [
"com.jaamsim.basicsim.JaamSimModel"
] | import com.jaamsim.basicsim.JaamSimModel; | import com.jaamsim.basicsim.*; | [
"com.jaamsim.basicsim"
] | com.jaamsim.basicsim; | 334,841 |
public static <PROMISE extends ScriptObject> PROMISE IfAbruptRejectPromise(ExecutionContext cx,
ScriptException e, PromiseCapability<PROMISE> capability) {
capability.getReject().call(cx, UNDEFINED, e.getValue());
return capability.getPromise();
} | static <PROMISE extends ScriptObject> PROMISE function(ExecutionContext cx, ScriptException e, PromiseCapability<PROMISE> capability) { capability.getReject().call(cx, UNDEFINED, e.getValue()); return capability.getPromise(); } | /**
* 25.4.1.1.1 IfAbruptRejectPromise (value, capability)
*
* @param <PROMISE>
* the promise type
* @param cx
* the execution context
* @param e
* the script exception
* @param capability
* the promise capability record
* @return the promise capability
*/ | 25.4.1.1.1 IfAbruptRejectPromise (value, capability) | IfAbruptRejectPromise | {
"repo_name": "jugglinmike/es6draft",
"path": "src/main/java/com/github/anba/es6draft/runtime/objects/promise/PromiseCapability.java",
"license": "mit",
"size": 2784
} | [
"com.github.anba.es6draft.runtime.ExecutionContext",
"com.github.anba.es6draft.runtime.internal.ScriptException",
"com.github.anba.es6draft.runtime.types.ScriptObject"
] | import com.github.anba.es6draft.runtime.ExecutionContext; import com.github.anba.es6draft.runtime.internal.ScriptException; import com.github.anba.es6draft.runtime.types.ScriptObject; | import com.github.anba.es6draft.runtime.*; import com.github.anba.es6draft.runtime.internal.*; import com.github.anba.es6draft.runtime.types.*; | [
"com.github.anba"
] | com.github.anba; | 724,065 |
private Context getURLContext(String name) throws NamingException {
int schemeIndex = name.indexOf(":");
if (schemeIndex != -1) {
String scheme = name.substring(0, schemeIndex);
return NamingManager.getURLContext(scheme, env);
}
return null;
} | Context function(String name) throws NamingException { int schemeIndex = name.indexOf(":"); if (schemeIndex != -1) { String scheme = name.substring(0, schemeIndex); return NamingManager.getURLContext(scheme, env); } return null; } | /**
* Get the URL context given a name based on the scheme of the URL.
*
* @param name The name to get the URL context for
* @return The URL context for the name
* @throws NamingException
*/ | Get the URL context given a name based on the scheme of the URL | getURLContext | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/pseudo/internal/PseudoContext.java",
"license": "epl-1.0",
"size": 7318
} | [
"javax.naming.Context",
"javax.naming.NamingException",
"javax.naming.spi.NamingManager"
] | import javax.naming.Context; import javax.naming.NamingException; import javax.naming.spi.NamingManager; | import javax.naming.*; import javax.naming.spi.*; | [
"javax.naming"
] | javax.naming; | 979,751 |
public static <T> T findByType(CamelContext camelContext, Class<T> type) {
Set<T> set = camelContext.getRegistry().findByType(type);
if (set.size() == 1) {
return set.iterator().next();
}
return null;
} | static <T> T function(CamelContext camelContext, Class<T> type) { Set<T> set = camelContext.getRegistry().findByType(type); if (set.size() == 1) { return set.iterator().next(); } return null; } | /**
* Look up a bean of the give type in the {@link org.apache.camel.spi.Registry} on the
* {@link CamelContext} returning an instance if only one bean is present,
*/ | Look up a bean of the give type in the <code>org.apache.camel.spi.Registry</code> on the <code>CamelContext</code> returning an instance if only one bean is present | findByType | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java",
"license": "apache-2.0",
"size": 30027
} | [
"java.util.Set",
"org.apache.camel.CamelContext"
] | import java.util.Set; import org.apache.camel.CamelContext; | import java.util.*; import org.apache.camel.*; | [
"java.util",
"org.apache.camel"
] | java.util; org.apache.camel; | 1,477,833 |
private long handleResults(LocalReasoner reasoner, Context context)
throws IOException, InterruptedException {
long numOutput = 0;
if (reasoner.hasNewFacts()) {
for (Fact fact : reasoner.getFacts()) {
mout.write(getOutputName(fact), fact, NullWritable.get());
numOutput++;
if (debug) {
debugK.set("OUTPUT<" + reasoner.getNode().stringValue() + ">");
debugV.set(fact.explain(false));
mout.write(MRReasoningUtils.DEBUG_OUT, debugK, debugV);
}
}
}
if (reasoner.hasInconsistencies()) {
for (Derivation inconsistency : reasoner.getInconsistencies()) {
mout.write(getOutputName(inconsistency), inconsistency,
NullWritable.get());
numOutput++;
if (debug) {
debugK.set("OUTPUT<" + inconsistency.getNode().stringValue() + ">");
debugV.set(inconsistency.explain(false));
mout.write(MRReasoningUtils.DEBUG_OUT, debugK, debugV);
}
}
}
return numOutput;
}
} | long function(LocalReasoner reasoner, Context context) throws IOException, InterruptedException { long numOutput = 0; if (reasoner.hasNewFacts()) { for (Fact fact : reasoner.getFacts()) { mout.write(getOutputName(fact), fact, NullWritable.get()); numOutput++; if (debug) { debugK.set(STR + reasoner.getNode().stringValue() + ">"); debugV.set(fact.explain(false)); mout.write(MRReasoningUtils.DEBUG_OUT, debugK, debugV); } } } if (reasoner.hasInconsistencies()) { for (Derivation inconsistency : reasoner.getInconsistencies()) { mout.write(getOutputName(inconsistency), inconsistency, NullWritable.get()); numOutput++; if (debug) { debugK.set(STR + inconsistency.getNode().stringValue() + ">"); debugV.set(inconsistency.explain(false)); mout.write(MRReasoningUtils.DEBUG_OUT, debugK, debugV); } } } return numOutput; } } | /**
* Process any new results from a reasoner.
*/ | Process any new results from a reasoner | handleResults | {
"repo_name": "kchilton2/incubator-rya",
"path": "extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/mr/ForwardChain.java",
"license": "apache-2.0",
"size": 11560
} | [
"java.io.IOException",
"org.apache.hadoop.io.NullWritable",
"org.apache.rya.reasoning.Derivation",
"org.apache.rya.reasoning.Fact",
"org.apache.rya.reasoning.LocalReasoner"
] | import java.io.IOException; import org.apache.hadoop.io.NullWritable; import org.apache.rya.reasoning.Derivation; import org.apache.rya.reasoning.Fact; import org.apache.rya.reasoning.LocalReasoner; | import java.io.*; import org.apache.hadoop.io.*; import org.apache.rya.reasoning.*; | [
"java.io",
"org.apache.hadoop",
"org.apache.rya"
] | java.io; org.apache.hadoop; org.apache.rya; | 1,127,463 |
public void setSpotUnderlyingIdentifier(ExternalIdBean spotUnderlyingIdentifier) {
this._spotUnderlyingIdentifier = spotUnderlyingIdentifier;
} | void function(ExternalIdBean spotUnderlyingIdentifier) { this._spotUnderlyingIdentifier = spotUnderlyingIdentifier; } | /**
* Sets the spotUnderlyingIdentifier.
* @param spotUnderlyingIdentifier the new value of the property
*/ | Sets the spotUnderlyingIdentifier | setSpotUnderlyingIdentifier | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/equity/EquityVarianceSwapSecurityBean.java",
"license": "apache-2.0",
"size": 23690
} | [
"com.opengamma.masterdb.security.hibernate.ExternalIdBean"
] | import com.opengamma.masterdb.security.hibernate.ExternalIdBean; | import com.opengamma.masterdb.security.hibernate.*; | [
"com.opengamma.masterdb"
] | com.opengamma.masterdb; | 747,288 |
public void operateOnCreateNewMeetingWorkspace(Ldtp l, String sharePointPath, String siteName, String location, String userName, String password, boolean withSubject, boolean clickRemove)
{
logger.info("Start creating new meeting workspace");
Ldtp security = new Ldtp("Windows Security");
l.click("btnMeeting");
// set focus on new window
String windowNameUntitled = waitForWindow("Untitled");
Ldtp l1 = new Ldtp(windowNameUntitled);
l.activateWindow(windowNameUntitled);
l1.click("btnMeetingWorkspace");
l1.click("hlnkChangesettings");
l1.waitTime(2);
l1.selectItem("cboWebsiteDropdown", "Other...");
String windowNameServer = waitForWindow("Other Workspace Server");
Ldtp l2 = new Ldtp(windowNameServer);
l.activateWindow(windowNameServer);
l2.deleteText("txtServerTextbox", 0);
l2.enterString("txtServerTextbox", sharePointPath);
l2.click("btnOK");
l2.waitTime(3);
operateOnSecurity(security, userName, password);
l1.click("chkAlldayevent");
windowNameUntitled = waitForWindow("Untitled");
Ldtp l3 = new Ldtp(windowNameUntitled);
l3.activateWindow(windowNameUntitled);
l3.click("btnOK");
if (withSubject == true)
{
l3.enterString("txtLocation", location);
l3.enterString("txtSubject", siteName);
}
else
{
l3.enterString("txtLocation", location);
}
if (withSubject == true)
{
logger.info("Creating the event");
l3.click("btnCreate");
l3.waitTime(4);
// first verification
operateOnSecurity(security, userName, password);
// second verification
operateOnSecurity(security, userName, password);
if (clickRemove == true)
{
String forRemove = waitForWindow(siteName);
Ldtp remove = new Ldtp(forRemove);
remove.activateWindow(forRemove);
remove.doubleClick("btnRemove");
String message = waitForWindow("Microsoft Outlook");
Ldtp l_error = new Ldtp(message);
l_error.click("btnYes");
}
}
else
{
// Your attempt to create a Meeting Workspace or link to an existing one can't be completed.
// Reason: Site name is not specified. Please fill up subject field.
logger.info("Error when subject is not filled");
l3.click("btnCreate");
l3.waitTime(4);
operateOnSecurity(security, userName, password);
}
}
| void function(Ldtp l, String sharePointPath, String siteName, String location, String userName, String password, boolean withSubject, boolean clickRemove) { logger.info(STR); Ldtp security = new Ldtp(STR); l.click(STR); String windowNameUntitled = waitForWindow(STR); Ldtp l1 = new Ldtp(windowNameUntitled); l.activateWindow(windowNameUntitled); l1.click(STR); l1.click(STR); l1.waitTime(2); l1.selectItem(STR, STR); String windowNameServer = waitForWindow(STR); Ldtp l2 = new Ldtp(windowNameServer); l.activateWindow(windowNameServer); l2.deleteText(STR, 0); l2.enterString(STR, sharePointPath); l2.click("btnOK"); l2.waitTime(3); operateOnSecurity(security, userName, password); l1.click(STR); windowNameUntitled = waitForWindow(STR); Ldtp l3 = new Ldtp(windowNameUntitled); l3.activateWindow(windowNameUntitled); l3.click("btnOK"); if (withSubject == true) { l3.enterString(STR, location); l3.enterString(STR, siteName); } else { l3.enterString(STR, location); } if (withSubject == true) { logger.info(STR); l3.click(STR); l3.waitTime(4); operateOnSecurity(security, userName, password); operateOnSecurity(security, userName, password); if (clickRemove == true) { String forRemove = waitForWindow(siteName); Ldtp remove = new Ldtp(forRemove); remove.activateWindow(forRemove); remove.doubleClick(STR); String message = waitForWindow(STR); Ldtp l_error = new Ldtp(message); l_error.click(STR); } } else { logger.info(STR); l3.click(STR); l3.waitTime(4); operateOnSecurity(security, userName, password); } } | /**
* This method creates a new meeting workspace in Outlook 2010
*
* @param sharePointPath - path for SharePoint
* @param siteName - name of the site
* @param location - location for the meeting
* @param userName
* @param password
*/ | This method creates a new meeting workspace in Outlook 2010 | operateOnCreateNewMeetingWorkspace | {
"repo_name": "Alfresco/community-edition",
"path": "projects/office-application/src/main/java/org/alfresco/office/application/MicorsoftOffice2010.java",
"license": "lgpl-3.0",
"size": 24894
} | [
"com.cobra.ldtp.Ldtp"
] | import com.cobra.ldtp.Ldtp; | import com.cobra.ldtp.*; | [
"com.cobra.ldtp"
] | com.cobra.ldtp; | 2,272,297 |
LOG.debug("Security request made");
ServletConfig config = servlet.getServletConfig();
ServletContext context = config.getServletContext();
// Application wide preferences
ApplicationPrefs prefs = (ApplicationPrefs) context.getAttribute(Constants.APPLICATION_PREFS);
// Get the intended action, if going to the login module, then let it proceed
String s = request.getServletPath();
int slash = s.lastIndexOf("/");
s = s.substring(slash + 1);
// If not setup then go to setup
if (!s.startsWith("Setup") && !prefs.isConfigured()) {
return "NotSetupError";
}
// External calls
if (s.startsWith("Service")) {
return null;
}
// Set the layout relevant to this request
if ("text".equals(request.getParameter("out")) ||
"text".equals(request.getAttribute("out"))) {
// do not use a layout, send the raw output
} else if ("true".equals(request.getParameter(Constants.REQUEST_PARAM_POPUP))) {
request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, "/layout1.jsp");
} else if ("true".equals(request.getParameter(Constants.REQUEST_PARAM_STYLE))) {
request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, "/layout1.jsp");
} else {
request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, context.getAttribute(Constants.REQUEST_TEMPLATE));
}
// If going to Setup then allow
if (s.startsWith("Setup")) {
request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, "/layout1.jsp");
return null;
}
// If going to Upgrade then allow
if (s.startsWith("Upgrade")) {
request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, "/layout1.jsp");
return null;
}
// Detect mobile users and mobile formatting
// ClientType clientType = (ClientType) request.getSession().getAttribute(Constants.SESSION_CLIENT_TYPE);
// @todo introduce when mobile is implemented
// if (clientType.getMobile()) {
// request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, "/layoutMobile.jsp");
// }
// URL forwarding for MVC requests (*.do, etc.)
String requestedPath = (String) request.getAttribute("requestedURL");
if (requestedPath == null && "GET".equals(request.getMethod()) && request.getParameter("redirectTo") == null) {
// Save the requestURI to be used downstream
String contextPath = request.getContextPath();
String uri = request.getRequestURI();
String queryString = request.getQueryString();
requestedPath = uri.substring(contextPath.length()) + (queryString == null ? "" : "?" + queryString);
LOG.debug("Requested path: " + requestedPath);
request.setAttribute("requestedURL", requestedPath);
// It's important the user is using the correct URL for accessing content;
// The portal has it's own redirect scheme, this is a general catch all
if (!s.startsWith("Portal") && !uri.contains(".shtml") && prefs.has(ApplicationPrefs.WEB_DOMAIN_NAME)) {
// Check to see if an old domain name is used
PortalBean bean = new PortalBean(request);
String expectedDomainName = prefs.get(ApplicationPrefs.WEB_DOMAIN_NAME);
if (expectedDomainName != null && requestedPath != null &&
!"127.0.0.1".equals(bean.getServerName()) &&
!"127.0.0.1".equals(expectedDomainName) &&
!"localhost".equals(bean.getServerName()) &&
!"localhost".equals(expectedDomainName) &&
!bean.getServerName().equals(expectedDomainName) &&
!bean.getServerName().startsWith("10.") &&
!bean.getServerName().startsWith("172.") &&
!bean.getServerName().startsWith("192.")) {
if (uri != null && !uri.substring(1).equals(prefs.get("PORTAL.INDEX"))) {
String newUrl = URLFactory.createURL(prefs.getPrefs()) + requestedPath;
request.setAttribute("redirectTo", newUrl);
LOG.debug("redirectTo: " + newUrl);
request.removeAttribute(Constants.REQUEST_PAGE_LAYOUT);
return "Redirect301";
}
}
}
}
// Version check
if (!s.startsWith("Login") && ApplicationVersion.isOutOfDate(prefs)) {
return "UpgradeCheck";
}
// Get the user object from the Session Validation...
if (sessionValidator == null) {
sessionValidator = SessionValidatorFactory.getInstance().getSessionValidator(servlet.getServletConfig().getServletContext(), request);
LOG.debug("Found sessionValidator? " + (sessionValidator != null));
}
// Check cookie for user's previous location info
SearchBean searchBean = (SearchBean) request.getSession().getAttribute(Constants.SESSION_SEARCH_BEAN);
if (searchBean == null) {
String searchLocation = CookieUtils.getCookieValue(request, Constants.COOKIE_USER_SEARCH_LOCATION);
if (searchLocation != null) {
LOG.debug("Setting search location from cookie: " + searchLocation);
searchBean = new SearchBean();
searchBean.setLocation(searchLocation);
request.getSession().setAttribute(Constants.SESSION_SEARCH_BEAN, searchBean);
}
}
// Continue with session creation...
User userSession = sessionValidator.validateSession(context, request, response);
ConnectionElement ceSession = (ConnectionElement) request.getSession().getAttribute(Constants.SESSION_CONNECTION_ELEMENT);
// The user is going to the portal so get them guest credentials if they need them
if ("true".equals(prefs.get("PORTAL")) ||
s.startsWith("Register") ||
s.startsWith("ResetPassword") ||
s.startsWith("LoginAccept") ||
s.startsWith("LoginReject") ||
s.startsWith("Search") ||
s.startsWith("ContactUs")) {
if (userSession == null || ceSession == null) {
// Allow portal mode to create a default session with guest capabilities
userSession = UserUtils.createGuestUser();
request.getSession().setAttribute(Constants.SESSION_USER, userSession);
// Give them a connection element
ceSession = new ConnectionElement();
ceSession.setDriver(prefs.get("SITE.DRIVER"));
ceSession.setUrl(prefs.get("SITE.URL"));
ceSession.setUsername(prefs.get("SITE.USER"));
ceSession.setPassword(prefs.get("SITE.PASSWORD"));
request.getSession().setAttribute(Constants.SESSION_CONNECTION_ELEMENT, ceSession);
}
// Make sure SSL is being used for this connection
if (userSession.getId() > 0 && "true".equals(prefs.get("SSL")) && !"https".equals(request.getScheme())) {
LOG.info("Redirecting to..." + requestedPath);
request.setAttribute("redirectTo", "https://" + request.getServerName() + request.getContextPath() + requestedPath);
request.removeAttribute(Constants.REQUEST_PAGE_LAYOUT);
return "Redirect301";
}
// Generate global items
Connection db = null;
try {
db = getConnection(context, request);
// TODO: Implement cache since every hit needs this list
if (db != null) {
// Load the project languages
WebSiteLanguageList webSiteLanguageList = new WebSiteLanguageList();
webSiteLanguageList.setEnabled(Constants.TRUE);
webSiteLanguageList.buildList(db);
// If an admin of a language, enable it...
webSiteLanguageList.add(userSession.getWebSiteLanguageList());
request.setAttribute("webSiteLanguageList", webSiteLanguageList);
// Load the menu list
ProjectList menu = new ProjectList();
PagedListInfo menuListInfo = new PagedListInfo();
menuListInfo.setColumnToSortBy("p.portal_default desc, p.level asc, p.title asc");
menuListInfo.setItemsPerPage(-1);
menu.setPagedListInfo(menuListInfo);
menu.setIncludeGuestProjects(false);
menu.setPortalState(Constants.TRUE);
menu.setOpenProjectsOnly(true);
menu.setApprovedOnly(true);
menu.setBuildLink(true);
menu.setLanguageId(webSiteLanguageList.getLanguageId(request));
menu.buildList(db);
request.setAttribute("menuList", menu);
// Load the main profile to use throughout
Project mainProfile = ProjectUtils.loadProject(prefs.get("MAIN_PROFILE"));
request.setAttribute(Constants.REQUEST_MAIN_PROFILE, mainProfile);
// Load the project categories for search and tab menus
ProjectCategoryList categoryList = new ProjectCategoryList();
categoryList.setEnabled(Constants.TRUE);
categoryList.setTopLevelOnly(true);
categoryList.buildList(db);
request.setAttribute(Constants.REQUEST_TAB_CATEGORY_LIST, categoryList);
// Determine the tab that needs to be highlighted
int chosenTabId = -1;
if (requestedPath != null) {
String chosenCategory = null;
String chosenTab = null;
if (requestedPath.length() > 0) {
chosenTab = requestedPath.substring(1);
}
LOG.debug("chosenTab? " + chosenTab);
if (chosenTab == null || "".equals(chosenTab)) {
LOG.debug("Setting tab to Home");
chosenTab = "home.shtml";
} else {
boolean foundChosenTab = false;
for (ProjectCategory projectCategory : categoryList) {
String categoryName = projectCategory.getDescription();
String normalizedCategoryTab = projectCategory.getNormalizedCategoryName().concat(".shtml");
if (chosenTab.startsWith(normalizedCategoryTab)) {
foundChosenTab = true;
chosenCategory = categoryName;
chosenTabId = projectCategory.getId();
LOG.debug("found: " + chosenCategory);
}
}
if (!foundChosenTab) {
LOG.debug("No tab to highlight");
chosenTab = "none";
}
}
request.setAttribute("chosenTab", chosenTab);
request.setAttribute("chosenCategory", chosenCategory);
}
// Go through the tabs and remove the ones the user shouldn't see, also check permission
if (!userSession.isLoggedIn()) {
boolean allowed = true;
Iterator i = categoryList.iterator();
while (i.hasNext()) {
ProjectCategory projectCategory = (ProjectCategory) i.next();
if (projectCategory.getSensitive()) {
if (chosenTabId == projectCategory.getId()) {
allowed = false;
}
i.remove();
}
}
if (!allowed) {
// Redirect to the login, perhaps the page would exist then
String newUrl = URLFactory.createURL(prefs.getPrefs()) + "/login?redirectTo=" + requestedPath;
request.setAttribute("redirectTo", newUrl);
LOG.debug("redirectTo: " + newUrl);
request.removeAttribute(Constants.REQUEST_PAGE_LAYOUT);
return "Redirect301";
}
}
// Category drop-down for search
HtmlSelect thisSelect = categoryList.getHtmlSelect();
thisSelect.addItem(-1, prefs.get("TITLE"), 0);
request.setAttribute(Constants.REQUEST_MENU_CATEGORY_LIST, thisSelect);
}
} catch (Exception e) {
LOG.error("Global items error", e);
} finally {
this.freeConnection(context, db);
}
}
// The user is not going to login, so verify login
if (!s.startsWith("Login")) {
if (userSession == null || ceSession == null) {
// boot them off now
LOG.debug("Security failed.");
LoginBean failedSession = new LoginBean();
failedSession.addError("actionError", "* Please login, your session has expired");
failedSession.checkURL(request);
request.setAttribute("LoginBean", failedSession);
request.removeAttribute(Constants.REQUEST_PAGE_LAYOUT);
return "SecurityCheck";
} else {
// The user should have a valid login now, so let them proceed
LOG.debug("Security passed: " + userSession.getId() + " (" + userSession.getUsername() + ")");
}
}
// Generate user's global items
if (userSession != null && userSession.getId() > 0) {
Connection db = null;
try {
db = getConnection(context, request);
// TODO: Implement cache since every hit needs this list
if (db != null) {
// A map for global alerts
ArrayList<String> alerts = new ArrayList<String>();
request.setAttribute(Constants.REQUEST_GLOBAL_ALERTS, alerts);
// Check to see if the application is configured...
if (userSession.getAccessAdmin()) {
String url = URLFactory.createURL(prefs.getPrefs());
if (url == null) {
alerts.add("The application configuration requires that the URL properties are updated. Store <strong>" + RequestUtils.getAbsoluteServerUrl(request) + "</strong>? <a href=\"" + RequestUtils.getAbsoluteServerUrl(request) + "/AdminUsage.do?command=StoreURL\">Save Changes</a>");
} else if (!url.equals(RequestUtils.getAbsoluteServerUrl(request))) {
alerts.add("There is a configuration mismatch -- expected: <strong>" + RequestUtils.getAbsoluteServerUrl(request) + "</strong> but the configuration has <strong><a href=\"" + url + "\">" + url + "</a></strong> <a href=\"" + RequestUtils.getAbsoluteServerUrl(request) + "/AdminUsage.do?command=StoreURL\">Save Changes</a>");
}
}
// Check the # of invitations
int invitationCount = InvitationList.queryCount(db, userSession.getId(), userSession.getProfileProjectId());
request.setAttribute(Constants.REQUEST_INVITATION_COUNT, String.valueOf(invitationCount));
// Check the # of private messages
int newMailCount = PrivateMessageList.queryUnreadCountForUser(db, userSession.getId());
request.setAttribute(Constants.REQUEST_PRIVATE_MESSAGE_COUNT, String.valueOf(newMailCount));
// NOTE: removed because not currently used
// Check the number of what's new
// int whatsNewCount = ProjectUtils.queryWhatsNewCount(db, userSession.getId());
// request.setAttribute(Constants.REQUEST_WHATS_NEW_COUNT, String.valueOf(whatsNewCount));
// Check the number of assignments
// int whatsAssignedCount = ProjectUtils.queryWhatsAssignedCount(db, userSession.getId());
// request.setAttribute(Constants.REQUEST_WHATS_ASSIGNED_COUNT, String.valueOf(whatsAssignedCount));
// int projectCount = ProjectUtils.queryMyProjectCount(db, userSession.getId());
// request.setAttribute(Constants.REQUEST_MY_PROJECT_COUNT, String.valueOf(projectCount));
}
} catch (Exception e) {
LOG.error("User's global items error", e);
} finally {
this.freeConnection(context, db);
}
}
return null;
} | LOG.debug(STR); ServletConfig config = servlet.getServletConfig(); ServletContext context = config.getServletContext(); ApplicationPrefs prefs = (ApplicationPrefs) context.getAttribute(Constants.APPLICATION_PREFS); String s = request.getServletPath(); int slash = s.lastIndexOf("/"); s = s.substring(slash + 1); if (!s.startsWith("Setup") && !prefs.isConfigured()) { return STR; } if (s.startsWith(STR)) { return null; } if ("text".equals(request.getParameter("out")) "text".equals(request.getAttribute("out"))) { } else if ("true".equals(request.getParameter(Constants.REQUEST_PARAM_POPUP))) { request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, STR); } else if ("true".equals(request.getParameter(Constants.REQUEST_PARAM_STYLE))) { request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, STR); } else { request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, context.getAttribute(Constants.REQUEST_TEMPLATE)); } if (s.startsWith("Setup")) { request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, STR); return null; } if (s.startsWith(STR)) { request.setAttribute(Constants.REQUEST_PAGE_LAYOUT, STR); return null; } String requestedPath = (String) request.getAttribute(STR); if (requestedPath == null && "GET".equals(request.getMethod()) && request.getParameter(STR) == null) { String contextPath = request.getContextPath(); String uri = request.getRequestURI(); String queryString = request.getQueryString(); requestedPath = uri.substring(contextPath.length()) + (queryString == null ? STR?STRRequested path: " + requestedPath); request.setAttribute(STR, requestedPath); if (!s.startsWith("PortalSTR.shtmlSTR127.0.0.1STR127.0.0.1STRlocalhostSTRlocalhostSTR10.STR172.STR192.STRPORTAL.INDEX"))) { String newUrl = URLFactory.createURL(prefs.getPrefs()) + requestedPath; request.setAttribute(STR, newUrl); LOG.debug("redirectTo: STRRedirect301STRLoginSTRUpgradeCheckSTRFound sessionValidator? STRSetting search location from cookie: STRtrueSTRPORTALSTRRegisterSTRResetPasswordSTRLoginAcceptSTRLoginRejectSTRSearchSTRContactUsSTRSITE.DRIVERSTRSITE.URLSTRSITE.USERSTRSITE.PASSWORDSTRtrueSTRSSLSTRhttpsSTRRedirecting to..." + requestedPath); request.setAttribute(STR, "https: request.removeAttribute(Constants.REQUEST_PAGE_LAYOUT); return STR; } Connection db = null; try { db = getConnection(context, request); if (db != null) { WebSiteLanguageList webSiteLanguageList = new WebSiteLanguageList(); webSiteLanguageList.setEnabled(Constants.TRUE); webSiteLanguageList.buildList(db); webSiteLanguageList.add(userSession.getWebSiteLanguageList()); request.setAttribute(STR, webSiteLanguageList); ProjectList menu = new ProjectList(); PagedListInfo menuListInfo = new PagedListInfo(); menuListInfo.setColumnToSortBy(STR); menuListInfo.setItemsPerPage(-1); menu.setPagedListInfo(menuListInfo); menu.setIncludeGuestProjects(false); menu.setPortalState(Constants.TRUE); menu.setOpenProjectsOnly(true); menu.setApprovedOnly(true); menu.setBuildLink(true); menu.setLanguageId(webSiteLanguageList.getLanguageId(request)); menu.buildList(db); request.setAttribute(STR, menu); Project mainProfile = ProjectUtils.loadProject(prefs.get(STR)); request.setAttribute(Constants.REQUEST_MAIN_PROFILE, mainProfile); ProjectCategoryList categoryList = new ProjectCategoryList(); categoryList.setEnabled(Constants.TRUE); categoryList.setTopLevelOnly(true); categoryList.buildList(db); request.setAttribute(Constants.REQUEST_TAB_CATEGORY_LIST, categoryList); int chosenTabId = -1; if (requestedPath != null) { String chosenCategory = null; String chosenTab = null; if (requestedPath.length() > 0) { chosenTab = requestedPath.substring(1); } LOG.debug(STR + chosenTab); if (chosenTab == null STRSetting tab to HomeSTRhome.shtmlSTR.shtmlSTRfound: STRNo tab to highlightSTRnoneSTRchosenTabSTRchosenCategorySTR/login?redirectTo=" + requestedPath; request.setAttribute(STR, newUrl); LOG.debug("redirectTo: STRRedirect301STRTITLESTRGlobal items errorSTRLoginSTRSecurity failed.STRactionErrorSTR* Please login, your session has expiredSTRLoginBeanSTRSecurityCheckSTRSecurity passed: STR (STR)STRThe application configuration requires that the URL properties are updated. Store <strong>STR</strong>? <a href=\"STR/AdminUsage.do?command=StoreURL\STR); } else if (!url.equals(RequestUtils.getAbsoluteServerUrl(request))) { alerts.add("There is a configuration mismatch -- expected: <strong>STR</strong> but the configuration has <strong><a href=\"STR\">STR</a></strong> <a href=\"STR/AdminUsage.do?command=StoreURL\STR); } } int invitationCount = InvitationList.queryCount(db, userSession.getId(), userSession.getProfileProjectId()); request.setAttribute(Constants.REQUEST_INVITATION_COUNT, String.valueOf(invitationCount)); int newMailCount = PrivateMessageList.queryUnreadCountForUser(db, userSession.getId()); request.setAttribute(Constants.REQUEST_PRIVATE_MESSAGE_COUNT, String.valueOf(newMailCount)); } } catch (Exception e) { LOG.error(STR, e); } finally { this.freeConnection(context, db); } } return null; } | /**
* Checks to see if a User session object exists, if not then the security
* check fails.
*
* @param servlet Description of the Parameter
* @param request Description of the Parameter
* @param response Description of the Parameter
* @return Description of the Return Value
*/ | Checks to see if a User session object exists, if not then the security check fails | beginRequest | {
"repo_name": "yukoff/concourse-connect",
"path": "src/main/java/com/concursive/connect/web/controller/hooks/SecurityHook.java",
"license": "agpl-3.0",
"size": 21792
} | [
"com.concursive.commons.http.RequestUtils",
"com.concursive.commons.web.URLFactory",
"com.concursive.connect.Constants",
"com.concursive.connect.config.ApplicationPrefs",
"com.concursive.connect.web.modules.members.dao.InvitationList",
"com.concursive.connect.web.modules.messages.dao.PrivateMessageList",
"com.concursive.connect.web.modules.profile.dao.Project",
"com.concursive.connect.web.modules.profile.dao.ProjectCategoryList",
"com.concursive.connect.web.modules.profile.dao.ProjectList",
"com.concursive.connect.web.modules.profile.utils.ProjectUtils",
"com.concursive.connect.web.modules.translation.dao.WebSiteLanguageList",
"com.concursive.connect.web.utils.PagedListInfo",
"java.sql.Connection",
"javax.servlet.ServletConfig",
"javax.servlet.ServletContext"
] | import com.concursive.commons.http.RequestUtils; import com.concursive.commons.web.URLFactory; import com.concursive.connect.Constants; import com.concursive.connect.config.ApplicationPrefs; import com.concursive.connect.web.modules.members.dao.InvitationList; import com.concursive.connect.web.modules.messages.dao.PrivateMessageList; import com.concursive.connect.web.modules.profile.dao.Project; import com.concursive.connect.web.modules.profile.dao.ProjectCategoryList; import com.concursive.connect.web.modules.profile.dao.ProjectList; import com.concursive.connect.web.modules.profile.utils.ProjectUtils; import com.concursive.connect.web.modules.translation.dao.WebSiteLanguageList; import com.concursive.connect.web.utils.PagedListInfo; import java.sql.Connection; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; | import com.concursive.commons.http.*; import com.concursive.commons.web.*; import com.concursive.connect.*; import com.concursive.connect.config.*; import com.concursive.connect.web.modules.members.dao.*; import com.concursive.connect.web.modules.messages.dao.*; import com.concursive.connect.web.modules.profile.dao.*; import com.concursive.connect.web.modules.profile.utils.*; import com.concursive.connect.web.modules.translation.dao.*; import com.concursive.connect.web.utils.*; import java.sql.*; import javax.servlet.*; | [
"com.concursive.commons",
"com.concursive.connect",
"java.sql",
"javax.servlet"
] | com.concursive.commons; com.concursive.connect; java.sql; javax.servlet; | 1,877,003 |
@Override
public int hashCode() {
return Arrays.hashCode(this.key) ^ Arrays.hashCode(this.value);
} | int function() { return Arrays.hashCode(this.key) ^ Arrays.hashCode(this.value); } | /**
* Calculate hash code.
*
* <p>
* The hash code of a {@link KVPair} is the exclusive-OR of the hash codes of the key
* and the value, each according to {@link Arrays#hashCode(byte[])}.
*
* @return hash value for this instance
*/ | Calculate hash code. The hash code of a <code>KVPair</code> is the exclusive-OR of the hash codes of the key and the value, each according to <code>Arrays#hashCode(byte[])</code> | hashCode | {
"repo_name": "permazen/permazen",
"path": "permazen-kv/src/main/java/io/permazen/kv/KVPair.java",
"license": "apache-2.0",
"size": 3496
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,133,818 |
public TreeSet<String> getMessagePublishedNodes() throws AndesException; | TreeSet<String> function() throws AndesException; | /**
* Get all message published nodes from NodeToLastPublishedId table
*
* @return set of message published nodes
*/ | Get all message published nodes from NodeToLastPublishedId table | getMessagePublishedNodes | {
"repo_name": "chanakaudaya/andes",
"path": "modules/andes-core/broker/src/main/java/org/wso2/andes/server/cluster/coordination/SlotAgent.java",
"license": "apache-2.0",
"size": 6489
} | [
"java.util.TreeSet",
"org.wso2.andes.kernel.AndesException"
] | import java.util.TreeSet; import org.wso2.andes.kernel.AndesException; | import java.util.*; import org.wso2.andes.kernel.*; | [
"java.util",
"org.wso2.andes"
] | java.util; org.wso2.andes; | 613,896 |
@Override
public Iterator<E> iterator() {
// override to go 75% faster
return listIterator(0);
} | Iterator<E> function() { return listIterator(0); } | /**
* Gets an iterator over the list.
*
* @return an iterator over the list
*/ | Gets an iterator over the list | iterator | {
"repo_name": "gonmarques/commons-collections",
"path": "src/main/java/org/apache/commons/collections4/list/TreeList.java",
"license": "apache-2.0",
"size": 39099
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 996,452 |
@Test
public void testClear() throws MalformedURLException, DownloadFailedException, IOException {
String id = "key";
//use a local file as this test will load the result and check the timestamp
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
String url = "file:///" + f.getCanonicalPath();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add(id, url, url, false);
assertFalse(instance.getCollection().isEmpty());
instance.clear();
assertTrue(instance.getCollection().isEmpty());
} | void function() throws MalformedURLException, DownloadFailedException, IOException { String id = "key"; File f = new File(STR); String url = "file: UpdateableNvdCve instance = new UpdateableNvdCve(); instance.add(id, url, url, false); assertFalse(instance.getCollection().isEmpty()); instance.clear(); assertTrue(instance.getCollection().isEmpty()); } | /**
* Test of clear method, of class UpdateableNvdCve.
*/ | Test of clear method, of class UpdateableNvdCve | testClear | {
"repo_name": "wmaintw/DependencyCheck",
"path": "dependency-check-core/src/test/java/org/owasp/dependencycheck/data/update/nvd/UpdateableNvdCveTest.java",
"license": "apache-2.0",
"size": 5182
} | [
"java.io.File",
"java.io.IOException",
"java.net.MalformedURLException",
"org.junit.Assert",
"org.owasp.dependencycheck.data.update.nvd.UpdateableNvdCve",
"org.owasp.dependencycheck.utils.DownloadFailedException"
] | import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import org.junit.Assert; import org.owasp.dependencycheck.data.update.nvd.UpdateableNvdCve; import org.owasp.dependencycheck.utils.DownloadFailedException; | import java.io.*; import java.net.*; import org.junit.*; import org.owasp.dependencycheck.data.update.nvd.*; import org.owasp.dependencycheck.utils.*; | [
"java.io",
"java.net",
"org.junit",
"org.owasp.dependencycheck"
] | java.io; java.net; org.junit; org.owasp.dependencycheck; | 2,597,566 |
private void printSpace() throws IOException {
writer.append(' ');
} | void function() throws IOException { writer.append(' '); } | /**
* Prints out a space.
*
* @throws IOException
*/ | Prints out a space | printSpace | {
"repo_name": "Bilal84/rdf-commons",
"path": "sesame-adapter/src/main/java/org/sindice/rdfcommons/adapter/sesame/nquads/NQuadsWriter.java",
"license": "apache-2.0",
"size": 7251
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 965,130 |
public int getAcceleration() throws TimeoutException, NotConnectedException {
byte options = 0;
boolean isResponseExpected = getResponseExpected(FUNCTION_GET_ACCELERATION);
if(isResponseExpected) {
options = 8;
}
ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)8, FUNCTION_GET_ACCELERATION, options, (byte)(0));
byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_GET_ACCELERATION);
bb = ByteBuffer.wrap(response, 8, response.length - 8);
bb.order(ByteOrder.LITTLE_ENDIAN);
int acceleration = IPConnection.unsignedShort(bb.getShort());
return acceleration;
} | int function() throws TimeoutException, NotConnectedException { byte options = 0; boolean isResponseExpected = getResponseExpected(FUNCTION_GET_ACCELERATION); if(isResponseExpected) { options = 8; } ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)8, FUNCTION_GET_ACCELERATION, options, (byte)(0)); byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_GET_ACCELERATION); bb = ByteBuffer.wrap(response, 8, response.length - 8); bb.order(ByteOrder.LITTLE_ENDIAN); int acceleration = IPConnection.unsignedShort(bb.getShort()); return acceleration; } | /**
* Returns the acceleration as set by {@link com.tinkerforge.BrickDC.setAcceleration}.
*/ | Returns the acceleration as set by <code>com.tinkerforge.BrickDC.setAcceleration</code> | getAcceleration | {
"repo_name": "ezeeb/pipes-tinkerforge",
"path": "src/main/java/com/tinkerforge/BrickDC.java",
"license": "apache-2.0",
"size": 34074
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 26,402 |
protected void notifyListeners(ChartChangeEvent event) {
if (this.notify) {
Object[] listeners = this.changeListeners.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChartChangeListener.class) {
((ChartChangeListener) listeners[i + 1]).chartChanged(
event);
}
}
}
} | void function(ChartChangeEvent event) { if (this.notify) { Object[] listeners = this.changeListeners.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ChartChangeListener.class) { ((ChartChangeListener) listeners[i + 1]).chartChanged( event); } } } } | /**
* Sends a {@link ChartChangeEvent} to all registered listeners.
*
* @param event information about the event that triggered the
* notification.
*/ | Sends a <code>ChartChangeEvent</code> to all registered listeners | notifyListeners | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/jfreechart-1.0.5/source/org/jfree/chart/JFreeChart.java",
"license": "lgpl-3.0",
"size": 64355
} | [
"org.jfree.chart.event.ChartChangeEvent",
"org.jfree.chart.event.ChartChangeListener"
] | import org.jfree.chart.event.ChartChangeEvent; import org.jfree.chart.event.ChartChangeListener; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,510,152 |
@Test()
public void testRequestHandlerMethods()
throws Exception
{
final InMemoryDirectoryServerConfig cfg =
new InMemoryDirectoryServerConfig("dc=example,dc=com",
"o=example.com");
cfg.addAdditionalBindCredentials("cn=Directory Manager", "password");
cfg.addAdditionalBindCredentials("cn=Manager", "password");
cfg.setSchema(Schema.getDefaultStandardSchema());
cfg.setListenerExceptionHandler(
new StandardErrorListenerExceptionHandler());
final InMemoryDirectoryServer ds = new InMemoryDirectoryServer(cfg);
final InMemoryRequestHandler rh = ds.getInMemoryRequestHandler();
assertNotNull(rh);
// The request handler instance won't have a connection associated with
// it, so the best we can do is just call methods to get coverage.
assertNull(rh.getClientConnection());
assertFalse(rh.getAuthenticatedDN().isNullDN());
rh.setAuthenticatedDN(new DN("cn=Directory Manager"));
assertEquals(rh.getAuthenticatedDN(), new DN("cn=Directory Manager"));
rh.setAuthenticatedDN(null);
assertTrue(rh.getAuthenticatedDN().isNullDN());
assertNotNull(rh.getAdditionalBindCredentials());
assertNotNull(rh.getAdditionalBindCredentials(
new DN("cn=Directory Manager")));
assertNotNull(rh.getConnectionState());
} | @Test() void function() throws Exception { final InMemoryDirectoryServerConfig cfg = new InMemoryDirectoryServerConfig(STR, STR); cfg.addAdditionalBindCredentials(STR, STR); cfg.addAdditionalBindCredentials(STR, STR); cfg.setSchema(Schema.getDefaultStandardSchema()); cfg.setListenerExceptionHandler( new StandardErrorListenerExceptionHandler()); final InMemoryDirectoryServer ds = new InMemoryDirectoryServer(cfg); final InMemoryRequestHandler rh = ds.getInMemoryRequestHandler(); assertNotNull(rh); assertNull(rh.getClientConnection()); assertFalse(rh.getAuthenticatedDN().isNullDN()); rh.setAuthenticatedDN(new DN(STR)); assertEquals(rh.getAuthenticatedDN(), new DN(STR)); rh.setAuthenticatedDN(null); assertTrue(rh.getAuthenticatedDN().isNullDN()); assertNotNull(rh.getAdditionalBindCredentials()); assertNotNull(rh.getAdditionalBindCredentials( new DN(STR))); assertNotNull(rh.getConnectionState()); } | /**
* Tests methods that are available only in the in-memory request handler.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests methods that are available only in the in-memory request handler | testRequestHandlerMethods | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/listener/InMemoryDirectoryServerTestCase.java",
"license": "gpl-2.0",
"size": 211674
} | [
"com.unboundid.ldap.sdk.schema.Schema",
"org.testng.annotations.Test"
] | import com.unboundid.ldap.sdk.schema.Schema; import org.testng.annotations.Test; | import com.unboundid.ldap.sdk.schema.*; import org.testng.annotations.*; | [
"com.unboundid.ldap",
"org.testng.annotations"
] | com.unboundid.ldap; org.testng.annotations; | 2,003,466 |
@Transactional(readOnly = true)
public ToDo getToDoById (long toDoId) {
ToDo toDo = (ToDo) getSession().get(ToDo.class, toDoId);
return toDo;
} | @Transactional(readOnly = true) ToDo function (long toDoId) { ToDo toDo = (ToDo) getSession().get(ToDo.class, toDoId); return toDo; } | /**
* gets ToDo data from DataBase
* @param toDoId
* @return
*/ | gets ToDo data from DataBase | getToDoById | {
"repo_name": "pxai/struts2-spring-hibernate",
"path": "ToDoRemoteWS/src/main/java/info/pello/spring/todo/ws/ToDoDAO.java",
"license": "gpl-2.0",
"size": 2485
} | [
"org.springframework.transaction.annotation.Transactional"
] | import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.*; | [
"org.springframework.transaction"
] | org.springframework.transaction; | 2,277,977 |
public void removeIngestModuleEventListener(final PropertyChangeListener listener) {
moduleEventPublisher.removeSubscriber(INGEST_MODULE_EVENT_NAMES, listener);
} | void function(final PropertyChangeListener listener) { moduleEventPublisher.removeSubscriber(INGEST_MODULE_EVENT_NAMES, listener); } | /**
* Removes an ingest module event property change listener.
*
* @param listener The PropertyChangeListener to be removed.
*/ | Removes an ingest module event property change listener | removeIngestModuleEventListener | {
"repo_name": "sleuthkit/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java",
"license": "apache-2.0",
"size": 63582
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 609,810 |
@Beta protected ListIterator<E> standardListIterator(int start) {
return Lists.listIteratorImpl(this, start);
} | @Beta ListIterator<E> function(int start) { return Lists.listIteratorImpl(this, start); } | /**
* A sensible default implementation of {@link #listIterator(int)}, in terms
* of {@link #size}, {@link #get(int)}, {@link #set(int, Object)}, {@link
* #add(int, Object)}, and {@link #remove(int)}. If you override any of these
* methods, you may wish to override {@link #listIterator(int)} to forward to
* this implementation.
*
* @since 7.0
*/ | A sensible default implementation of <code>#listIterator(int)</code>, in terms of <code>#size</code>, <code>#get(int)</code>, <code>#set(int, Object)</code>, <code>#add(int, Object)</code>, and <code>#remove(int)</code>. If you override any of these methods, you may wish to override <code>#listIterator(int)</code> to forward to this implementation | standardListIterator | {
"repo_name": "newrelic/guava-libraries",
"path": "guava/src/com/google/common/collect/ForwardingList.java",
"license": "apache-2.0",
"size": 7503
} | [
"com.google.common.annotations.Beta",
"java.util.ListIterator"
] | import com.google.common.annotations.Beta; import java.util.ListIterator; | import com.google.common.annotations.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,396,864 |
public void putBooleanTfft(Map<String, Boolean> arrayBody) {
putBooleanTfftWithServiceResponseAsync(arrayBody).toBlocking().single().body();
} | void function(Map<String, Boolean> arrayBody) { putBooleanTfftWithServiceResponseAsync(arrayBody).toBlocking().single().body(); } | /**
* Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }.
*
* @param arrayBody the Map<String, Boolean> value
*/ | Set dictionary value empty {"0": true, "1": false, "2": false, "3": true } | putBooleanTfft | {
"repo_name": "matthchr/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 210563
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,119,844 |
public void setInvoice(ReferenceInvoice invoice) {
this.invoice = invoice;
} | void function(ReferenceInvoice invoice) { this.invoice = invoice; } | /**
* Sets the refund invoice
*
* @param invoice the invoice to refund
*/ | Sets the refund invoice | setInvoice | {
"repo_name": "Zooz/Zooz-Java",
"path": "src/main/java/com/zooz/common/client/ecomm/beans/requests/RefundRequest.java",
"license": "apache-2.0",
"size": 8582
} | [
"com.zooz.common.client.ecomm.beans.ReferenceInvoice"
] | import com.zooz.common.client.ecomm.beans.ReferenceInvoice; | import com.zooz.common.client.ecomm.beans.*; | [
"com.zooz.common"
] | com.zooz.common; | 2,786,703 |
@Nullable
private static Module getModuleOfOutermostStarlarkFunction(StarlarkThread thread) {
for (Debug.Frame fr : Debug.getCallStack(thread)) {
if (fr.getFunction() instanceof StarlarkFunction) {
return ((StarlarkFunction) fr.getFunction()).getModule();
}
}
return null;
} | static Module function(StarlarkThread thread) { for (Debug.Frame fr : Debug.getCallStack(thread)) { if (fr.getFunction() instanceof StarlarkFunction) { return ((StarlarkFunction) fr.getFunction()).getModule(); } } return null; } | /**
* Returns the module (file) of the outermost enclosing Starlark function on the call stack or
* null if none of the active calls are functions defined in Starlark.
*/ | Returns the module (file) of the outermost enclosing Starlark function on the call stack or null if none of the active calls are functions defined in Starlark | getModuleOfOutermostStarlarkFunction | {
"repo_name": "bazelbuild/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java",
"license": "apache-2.0",
"size": 49594
} | [
"net.starlark.java.eval.Debug",
"net.starlark.java.eval.Module",
"net.starlark.java.eval.StarlarkFunction",
"net.starlark.java.eval.StarlarkThread"
] | import net.starlark.java.eval.Debug; import net.starlark.java.eval.Module; import net.starlark.java.eval.StarlarkFunction; import net.starlark.java.eval.StarlarkThread; | import net.starlark.java.eval.*; | [
"net.starlark.java"
] | net.starlark.java; | 519,430 |
public static Pair<RelNode, RelNode> getTopLevelSelect(final RelNode rootRel) {
RelNode tmpRel = rootRel;
RelNode parentOforiginalProjRel = rootRel;
HiveProject originalProjRel = null;
while (tmpRel != null) {
if (tmpRel instanceof HiveProject) {
originalProjRel = (HiveProject) tmpRel;
break;
}
parentOforiginalProjRel = tmpRel;
tmpRel = tmpRel.getInput(0);
}
return (new Pair<RelNode, RelNode>(parentOforiginalProjRel, originalProjRel));
} | static Pair<RelNode, RelNode> function(final RelNode rootRel) { RelNode tmpRel = rootRel; RelNode parentOforiginalProjRel = rootRel; HiveProject originalProjRel = null; while (tmpRel != null) { if (tmpRel instanceof HiveProject) { originalProjRel = (HiveProject) tmpRel; break; } parentOforiginalProjRel = tmpRel; tmpRel = tmpRel.getInput(0); } return (new Pair<RelNode, RelNode>(parentOforiginalProjRel, originalProjRel)); } | /**
* Get top level select starting from root. Assumption here is root can only
* be Sort & Project. Also the top project should be at most 2 levels below
* Sort; i.e Sort(Limit)-Sort(OB)-Select
*
* @param rootRel
* @return
*/ | Get top level select starting from root. Assumption here is root can only be Sort & Project. Also the top project should be at most 2 levels below Sort; i.e Sort(Limit)-Sort(OB)-Select | getTopLevelSelect | {
"repo_name": "vergilchiu/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java",
"license": "apache-2.0",
"size": 42761
} | [
"org.apache.calcite.rel.RelNode",
"org.apache.calcite.util.Pair",
"org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveProject"
] | import org.apache.calcite.rel.RelNode; import org.apache.calcite.util.Pair; import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveProject; | import org.apache.calcite.rel.*; import org.apache.calcite.util.*; import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.*; | [
"org.apache.calcite",
"org.apache.hadoop"
] | org.apache.calcite; org.apache.hadoop; | 1,082,425 |
static private void writeNoDST(SimpleIcsWriter writer, TimeZone tz, String offsetString)
throws IOException {
writer.writeTag("BEGIN", "STANDARD");
writer.writeTag("TZOFFSETFROM", offsetString);
writer.writeTag("TZOFFSETTO", offsetString);
// Might as well use start of epoch for start date
writer.writeTag("DTSTART", millisToEasDateTime(0L));
writer.writeTag("END", "STANDARD");
writer.writeTag("END", "VTIMEZONE");
} | static void function(SimpleIcsWriter writer, TimeZone tz, String offsetString) throws IOException { writer.writeTag("BEGIN", STR); writer.writeTag(STR, offsetString); writer.writeTag(STR, offsetString); writer.writeTag(STR, millisToEasDateTime(0L)); writer.writeTag("END", STR); writer.writeTag("END", STR); } | /**
* Write out the STANDARD block of VTIMEZONE and end the VTIMEZONE
* @param writer the SimpleIcsWriter we're using
* @param tz the time zone
* @param offsetString the offset string in VTIMEZONE format (e.g. +0800)
* @throws IOException
*/ | Write out the STANDARD block of VTIMEZONE and end the VTIMEZONE | writeNoDST | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/Exchange/src/com/android/exchange/utility/CalendarUtilities.java",
"license": "gpl-3.0",
"size": 93299
} | [
"java.io.IOException",
"java.util.TimeZone"
] | import java.io.IOException; import java.util.TimeZone; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,676,198 |
void writeClusterJob(ClusterJob clusterJob) throws IOException; | void writeClusterJob(ClusterJob clusterJob) throws IOException; | /**
* Write a cluster job to the store.
* @param clusterJob The cluster job to write.
* @throws IOException if there was a problem writing the cluster job.
*/ | Write a cluster job to the store | writeClusterJob | {
"repo_name": "quantiply-fork/coopr",
"path": "coopr-server/src/main/java/co/cask/coopr/store/cluster/ClusterStore.java",
"license": "apache-2.0",
"size": 3814
} | [
"co.cask.coopr.scheduler.task.ClusterJob",
"java.io.IOException"
] | import co.cask.coopr.scheduler.task.ClusterJob; import java.io.IOException; | import co.cask.coopr.scheduler.task.*; import java.io.*; | [
"co.cask.coopr",
"java.io"
] | co.cask.coopr; java.io; | 2,020,118 |
public boolean courseExists(CourseDbModel course) throws SQLException {
this.courseDbModel = DaoManager.createDao(connectionSource, CourseDbModel.class);
List<CourseDbModel> result;
result = this.courseDbModel.queryForMatching(course);
if (result.size() == 1) {
return true;
} else {
return false;
}
} | boolean function(CourseDbModel course) throws SQLException { this.courseDbModel = DaoManager.createDao(connectionSource, CourseDbModel.class); List<CourseDbModel> result; result = this.courseDbModel.queryForMatching(course); if (result.size() == 1) { return true; } else { return false; } } | /**
* Checks if given cource exists in Kurki databse.
* @param course Database model which is to be checked.
* @return true or false if exists.
* @throws SQLException
*/ | Checks if given cource exists in Kurki databse | courseExists | {
"repo_name": "ohtuprojekti/OKKoPa_all",
"path": "OKKoPa_shared/src/main/java/fi/helsinki/cs/okkopa/shared/database/OracleConnector.java",
"license": "mit",
"size": 5094
} | [
"com.j256.ormlite.dao.DaoManager",
"fi.helsinki.cs.okkopa.shared.database.model.CourseDbModel",
"java.sql.SQLException",
"java.util.List"
] | import com.j256.ormlite.dao.DaoManager; import fi.helsinki.cs.okkopa.shared.database.model.CourseDbModel; import java.sql.SQLException; import java.util.List; | import com.j256.ormlite.dao.*; import fi.helsinki.cs.okkopa.shared.database.model.*; import java.sql.*; import java.util.*; | [
"com.j256.ormlite",
"fi.helsinki.cs",
"java.sql",
"java.util"
] | com.j256.ormlite; fi.helsinki.cs; java.sql; java.util; | 2,766,470 |
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//设置编码方式
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
SensorDataType_functionDAO SensorDataType_functionDAOImpl = SensorDataType_functionDAOFactory.createSensorDataType_functionDAOImplm();
//从页面得到参数,并且访问数据库
//改动下面第二条语句大写S改成了小写。因为showAllSensorDataType提交上的name是小写
String SensorDataTypeID = request.getParameter("sensorDataTypeID");
String SensorDataTypeName = request.getParameter("sensorDataTypeName");
//System.out.print("查询的输入\n"+SensorDataTypeName) ;
String[] str = SensorDataType_functionDAOImpl.searchSensorDataType(SensorDataTypeID, SensorDataTypeName);
System.out.println(str);
//System.out.print("结果集长度\n"+str.length) ;
request.setAttribute("str",str);
request.getRequestDispatcher("../jsp/sensorDataType/showAllSensorDataType.jsp").forward(request, response);
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType(STR); SensorDataType_functionDAO SensorDataType_functionDAOImpl = SensorDataType_functionDAOFactory.createSensorDataType_functionDAOImplm(); String SensorDataTypeID = request.getParameter(STR); String SensorDataTypeName = request.getParameter(STR); String[] str = SensorDataType_functionDAOImpl.searchSensorDataType(SensorDataTypeID, SensorDataTypeName); System.out.println(str); request.setAttribute("str",str); request.getRequestDispatcher(STR).forward(request, response); } | /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/ | The doPost method of the servlet. This method is called when a form has its tag value method equals to post | doPost | {
"repo_name": "htzy/te",
"path": "envirMonitor/src/com/monitor/servlet/SearchSensorDataTypeServlet.java",
"license": "apache-2.0",
"size": 2845
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 631,580 |
@Nonnull
@Convert(MappingJarConverter.class)
GenericAttributeValue<PsiFile> getJar(); | @Convert(MappingJarConverter.class) GenericAttributeValue<PsiFile> getJar(); | /**
* Returns the value of the jar child.
* Attribute jar
* @return the value of the jar child.
*/ | Returns the value of the jar child. Attribute jar | getJar | {
"repo_name": "consulo-trash/consulo-hibernate",
"path": "plugin/src/main/java/com/intellij/hibernate/model/xml/config/Mapping.java",
"license": "apache-2.0",
"size": 2093
} | [
"com.intellij.hibernate.model.converters.MappingJarConverter",
"com.intellij.psi.PsiFile",
"com.intellij.util.xml.Convert",
"com.intellij.util.xml.GenericAttributeValue"
] | import com.intellij.hibernate.model.converters.MappingJarConverter; import com.intellij.psi.PsiFile; import com.intellij.util.xml.Convert; import com.intellij.util.xml.GenericAttributeValue; | import com.intellij.hibernate.model.converters.*; import com.intellij.psi.*; import com.intellij.util.xml.*; | [
"com.intellij.hibernate",
"com.intellij.psi",
"com.intellij.util"
] | com.intellij.hibernate; com.intellij.psi; com.intellij.util; | 1,184,983 |
public double[] getParameterEstimates() {
if (this.parameters == null) {
return null;
}
return MathArrays.copyOf(parameters);
} | double[] function() { if (this.parameters == null) { return null; } return MathArrays.copyOf(parameters); } | /**
* <p>Returns a copy of the regression parameters estimates.</p>
*
* <p>The parameter estimates are returned in the natural order of the data.</p>
*
* <p>A redundant regressor will have its redundancy flag set, as will
* a parameter estimate equal to {@code Double.NaN}.</p>
*
* @return array of parameter estimates, null if no estimation occurred
*/ | Returns a copy of the regression parameters estimates. The parameter estimates are returned in the natural order of the data. A redundant regressor will have its redundancy flag set, as will a parameter estimate equal to Double.NaN | getParameterEstimates | {
"repo_name": "happyjack27/autoredistrict",
"path": "src/org/apache/commons/math3/stat/regression/RegressionResults.java",
"license": "gpl-3.0",
"size": 15908
} | [
"org.apache.commons.math3.util.MathArrays"
] | import org.apache.commons.math3.util.MathArrays; | import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 737,705 |
public void run() throws InvalidRegisterException{
HashMap<Integer, IInstruction> mapping = generateInstructionMapping();
int ip = 2;
while(ip<this.intcode.length){
IInstruction i = mapping.get(intcode[ip]).getInstance(ip, intcode);
i.execute();
ip += i.getSize();
}
}
| void function() throws InvalidRegisterException{ HashMap<Integer, IInstruction> mapping = generateInstructionMapping(); int ip = 2; while(ip<this.intcode.length){ IInstruction i = mapping.get(intcode[ip]).getInstance(ip, intcode); i.execute(); ip += i.getSize(); } } | /***
* run loop goes here... ip=0 look at intcode[ip], look up instruction,
* execute instruction, ip+=sizeof(instruction[ip]), repeat while
* ip<sizeof(intcode)
* @throws InvalidRegisterException
*/ | run loop goes here... ip=0 look at intcode[ip], look up instruction, execute instruction, ip+=sizeof(instruction[ip]), repeat while ip<sizeof(intcode) | run | {
"repo_name": "JosephRedfern/JvmVm",
"path": "src/me/redfern/jvmvm/JvmVm.java",
"license": "bsd-3-clause",
"size": 1812
} | [
"java.util.HashMap",
"me.redfern.jvmvm.exceptions.InvalidRegisterException",
"me.redfern.jvmvm.vm.instructions.IInstruction"
] | import java.util.HashMap; import me.redfern.jvmvm.exceptions.InvalidRegisterException; import me.redfern.jvmvm.vm.instructions.IInstruction; | import java.util.*; import me.redfern.jvmvm.exceptions.*; import me.redfern.jvmvm.vm.instructions.*; | [
"java.util",
"me.redfern.jvmvm"
] | java.util; me.redfern.jvmvm; | 709,772 |
public String getTabColorClass() {
return m_tabColorClass;
}
}
protected class TabPanel extends TabLayoutPanel {
private DeckLayoutPanel m_contentPanel;
private FlowPanel m_tabBar;
public TabPanel(double barHeight, Unit barUnit) {
super(barHeight, barUnit);
LayoutPanel tabLayout = (LayoutPanel)getWidget();
// Find the tab bar, which is the first flow panel in the LayoutPanel
for (int i = 0; i < tabLayout.getWidgetCount(); ++i) {
Widget widget = tabLayout.getWidget(i);
if (widget instanceof FlowPanel) {
m_tabBar = (FlowPanel)widget;
break; // tab bar found
}
}
for (int i = 0; i < tabLayout.getWidgetCount(); ++i) {
Widget widget = tabLayout.getWidget(i);
if (widget instanceof DeckLayoutPanel) {
m_contentPanel = (DeckLayoutPanel)widget;
break; // tab bar found
}
}
} | String function() { return m_tabColorClass; } } protected class TabPanel extends TabLayoutPanel { private DeckLayoutPanel m_contentPanel; private FlowPanel m_tabBar; public TabPanel(double barHeight, Unit barUnit) { super(barHeight, barUnit); LayoutPanel tabLayout = (LayoutPanel)getWidget(); for (int i = 0; i < tabLayout.getWidgetCount(); ++i) { Widget widget = tabLayout.getWidget(i); if (widget instanceof FlowPanel) { m_tabBar = (FlowPanel)widget; break; } } for (int i = 0; i < tabLayout.getWidgetCount(); ++i) { Widget widget = tabLayout.getWidget(i); if (widget instanceof DeckLayoutPanel) { m_contentPanel = (DeckLayoutPanel)widget; break; } } } | /**
* Returns the tabColorClass.<p>
*
* @return the tabColorClass
*/ | Returns the tabColorClass | getTabColorClass | {
"repo_name": "sbonoc/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java",
"license": "lgpl-2.1",
"size": 22895
} | [
"com.google.gwt.dom.client.Style",
"com.google.gwt.user.client.ui.DeckLayoutPanel",
"com.google.gwt.user.client.ui.FlowPanel",
"com.google.gwt.user.client.ui.LayoutPanel",
"com.google.gwt.user.client.ui.TabLayoutPanel",
"com.google.gwt.user.client.ui.Widget"
] | import com.google.gwt.dom.client.Style; import com.google.gwt.user.client.ui.DeckLayoutPanel; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.LayoutPanel; import com.google.gwt.user.client.ui.TabLayoutPanel; import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.dom.client.*; import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,306,422 |
@ApiModelProperty(value = "")
public String getLogEntryId() {
return logEntryId;
} | @ApiModelProperty(value = "") String function() { return logEntryId; } | /**
* Get logEntryId
* @return logEntryId
**/ | Get logEntryId | getLogEntryId | {
"repo_name": "LogSentinel/logsentinel-java-client",
"path": "src/main/java/com/logsentinel/model/LogResponse.java",
"license": "mit",
"size": 4473
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 333,719 |
@Test
public final void testInsertX1Y0()
{
final AreaL area =
AreaL.of(0L, 100L, 0L, 100L);
final QuadTreeConfigurationL.Builder cb = QuadTreeConfigurationL.builder();
cb.setArea(area);
final QuadTreeConfigurationL c = cb.build();
final QuadTreeLType<Object> tree = this.create(c);
final Integer item = Integer.valueOf(0);
final AreaL item_area = AreaL.of(98L, 99L, 1L, 2L);
Assert.assertTrue(tree.insert(item, item_area));
Assert.assertTrue(tree.contains(item));
Assert.assertEquals(1L, tree.size());
Assert.assertFalse(tree.isEmpty());
Assert.assertTrue(tree.insert(item, item_area));
Assert.assertTrue(tree.contains(item));
Assert.assertEquals(1L, tree.size());
Assert.assertFalse(tree.isEmpty());
} | final void function() { final AreaL area = AreaL.of(0L, 100L, 0L, 100L); final QuadTreeConfigurationL.Builder cb = QuadTreeConfigurationL.builder(); cb.setArea(area); final QuadTreeConfigurationL c = cb.build(); final QuadTreeLType<Object> tree = this.create(c); final Integer item = Integer.valueOf(0); final AreaL item_area = AreaL.of(98L, 99L, 1L, 2L); Assert.assertTrue(tree.insert(item, item_area)); Assert.assertTrue(tree.contains(item)); Assert.assertEquals(1L, tree.size()); Assert.assertFalse(tree.isEmpty()); Assert.assertTrue(tree.insert(item, item_area)); Assert.assertTrue(tree.contains(item)); Assert.assertEquals(1L, tree.size()); Assert.assertFalse(tree.isEmpty()); } | /**
* Inserting an object into the X1Y0 quadrant works.
*/ | Inserting an object into the X1Y0 quadrant works | testInsertX1Y0 | {
"repo_name": "io7m/jspatial",
"path": "com.io7m.jspatial.tests/src/test/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeLContract.java",
"license": "isc",
"size": 40901
} | [
"com.io7m.jregions.core.unparameterized.areas.AreaL",
"com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationL",
"com.io7m.jspatial.api.quadtrees.QuadTreeLType",
"org.junit.Assert"
] | import com.io7m.jregions.core.unparameterized.areas.AreaL; import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationL; import com.io7m.jspatial.api.quadtrees.QuadTreeLType; import org.junit.Assert; | import com.io7m.jregions.core.unparameterized.areas.*; import com.io7m.jspatial.api.quadtrees.*; import org.junit.*; | [
"com.io7m.jregions",
"com.io7m.jspatial",
"org.junit"
] | com.io7m.jregions; com.io7m.jspatial; org.junit; | 637,298 |
public T secureXML(String secureTag, boolean secureTagContents, byte[] passPhraseByte) {
XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat();
xsdf.setSecureTag(secureTag);
xsdf.setSecureTagContents(secureTagContents);
xsdf.setPassPhraseByte(passPhraseByte);
return dataFormat(xsdf);
} | T function(String secureTag, boolean secureTagContents, byte[] passPhraseByte) { XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(); xsdf.setSecureTag(secureTag); xsdf.setSecureTagContents(secureTagContents); xsdf.setPassPhraseByte(passPhraseByte); return dataFormat(xsdf); } | /**
* Uses the XML Security data format
*/ | Uses the XML Security data format | secureXML | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java",
"license": "apache-2.0",
"size": 46443
} | [
"org.apache.camel.model.dataformat.XMLSecurityDataFormat"
] | import org.apache.camel.model.dataformat.XMLSecurityDataFormat; | import org.apache.camel.model.dataformat.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,128,483 |
private Cursor queryNotesSearchQueried(SQLiteDatabase db, String query, String sortOrder) {
SearchQuery searchQuery = new SearchQuery(query);
StringBuilder selection = new StringBuilder();
List<String> selectionArgs = new ArrayList<>();
selection.append(DatabaseUtils.WHERE_EXISTING_NOTES);
for (String tag: searchQuery.getTags()) {
selection.append(" AND (")
.append(ProviderContract.Notes.QueryParam.TAGS).append(" LIKE ? OR ")
.append(ProviderContract.Notes.QueryParam.INHERITED_TAGS).append(" LIKE ?)");
selectionArgs.add("%" + tag + "%");
selectionArgs.add("%" + tag + "%");
}
for (String tag: searchQuery.getNotTags()) {
selection.append(" AND (")
.append("COALESCE(").append(ProviderContract.Notes.QueryParam.TAGS).append(", '')").append(" NOT LIKE ? AND ")
.append("COALESCE(").append(ProviderContract.Notes.QueryParam.INHERITED_TAGS).append(", '')").append(" NOT LIKE ?)");
selectionArgs.add("%" + tag + "%");
selectionArgs.add("%" + tag + "%");
}
if (searchQuery.hasBookName()) {
selection.append(" AND ").append(ProviderContract.Notes.QueryParam.BOOK_NAME).append(" = ?");
selectionArgs.add(searchQuery.getBookName());
}
if (searchQuery.hasNotBookName()) {
for (String name: searchQuery.getNotBookName()) {
selection.append(" AND ").append(ProviderContract.Notes.QueryParam.BOOK_NAME).append(" != ?");
selectionArgs.add(name);
}
}
if (searchQuery.hasState()) {
selection.append(" AND COALESCE(" + ProviderContract.Notes.QueryParam.STATE + ", '') = ?");
selectionArgs.add(searchQuery.getState());
}
if (searchQuery.hasNotState()) {
for (String state: searchQuery.getNotState()) {
selection.append(" AND COALESCE(" + ProviderContract.Notes.QueryParam.STATE + ", '') != ?");
selectionArgs.add(state);
}
}
for (String token: searchQuery.getTextSearch()) {
selection.append(" AND (").append(ProviderContract.Notes.QueryParam.TITLE).append(" LIKE ?");
selectionArgs.add("%" + token + "%");
selection.append(" OR ").append(ProviderContract.Notes.QueryParam.CONTENT).append(" LIKE ?");
selectionArgs.add("%" + token + "%");
selection.append(" OR ").append(ProviderContract.Notes.QueryParam.TAGS).append(" LIKE ?");
selectionArgs.add("%" + token + "%");
selection.append(")");
}
if (searchQuery.hasScheduled()) {
appendBeforeInterval(selection, ProviderContract.Notes.QueryParam.SCHEDULED_TIME_TIMESTAMP, searchQuery.getScheduled());
}
if (searchQuery.hasDeadline()) {
appendBeforeInterval(selection, ProviderContract.Notes.QueryParam.DEADLINE_TIME_TIMESTAMP, searchQuery.getDeadline());
}
if (searchQuery.hasPriority()) {
String defaultPriority = AppPreferences.defaultPriority(getContext());
selection.append(" AND lower(coalesce(nullif(" + ProviderContract.Notes.QueryParam.PRIORITY + ", ''), ?)) = ?");
selectionArgs.add(defaultPriority);
selectionArgs.add(searchQuery.getPriority());
}
if (searchQuery.hasNoteTags()) {
for (String tag: searchQuery.getNoteTags()) {
selection.append(" AND ").append(ProviderContract.Notes.QueryParam.TAGS).append(" LIKE ?");
selectionArgs.add("%" + tag + "%");
}
}
String sql = "SELECT * FROM " + NotesView.VIEW_NAME + " WHERE " + selection.toString() + " ORDER BY " + sortOrder;
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, sql, selectionArgs);
return db.rawQuery(sql, selectionArgs.toArray(new String[selectionArgs.size()]));
} | Cursor function(SQLiteDatabase db, String query, String sortOrder) { SearchQuery searchQuery = new SearchQuery(query); StringBuilder selection = new StringBuilder(); List<String> selectionArgs = new ArrayList<>(); selection.append(DatabaseUtils.WHERE_EXISTING_NOTES); for (String tag: searchQuery.getTags()) { selection.append(STR) .append(ProviderContract.Notes.QueryParam.TAGS).append(STR) .append(ProviderContract.Notes.QueryParam.INHERITED_TAGS).append(STR); selectionArgs.add("%" + tag + "%"); selectionArgs.add("%" + tag + "%"); } for (String tag: searchQuery.getNotTags()) { selection.append(STR) .append(STR).append(ProviderContract.Notes.QueryParam.TAGS).append(STR).append(STR) .append(STR).append(ProviderContract.Notes.QueryParam.INHERITED_TAGS).append(STR).append(STR); selectionArgs.add("%" + tag + "%"); selectionArgs.add("%" + tag + "%"); } if (searchQuery.hasBookName()) { selection.append(STR).append(ProviderContract.Notes.QueryParam.BOOK_NAME).append(STR); selectionArgs.add(searchQuery.getBookName()); } if (searchQuery.hasNotBookName()) { for (String name: searchQuery.getNotBookName()) { selection.append(STR).append(ProviderContract.Notes.QueryParam.BOOK_NAME).append(STR); selectionArgs.add(name); } } if (searchQuery.hasState()) { selection.append(STR + ProviderContract.Notes.QueryParam.STATE + STR); selectionArgs.add(searchQuery.getState()); } if (searchQuery.hasNotState()) { for (String state: searchQuery.getNotState()) { selection.append(STR + ProviderContract.Notes.QueryParam.STATE + STR); selectionArgs.add(state); } } for (String token: searchQuery.getTextSearch()) { selection.append(STR).append(ProviderContract.Notes.QueryParam.TITLE).append(STR); selectionArgs.add("%" + token + "%"); selection.append(STR).append(ProviderContract.Notes.QueryParam.CONTENT).append(STR); selectionArgs.add("%" + token + "%"); selection.append(STR).append(ProviderContract.Notes.QueryParam.TAGS).append(STR); selectionArgs.add("%" + token + "%"); selection.append(")"); } if (searchQuery.hasScheduled()) { appendBeforeInterval(selection, ProviderContract.Notes.QueryParam.SCHEDULED_TIME_TIMESTAMP, searchQuery.getScheduled()); } if (searchQuery.hasDeadline()) { appendBeforeInterval(selection, ProviderContract.Notes.QueryParam.DEADLINE_TIME_TIMESTAMP, searchQuery.getDeadline()); } if (searchQuery.hasPriority()) { String defaultPriority = AppPreferences.defaultPriority(getContext()); selection.append(STR + ProviderContract.Notes.QueryParam.PRIORITY + STR); selectionArgs.add(defaultPriority); selectionArgs.add(searchQuery.getPriority()); } if (searchQuery.hasNoteTags()) { for (String tag: searchQuery.getNoteTags()) { selection.append(STR).append(ProviderContract.Notes.QueryParam.TAGS).append(STR); selectionArgs.add("%" + tag + "%"); } } String sql = STR + NotesView.VIEW_NAME + STR + selection.toString() + STR + sortOrder; if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, sql, selectionArgs); return db.rawQuery(sql, selectionArgs.toArray(new String[selectionArgs.size()])); } | /**
* Builds query parameters from {@link SearchQuery}.
*/ | Builds query parameters from <code>SearchQuery</code> | queryNotesSearchQueried | {
"repo_name": "MackieLoeffel/orgzly-android",
"path": "app/src/main/java/com/orgzly/android/provider/Provider.java",
"license": "gpl-3.0",
"size": 70159
} | [
"android.database.Cursor",
"android.database.sqlite.SQLiteDatabase",
"com.orgzly.BuildConfig",
"com.orgzly.android.SearchQuery",
"com.orgzly.android.prefs.AppPreferences",
"com.orgzly.android.provider.views.NotesView",
"com.orgzly.android.util.LogUtils",
"java.util.ArrayList",
"java.util.List"
] | import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.orgzly.BuildConfig; import com.orgzly.android.SearchQuery; import com.orgzly.android.prefs.AppPreferences; import com.orgzly.android.provider.views.NotesView; import com.orgzly.android.util.LogUtils; import java.util.ArrayList; import java.util.List; | import android.database.*; import android.database.sqlite.*; import com.orgzly.*; import com.orgzly.android.*; import com.orgzly.android.prefs.*; import com.orgzly.android.provider.views.*; import com.orgzly.android.util.*; import java.util.*; | [
"android.database",
"com.orgzly",
"com.orgzly.android",
"java.util"
] | android.database; com.orgzly; com.orgzly.android; java.util; | 2,090,399 |
public String host() {
try {
if (!config.isBindOnLocalhost()) {
return InetAddress.getLocalHost().getHostName();
} else {
return "localhost";
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new IllegalStateException("failed to find host", e);
}
} | String function() { try { if (!config.isBindOnLocalhost()) { return InetAddress.getLocalHost().getHostName(); } else { return STR; } } catch (Exception e) { LOG.error(e.getMessage(), e); throw new IllegalStateException(STR, e); } } | /**
* Derive the host
*
* @param isBindOnLocalhost
* @return
*/ | Derive the host | host | {
"repo_name": "bradtm/pulsar",
"path": "pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/DiscoveryService.java",
"license": "apache-2.0",
"size": 9216
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 1,328,533 |
//-----------------------------------------------------------------------
public MetaProperty<ResolvedTrade> trade() {
return trade;
} | MetaProperty<ResolvedTrade> function() { return trade; } | /**
* The meta-property for the {@code trade} property.
* @return the meta-property, not null
*/ | The meta-property for the trade property | trade | {
"repo_name": "OpenGamma/Strata",
"path": "modules/market/src/main/java/com/opengamma/strata/market/param/ResolvedTradeParameterMetadata.java",
"license": "apache-2.0",
"size": 10687
} | [
"com.opengamma.strata.product.ResolvedTrade",
"org.joda.beans.MetaProperty"
] | import com.opengamma.strata.product.ResolvedTrade; import org.joda.beans.MetaProperty; | import com.opengamma.strata.product.*; import org.joda.beans.*; | [
"com.opengamma.strata",
"org.joda.beans"
] | com.opengamma.strata; org.joda.beans; | 278,086 |
public void createEDG(Program p, AnswerSetList asl) throws NotValidProgramException{
if (isProgramValid(p)){
edgs = new HashMap<AnswerSet,ExtendedDependencyGraph>();
positiveNodes = new HashMap<String, List<EDGVertex>>();
negativeNodes = new HashMap<String, List<EDGVertex>>();
ExtendedDependencyGraph edg = new ExtendedDependencyGraph();
HashMap<String, List<EDGVertex>> nodes = new HashMap<String, List<EDGVertex>>();
HashSet<EDGVertex> conNodes = new HashSet<EDGVertex>();
Iterator<Rule> rules = p.iterator();
int ruleNo = 0;
while (rules.hasNext()){
Rule r = rules.next();
ruleNo++;
String atomName;
EDGVertex v;
if (r.isConstraint()){
atomName = "-";
v = new EDGVertex(atomName, ruleNo);
conNodes.add(v);
}
else {
List<Literal> head = r.getHead();
Literal l = head.get(0);
if (l instanceof Neg){
atomName = "-" + l.getAtom().toString();
v = new EDGVertex(atomName, ruleNo);
if (!negativeNodes.containsKey(atomName)){
List<EDGVertex> list = new LinkedList<EDGVertex>();
list.add(v);
negativeNodes.put(atomName, list);
}
else{
List<EDGVertex> list = negativeNodes.get(atomName);
list.add(v);
}
if (!nodes.containsKey(atomName)){
List<EDGVertex> list = new LinkedList<EDGVertex>();
list.add(v);
nodes.put(atomName, list);
}
else{
List<EDGVertex> list = nodes.get(atomName);
list.add(v);
}
}
else {
atomName = l.getAtom().toString();
v = new EDGVertex(atomName, ruleNo);
if (!positiveNodes.containsKey(atomName)){
List<EDGVertex> list = new LinkedList<EDGVertex>();
list.add(v);
positiveNodes.put(atomName, list);
}
else{
List<EDGVertex> list = positiveNodes.get(atomName);
list.add(v);
}
if (!nodes.containsKey(atomName)){
List<EDGVertex> list = new LinkedList<EDGVertex>();
list.add(v);
nodes.put(atomName, list);
}
else{
List<EDGVertex> list = nodes.get(atomName);
list.add(v);
}
edg.addVertex(v);
}
}
}
rules = p.iterator();
while (rules.hasNext()){
Rule r = rules.next();
ruleNo++;
String atomName;
EDGVertex v;
List<Literal> body = r.getBody();
for (Literal lit : body){
if (lit instanceof Neg){
atomName = "-" + lit.getAtom().toString();
if (!negativeNodes.containsKey(atomName)){
v = new EDGVertex (atomName, 0);
List<EDGVertex> list = new LinkedList<EDGVertex>();
list.add(v);
negativeNodes.put(atomName, list);
List<EDGVertex> list2 = new LinkedList<EDGVertex>();
list2.add(v);
nodes.put(atomName, list2);
edg.addVertex(v);
}
}
else {
atomName = lit.getAtom().toString();
if (!positiveNodes.containsKey(atomName)){
List<EDGVertex> list = new LinkedList<EDGVertex>();
v = new EDGVertex(atomName, 0);
list.add(v);
positiveNodes.put(atomName, list);
List<EDGVertex> list2 = new LinkedList<EDGVertex>();
list2.add(v);
nodes.put(atomName, list2);
edg.addVertex(v);
}
}
}
}
Iterator<Rule> rules2 = p.iterator();
ruleNo = 0;
while(rules2.hasNext()){
Rule r = rules2.next();
ruleNo++;
List<Literal> body = r.getBody();
List<Literal> head = r.getHead();
String headName;
boolean and = false;
if (body.size() > 1) and = true;
if (r.isConstraint()){
headName = "-";
}
else
if (head.get(0) instanceof Neg){
headName = "-" + head.get(0).getAtom().toString();
}
else headName = head.get(0).getAtom().toString();
if (!body.isEmpty()){
for (Literal literal : body){
String name;
if (literal instanceof Neg) name = "-" + literal.getAtom().toString();
else name = literal.getAtom().toString();
List<EDGVertex> sourcelist = nodes.get(name);
EDGVertex target = null;
EDGEdge e = null;
for (EDGVertex v : nodes.get(headName)){
if (v.getRuleNo() == ruleNo) target = v;
}
boolean or = false;
if (sourcelist.size() > 1) or = true;
for(EDGVertex v : sourcelist){
if (literal.isDefaultNegated()){
e = new EDGEdge(v, target, EDGEdge.EdgeType.NEG, and, or);
}
else {
e = new EDGEdge(v, target, EDGEdge.EdgeType.POS, and, or);
}
edg.addEdge(v, target, e);
}
}
}
}
HashSet<Contradiction> contradictions = getContradictions();
ruleNo = p.size();
for (Contradiction c : contradictions){
for (EDGVertex pos : c.getPositive()){
for (EDGVertex neg : c.getNegative()){
ruleNo++;
EDGVertex con = new EDGVertex("-", ruleNo);
conNodes.add(con);
EDGEdge e1 = new EDGEdge(pos, con, EdgeType.NEG,true,false);
EDGEdge e2 = new EDGEdge(neg, con, EdgeType.NEG,true,false);
edg.addEdge(pos, con, e1);
edg.addEdge(neg, con, e2);
}
}
}
edg.setContradictionNodes(conNodes);
edg.setNodeMap(nodes);
edgs.put(null, edg);
try {
for (AnswerSet as : asl){
ExtendedDependencyGraph edg2 = edg.deepCopy();
edg2.setAnswerSet(as);
edgs.put(as, edg2);
}
} catch (ClassNotFoundException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else throw new NotValidProgramException();
}
| void function(Program p, AnswerSetList asl) throws NotValidProgramException{ if (isProgramValid(p)){ edgs = new HashMap<AnswerSet,ExtendedDependencyGraph>(); positiveNodes = new HashMap<String, List<EDGVertex>>(); negativeNodes = new HashMap<String, List<EDGVertex>>(); ExtendedDependencyGraph edg = new ExtendedDependencyGraph(); HashMap<String, List<EDGVertex>> nodes = new HashMap<String, List<EDGVertex>>(); HashSet<EDGVertex> conNodes = new HashSet<EDGVertex>(); Iterator<Rule> rules = p.iterator(); int ruleNo = 0; while (rules.hasNext()){ Rule r = rules.next(); ruleNo++; String atomName; EDGVertex v; if (r.isConstraint()){ atomName = "-"; v = new EDGVertex(atomName, ruleNo); conNodes.add(v); } else { List<Literal> head = r.getHead(); Literal l = head.get(0); if (l instanceof Neg){ atomName = "-" + l.getAtom().toString(); v = new EDGVertex(atomName, ruleNo); if (!negativeNodes.containsKey(atomName)){ List<EDGVertex> list = new LinkedList<EDGVertex>(); list.add(v); negativeNodes.put(atomName, list); } else{ List<EDGVertex> list = negativeNodes.get(atomName); list.add(v); } if (!nodes.containsKey(atomName)){ List<EDGVertex> list = new LinkedList<EDGVertex>(); list.add(v); nodes.put(atomName, list); } else{ List<EDGVertex> list = nodes.get(atomName); list.add(v); } } else { atomName = l.getAtom().toString(); v = new EDGVertex(atomName, ruleNo); if (!positiveNodes.containsKey(atomName)){ List<EDGVertex> list = new LinkedList<EDGVertex>(); list.add(v); positiveNodes.put(atomName, list); } else{ List<EDGVertex> list = positiveNodes.get(atomName); list.add(v); } if (!nodes.containsKey(atomName)){ List<EDGVertex> list = new LinkedList<EDGVertex>(); list.add(v); nodes.put(atomName, list); } else{ List<EDGVertex> list = nodes.get(atomName); list.add(v); } edg.addVertex(v); } } } rules = p.iterator(); while (rules.hasNext()){ Rule r = rules.next(); ruleNo++; String atomName; EDGVertex v; List<Literal> body = r.getBody(); for (Literal lit : body){ if (lit instanceof Neg){ atomName = "-" + lit.getAtom().toString(); if (!negativeNodes.containsKey(atomName)){ v = new EDGVertex (atomName, 0); List<EDGVertex> list = new LinkedList<EDGVertex>(); list.add(v); negativeNodes.put(atomName, list); List<EDGVertex> list2 = new LinkedList<EDGVertex>(); list2.add(v); nodes.put(atomName, list2); edg.addVertex(v); } } else { atomName = lit.getAtom().toString(); if (!positiveNodes.containsKey(atomName)){ List<EDGVertex> list = new LinkedList<EDGVertex>(); v = new EDGVertex(atomName, 0); list.add(v); positiveNodes.put(atomName, list); List<EDGVertex> list2 = new LinkedList<EDGVertex>(); list2.add(v); nodes.put(atomName, list2); edg.addVertex(v); } } } } Iterator<Rule> rules2 = p.iterator(); ruleNo = 0; while(rules2.hasNext()){ Rule r = rules2.next(); ruleNo++; List<Literal> body = r.getBody(); List<Literal> head = r.getHead(); String headName; boolean and = false; if (body.size() > 1) and = true; if (r.isConstraint()){ headName = "-"; } else if (head.get(0) instanceof Neg){ headName = "-" + head.get(0).getAtom().toString(); } else headName = head.get(0).getAtom().toString(); if (!body.isEmpty()){ for (Literal literal : body){ String name; if (literal instanceof Neg) name = "-" + literal.getAtom().toString(); else name = literal.getAtom().toString(); List<EDGVertex> sourcelist = nodes.get(name); EDGVertex target = null; EDGEdge e = null; for (EDGVertex v : nodes.get(headName)){ if (v.getRuleNo() == ruleNo) target = v; } boolean or = false; if (sourcelist.size() > 1) or = true; for(EDGVertex v : sourcelist){ if (literal.isDefaultNegated()){ e = new EDGEdge(v, target, EDGEdge.EdgeType.NEG, and, or); } else { e = new EDGEdge(v, target, EDGEdge.EdgeType.POS, and, or); } edg.addEdge(v, target, e); } } } } HashSet<Contradiction> contradictions = getContradictions(); ruleNo = p.size(); for (Contradiction c : contradictions){ for (EDGVertex pos : c.getPositive()){ for (EDGVertex neg : c.getNegative()){ ruleNo++; EDGVertex con = new EDGVertex("-", ruleNo); conNodes.add(con); EDGEdge e1 = new EDGEdge(pos, con, EdgeType.NEG,true,false); EDGEdge e2 = new EDGEdge(neg, con, EdgeType.NEG,true,false); edg.addEdge(pos, con, e1); edg.addEdge(neg, con, e2); } } } edg.setContradictionNodes(conNodes); edg.setNodeMap(nodes); edgs.put(null, edg); try { for (AnswerSet as : asl){ ExtendedDependencyGraph edg2 = edg.deepCopy(); edg2.setAnswerSet(as); edgs.put(as, edg2); } } catch (ClassNotFoundException IOException e) { e.printStackTrace(); } } else throw new NotValidProgramException(); } | /**
* Creates an Extended Dependency Graph to a logic program
* @param p Logic program
* @throws NotValidProgramException Exception is thrown when program is not suitable for being represented
* as an Extended Dependency Graph
*/ | Creates an Extended Dependency Graph to a logic program | createEDG | {
"repo_name": "Angerona/angerona-framework",
"path": "aspgraph/src/main/java/com/github/angerona/fw/aspgraph/controller/EDGController.java",
"license": "gpl-3.0",
"size": 10301
} | [
"java.io.IOException",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List",
"net.sf.tweety.logicprogramming.asplibrary.syntax.Literal",
"net.sf.tweety.logicprogramming.asplibrary.syntax.Neg",
"net.sf.tweety.logicprogramming.asplibrary.syntax.Program",
"net.sf.tweety.logicprogramming.asplibrary.syntax.Rule",
"net.sf.tweety.logicprogramming.asplibrary.util.AnswerSet",
"net.sf.tweety.logicprogramming.asplibrary.util.AnswerSetList"
] | import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import net.sf.tweety.logicprogramming.asplibrary.syntax.Literal; import net.sf.tweety.logicprogramming.asplibrary.syntax.Neg; import net.sf.tweety.logicprogramming.asplibrary.syntax.Program; import net.sf.tweety.logicprogramming.asplibrary.syntax.Rule; import net.sf.tweety.logicprogramming.asplibrary.util.AnswerSet; import net.sf.tweety.logicprogramming.asplibrary.util.AnswerSetList; | import java.io.*; import java.util.*; import net.sf.tweety.logicprogramming.asplibrary.syntax.*; import net.sf.tweety.logicprogramming.asplibrary.util.*; | [
"java.io",
"java.util",
"net.sf.tweety"
] | java.io; java.util; net.sf.tweety; | 16,359 |
public CollectionOfLinksOfDirectoryObjectAutoGenerated withAdditionalProperties(
Map<String, Object> additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
} | CollectionOfLinksOfDirectoryObjectAutoGenerated function( Map<String, Object> additionalProperties) { this.additionalProperties = additionalProperties; return this; } | /**
* Set the additionalProperties property: Collection of links of directoryObject.
*
* @param additionalProperties the additionalProperties value to set.
* @return the CollectionOfLinksOfDirectoryObjectAutoGenerated object itself.
*/ | Set the additionalProperties property: Collection of links of directoryObject | withAdditionalProperties | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/CollectionOfLinksOfDirectoryObjectAutoGenerated.java",
"license": "mit",
"size": 3537
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,848,986 |
String outputDirectory = Utils.getOutputDirectoryPath("RenderDocumentWithNotes");
String pageFilePathFormat = new File(outputDirectory, "page_{0}.html").getPath();
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
viewOptions.setRenderNotes(true);
try (Viewer viewer = new Viewer(TestFiles.PPTX_WITH_NOTES)) {
viewer.view(viewOptions);
}
System.out.println(
"\nSource document rendered successfully.\nCheck output in " + outputDirectory);
} | String outputDirectory = Utils.getOutputDirectoryPath(STR); String pageFilePathFormat = new File(outputDirectory, STR).getPath(); HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat); viewOptions.setRenderNotes(true); try (Viewer viewer = new Viewer(TestFiles.PPTX_WITH_NOTES)) { viewer.view(viewOptions); } System.out.println( STR + outputDirectory); } | /**
* This example demonstrates how to render presentation with notes.
*/ | This example demonstrates how to render presentation with notes | run | {
"repo_name": "groupdocs-viewer/GroupDocs.Viewer-for-Java",
"path": "Examples/src/main/java/com/groupdocs/viewer/examples/advanced_usage/rendering/common_rendering_options/RenderDocumentWithNotes.java",
"license": "mit",
"size": 1025
} | [
"com.groupdocs.viewer.Viewer",
"com.groupdocs.viewer.examples.TestFiles",
"com.groupdocs.viewer.examples.Utils",
"com.groupdocs.viewer.options.HtmlViewOptions",
"java.io.File"
] | import com.groupdocs.viewer.Viewer; import com.groupdocs.viewer.examples.TestFiles; import com.groupdocs.viewer.examples.Utils; import com.groupdocs.viewer.options.HtmlViewOptions; import java.io.File; | import com.groupdocs.viewer.*; import com.groupdocs.viewer.examples.*; import com.groupdocs.viewer.options.*; import java.io.*; | [
"com.groupdocs.viewer",
"java.io"
] | com.groupdocs.viewer; java.io; | 2,191,258 |
public StatementHelper generateUpdateQuery(String tableName, RowItem item); | StatementHelper function(String tableName, RowItem item); | /**
* Generates an UPDATE query with the provided parameters.
*
* @param tableName
* Name of the table queried
* @param item
* RowItem containing the updated values update.
* @return StatementHelper instance containing the query string for a
* PreparedStatement and the values required for the parameters
*/ | Generates an UPDATE query with the provided parameters | generateUpdateQuery | {
"repo_name": "jdahlstrom/vaadin.react",
"path": "server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/SQLGenerator.java",
"license": "apache-2.0",
"size": 4049
} | [
"com.vaadin.data.util.sqlcontainer.RowItem"
] | import com.vaadin.data.util.sqlcontainer.RowItem; | import com.vaadin.data.util.sqlcontainer.*; | [
"com.vaadin.data"
] | com.vaadin.data; | 267,834 |
private Response addSpaceACLsToResponse(ResponseBuilder response,
String spaceID,
String storeID)
throws ResourceException {
Map<String, String> aclProps = new HashMap<String, String>();
Map<String, AclType> acls = spaceResource.getSpaceACLs(spaceID,
storeID);
for (String key : acls.keySet()) {
aclProps.put(key, acls.get(key).name());
}
return addPropertiesToResponse(response, aclProps);
} | Response function(ResponseBuilder response, String spaceID, String storeID) throws ResourceException { Map<String, String> aclProps = new HashMap<String, String>(); Map<String, AclType> acls = spaceResource.getSpaceACLs(spaceID, storeID); for (String key : acls.keySet()) { aclProps.put(key, acls.get(key).name()); } return addPropertiesToResponse(response, aclProps); } | /**
* Adds the ACLs of a space as header values to the response.
*/ | Adds the ACLs of a space as header values to the response | addSpaceACLsToResponse | {
"repo_name": "duracloud/duracloud",
"path": "durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java",
"license": "apache-2.0",
"size": 13135
} | [
"java.util.HashMap",
"java.util.Map",
"javax.ws.rs.core.Response",
"org.duracloud.common.model.AclType",
"org.duracloud.durastore.error.ResourceException"
] | import java.util.HashMap; import java.util.Map; import javax.ws.rs.core.Response; import org.duracloud.common.model.AclType; import org.duracloud.durastore.error.ResourceException; | import java.util.*; import javax.ws.rs.core.*; import org.duracloud.common.model.*; import org.duracloud.durastore.error.*; | [
"java.util",
"javax.ws",
"org.duracloud.common",
"org.duracloud.durastore"
] | java.util; javax.ws; org.duracloud.common; org.duracloud.durastore; | 805,780 |
private void resumeConnectingToDevice() {
// Is the Bluetooth adapter enabled?
if (!mBluetoothAdapter.isEnabled()) {
attemptEnableBluetooth();
return;
}
// Are we bound to the device management service?
if (mDeviceManagementBinder == null) {
attemptBindService();
return;
}
final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mTargetAddress);
final Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices();
if (bondedDevices == null) {
showFailure(R.string.failure_connect_device);
return;
}
// Are we bonded to the Bluetooth device?
if (!bondedDevices.contains(device)) {
attemptBondDevice(device);
return;
}
attemptConnectDevice(device);
} | void function() { if (!mBluetoothAdapter.isEnabled()) { attemptEnableBluetooth(); return; } if (mDeviceManagementBinder == null) { attemptBindService(); return; } final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mTargetAddress); final Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices(); if (bondedDevices == null) { showFailure(R.string.failure_connect_device); return; } if (!bondedDevices.contains(device)) { attemptBondDevice(device); return; } attemptConnectDevice(device); } | /**
* Attempts to connect to the device with the specified address, handling
* failure cases where possible.
* <p/>
* If necessary, this method will attempt to:
* <ul>
* <li>Prompt the user to enable Bluetooth</li>
* <li>Initiate bonding with the requested device</li>
* </ul>
*/ | Attempts to connect to the device with the specified address, handling failure cases where possible. If necessary, this method will attempt to: Prompt the user to enable Bluetooth Initiate bonding with the requested device | resumeConnectingToDevice | {
"repo_name": "aviverette/a2dpswitcher",
"path": "app/src/main/java/com/googamaphone/a2dpswitcher/ReadTagActivity.java",
"license": "apache-2.0",
"size": 14922
} | [
"android.bluetooth.BluetoothDevice",
"java.util.Set"
] | import android.bluetooth.BluetoothDevice; import java.util.Set; | import android.bluetooth.*; import java.util.*; | [
"android.bluetooth",
"java.util"
] | android.bluetooth; java.util; | 2,334,627 |
boolean onContextClick(@NonNull MotionEvent e); | boolean onContextClick(@NonNull MotionEvent e); | /**
* Called when user performs a context click, usually via mouse pointer
* right-click.
*
* @param e the event associated with the click.
* @return true if the event was handled.
*/ | Called when user performs a context click, usually via mouse pointer right-click | onContextClick | {
"repo_name": "AndroidX/androidx",
"path": "recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/OnContextClickListener.java",
"license": "apache-2.0",
"size": 1249
} | [
"android.view.MotionEvent",
"androidx.annotation.NonNull"
] | import android.view.MotionEvent; import androidx.annotation.NonNull; | import android.view.*; import androidx.annotation.*; | [
"android.view",
"androidx.annotation"
] | android.view; androidx.annotation; | 2,192,923 |
@CheckForNull
Validator childNodeDeleted(String name, NodeState before)
throws CommitFailedException; | Validator childNodeDeleted(String name, NodeState before) throws CommitFailedException; | /**
* Validate a deleted node
* @param name The name of the deleted node.
* @param before the original node
* @return a {@code Validator} for the removed subtree or
* {@code null} if validation should not decent into the subtree
* @throws CommitFailedException if validation fails.
*/ | Validate a deleted node | childNodeDeleted | {
"repo_name": "tteofili/jackrabbit-oak",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java",
"license": "apache-2.0",
"size": 3447
} | [
"org.apache.jackrabbit.oak.api.CommitFailedException",
"org.apache.jackrabbit.oak.spi.state.NodeState"
] | import org.apache.jackrabbit.oak.api.CommitFailedException; import org.apache.jackrabbit.oak.spi.state.NodeState; | import org.apache.jackrabbit.oak.api.*; import org.apache.jackrabbit.oak.spi.state.*; | [
"org.apache.jackrabbit"
] | org.apache.jackrabbit; | 1,614,138 |
HttpPipeline getHttpPipeline(); | HttpPipeline getHttpPipeline(); | /**
* Gets The HTTP pipeline to send requests through.
*
* @return the httpPipeline value.
*/ | Gets The HTTP pipeline to send requests through | getHttpPipeline | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/machinelearningservices/azure-resourcemanager-machinelearningservices/src/main/java/com/azure/resourcemanager/machinelearningservices/fluent/AzureMachineLearningWorkspaces.java",
"license": "mit",
"size": 3846
} | [
"com.azure.core.http.HttpPipeline"
] | import com.azure.core.http.HttpPipeline; | import com.azure.core.http.*; | [
"com.azure.core"
] | com.azure.core; | 2,628,690 |
public AliasedField nextIdValue(TableReference sourceTable, TableReference sourceReference, Table autoNumberTable,
String nameColumn, String valueColumn) {
String autoNumberName = getAutoNumberName(sourceTable.getName());
if (sourceReference == null) {
return new FieldFromSelect(new SelectStatement(Function.isnull(new FieldReference(valueColumn), new FieldLiteral(1))).from(
new TableReference(autoNumberTable.getName(), autoNumberTable.isTemporary())).where(
new Criterion(Operator.EQ, new FieldReference(nameColumn), autoNumberName)));
} else {
return new MathsField(new FieldFromSelect(new SelectStatement(Function.isnull(new FieldReference(valueColumn),
new FieldLiteral(0))).from(new TableReference(autoNumberTable.getName(), autoNumberTable.isTemporary())).where(
new Criterion(Operator.EQ, new FieldReference(nameColumn), autoNumberName))), MathsOperator.PLUS, new FieldReference(
sourceReference, "id"));
}
}
| AliasedField function(TableReference sourceTable, TableReference sourceReference, Table autoNumberTable, String nameColumn, String valueColumn) { String autoNumberName = getAutoNumberName(sourceTable.getName()); if (sourceReference == null) { return new FieldFromSelect(new SelectStatement(Function.isnull(new FieldReference(valueColumn), new FieldLiteral(1))).from( new TableReference(autoNumberTable.getName(), autoNumberTable.isTemporary())).where( new Criterion(Operator.EQ, new FieldReference(nameColumn), autoNumberName))); } else { return new MathsField(new FieldFromSelect(new SelectStatement(Function.isnull(new FieldReference(valueColumn), new FieldLiteral(0))).from(new TableReference(autoNumberTable.getName(), autoNumberTable.isTemporary())).where( new Criterion(Operator.EQ, new FieldReference(nameColumn), autoNumberName))), MathsOperator.PLUS, new FieldReference( sourceReference, "id")); } } | /**
* Creates a field reference to provide id column values.
*
* @param sourceTable the source table.
* @param sourceReference a reference lookup to add the ID to.
* @param autoNumberTable the name of the table to query over.
* @param nameColumn the name of the column holding the Autonumber name.
* @param valueColumn the name of the column holding the Autonumber value.
* @return a field reference.
*/ | Creates a field reference to provide id column values | nextIdValue | {
"repo_name": "badgerwithagun/morf",
"path": "morf-core/src/main/java/org/alfasoftware/morf/jdbc/SqlDialect.java",
"license": "apache-2.0",
"size": 128834
} | [
"org.alfasoftware.morf.metadata.Table",
"org.alfasoftware.morf.sql.SelectStatement",
"org.alfasoftware.morf.sql.element.AliasedField",
"org.alfasoftware.morf.sql.element.Criterion",
"org.alfasoftware.morf.sql.element.FieldFromSelect",
"org.alfasoftware.morf.sql.element.FieldLiteral",
"org.alfasoftware.morf.sql.element.FieldReference",
"org.alfasoftware.morf.sql.element.Function",
"org.alfasoftware.morf.sql.element.MathsField",
"org.alfasoftware.morf.sql.element.MathsOperator",
"org.alfasoftware.morf.sql.element.Operator",
"org.alfasoftware.morf.sql.element.TableReference"
] | import org.alfasoftware.morf.metadata.Table; import org.alfasoftware.morf.sql.SelectStatement; import org.alfasoftware.morf.sql.element.AliasedField; import org.alfasoftware.morf.sql.element.Criterion; import org.alfasoftware.morf.sql.element.FieldFromSelect; import org.alfasoftware.morf.sql.element.FieldLiteral; import org.alfasoftware.morf.sql.element.FieldReference; import org.alfasoftware.morf.sql.element.Function; import org.alfasoftware.morf.sql.element.MathsField; import org.alfasoftware.morf.sql.element.MathsOperator; import org.alfasoftware.morf.sql.element.Operator; import org.alfasoftware.morf.sql.element.TableReference; | import org.alfasoftware.morf.metadata.*; import org.alfasoftware.morf.sql.*; import org.alfasoftware.morf.sql.element.*; | [
"org.alfasoftware.morf"
] | org.alfasoftware.morf; | 75,081 |
public void generateBackground() throws ContentTypeNotBoundException
{
MultiplicityClient.get().getViewPort().setBackgroundColor(MuseumAppPreferences.getBackgroundColour());
File imageFile = MuseumAppPreferences.getBackgroundImage();
if (imageFile != null)
{
if (imageFile.exists())
{
IImage background = stage.getContentFactory().create(IImage.class, "background", UUID.randomUUID());
background.setImage(imageFile);
background.setSize(displayWidth, displayHeight);
background.setRelativeLocation(new Vector2f());
background.setInteractionEnabled(false);
stage.getZOrderManager().sendToBottom(background);
stage.addItem(background);
}
}
}
| void function() throws ContentTypeNotBoundException { MultiplicityClient.get().getViewPort().setBackgroundColor(MuseumAppPreferences.getBackgroundColour()); File imageFile = MuseumAppPreferences.getBackgroundImage(); if (imageFile != null) { if (imageFile.exists()) { IImage background = stage.getContentFactory().create(IImage.class, STR, UUID.randomUUID()); background.setImage(imageFile); background.setSize(displayWidth, displayHeight); background.setRelativeLocation(new Vector2f()); background.setInteractionEnabled(false); stage.getZOrderManager().sendToBottom(background); stage.addItem(background); } } } | /**
* Generate background.
*
* @throws ContentTypeNotBoundException
* the content type not bound exception
*/ | Generate background | generateBackground | {
"repo_name": "synergynet/synergynet3.1",
"path": "synergynet3-museum/synergynet3-museum-table/src/main/java/synergynet3/museum/table/mainapp/POIManager.java",
"license": "bsd-3-clause",
"size": 11234
} | [
"com.jme3.math.Vector2f",
"java.io.File",
"java.util.UUID"
] | import com.jme3.math.Vector2f; import java.io.File; import java.util.UUID; | import com.jme3.math.*; import java.io.*; import java.util.*; | [
"com.jme3.math",
"java.io",
"java.util"
] | com.jme3.math; java.io; java.util; | 2,816,387 |
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String azureFirewallName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, azureFirewallName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String azureFirewallName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, azureFirewallName), serviceCallback); } | /**
* Deletes the specified Azure Firewall.
*
* @param resourceGroupName The name of the resource group.
* @param azureFirewallName The name of the Azure Firewall.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Deletes the specified Azure Firewall | beginDeleteAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/AzureFirewallsInner.java",
"license": "mit",
"size": 60332
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 284,799 |
public void addChildResource(SimulatorResource resource)
throws InvalidArgsException, SimulatorException {
nativeAddChildResource(resource);
} | void function(SimulatorResource resource) throws InvalidArgsException, SimulatorException { nativeAddChildResource(resource); } | /**
* API to add child resource to collection.
*
* @param resource
* Child resource to be added to collection.
*
* @throws InvalidArgsException
* This exception will be thrown on invalid input.
* @throws SimulatorException
* This exception will be thrown on occurrence of error in
* native.
*/ | API to add child resource to collection | addChildResource | {
"repo_name": "rzr/iotivity",
"path": "service/simulator/java/sdk/src/org/oic/simulator/server/SimulatorCollectionResource.java",
"license": "apache-2.0",
"size": 3649
} | [
"org.oic.simulator.InvalidArgsException",
"org.oic.simulator.SimulatorException"
] | import org.oic.simulator.InvalidArgsException; import org.oic.simulator.SimulatorException; | import org.oic.simulator.*; | [
"org.oic.simulator"
] | org.oic.simulator; | 2,422,921 |
static public void printNotice(TextOutputStream stream) {
// stream.println("\n******************************* NOTICE ************************************");
stream.println("jModelTest " + CURRENT_VERSION);
stream.println("Copyright (C) 2011 D. Darriba, G.L. Taboada, R. Doallo and D. Posada");
stream.println("This program comes with ABSOLUTELY NO WARRANTY");
stream.println("This is free software, and you are welcome to redistribute it under certain");
stream.println("conditions");
stream.println(" ");
stream.println("Notice: This program may contain errors. Please inspect results carefully.");
stream.println(" ");
// stream.println("***************************************************************************\n");
} | static void function(TextOutputStream stream) { stream.println(STR + CURRENT_VERSION); stream.println(STR); stream.println(STR); stream.println(STR); stream.println(STR); stream.println(" "); stream.println(STR); stream.println(" "); } | /****************************
* printNotice ****************************** * Prints notice information at
* start up * * *
***********************************************************************/ | printNotice ****************************** * Prints notice information at start up * * | printNotice | {
"repo_name": "ddarriba/jmodeltest2",
"path": "src/main/java/es/uvigo/darwin/jmodeltest/ModelTest.java",
"license": "gpl-3.0",
"size": 60537
} | [
"es.uvigo.darwin.jmodeltest.io.TextOutputStream"
] | import es.uvigo.darwin.jmodeltest.io.TextOutputStream; | import es.uvigo.darwin.jmodeltest.io.*; | [
"es.uvigo.darwin"
] | es.uvigo.darwin; | 1,240,446 |
private void error() {
org.hibernate.Transaction txn = session.getTransaction();
if (txn != null && txn.getStatus().equals(TransactionStatus.ACTIVE)) {
txn.rollback();
}
}
/**
* Closes and unbinds the current session. <br/>
* If {@link ManagedSessionContext} had a session before the current session, re-binds it to {@link ManagedSessionContext} | void function() { org.hibernate.Transaction txn = session.getTransaction(); if (txn != null && txn.getStatus().equals(TransactionStatus.ACTIVE)) { txn.rollback(); } } /** * Closes and unbinds the current session. <br/> * If {@link ManagedSessionContext} had a session before the current session, re-binds it to {@link ManagedSessionContext} | /**
* If transaction is present and active then rollback.
*/ | If transaction is present and active then rollback | error | {
"repo_name": "robeio/robe",
"path": "robe-hibernate/src/main/java/io/robe/hibernate/transaction/Transaction.java",
"license": "lgpl-3.0",
"size": 6571
} | [
"org.hibernate.context.internal.ManagedSessionContext",
"org.hibernate.resource.transaction.spi.TransactionStatus"
] | import org.hibernate.context.internal.ManagedSessionContext; import org.hibernate.resource.transaction.spi.TransactionStatus; | import org.hibernate.context.internal.*; import org.hibernate.resource.transaction.spi.*; | [
"org.hibernate.context",
"org.hibernate.resource"
] | org.hibernate.context; org.hibernate.resource; | 551,875 |
@Override
public boolean isRecognizedFormat(InputStream stream)
throws IOException {
// Our strategy is to look for the "PY <year>" line.
BufferedReader in =
new BufferedReader(ImportFormatReader.getReaderDefaultEncoding(stream));
//Pattern pat1 = Pattern.compile("PY: \\d{4}");
Pattern pat1 = Pattern.compile("Record.*INSPEC.*");
//was PY \\\\d{4}? before
String str;
while ((str = in.readLine()) != null) {
//Inspec and IEEE seem to have these strange " - " between key and value
//str = str.replace(" - ", "");
//System.out.println(str);
if (pat1.matcher(str).find()) {
return true;
}
}
return false;
} | boolean function(InputStream stream) throws IOException { BufferedReader in = new BufferedReader(ImportFormatReader.getReaderDefaultEncoding(stream)); Pattern pat1 = Pattern.compile(STR); String str; while ((str = in.readLine()) != null) { if (pat1.matcher(str).find()) { return true; } } return false; } | /**
* Check whether the source is in the correct format for this importer.
*/ | Check whether the source is in the correct format for this importer | isRecognizedFormat | {
"repo_name": "robymus/jabref",
"path": "src/main/java/net/sf/jabref/importer/fileformat/InspecImporter.java",
"license": "gpl-2.0",
"size": 6332
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.util.regex.Pattern",
"net.sf.jabref.importer.ImportFormatReader"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.util.regex.Pattern; import net.sf.jabref.importer.ImportFormatReader; | import java.io.*; import java.util.regex.*; import net.sf.jabref.importer.*; | [
"java.io",
"java.util",
"net.sf.jabref"
] | java.io; java.util; net.sf.jabref; | 1,804,539 |
@Deprecated
public ReferenceList getWorkflowsEnabled( AdminUser user, Locale locale )
{
return getWorkflowsEnabled( (User) user, locale );
} | ReferenceList function( AdminUser user, Locale locale ) { return getWorkflowsEnabled( (User) user, locale ); } | /**
* return a reference list which contains a list enabled workflow
*
* @param user
* the User
* @param locale
* the locale
* @return a reference list which contains a list enabled workflow
* @deprecated use getWorkflowsEnabled( User, Locale )
*/ | return a reference list which contains a list enabled workflow | getWorkflowsEnabled | {
"repo_name": "lutece-platform/lutece-core",
"path": "src/java/fr/paris/lutece/portal/service/workflow/WorkflowService.java",
"license": "bsd-3-clause",
"size": 36553
} | [
"fr.paris.lutece.api.user.User",
"fr.paris.lutece.portal.business.user.AdminUser",
"fr.paris.lutece.util.ReferenceList",
"java.util.Locale"
] | import fr.paris.lutece.api.user.User; import fr.paris.lutece.portal.business.user.AdminUser; import fr.paris.lutece.util.ReferenceList; import java.util.Locale; | import fr.paris.lutece.api.user.*; import fr.paris.lutece.portal.business.user.*; import fr.paris.lutece.util.*; import java.util.*; | [
"fr.paris.lutece",
"java.util"
] | fr.paris.lutece; java.util; | 117,202 |
@Nonnull
public static ItemStack loadItemStackFromTag(@Nonnull NBTTagCompound tag)
{
ItemStack stack = new ItemStack(tag);
if (tag.hasKey("ActualCount", Constants.NBT.TAG_INT))
{
stack.setCount(tag.getInteger("ActualCount"));
}
return stack.isEmpty() ? ItemStack.EMPTY : stack;
} | static ItemStack function(@Nonnull NBTTagCompound tag) { ItemStack stack = new ItemStack(tag); if (tag.hasKey(STR, Constants.NBT.TAG_INT)) { stack.setCount(tag.getInteger(STR)); } return stack.isEmpty() ? ItemStack.EMPTY : stack; } | /**
* Reads an ItemStack from the given compound tag, including the Ender Utilities-specific custom stackSize.
* @param tag
* @return
*/ | Reads an ItemStack from the given compound tag, including the Ender Utilities-specific custom stackSize | loadItemStackFromTag | {
"repo_name": "maruohon/autoverse",
"path": "src/main/java/fi/dy/masa/autoverse/util/NBTUtils.java",
"license": "gpl-3.0",
"size": 17670
} | [
"javax.annotation.Nonnull",
"net.minecraft.item.ItemStack",
"net.minecraft.nbt.NBTTagCompound",
"net.minecraftforge.common.util.Constants"
] | import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants; | import javax.annotation.*; import net.minecraft.item.*; import net.minecraft.nbt.*; import net.minecraftforge.common.util.*; | [
"javax.annotation",
"net.minecraft.item",
"net.minecraft.nbt",
"net.minecraftforge.common"
] | javax.annotation; net.minecraft.item; net.minecraft.nbt; net.minecraftforge.common; | 1,919,667 |
@SuppressLint("NewApi")
public static boolean isExternalStorageRemovable() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
return Environment.isExternalStorageRemovable();
}
return true;
} | @SuppressLint(STR) static boolean function() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return Environment.isExternalStorageRemovable(); } return true; } | /**
* Check if external storage is built-in or removable.
*
* @return True if external storage is removable (like an SD card), false
* otherwise.
*/ | Check if external storage is built-in or removable | isExternalStorageRemovable | {
"repo_name": "Ajapaik/ajapaik-android",
"path": "app/src/ee/ajapaik/android/external/bitmaputil/Utils.java",
"license": "mit",
"size": 4502
} | [
"android.annotation.SuppressLint",
"android.os.Build",
"android.os.Environment"
] | import android.annotation.SuppressLint; import android.os.Build; import android.os.Environment; | import android.annotation.*; import android.os.*; | [
"android.annotation",
"android.os"
] | android.annotation; android.os; | 1,674,637 |
public Path lookupNative(String name, Map<String,Object> attributes)
{
return lookup(name, attributes);
} | Path function(String name, Map<String,Object> attributes) { return lookup(name, attributes); } | /**
* Looks up a native path, adding attributes.
*/ | Looks up a native path, adding attributes | lookupNative | {
"repo_name": "christianchristensen/resin",
"path": "modules/kernel/src/com/caucho/vfs/Path.java",
"license": "gpl-2.0",
"size": 35240
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,692,318 |
public BlockBuilder closeEntryStrict()
throws DuplicateMapKeyException, NotSupportedException
{
if (!currentEntryOpened) {
throw new IllegalStateException("Expected entry to be opened but was closed");
}
entryAdded(false);
currentEntryOpened = false;
ensureHashTableSize();
int previousAggregatedEntryCount = offsets[positionCount - 1];
int aggregatedEntryCount = offsets[positionCount];
int entryCount = aggregatedEntryCount - previousAggregatedEntryCount;
int[] rawHashTables = hashTables.get();
verify(rawHashTables != null, "rawHashTables is null");
buildHashTableStrict(
keyBlockBuilder,
previousAggregatedEntryCount,
entryCount,
keyBlockEquals,
keyBlockHashCode,
rawHashTables,
previousAggregatedEntryCount * HASH_MULTIPLIER,
entryCount * HASH_MULTIPLIER);
return this;
} | BlockBuilder function() throws DuplicateMapKeyException, NotSupportedException { if (!currentEntryOpened) { throw new IllegalStateException(STR); } entryAdded(false); currentEntryOpened = false; ensureHashTableSize(); int previousAggregatedEntryCount = offsets[positionCount - 1]; int aggregatedEntryCount = offsets[positionCount]; int entryCount = aggregatedEntryCount - previousAggregatedEntryCount; int[] rawHashTables = hashTables.get(); verify(rawHashTables != null, STR); buildHashTableStrict( keyBlockBuilder, previousAggregatedEntryCount, entryCount, keyBlockEquals, keyBlockHashCode, rawHashTables, previousAggregatedEntryCount * HASH_MULTIPLIER, entryCount * HASH_MULTIPLIER); return this; } | /**
* This method will check duplicate keys and close entry.
* <p>
* When duplicate keys are discovered, the block is guaranteed to be in
* a consistent state before {@link DuplicateMapKeyException} is thrown.
* In other words, one can continue to use this BlockBuilder.
*/ | This method will check duplicate keys and close entry. When duplicate keys are discovered, the block is guaranteed to be in a consistent state before <code>DuplicateMapKeyException</code> is thrown. In other words, one can continue to use this BlockBuilder | closeEntryStrict | {
"repo_name": "twitter-forks/presto",
"path": "presto-common/src/main/java/com/facebook/presto/common/block/MapBlockBuilder.java",
"license": "apache-2.0",
"size": 21041
} | [
"com.facebook.presto.common.NotSupportedException"
] | import com.facebook.presto.common.NotSupportedException; | import com.facebook.presto.common.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 736,207 |
@RequiredScope({view,download})
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = UrlHelpers.DOWNLOAD_ORDER_HISTORY, method = RequestMethod.POST)
public @ResponseBody DownloadOrderSummaryResponse getDownloadOrderHistory(
@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
@RequestBody DownloadOrderSummaryRequest request) throws Throwable {
return this.fileService.getDownloadOrderHistory(userId, request);
}
| @RequiredScope({view,download}) @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = UrlHelpers.DOWNLOAD_ORDER_HISTORY, method = RequestMethod.POST) @ResponseBody DownloadOrderSummaryResponse function( @RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId, @RequestBody DownloadOrderSummaryRequest request) throws Throwable { return this.fileService.getDownloadOrderHistory(userId, request); } | /**
* Get the caller's download order history in reverse chronological order. This
* is a paginated call.
*
* @param userId
* @return A single page of download order summaries.
* @throws Throwable
*/ | Get the caller's download order history in reverse chronological order. This is a paginated call | getDownloadOrderHistory | {
"repo_name": "Sage-Bionetworks/Synapse-Repository-Services",
"path": "services/repository/src/main/java/org/sagebionetworks/file/controller/UploadController.java",
"license": "apache-2.0",
"size": 47138
} | [
"org.sagebionetworks.repo.model.AuthorizationConstants",
"org.sagebionetworks.repo.model.file.DownloadOrderSummaryRequest",
"org.sagebionetworks.repo.model.file.DownloadOrderSummaryResponse",
"org.sagebionetworks.repo.web.RequiredScope",
"org.sagebionetworks.repo.web.UrlHelpers",
"org.springframework.http.HttpStatus",
"org.springframework.web.bind.annotation.RequestBody",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.RequestParam",
"org.springframework.web.bind.annotation.ResponseBody",
"org.springframework.web.bind.annotation.ResponseStatus"
] | import org.sagebionetworks.repo.model.AuthorizationConstants; import org.sagebionetworks.repo.model.file.DownloadOrderSummaryRequest; import org.sagebionetworks.repo.model.file.DownloadOrderSummaryResponse; import org.sagebionetworks.repo.web.RequiredScope; import org.sagebionetworks.repo.web.UrlHelpers; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; | import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.file.*; import org.sagebionetworks.repo.web.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; | [
"org.sagebionetworks.repo",
"org.springframework.http",
"org.springframework.web"
] | org.sagebionetworks.repo; org.springframework.http; org.springframework.web; | 2,383,766 |
public static DataNode instantiateDataNode(String args[],
Configuration conf,
SecureResources resources) throws IOException {
if (conf == null)
conf = new Configuration();
if (!parseArguments(args, conf)) {
printUsage();
System.exit(-2);
}
if (conf.get("dfs.network.script") != null) {
LOG.error("This configuration for rack identification is not supported" +
" anymore. RackID resolution is handled by the NameNode.");
System.exit(-1);
}
String[] dataDirs = conf.getStrings(DATA_DIR_KEY);
dnThreadName = "DataNode: [" +
StringUtils.arrayToString(dataDirs) + "]";
DefaultMetricsSystem.initialize("DataNode");
return makeInstance(dataDirs, conf, resources);
} | static DataNode function(String args[], Configuration conf, SecureResources resources) throws IOException { if (conf == null) conf = new Configuration(); if (!parseArguments(args, conf)) { printUsage(); System.exit(-2); } if (conf.get(STR) != null) { LOG.error(STR + STR); System.exit(-1); } String[] dataDirs = conf.getStrings(DATA_DIR_KEY); dnThreadName = STR + StringUtils.arrayToString(dataDirs) + "]"; DefaultMetricsSystem.initialize(STR); return makeInstance(dataDirs, conf, resources); } | /** Instantiate a single datanode object. This must be run by invoking
* {@link DataNode#runDatanodeDaemon(DataNode)} subsequently.
* @param resources Secure resources needed to run under Kerberos
*/ | Instantiate a single datanode object. This must be run by invoking <code>DataNode#runDatanodeDaemon(DataNode)</code> subsequently | instantiateDataNode | {
"repo_name": "gndpig/hadoop",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java",
"license": "apache-2.0",
"size": 86689
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.server.datanode.SecureDataNodeStarter",
"org.apache.hadoop.metrics2.lib.DefaultMetricsSystem",
"org.apache.hadoop.util.StringUtils"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.server.datanode.SecureDataNodeStarter; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.util.StringUtils; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.server.datanode.*; import org.apache.hadoop.metrics2.lib.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,793,724 |
protected boolean verifyEnvironMarkerData(Map<String, String> markerData, Environment env,
Iterable<String> keys) throws InterruptedException {
Map<String, String> environ = ActionEnvironmentFunction.getEnvironmentView(env, keys);
if (env.valuesMissing()) {
return false; // Returns false so caller knows to return immediately
}
Map<String, String> repoEnvOverride = PrecomputedValue.REPO_ENV.get(env);
if (repoEnvOverride == null) {
return false;
}
Map<String, String> repoEnv = new LinkedHashMap<>(environ);
for (Map.Entry<String, String> value : repoEnvOverride.entrySet()) {
repoEnv.put(value.getKey(), value.getValue());
}
// Verify that all environment variable in the marker file are also in keys
for (String key : markerData.keySet()) {
if (key.startsWith("ENV:") && !repoEnv.containsKey(key.substring(4))) {
return false;
}
}
// Now verify the values of the marker data
for (Map.Entry<String, String> value : repoEnv.entrySet()) {
if (!markerData.containsKey("ENV:" + value.getKey())) {
return false;
}
String markerValue = markerData.get("ENV:" + value.getKey());
if (!Objects.equals(markerValue, value.getValue())) {
return false;
}
}
return true;
} | boolean function(Map<String, String> markerData, Environment env, Iterable<String> keys) throws InterruptedException { Map<String, String> environ = ActionEnvironmentFunction.getEnvironmentView(env, keys); if (env.valuesMissing()) { return false; } Map<String, String> repoEnvOverride = PrecomputedValue.REPO_ENV.get(env); if (repoEnvOverride == null) { return false; } Map<String, String> repoEnv = new LinkedHashMap<>(environ); for (Map.Entry<String, String> value : repoEnvOverride.entrySet()) { repoEnv.put(value.getKey(), value.getValue()); } for (String key : markerData.keySet()) { if (key.startsWith("ENV:") && !repoEnv.containsKey(key.substring(4))) { return false; } } for (Map.Entry<String, String> value : repoEnv.entrySet()) { if (!markerData.containsKey("ENV:" + value.getKey())) { return false; } String markerValue = markerData.get("ENV:" + value.getKey()); if (!Objects.equals(markerValue, value.getValue())) { return false; } } return true; } | /**
* Verify marker data previously saved by
* {@link #declareEnvironmentDependencies(Map, Environment, Iterable)}. This function is to be
* called from a {@link #verifyMarkerData(Rule, Map, Environment)} function to verify the values
* for environment variables.
*/ | Verify marker data previously saved by <code>#declareEnvironmentDependencies(Map, Environment, Iterable)</code>. This function is to be called from a <code>#verifyMarkerData(Rule, Map, Environment)</code> function to verify the values for environment variables | verifyEnvironMarkerData | {
"repo_name": "cushon/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java",
"license": "apache-2.0",
"size": 27637
} | [
"com.google.devtools.build.lib.skyframe.ActionEnvironmentFunction",
"com.google.devtools.build.lib.skyframe.PrecomputedValue",
"com.google.devtools.build.skyframe.SkyFunction",
"java.util.LinkedHashMap",
"java.util.Map",
"java.util.Objects"
] | import com.google.devtools.build.lib.skyframe.ActionEnvironmentFunction; import com.google.devtools.build.lib.skyframe.PrecomputedValue; import com.google.devtools.build.skyframe.SkyFunction; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; | import com.google.devtools.build.lib.skyframe.*; import com.google.devtools.build.skyframe.*; import java.util.*; | [
"com.google.devtools",
"java.util"
] | com.google.devtools; java.util; | 2,165,819 |
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
AndroReceiptParam param = new AndroReceiptParam();
param.setSignature("iqXB0Gn4saVtmURy+J7d28E0HvoAzNyIiIoKig6TyGbz"
+ "Y6AwHtWFsx+IRj5RsbsmFWBF6OQssjuVbnIMBsB3IZ/q"
+ "POnmCbM1E24NVPSrZPB4To5b1Nw/VpvA4VTRUYGZov/"
+ "PQP1oWXkxyXxAQQCboYeSCAzxysZolLXv/Q8+YrxVUdcr"
+ "Plh7p3ZbriUlYSQ/qa0mTL76cqwIZi0al24V20ZmN69RBl1"
+ "MVrYrqQlwX/KRrR66RVm4TCjbmKNIqXR+XddJfbo4ybx7tpbDewb8"
+ "KO+C3i2WZXkhGHrgMMpgzyp2HeartH2lpoWlrtgtw1Ng7uOnXC5"
+ "QM7fkB1jtuE5j4Tgfg==");
param.setSignedData(
"{\"orderId\":\"12999763169054705758.1325922859268362\","
+ "\"packageName\":\"com.Devnom.PuzzleSaga\","
+ "\"productId\":\"cash_10\","
+ "\"purchaseTime\":1393831756523,"
+ "\"purchaseState\":0,"
+ "\"purchaseToken\":\"bhgoxzxhueotabyuqngtiupv.AO-J1OyLF4p"
+ "ECMOcB-loM8ToCZKio7rbpjwLWQVreLB5LAMEbWGvk6P65zD"
+ "Ds6kb3N1Kw5m9PsNqinoEQuyHyMQ28HeartIy1z1gGlB"
+ "XpuuUt01Q4Ksi8pHeartKk\"}");
Gson gson = new GsonBuilder().serializeNulls().create();
String jsonParam = gson.toJson(param, AndroReceiptParam.class);
jsonParam = URLEncoder.encode(jsonParam, "UTF-8");
String url =
PayPushGlobalConsts.SERVER_PATH
+ PayPushServletCommands.ANDRO_RECEIPT
+ "?data=" + jsonParam;
HttpGet httpget = new HttpGet(url);
System.out.println("Executing request " + httpget.getRequestLine()); | CloseableHttpClient httpclient = HttpClients.createDefault(); try { AndroReceiptParam param = new AndroReceiptParam(); param.setSignature(STR + STR + STR + STR + STR + STR + STR + STR); param.setSignedData( "{\"orderId\":\"12999763169054705758.1325922859268362\",STR\"packageName\":\"com.Devnom.PuzzleSaga\",STR\"productId\":\"cash_10\",STR\"purchaseTime\STR + "\"purchaseState\":0,STR\"purchaseToken\":\"bhgoxzxhueotabyuqngtiupv.AO-J1OyLF4pSTRECMOcB-loM8ToCZKio7rbpjwLWQVreLB5LAMEbWGvk6P65zDSTRDs6kb3N1Kw5m9PsNqinoEQuyHyMQ28HeartIy1z1gGlBSTRXpuuUt01Q4Ksi8pHeartKk\"}"); Gson gson = new GsonBuilder().serializeNulls().create(); String jsonParam = gson.toJson(param, AndroReceiptParam.class); jsonParam = URLEncoder.encode(jsonParam, "UTF-8"); String url = PayPushGlobalConsts.SERVER_PATH + PayPushServletCommands.ANDRO_RECEIPT + STR + jsonParam; HttpGet httpget = new HttpGet(url); System.out.println(STR + httpget.getRequestLine()); | /**
* Unit Test Method.
*
* @throws Exception Exception
*/ | Unit Test Method | test | {
"repo_name": "myc0058/PayPushServer",
"path": "PayPushServer/src/com/myc0058/paypush/Tests/SendAndroReceipt.java",
"license": "apache-2.0",
"size": 4016
} | [
"com.google.gson.Gson",
"com.google.gson.GsonBuilder",
"com.myc0058.paypush.Params",
"com.myc0058.paypush.Strings",
"com.myc0058.paypush.settings.PayPushGlobalConsts",
"java.net.URLEncoder",
"org.apache.http.client.methods.HttpGet",
"org.apache.http.impl.client.CloseableHttpClient",
"org.apache.http.impl.client.HttpClients"
] | import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.myc0058.paypush.Params; import com.myc0058.paypush.Strings; import com.myc0058.paypush.settings.PayPushGlobalConsts; import java.net.URLEncoder; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; | import com.google.gson.*; import com.myc0058.paypush.*; import com.myc0058.paypush.settings.*; import java.net.*; import org.apache.http.client.methods.*; import org.apache.http.impl.client.*; | [
"com.google.gson",
"com.myc0058.paypush",
"java.net",
"org.apache.http"
] | com.google.gson; com.myc0058.paypush; java.net; org.apache.http; | 1,417,733 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS,
mespswpFactory.eINSTANCE.createMSwPackageProvidedInterfacePVASwitch()));
newChildDescriptors.add
(createChildParameter
(mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS,
mespswpFactory.eINSTANCE.createMSwPackageProvidedInterfacePVAExpression()));
newChildDescriptors.add
(createChildParameter
(mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS,
commonFactory.eINSTANCE.createMParameterValueAssignmentSingleExpression()));
newChildDescriptors.add
(createChildParameter
(mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS,
pdlFactory.eINSTANCE.createMOSSupportedOSAPIPVAExpression()));
newChildDescriptors.add
(createChildParameter
(mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS,
pdlFactory.eINSTANCE.createMOSSupportedOSAPIPVASwitch()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS, mespswpFactory.eINSTANCE.createMSwPackageProvidedInterfacePVASwitch())); newChildDescriptors.add (createChildParameter (mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS, mespswpFactory.eINSTANCE.createMSwPackageProvidedInterfacePVAExpression())); newChildDescriptors.add (createChildParameter (mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS, commonFactory.eINSTANCE.createMParameterValueAssignmentSingleExpression())); newChildDescriptors.add (createChildParameter (mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS, pdlFactory.eINSTANCE.createMOSSupportedOSAPIPVAExpression())); newChildDescriptors.add (createChildParameter (mespswpPackage.Literals.MINSTANTIABLE_RESOURCE_DEMAND__PARAMETER_VALUE_ASSIGNMENTS, pdlFactory.eINSTANCE.createMOSSupportedOSAPIPVASwitch())); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object | collectNewChildDescriptors | {
"repo_name": "parraman/micobs",
"path": "mesp/es.uah.aut.srg.micobs.mesp/src/es/uah/aut/srg/micobs/mesp/mespswp/provider/MInstantiableResourceDemandItemProvider.java",
"license": "epl-1.0",
"size": 8598
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,477,721 |
public static void init( )
{
CacheService.registerCacheableService( new XmlTransformerCacheService( ) );
}
/**
* {@inheritDoc }
| static void function( ) { CacheService.registerCacheableService( new XmlTransformerCacheService( ) ); } /** * {@inheritDoc } | /**
* Inits the.
*/ | Inits the | init | {
"repo_name": "rzara/lutece-core",
"path": "src/java/fr/paris/lutece/portal/service/html/XmlTransformerCacheService.java",
"license": "bsd-3-clause",
"size": 3966
} | [
"fr.paris.lutece.portal.service.cache.CacheService"
] | import fr.paris.lutece.portal.service.cache.CacheService; | import fr.paris.lutece.portal.service.cache.*; | [
"fr.paris.lutece"
] | fr.paris.lutece; | 2,082,042 |
T getType(Map<String, Object> raw) {
return supplier.get();
}
}
private static class HeadingResolver extends BlockResolver<CMARichHeading> {
final int level;
HeadingResolver(int level) {
super(() -> new CMARichHeading(level));
this.level = level;
}
} | T getType(Map<String, Object> raw) { return supplier.get(); } } private static class HeadingResolver extends BlockResolver<CMARichHeading> { final int level; HeadingResolver(int level) { super(() -> new CMARichHeading(level)); this.level = level; } } | /**
* Convenience method to try and find out the type of the given raw map representation.
*
* @param raw a map coming from Contentful, parsed from the json response.
* @return a new node based on the type of T.
*/ | Convenience method to try and find out the type of the given raw map representation | getType | {
"repo_name": "contentful/contentful-management.java",
"path": "src/main/java/com/contentful/java/cma/model/rich/RichTextFactory.java",
"license": "apache-2.0",
"size": 9844
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,069,266 |
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) {
if (value == null) {
list.setSelectedIndex(0);
return false;
}
else {
int index = findValueInListBox(list, value);
if (index >= 0) {
list.setSelectedIndex(index);
return true;
}
if (addMissingValues) {
list.addItem(value, value);
// now that it's there, search again
index = findValueInListBox(list, value);
list.setSelectedIndex(index);
return true;
}
return false;
}
} | static final boolean function(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if (addMissingValues) { list.addItem(value, value); index = findValueInListBox(list, value); list.setSelectedIndex(index); return true; } return false; } } | /**
* Utility function to set the current value in a ListBox.
*
* @return returns true if the option corresponding to the value
* was successfully selected in the ListBox
*/ | Utility function to set the current value in a ListBox | setSelectedValue | {
"repo_name": "tractionsoftware/gwt-traction",
"path": "src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java",
"license": "apache-2.0",
"size": 5809
} | [
"com.google.gwt.user.client.ui.ListBox"
] | import com.google.gwt.user.client.ui.ListBox; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,746,769 |
public void setDueDt(LocalDate dueDt) {
this.dueDt = dueDt;
} | void function(LocalDate dueDt) { this.dueDt = dueDt; } | /**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TODO.DUE_DT
*
* @param dueDt the value for TODO.DUE_DT
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method sets the value of the database column TODO.DUE_DT | setDueDt | {
"repo_name": "agwlvssainokuni/springapp",
"path": "querytutorial/src/generated/java/cherry/querytutorial/db/gen/dto/Todo.java",
"license": "apache-2.0",
"size": 13451
} | [
"org.joda.time.LocalDate"
] | import org.joda.time.LocalDate; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,252,795 |
@Test
public void test_getClaimNumber() {
String value = "new_value";
instance.setClaimNumber(value);
assertEquals("'getClaimNumber' should be correct.",
value, instance.getClaimNumber());
} | void function() { String value = STR; instance.setClaimNumber(value); assertEquals(STR, value, instance.getClaimNumber()); } | /**
* <p>
* Accuracy test for the method <code>getClaimNumber()</code>.<br>
* The value should be properly retrieved.
* </p>
*/ | Accuracy test for the method <code>getClaimNumber()</code>. The value should be properly retrieved. | test_getClaimNumber | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/entities/application/AnnuitantListUnitTests.java",
"license": "apache-2.0",
"size": 2873
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,036,535 |
void importActivityStatement(InputStream f, List<Exception> errors)
{
try
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(f);
doc.getDocumentElement().normalize();
// Process all Trades
importModelObjects(doc, "Trade", errors);
// Process all CashTransaction
importModelObjects(doc, "CashTransaction", errors);
// Process all CorporateTransactions
importModelObjects(doc, "CorporateAction", errors);
// TODO: Process all FxTransactions and ConversionRates
}
catch (ParserConfigurationException | SAXException | IOException e)
{
errors.add(e);
}
}
| void importActivityStatement(InputStream f, List<Exception> errors) { try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(f); doc.getDocumentElement().normalize(); importModelObjects(doc, "Trade", errors); importModelObjects(doc, STR, errors); importModelObjects(doc, STR, errors); } catch (ParserConfigurationException SAXException IOException e) { errors.add(e); } } | /**
* Import an Interactive Broker ActivityStatement from an XML file. It
* currently only imports Trades, Corporate Transactions and Cash
* Transactions.
*/ | Import an Interactive Broker ActivityStatement from an XML file. It currently only imports Trades, Corporate Transactions and Cash Transactions | importActivityStatement | {
"repo_name": "simpsus/portfolio",
"path": "name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/IBFlexStatementExtractor.java",
"license": "epl-1.0",
"size": 17103
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.List",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Document",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.io.InputStream; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.SAXException; | import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"java.util",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | java.io; java.util; javax.xml; org.w3c.dom; org.xml.sax; | 356,450 |
private ResultFilterVO initSearchFilter(HttpServletRequest request,
PdcSearchSessionController pdcSC) {
String userId = request.getParameter("authorFilter");
String instanceId = request.getParameter("componentFilter");
String datatype = request.getParameter("datatypeFilter");
ResultFilterVO filter = new ResultFilterVO();
// Check filter values
if (StringUtil.isDefined(userId)) {
filter.setAuthorId(userId);
}
if (StringUtil.isDefined(instanceId)) {
filter.setComponentId(instanceId);
}
if (StringUtil.isDefined(datatype)) {
filter.setDatatype(datatype);
}
// check form field facets
for (String facetId : pdcSC.getFieldFacets().keySet()) {
String param = request.getParameter(facetId + "Filter");
if (StringUtil.isDefined(param)) {
filter.addFormFieldSelectedFacetEntry(facetId, param);
}
}
pdcSC.setIndexOfFirstResultToDisplay("0");
pdcSC.setSelectedFacetEntries(filter);
return filter;
} | ResultFilterVO function(HttpServletRequest request, PdcSearchSessionController pdcSC) { String userId = request.getParameter(STR); String instanceId = request.getParameter(STR); String datatype = request.getParameter(STR); ResultFilterVO filter = new ResultFilterVO(); if (StringUtil.isDefined(userId)) { filter.setAuthorId(userId); } if (StringUtil.isDefined(instanceId)) { filter.setComponentId(instanceId); } if (StringUtil.isDefined(datatype)) { filter.setDatatype(datatype); } for (String facetId : pdcSC.getFieldFacets().keySet()) { String param = request.getParameter(facetId + STR); if (StringUtil.isDefined(param)) { filter.addFormFieldSelectedFacetEntry(facetId, param); } } pdcSC.setIndexOfFirstResultToDisplay("0"); pdcSC.setSelectedFacetEntries(filter); return filter; } | /**
* Initialize search result filter object from request
*
* @param request the HTTPServletRequest
* @param pdcSC the pdcSearchSessionController
* @return a new ResultFilterVO which contains data information
*/ | Initialize search result filter object from request | initSearchFilter | {
"repo_name": "NicolasEYSSERIC/Silverpeas-Core",
"path": "war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/servlets/PdcSearchRequestRouter.java",
"license": "agpl-3.0",
"size": 84410
} | [
"com.silverpeas.util.StringUtil",
"com.stratelia.silverpeas.pdcPeas.control.PdcSearchSessionController",
"com.stratelia.silverpeas.pdcPeas.vo.ResultFilterVO",
"javax.servlet.http.HttpServletRequest"
] | import com.silverpeas.util.StringUtil; import com.stratelia.silverpeas.pdcPeas.control.PdcSearchSessionController; import com.stratelia.silverpeas.pdcPeas.vo.ResultFilterVO; import javax.servlet.http.HttpServletRequest; | import com.silverpeas.util.*; import com.stratelia.silverpeas.*; import javax.servlet.http.*; | [
"com.silverpeas.util",
"com.stratelia.silverpeas",
"javax.servlet"
] | com.silverpeas.util; com.stratelia.silverpeas; javax.servlet; | 1,638,421 |
private List<FileStatus> listDirectory(SwiftObjectPath path,
boolean listDeep,
boolean newest) throws IOException {
final byte[] bytes;
final ArrayList<FileStatus> files = new ArrayList<FileStatus>();
final Path correctSwiftPath = getCorrectSwiftPath(path);
try {
bytes = swiftRestClient.listDeepObjectsInDirectory(path, listDeep);
} catch (FileNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("" +
"File/Directory not found " + path);
}
if (SwiftUtils.isRootDir(path)) {
return Collections.emptyList();
} else {
throw e;
}
} catch (SwiftInvalidResponseException e) {
//bad HTTP error code
if (e.getStatusCode() == HttpStatus.SC_NO_CONTENT) {
//this can come back on a root list if the container is empty
if (SwiftUtils.isRootDir(path)) {
return Collections.emptyList();
} else {
//NO_CONTENT returned on something other than the root directory;
//see if it is there, and convert to empty list or not found
//depending on whether the entry exists.
FileStatus stat = getObjectMetadata(correctSwiftPath, newest);
if (stat.isDirectory()) {
//it's an empty directory. state that
return Collections.emptyList();
} else {
//it's a file -return that as the status
files.add(stat);
return files;
}
}
} else {
//a different status code: rethrow immediately
throw e;
}
}
final CollectionType collectionType = JSONUtil.getJsonMapper().getTypeFactory().
constructCollectionType(List.class, SwiftObjectFileStatus.class);
final List<SwiftObjectFileStatus> fileStatusList = JSONUtil.toObject(
new String(bytes, Charset.forName("UTF-8")), collectionType);
//this can happen if user lists file /data/files/file
//in this case swift will return empty array
if (fileStatusList.isEmpty()) {
SwiftFileStatus objectMetadata = getObjectMetadata(correctSwiftPath,
newest);
if (objectMetadata.isFile()) {
files.add(objectMetadata);
}
return files;
}
for (SwiftObjectFileStatus status : fileStatusList) {
if (status.getName() != null) {
files.add(new SwiftFileStatus(status.getBytes(),
status.getBytes() == 0,
1,
getBlocksize(),
status.getLast_modified().getTime(),
getCorrectSwiftPath(new Path(status.getName()))));
}
}
return files;
} | List<FileStatus> function(SwiftObjectPath path, boolean listDeep, boolean newest) throws IOException { final byte[] bytes; final ArrayList<FileStatus> files = new ArrayList<FileStatus>(); final Path correctSwiftPath = getCorrectSwiftPath(path); try { bytes = swiftRestClient.listDeepObjectsInDirectory(path, listDeep); } catch (FileNotFoundException e) { if (LOG.isDebugEnabled()) { LOG.debug(STRFile/Directory not found STRUTF-8")), collectionType); if (fileStatusList.isEmpty()) { SwiftFileStatus objectMetadata = getObjectMetadata(correctSwiftPath, newest); if (objectMetadata.isFile()) { files.add(objectMetadata); } return files; } for (SwiftObjectFileStatus status : fileStatusList) { if (status.getName() != null) { files.add(new SwiftFileStatus(status.getBytes(), status.getBytes() == 0, 1, getBlocksize(), status.getLast_modified().getTime(), getCorrectSwiftPath(new Path(status.getName())))); } } return files; } | /**
* List a directory.
* This is O(n) for the number of objects in this path.
*
*
*
* @param path working path
* @param listDeep ask for all the data
* @param newest ask for the newest data
* @return Collection of file statuses
* @throws IOException IO problems
* @throws FileNotFoundException if the path does not exist
*/ | List a directory. This is O(n) for the number of objects in this path | listDirectory | {
"repo_name": "legend-hua/hadoop",
"path": "hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java",
"license": "apache-2.0",
"size": 35041
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.swift.util.SwiftObjectPath"
] | import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.swift.util.SwiftObjectPath; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.swift.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 2,341,473 |
public void startExperiment(){
if(this.completedExperiment){
System.out.println("Experiment was already run and has completed. If you want to run a new experiment create a new Experiment object.");
return;
}
if(this.plotter == null){
TrialMode trialMode = TrialMode.MOSTRECENTANDAVERAGE;
if(this.nTrials == 1){
trialMode = TrialMode.MOSTRECENTTTRIALONLY;
}
this.plotter = new PerformancePlotter(this.agentFactories[0].getAgentName(), rf, 500, 250, 2, 500, trialMode);
}
this.domain.addActionObserverForAllAction(plotter);
if(this.displayPlots){
this.plotter.startGUI();
}
for(int i = 0; i < this.agentFactories.length; i++){
if(i > 0){
this.plotter.startNewAgent(this.agentFactories[i].getAgentName());
}
for(int j = 0; j < this.nTrials; j++){
DPrint.cl(this.debugCode, "Beginning " + this.agentFactories[i].getAgentName() + " trial " + (j+1) + "/" + this.nTrials);
if(this.trialLengthIsInEpisodes){
this.runEpisodeBoundTrial(this.agentFactories[i]);
}
else{
this.runStepBoundTrial(this.agentFactories[i]);
}
}
}
this.plotter.endAllAgents();
this.completedExperiment = true;
}
| void function(){ if(this.completedExperiment){ System.out.println(STR); return; } if(this.plotter == null){ TrialMode trialMode = TrialMode.MOSTRECENTANDAVERAGE; if(this.nTrials == 1){ trialMode = TrialMode.MOSTRECENTTTRIALONLY; } this.plotter = new PerformancePlotter(this.agentFactories[0].getAgentName(), rf, 500, 250, 2, 500, trialMode); } this.domain.addActionObserverForAllAction(plotter); if(this.displayPlots){ this.plotter.startGUI(); } for(int i = 0; i < this.agentFactories.length; i++){ if(i > 0){ this.plotter.startNewAgent(this.agentFactories[i].getAgentName()); } for(int j = 0; j < this.nTrials; j++){ DPrint.cl(this.debugCode, STR + this.agentFactories[i].getAgentName() + STR + (j+1) + "/" + this.nTrials); if(this.trialLengthIsInEpisodes){ this.runEpisodeBoundTrial(this.agentFactories[i]); } else{ this.runStepBoundTrial(this.agentFactories[i]); } } } this.plotter.endAllAgents(); this.completedExperiment = true; } | /**
* Starts the experiment and runs all trails for all agents.
*/ | Starts the experiment and runs all trails for all agents | startExperiment | {
"repo_name": "ryanlinnane/burlap",
"path": "src/burlap/behavior/singleagent/auxiliary/performance/LearningAlgorithmExperimenter.java",
"license": "lgpl-3.0",
"size": 12984
} | [
"burlap.debugtools.DPrint"
] | import burlap.debugtools.DPrint; | import burlap.debugtools.*; | [
"burlap.debugtools"
] | burlap.debugtools; | 330,239 |
@Idempotent
BlockStoragePolicy getStoragePolicy(String path) throws IOException; | BlockStoragePolicy getStoragePolicy(String path) throws IOException; | /**
* Get the storage policy for a file/directory.
* @param path
* Path of an existing file/directory.
* @throws AccessControlException
* If access is denied
* @throws org.apache.hadoop.fs.UnresolvedLinkException
* if <code>src</code> contains a symlink
* @throws java.io.FileNotFoundException
* If file/dir <code>src</code> is not found
*/ | Get the storage policy for a file/directory | getStoragePolicy | {
"repo_name": "Ethanlm/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 63582
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,460,609 |
@Override
public boolean requestInfo(final Configuration output, final String command) throws ManifoldCFException {
if (command.startsWith("folders/")) {
final String parentFolder = command.substring("folders/".length());
try {
final String[] folders = getChildFolderNames(parentFolder);
int i = 0;
while (i < folders.length) {
final String folder = folders[i++];
final ConfigurationNode node = new ConfigurationNode("folder");
node.setValue(folder);
output.addChild(output.getChildCount(), node);
}
} catch (final ManifoldCFException e) {
ManifoldCF.createErrorNode(output, e);
}
} else if (command.startsWith("folder/")) {
final String folder = command.substring("folder/".length());
try {
final String canonicalFolder = validateFolderName(folder);
if (canonicalFolder != null) {
final ConfigurationNode node = new ConfigurationNode("folder");
node.setValue(canonicalFolder);
output.addChild(output.getChildCount(), node);
}
} catch (final ManifoldCFException e) {
ManifoldCF.createErrorNode(output, e);
}
} else {
return super.requestInfo(output, command);
}
return true;
} | boolean function(final Configuration output, final String command) throws ManifoldCFException { if (command.startsWith(STR)) { final String parentFolder = command.substring(STR.length()); try { final String[] folders = getChildFolderNames(parentFolder); int i = 0; while (i < folders.length) { final String folder = folders[i++]; final ConfigurationNode node = new ConfigurationNode(STR); node.setValue(folder); output.addChild(output.getChildCount(), node); } } catch (final ManifoldCFException e) { ManifoldCF.createErrorNode(output, e); } } else if (command.startsWith(STR)) { final String folder = command.substring(STR.length()); try { final String canonicalFolder = validateFolderName(folder); if (canonicalFolder != null) { final ConfigurationNode node = new ConfigurationNode(STR); node.setValue(canonicalFolder); output.addChild(output.getChildCount(), node); } } catch (final ManifoldCFException e) { ManifoldCF.createErrorNode(output, e); } } else { return super.requestInfo(output, command); } return true; } | /**
* Request arbitrary connector information. This method is called directly from the API in order to allow API users to perform any one of several connector-specific queries.
*
* @param output is the response object, to be filled in by this method.
* @param command is the command, which is taken directly from the API request.
* @return true if the resource is found, false if not. In either case, output may be filled in.
*/ | Request arbitrary connector information. This method is called directly from the API in order to allow API users to perform any one of several connector-specific queries | requestInfo | {
"repo_name": "francelabs/datafari",
"path": "datafari-share-connector/src/main/java/com/francelabs/datafari/connectors/share/SharedDriveConnector.java",
"license": "apache-2.0",
"size": 233737
} | [
"org.apache.manifoldcf.core.interfaces.Configuration",
"org.apache.manifoldcf.core.interfaces.ConfigurationNode",
"org.apache.manifoldcf.core.interfaces.ManifoldCFException",
"org.apache.manifoldcf.crawler.system.ManifoldCF"
] | import org.apache.manifoldcf.core.interfaces.Configuration; import org.apache.manifoldcf.core.interfaces.ConfigurationNode; import org.apache.manifoldcf.core.interfaces.ManifoldCFException; import org.apache.manifoldcf.crawler.system.ManifoldCF; | import org.apache.manifoldcf.core.interfaces.*; import org.apache.manifoldcf.crawler.system.*; | [
"org.apache.manifoldcf"
] | org.apache.manifoldcf; | 2,557,859 |
public static Map<String, Object> fromAMQPTable( byte[] reply )
{
try
{
return fixAMQPTable(
new MethodArgumentReader( new ValueReader( new DataInputStream( new ByteArrayInputStream( reply ) ) ) )
.readTable()
);
} catch( IOException ex )
{
throw new UncheckedIOException( ex );
}
} | static Map<String, Object> function( byte[] reply ) { try { return fixAMQPTable( new MethodArgumentReader( new ValueReader( new DataInputStream( new ByteArrayInputStream( reply ) ) ) ) .readTable() ); } catch( IOException ex ) { throw new UncheckedIOException( ex ); } } | /**
* Convert an AMQP table to a map
*
* @param reply
*
* @return
*/ | Convert an AMQP table to a map | fromAMQPTable | {
"repo_name": "peter-mount/opendata-common",
"path": "brokers/rabbitmq/src/main/java/uk/trainwatch/rabbitmq/RabbitMQ.java",
"license": "apache-2.0",
"size": 29777
} | [
"com.rabbitmq.client.impl.MethodArgumentReader",
"com.rabbitmq.client.impl.ValueReader",
"java.io.ByteArrayInputStream",
"java.io.DataInputStream",
"java.io.IOException",
"java.io.UncheckedIOException",
"java.util.Map"
] | import com.rabbitmq.client.impl.MethodArgumentReader; import com.rabbitmq.client.impl.ValueReader; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.io.UncheckedIOException; import java.util.Map; | import com.rabbitmq.client.impl.*; import java.io.*; import java.util.*; | [
"com.rabbitmq.client",
"java.io",
"java.util"
] | com.rabbitmq.client; java.io; java.util; | 1,264,965 |
protected Coordinate inversePointRaw (double x, double y, Coordinate storage) {
double yy = 2.0 * y / StrictMath.PI / _a;
double phid = yy * 90.0;
double p2 = StrictMath.abs(phid / 5.0);
int ip1 = (int)StrictMath.floor(p2 - EPSLN);
if (ip1 >= 18) {
storage.x = Double.NaN;
storage.y = Double.NaN;
return storage;
}
if (ip1 == 0) ip1 = 1;
for (int i = 0;;) {
double u = pr[ip1 + 3] - pr[ip1 + 1];
double v = pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1];
double t = 2.0 * (StrictMath.abs(yy) - pr[ip1 + 2]) / u;
double c = v / u;
p2 = t * (1.0 - c * t * (1.0 - 2.0 * c * t));
if ((p2 >= 0.0) || (ip1 == 1)) {
phid = GeometryUtils.sign(y) * (p2 + (double) ip1 ) * 5.0;
double y1;
do {
p2 = StrictMath.abs(phid / 5.0);
ip1 = (int)(p2 - EPSLN);
if (ip1 >= 18) {
storage.x = Double.NaN;
storage.y = Double.NaN;
return storage;
}
p2 -= (double)ip1;
y1 = GeometryUtils.sign(y) * _a * (pr[ip1 +2] + p2 *(pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1])/2.0) * GeometryUtils.HALF_PI;
phid += -180.0 * (y1 - y) / StrictMath.PI / _a;
i += 1;
if (i > 75) {
throw(new ArithmeticException("too many iterations in inverse"));
}
} while (StrictMath.abs(y1 - y) > 0.00001);
break;
} else {
ip1 -= 1;
if (ip1 < 0) {
throw(new ArithmeticException("too many iterations in inverse"));
}
}
}
storage.y = phid * 0.01745329252;
storage.x = GeometryUtils.wrap_longitude(_lambda0 + x / _a / (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1]) / 2.0 + p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] + xlr[ip1 + 1]) / 2.0));
return storage;
}
//-------------------------------------------------------------------------
// Projection implementation
//------------------------------------------------------------------------- | Coordinate function (double x, double y, Coordinate storage) { double yy = 2.0 * y / StrictMath.PI / _a; double phid = yy * 90.0; double p2 = StrictMath.abs(phid / 5.0); int ip1 = (int)StrictMath.floor(p2 - EPSLN); if (ip1 >= 18) { storage.x = Double.NaN; storage.y = Double.NaN; return storage; } if (ip1 == 0) ip1 = 1; for (int i = 0;;) { double u = pr[ip1 + 3] - pr[ip1 + 1]; double v = pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1]; double t = 2.0 * (StrictMath.abs(yy) - pr[ip1 + 2]) / u; double c = v / u; p2 = t * (1.0 - c * t * (1.0 - 2.0 * c * t)); if ((p2 >= 0.0) (ip1 == 1)) { phid = GeometryUtils.sign(y) * (p2 + (double) ip1 ) * 5.0; double y1; do { p2 = StrictMath.abs(phid / 5.0); ip1 = (int)(p2 - EPSLN); if (ip1 >= 18) { storage.x = Double.NaN; storage.y = Double.NaN; return storage; } p2 -= (double)ip1; y1 = GeometryUtils.sign(y) * _a * (pr[ip1 +2] + p2 *(pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1])/2.0) * GeometryUtils.HALF_PI; phid += -180.0 * (y1 - y) / StrictMath.PI / _a; i += 1; if (i > 75) { throw(new ArithmeticException(STR)); } } while (StrictMath.abs(y1 - y) > 0.00001); break; } else { ip1 -= 1; if (ip1 < 0) { throw(new ArithmeticException(STR)); } } } storage.y = phid * 0.01745329252; storage.x = GeometryUtils.wrap_longitude(_lambda0 + x / _a / (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1]) / 2.0 + p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] + xlr[ip1 + 1]) / 2.0)); return storage; } | /**
* Inverse projects a point.
* @param x the x coordinate of the point to be inverse projected
* @param y the y coordinate of the point to be inverse projected
* @param storage a place to store the result
* @return The inverse of <code>pt</code>. Same object as <code>storage</code>.
*/ | Inverse projects a point | inversePointRaw | {
"repo_name": "reuven/modelingcommons",
"path": "public/extensions/gis/src/org/myworldgis/projection/Robinson.java",
"license": "agpl-3.0",
"size": 7908
} | [
"com.vividsolutions.jts.geom.Coordinate",
"org.myworldgis.util.GeometryUtils"
] | import com.vividsolutions.jts.geom.Coordinate; import org.myworldgis.util.GeometryUtils; | import com.vividsolutions.jts.geom.*; import org.myworldgis.util.*; | [
"com.vividsolutions.jts",
"org.myworldgis.util"
] | com.vividsolutions.jts; org.myworldgis.util; | 2,334,226 |
public Builder loadFromSource(String source) {
SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromSource(source);
try {
Map<String, String> loadedSettings = settingsLoader.load(source);
put(loadedSettings);
} catch (Exception e) {
throw new SettingsException("Failed to load settings from [" + source + "]", e);
}
return this;
} | Builder function(String source) { SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromSource(source); try { Map<String, String> loadedSettings = settingsLoader.load(source); put(loadedSettings); } catch (Exception e) { throw new SettingsException(STR + source + "]", e); } return this; } | /**
* Loads settings from the actual string content that represents them using the
* {@link SettingsLoaderFactory#loaderFromSource(String)}.
*/ | Loads settings from the actual string content that represents them using the <code>SettingsLoaderFactory#loaderFromSource(String)</code> | loadFromSource | {
"repo_name": "strapdata/elassandra-test",
"path": "core/src/main/java/org/elasticsearch/common/settings/Settings.java",
"license": "apache-2.0",
"size": 49155
} | [
"java.util.Map",
"org.elasticsearch.common.settings.loader.SettingsLoader",
"org.elasticsearch.common.settings.loader.SettingsLoaderFactory"
] | import java.util.Map; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.common.settings.loader.SettingsLoaderFactory; | import java.util.*; import org.elasticsearch.common.settings.loader.*; | [
"java.util",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.common; | 998,604 |
public Timestamp getMemberSince() {
return (Timestamp) getValue(5);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc} | Timestamp function() { return (Timestamp) getValue(5); } /** * {@inheritDoc} | /**
* Getter for <code>collect.ofc_user_usergroup.member_since</code>.
*/ | Getter for <code>collect.ofc_user_usergroup.member_since</code> | getMemberSince | {
"repo_name": "openforis/collect",
"path": "collect-core/src/generated/java/org/openforis/collect/persistence/jooq/tables/records/OfcUserUsergroupRecord.java",
"license": "mit",
"size": 6709
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 59,357 |
private static int closest(int of, List<Integer> in) {
int min = Integer.MAX_VALUE;
int closest = of;
for (int v : in) {
final int diff = Math.abs(v - of);
if (diff < min) {
min = diff;
closest = v;
}
}
return closest;
} | static int function(int of, List<Integer> in) { int min = Integer.MAX_VALUE; int closest = of; for (int v : in) { final int diff = Math.abs(v - of); if (diff < min) { min = diff; closest = v; } } return closest; } | /**
* find the forecast time for a given time
*
* @param of look for this int
* @param in in this list
* @return the int the closest to of
*/ | find the forecast time for a given time | closest | {
"repo_name": "Nbzh/TsenTest",
"path": "appli_tsen/src/fr/esir/oep/Weather.java",
"license": "apache-2.0",
"size": 2553
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,892,377 |
private void computeUpperBound(PrimSig sig) throws Err {
// Sig's upperbound is fully computed. We recursively compute the upperbound for children...
TupleSet x = ub.get(sig).clone();
// We remove atoms that MUST be in a subsig
for(PrimSig c: sig.children()) x.removeAll(lb.get(c));
// So now X is the set of atoms that MIGHT be in this sig, but MIGHT NOT be in any particular subsig.
// For each subsig that may need more atom, we say it could potentionally get any of the atom from X.
for(PrimSig c: sig.children()) {
if (sc.sig2scope(c) > lb.get(c).size()) ub.get(c).addAll(x);
computeUpperBound(c);
}
}
//==============================================================================================================// | void function(PrimSig sig) throws Err { TupleSet x = ub.get(sig).clone(); for(PrimSig c: sig.children()) x.removeAll(lb.get(c)); for(PrimSig c: sig.children()) { if (sc.sig2scope(c) > lb.get(c).size()) ub.get(c).addAll(x); computeUpperBound(c); } } | /** Computes the upperbound from top-down, then allocate a relation for it.
* Precondition: sig is not a builtin sig
*/ | Computes the upperbound from top-down, then allocate a relation for it. Precondition: sig is not a builtin sig | computeUpperBound | {
"repo_name": "ModelWriter/WP3",
"path": "Source/eu.modelwriter.alloyanalyzer/src/edu/mit/csail/sdg/alloy4compiler/translator/BoundsComputer.java",
"license": "epl-1.0",
"size": 17004
} | [
"edu.mit.csail.sdg.alloy4.Err",
"edu.mit.csail.sdg.alloy4compiler.ast.Sig"
] | import edu.mit.csail.sdg.alloy4.Err; import edu.mit.csail.sdg.alloy4compiler.ast.Sig; | import edu.mit.csail.sdg.alloy4.*; import edu.mit.csail.sdg.alloy4compiler.ast.*; | [
"edu.mit.csail"
] | edu.mit.csail; | 389,351 |
public Set<PosTaggedToken> getYield() {
if (yield == null) {
yield = new TreeSet<PosTaggedToken>(new PosTaggedTokenLeftToRightComparator());
this.getAllNodes(yield);
}
return yield;
} | Set<PosTaggedToken> function() { if (yield == null) { yield = new TreeSet<PosTaggedToken>(new PosTaggedTokenLeftToRightComparator()); this.getAllNodes(yield); } return yield; } | /**
* The current node's yield, an ordered set of the current node and all of its
* descendants, that have actually been added.
*
* @return
*/ | The current node's yield, an ordered set of the current node and all of its descendants, that have actually been added | getYield | {
"repo_name": "urieli/talismane",
"path": "talismane_core/src/main/java/com/joliciel/talismane/parser/DependencyNode.java",
"license": "agpl-3.0",
"size": 9940
} | [
"com.joliciel.talismane.posTagger.PosTaggedToken",
"com.joliciel.talismane.posTagger.PosTaggedTokenLeftToRightComparator",
"java.util.Set",
"java.util.TreeSet"
] | import com.joliciel.talismane.posTagger.PosTaggedToken; import com.joliciel.talismane.posTagger.PosTaggedTokenLeftToRightComparator; import java.util.Set; import java.util.TreeSet; | import com.joliciel.talismane.*; import java.util.*; | [
"com.joliciel.talismane",
"java.util"
] | com.joliciel.talismane; java.util; | 1,571,513 |
public boolean getIsActive() {
if ( isActive == null ) {
isActive = (SFBool)getField( "isActive" );
}
return( isActive.getValue( ) );
} | boolean function() { if ( isActive == null ) { isActive = (SFBool)getField( STR ); } return( isActive.getValue( ) ); } | /** Return the isActive boolean value.
* @return The isActive boolean value. */ | Return the isActive boolean value | getIsActive | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/external/node/pointingdevicesensor/SAIPlaneSensor.java",
"license": "gpl-2.0",
"size": 6199
} | [
"org.web3d.x3d.sai.SFBool"
] | import org.web3d.x3d.sai.SFBool; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 2,461,901 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.