method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void waitAsync(final IgniteInternalFuture<?> fut,
long timeout,
IgniteBiInClosure<IgniteCheckedException, Boolean> clo) {
if (timeout == -1) {
clo.apply(null, true);
return;
}
if (fut == null || fut.isDone())
clo.apply(null, false);
else {
WaitFutureTimeoutObject timeoutObj = null;
if (timeout > 0) {
timeoutObj = new WaitFutureTimeoutObject(fut, timeout, clo);
addTimeoutObject(timeoutObj);
}
final WaitFutureTimeoutObject finalTimeoutObj = timeoutObj; | void function(final IgniteInternalFuture<?> fut, long timeout, IgniteBiInClosure<IgniteCheckedException, Boolean> clo) { if (timeout == -1) { clo.apply(null, true); return; } if (fut == null fut.isDone()) clo.apply(null, false); else { WaitFutureTimeoutObject timeoutObj = null; if (timeout > 0) { timeoutObj = new WaitFutureTimeoutObject(fut, timeout, clo); addTimeoutObject(timeoutObj); } final WaitFutureTimeoutObject finalTimeoutObj = timeoutObj; | /**
* Wait for a future (listen with timeout).
* @param fut Future.
* @param timeout Timeout millis. -1 means expired timeout, 0 means waiting without timeout.
* @param clo Finish closure. First argument contains error on future or null if no errors,
* second is {@code true} if wait timed out or passed timeout argument means expired timeout.
*/ | Wait for a future (listen with timeout) | waitAsync | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java",
"license": "apache-2.0",
"size": 14348
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.IgniteInternalFuture",
"org.apache.ignite.lang.IgniteBiInClosure"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.lang.IgniteBiInClosure; | import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,644,586 |
public void internalEntityDecl(String name, String value)
throws SAXException
{
// The internal DTD subset is not serialized by the ToHTMLStream serializer
} | void function(String name, String value) throws SAXException { } | /**
* This method does nothing.
*/ | This method does nothing | internalEntityDecl | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java",
"license": "mit",
"size": 82074
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,556,130 |
@Override public void enterEveryRule(ParserRuleContext ctx) { } | @Override public void enterEveryRule(ParserRuleContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitR | {
"repo_name": "walterfan/snippets",
"path": "c/lr/HelloBaseListener.java",
"license": "apache-2.0",
"size": 1304
} | [
"org.antlr.v4.runtime.ParserRuleContext"
] | import org.antlr.v4.runtime.ParserRuleContext; | import org.antlr.v4.runtime.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 977,650 |
public static Status makeStatus(String value, String message) {
Status status = makeStatus(value);
status.setStatusMessage(makeStatusMessage(message));
return status;
} | static Status function(String value, String message) { Status status = makeStatus(value); status.setStatusMessage(makeStatusMessage(message)); return status; } | /**
* Static factory for SAML <code>Status</code> objects.
*
* A convenience method that generates a status object with a message.
*
* @param value
* A URI specifying one of the standard SAML status codes.
* @param message
* A string describing the status.
* @return A new <code>Status</code> object.
*/ | Static factory for SAML <code>Status</code> objects. A convenience method that generates a status object with a message | makeStatus | {
"repo_name": "pasha4j/xacml4j-opensaml",
"path": "src/main/java/org/xacml4j/opensaml/OpenSamlObjectBuilder.java",
"license": "lgpl-3.0",
"size": 22358
} | [
"org.opensaml.saml2.core.Status"
] | import org.opensaml.saml2.core.Status; | import org.opensaml.saml2.core.*; | [
"org.opensaml.saml2"
] | org.opensaml.saml2; | 1,670,893 |
@Override
public ResourceLocator getResourceLocator() {
return AllEditPlugin.INSTANCE;
} | ResourceLocator function() { return AllEditPlugin.INSTANCE; } | /**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Return the resource locator for this item provider's resources. | getResourceLocator | {
"repo_name": "paetti1988/qmate",
"path": "MATE/org.tud.inf.st.mbt.emf.edit/src-gen/org/tud/inf/st/mbt/rules/provider/TimeAtomItemProvider.java",
"license": "apache-2.0",
"size": 5095
} | [
"org.eclipse.emf.common.util.ResourceLocator",
"org.tud.inf.st.mbt.actions.provider.AllEditPlugin"
] | import org.eclipse.emf.common.util.ResourceLocator; import org.tud.inf.st.mbt.actions.provider.AllEditPlugin; | import org.eclipse.emf.common.util.*; import org.tud.inf.st.mbt.actions.provider.*; | [
"org.eclipse.emf",
"org.tud.inf"
] | org.eclipse.emf; org.tud.inf; | 711,635 |
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
} | List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; } | /**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/ | This returns the property descriptors for the adapted class. | getPropertyDescriptors | {
"repo_name": "drbgfc/mdht",
"path": "cts2/plugins/org.openhealthtools.mdht.cts2.core.edit/src/org/openhealthtools/mdht/cts2/codesystemversion/provider/CodeSystemVersionCatalogEntryDirectoryItemProvider.java",
"license": "epl-1.0",
"size": 6384
} | [
"java.util.List",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor"
] | import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 1,705,237 |
protected java.sql.Connection getConnection(Properties props) throws SQLException {
String jdbcUrlToUse = null;
if (!this.explicitUrl) {
StringBuilder jdbcUrl = new StringBuilder("jdbc:mysql://");
if (this.hostName != null) {
jdbcUrl.append(this.hostName);
}
jdbcUrl.append(":");
jdbcUrl.append(this.port);
jdbcUrl.append("/");
if (this.databaseName != null) {
jdbcUrl.append(this.databaseName);
}
jdbcUrlToUse = jdbcUrl.toString();
} else {
jdbcUrlToUse = this.url;
}
//
// URL should take precedence over properties
//
Properties urlProps = mysqlDriver.parseURL(jdbcUrlToUse, null);
if (urlProps == null) {
throw SQLError.createSQLException(Messages.getString("MysqlDataSource.BadUrl", new Object[] { jdbcUrlToUse }),
SQLError.SQL_STATE_CONNECTION_FAILURE, null);
}
urlProps.remove(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
urlProps.remove(NonRegisteringDriver.HOST_PROPERTY_KEY);
urlProps.remove(NonRegisteringDriver.PORT_PROPERTY_KEY);
Iterator<Object> keys = urlProps.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
props.setProperty(key, urlProps.getProperty(key));
}
return mysqlDriver.connect(jdbcUrlToUse, props);
}
//
// public boolean isWrapperFor(Class<?> iface) throws SQLException {
// throw SQLError.createSQLFeatureNotSupportedException();
// }
//
// public <T> T unwrap(Class<T> iface) throws SQLException {
// throw SQLError.createSQLFeatureNotSupportedException();
// } | java.sql.Connection function(Properties props) throws SQLException { String jdbcUrlToUse = null; if (!this.explicitUrl) { StringBuilder jdbcUrl = new StringBuilder(STR:STR/STRMysqlDataSource.BadUrl", new Object[] { jdbcUrlToUse }), SQLError.SQL_STATE_CONNECTION_FAILURE, null); } urlProps.remove(NonRegisteringDriver.DBNAME_PROPERTY_KEY); urlProps.remove(NonRegisteringDriver.HOST_PROPERTY_KEY); urlProps.remove(NonRegisteringDriver.PORT_PROPERTY_KEY); Iterator<Object> keys = urlProps.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); props.setProperty(key, urlProps.getProperty(key)); } return mysqlDriver.connect(jdbcUrlToUse, props); } | /**
* Creates a connection using the specified properties.
*
* @param props
* the properties to connect with
*
* @return a connection to the database
*
* @throws SQLException
* if an error occurs
*/ | Creates a connection using the specified properties | getConnection | {
"repo_name": "swankjesse/mysql-connector-j",
"path": "src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java",
"license": "gpl-2.0",
"size": 12297
} | [
"com.mysql.jdbc.NonRegisteringDriver",
"com.mysql.jdbc.SQLError",
"java.sql.SQLException",
"java.util.Iterator",
"java.util.Properties"
] | import com.mysql.jdbc.NonRegisteringDriver; import com.mysql.jdbc.SQLError; import java.sql.SQLException; import java.util.Iterator; import java.util.Properties; | import com.mysql.jdbc.*; import java.sql.*; import java.util.*; | [
"com.mysql.jdbc",
"java.sql",
"java.util"
] | com.mysql.jdbc; java.sql; java.util; | 1,670,522 |
public void testContainsInListFields()
{
Object id = null;
Object idCloth = null;
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
Wardrobe wardrobe2 = new Wardrobe();
wardrobe2.setModel("2 doors");
Wardrobe wardrobe3 = new Wardrobe();
wardrobe3.setModel("3 doors");
pm.makePersistent(wardrobe2);
pm.makePersistent(wardrobe3);
Cloth whiteShirt = new Cloth();
whiteShirt.setName("white shirt");
Cloth blackShirt = new Cloth();
blackShirt.setName("black shirt");
Cloth skirt = new Cloth();
skirt.setName("skirt");
wardrobe3.getClothes().add(whiteShirt);
wardrobe3.getClothes().add(skirt);
wardrobe2.getClothes().add(blackShirt);
tx.commit();
id = JDOHelper.getObjectId(wardrobe3);
idCloth = JDOHelper.getObjectId(blackShirt);
tx.begin();
Query q = pm.newQuery(Wardrobe.class,"this.clothes.contains(c)");
q.declareParameters("org.jpox.samples.models.fitness.Cloth c");
Collection c = (Collection) q.execute(skirt);
assertEquals(1,c.size());
assertEquals(id,JDOHelper.getObjectId(c.iterator().next()));
assertEquals(2,wardrobe3.getClothes().size());
tx.commit();
tx.begin();
Query q1 = pm.newQuery(Cloth.class,"wardrobe.clothes.contains(this) && wardrobe.model ==\"2 doors\"");
q1.declareVariables("org.jpox.samples.models.fitness.Wardrobe wardrobe");
Collection c1 = (Collection) q1.execute();
assertEquals(1,c1.size());
assertEquals(idCloth,JDOHelper.getObjectId(c1.iterator().next()));
tx.commit();
tx.begin();
Query q2 = pm.newQuery(Cloth.class,"wardrobe.clothes.contains(this)");
q2.declareParameters("org.jpox.samples.models.fitness.Wardrobe wardrobe");
Collection c2 = (Collection) q2.execute(wardrobe2);
assertEquals(1,c2.size());
assertEquals(idCloth,JDOHelper.getObjectId(c2.iterator().next()));
tx.commit();
}
finally
{
if (tx.isActive())
{
tx.rollback();
}
pm.close();
// Clean out our data
FitnessHelper.cleanFitnessData(pmf);
}
}
| void function() { Object id = null; Object idCloth = null; PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); Wardrobe wardrobe2 = new Wardrobe(); wardrobe2.setModel(STR); Wardrobe wardrobe3 = new Wardrobe(); wardrobe3.setModel(STR); pm.makePersistent(wardrobe2); pm.makePersistent(wardrobe3); Cloth whiteShirt = new Cloth(); whiteShirt.setName(STR); Cloth blackShirt = new Cloth(); blackShirt.setName(STR); Cloth skirt = new Cloth(); skirt.setName("skirt"); wardrobe3.getClothes().add(whiteShirt); wardrobe3.getClothes().add(skirt); wardrobe2.getClothes().add(blackShirt); tx.commit(); id = JDOHelper.getObjectId(wardrobe3); idCloth = JDOHelper.getObjectId(blackShirt); tx.begin(); Query q = pm.newQuery(Wardrobe.class,STR); q.declareParameters(STR); Collection c = (Collection) q.execute(skirt); assertEquals(1,c.size()); assertEquals(id,JDOHelper.getObjectId(c.iterator().next())); assertEquals(2,wardrobe3.getClothes().size()); tx.commit(); tx.begin(); Query q1 = pm.newQuery(Cloth.class,STR2 doors\STRorg.jpox.samples.models.fitness.Wardrobe wardrobeSTRwardrobe.clothes.contains(this)STRorg.jpox.samples.models.fitness.Wardrobe wardrobe"); Collection c2 = (Collection) q2.execute(wardrobe2); assertEquals(1,c2.size()); assertEquals(idCloth,JDOHelper.getObjectId(c2.iterator().next())); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); FitnessHelper.cleanFitnessData(pmf); } } | /**
* Tests contains() in List fields
*/ | Tests contains() in List fields | testContainsInListFields | {
"repo_name": "hopecee/texsts",
"path": "jdo/identity/src/test/org/datanucleus/tests/JDOQLContainerTest.java",
"license": "apache-2.0",
"size": 235732
} | [
"java.util.Collection",
"javax.jdo.JDOHelper",
"javax.jdo.PersistenceManager",
"javax.jdo.Query",
"javax.jdo.Transaction",
"org.jpox.samples.models.fitness.Cloth",
"org.jpox.samples.models.fitness.FitnessHelper",
"org.jpox.samples.models.fitness.Wardrobe"
] | import java.util.Collection; import javax.jdo.JDOHelper; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import org.jpox.samples.models.fitness.Cloth; import org.jpox.samples.models.fitness.FitnessHelper; import org.jpox.samples.models.fitness.Wardrobe; | import java.util.*; import javax.jdo.*; import org.jpox.samples.models.fitness.*; | [
"java.util",
"javax.jdo",
"org.jpox.samples"
] | java.util; javax.jdo; org.jpox.samples; | 1,818,084 |
Paint paint = new Paint();
String result = paint.painting(3);
final String line = System.getProperty("line.separator");
String expected = String.format(" ^ %s ^^^ %s^^^^^%s", line, line, line);
assertThat(result, is(expected));
} | Paint paint = new Paint(); String result = paint.painting(3); final String line = System.getProperty(STR); String expected = String.format(STR, line, line, line); assertThat(result, is(expected)); } | /**
* Test for pyramid with size 3.
*/ | Test for pyramid with size 3 | whenPaintPyramidWithHeightThreeThenStringWithThreeColsAndFiveRows | {
"repo_name": "MikhailoPalii/paliim",
"path": "chapter_001/src/test/java/ru/job4j/loop/PaintTest.java",
"license": "apache-2.0",
"size": 1110
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 2,829,712 |
public int answerQuestion(FormIndex index, IAnswerData data) throws JavaRosaException {
try {
return mFormEntryController.answerQuestion(index, data, true);
} catch (Exception e) {
throw new JavaRosaException(e);
}
} | int function(FormIndex index, IAnswerData data) throws JavaRosaException { try { return mFormEntryController.answerQuestion(index, data, true); } catch (Exception e) { throw new JavaRosaException(e); } } | /**
* Attempts to save answer into the given FormIndex into the data model.
*/ | Attempts to save answer into the given FormIndex into the data model | answerQuestion | {
"repo_name": "max2me/collect",
"path": "collect_app/src/main/java/org/odk/collect/android/logic/FormController.java",
"license": "apache-2.0",
"size": 45658
} | [
"org.javarosa.core.model.FormIndex",
"org.javarosa.core.model.data.IAnswerData",
"org.odk.collect.android.exception.JavaRosaException"
] | import org.javarosa.core.model.FormIndex; import org.javarosa.core.model.data.IAnswerData; import org.odk.collect.android.exception.JavaRosaException; | import org.javarosa.core.model.*; import org.javarosa.core.model.data.*; import org.odk.collect.android.exception.*; | [
"org.javarosa.core",
"org.odk.collect"
] | org.javarosa.core; org.odk.collect; | 1,415,520 |
public static Integer month(Date d) {
if (d == null) {
return null;
}
return ValuePool.getInt(
HsqlDateTime.getDateTimePart(d, Calendar.MONTH) + 1);
} | static Integer function(Date d) { if (d == null) { return null; } return ValuePool.getInt( HsqlDateTime.getDateTimePart(d, Calendar.MONTH) + 1); } | /**
* Returns the month from the given date value, as an integer value in the
* range of 1-12. <p>
*
* The sql_month database property is now obsolete.
* The function always returns the SQL (1-12) value for month.
*
* @param d the date value from which to extract the month value
* @return the month value from the given date value
*/ | Returns the month from the given date value, as an integer value in the range of 1-12. The sql_month database property is now obsolete. The function always returns the SQL (1-12) value for month | month | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/hsqldb_1_8_1_2/src/org/hsqldb/Library.java",
"license": "lgpl-3.0",
"size": 79684
} | [
"java.sql.Date",
"java.util.Calendar",
"org.hsqldb.store.ValuePool"
] | import java.sql.Date; import java.util.Calendar; import org.hsqldb.store.ValuePool; | import java.sql.*; import java.util.*; import org.hsqldb.store.*; | [
"java.sql",
"java.util",
"org.hsqldb.store"
] | java.sql; java.util; org.hsqldb.store; | 1,916,194 |
public void setEventTrackingService(EventTrackingService service)
{
m_eventTrackingService = service;
}
protected PrivacyManager m_privacyManager = null; | void function(EventTrackingService service) { m_eventTrackingService = service; } protected PrivacyManager m_privacyManager = null; | /**
* Dependency: EventTrackingService.
*
* @param service
* The EventTrackingService.
*/ | Dependency: EventTrackingService | setEventTrackingService | {
"repo_name": "harfalm/Sakai-10.1",
"path": "presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/BasePresenceService.java",
"license": "apache-2.0",
"size": 21398
} | [
"org.sakaiproject.api.privacy.PrivacyManager",
"org.sakaiproject.event.api.EventTrackingService"
] | import org.sakaiproject.api.privacy.PrivacyManager; import org.sakaiproject.event.api.EventTrackingService; | import org.sakaiproject.api.privacy.*; import org.sakaiproject.event.api.*; | [
"org.sakaiproject.api",
"org.sakaiproject.event"
] | org.sakaiproject.api; org.sakaiproject.event; | 1,200,767 |
public ListMetadataFormatsType listMetadataFormats(String identifier) throws IOException, OAIException,
JAXBException
{
String query = builder.buildListMetadataFormatsQuery(identifier);
return unMarshal(query).getListMetadataFormats();
} | ListMetadataFormatsType function(String identifier) throws IOException, OAIException, JAXBException { String query = builder.buildListMetadataFormatsQuery(identifier); return unMarshal(query).getListMetadataFormats(); } | /**
* Ask the OAI-PMH server to list all metadata formats it holds
* for the specified identifier.
* @return a list of available metadata formats
* @throws JAXBException
* @throws OAIException
*/ | Ask the OAI-PMH server to list all metadata formats it holds for the specified identifier | listMetadataFormats | {
"repo_name": "beeldengeluid/zieook",
"path": "backend/zieook-backend/zieook-inx/zieook-oaipmh/src/main/java/nl/gridline/zieook/Harvester.java",
"license": "apache-2.0",
"size": 13771
} | [
"java.io.IOException",
"javax.xml.bind.JAXBException",
"org.openarchives.oai._2.ListMetadataFormatsType"
] | import java.io.IOException; import javax.xml.bind.JAXBException; import org.openarchives.oai._2.ListMetadataFormatsType; | import java.io.*; import javax.xml.bind.*; import org.openarchives.oai.*; | [
"java.io",
"javax.xml",
"org.openarchives.oai"
] | java.io; javax.xml; org.openarchives.oai; | 1,785,982 |
public BigDecimal getResolved() {
return resolved;
} | BigDecimal function() { return resolved; } | /**
* Gets the value of the field <code>resolved</code>.
*
* @return the resolved
*/ | Gets the value of the field <code>resolved</code> | getResolved | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/ejb/gov/opm/scrd/services/impl/reporting/SuspenseResolutionReportResponseItem.java",
"license": "apache-2.0",
"size": 5291
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,245,592 |
public static boolean isManipulator(TileEntity tile){
if(tile != null) return tile instanceof IEnergyManipulator;
return false;
} | static boolean function(TileEntity tile){ if(tile != null) return tile instanceof IEnergyManipulator; return false; } | /**
* Checks if a TileEntity is a PE Manipulator (extends IEnergyManipulator)
* @param tile TileEntity to check
* @return True if the TileEntity is a PE Manipulator, otherwise false
*/ | Checks if a TileEntity is a PE Manipulator (extends IEnergyManipulator) | isManipulator | {
"repo_name": "sirsavary/Realistic-Terrain-Generation",
"path": "src/api/java/com/shinoow/abyssalcraft/api/energy/PEUtils.java",
"license": "gpl-3.0",
"size": 10066
} | [
"net.minecraft.tileentity.TileEntity"
] | import net.minecraft.tileentity.TileEntity; | import net.minecraft.tileentity.*; | [
"net.minecraft.tileentity"
] | net.minecraft.tileentity; | 2,399,918 |
public Integer getParentTroid()
throws AccessPoemException {
readLock();
return getParent_unsafe();
} | Integer function() throws AccessPoemException { readLock(); return getParent_unsafe(); } | /**
* Retrieves the Table Row Object ID.
*
* Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
* @throws AccessPoemException
* if the current <code>AccessToken</code>
* does not confer read access rights
* @return the TROID as an <code>Integer</code>
*/ | Retrieves the Table Row Object ID. Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | getParentTroid | {
"repo_name": "timp21337/Melati",
"path": "melati-example-odmg/src/main/java/org/melati/example/odmg/generated/ChildBase.java",
"license": "gpl-2.0",
"size": 10419
} | [
"org.melati.poem.AccessPoemException"
] | import org.melati.poem.AccessPoemException; | import org.melati.poem.*; | [
"org.melati.poem"
] | org.melati.poem; | 987,871 |
public final NodeAddress getNxh() {
return new NodeAddress(data[NXH_INDEX], data[NXH_INDEX + 1]);
}
| final NodeAddress function() { return new NodeAddress(data[NXH_INDEX], data[NXH_INDEX + 1]); } | /**
* Returns the NodeAddress of the next hop towards the destination.
*
* @return the NodeAddress of the the next hop towards the destination node
*/ | Returns the NodeAddress of the next hop towards the destination | getNxh | {
"repo_name": "sdnwiselab/sdn-wise-java",
"path": "core/src/main/java/com/github/sdnwiselab/sdnwise/packet/NetworkPacket.java",
"license": "gpl-3.0",
"size": 23883
} | [
"com.github.sdnwiselab.sdnwise.util.NodeAddress"
] | import com.github.sdnwiselab.sdnwise.util.NodeAddress; | import com.github.sdnwiselab.sdnwise.util.*; | [
"com.github.sdnwiselab"
] | com.github.sdnwiselab; | 2,572,851 |
protected IPersonAttributes mapPersonAttributes(final ILocalAccountPerson person) {
final Map<String, List<Object>> mappedAttributes =
new LinkedHashMap<String, List<Object>>();
mappedAttributes.putAll(person.getAttributes());
// map the user's username to the portal's username attribute in the
// attribute map
mappedAttributes.put(
this.getUsernameAttributeProvider().getUsernameAttribute(),
Collections.<Object>singletonList(person.getName()));
// if the user does not have a display name attribute set, attempt
// to build one from the first and last name attributes
if (!mappedAttributes.containsKey(displayNameAttribute)
|| mappedAttributes.get(displayNameAttribute).size() == 0
|| StringUtils.isBlank(
(String) mappedAttributes.get(displayNameAttribute).get(0))) {
final List<Object> firstNames = mappedAttributes.get("givenName");
final List<Object> lastNames = mappedAttributes.get("sn");
final StringBuilder displayName = new StringBuilder();
if (firstNames != null && firstNames.size() > 0) {
displayName.append(firstNames.get(0)).append(" ");
}
if (lastNames != null && lastNames.size() > 0) {
displayName.append(lastNames.get(0));
}
mappedAttributes.put(
displayNameAttribute,
Collections.<Object>singletonList(displayName.toString()));
}
for (final Map.Entry<String, Set<String>> resultAttrEntry :
this.getResultAttributeMapping().entrySet()) {
final String dataKey = resultAttrEntry.getKey();
// Only map found data attributes
if (mappedAttributes.containsKey(dataKey)) {
Set<String> resultKeys = resultAttrEntry.getValue();
// If dataKey has no mapped resultKeys just use the dataKey
if (resultKeys == null) {
resultKeys = Collections.singleton(dataKey);
}
// Add the value to the mapped attributes for each mapped key
final List<Object> value = mappedAttributes.get(dataKey);
for (final String resultKey : resultKeys) {
if (resultKey == null) {
// TODO is this possible?
if (!mappedAttributes.containsKey(dataKey)) {
mappedAttributes.put(dataKey, value);
}
} else if (!mappedAttributes.containsKey(resultKey)) {
mappedAttributes.put(resultKey, value);
}
}
}
}
final IPersonAttributes newPerson;
final String name = person.getName();
if (name != null) {
newPerson = new NamedPersonImpl(name, mappedAttributes);
} else {
final String userNameAttribute = this.getConfiguredUserNameAttribute();
newPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes);
}
return newPerson;
} | IPersonAttributes function(final ILocalAccountPerson person) { final Map<String, List<Object>> mappedAttributes = new LinkedHashMap<String, List<Object>>(); mappedAttributes.putAll(person.getAttributes()); mappedAttributes.put( this.getUsernameAttributeProvider().getUsernameAttribute(), Collections.<Object>singletonList(person.getName())); if (!mappedAttributes.containsKey(displayNameAttribute) mappedAttributes.get(displayNameAttribute).size() == 0 StringUtils.isBlank( (String) mappedAttributes.get(displayNameAttribute).get(0))) { final List<Object> firstNames = mappedAttributes.get(STR); final List<Object> lastNames = mappedAttributes.get("sn"); final StringBuilder displayName = new StringBuilder(); if (firstNames != null && firstNames.size() > 0) { displayName.append(firstNames.get(0)).append(" "); } if (lastNames != null && lastNames.size() > 0) { displayName.append(lastNames.get(0)); } mappedAttributes.put( displayNameAttribute, Collections.<Object>singletonList(displayName.toString())); } for (final Map.Entry<String, Set<String>> resultAttrEntry : this.getResultAttributeMapping().entrySet()) { final String dataKey = resultAttrEntry.getKey(); if (mappedAttributes.containsKey(dataKey)) { Set<String> resultKeys = resultAttrEntry.getValue(); if (resultKeys == null) { resultKeys = Collections.singleton(dataKey); } final List<Object> value = mappedAttributes.get(dataKey); for (final String resultKey : resultKeys) { if (resultKey == null) { if (!mappedAttributes.containsKey(dataKey)) { mappedAttributes.put(dataKey, value); } } else if (!mappedAttributes.containsKey(resultKey)) { mappedAttributes.put(resultKey, value); } } } } final IPersonAttributes newPerson; final String name = person.getName(); if (name != null) { newPerson = new NamedPersonImpl(name, mappedAttributes); } else { final String userNameAttribute = this.getConfiguredUserNameAttribute(); newPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes); } return newPerson; } | /**
* This implementation uses the result attribute mapping to supplement, rather than replace, the
* attributes returned from the database.
*/ | This implementation uses the result attribute mapping to supplement, rather than replace, the attributes returned from the database | mapPersonAttributes | {
"repo_name": "phillips1021/uPortal",
"path": "uPortal-persondir/src/main/java/org/apereo/portal/persondir/LocalAccountPersonAttributeDao.java",
"license": "apache-2.0",
"size": 13404
} | [
"java.util.Collections",
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.apache.commons.lang.StringUtils",
"org.apereo.services.persondir.IPersonAttributes",
"org.apereo.services.persondir.support.AttributeNamedPersonImpl",
"org.apereo.services.persondir.support.NamedPersonImpl"
] | import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apereo.services.persondir.IPersonAttributes; import org.apereo.services.persondir.support.AttributeNamedPersonImpl; import org.apereo.services.persondir.support.NamedPersonImpl; | import java.util.*; import org.apache.commons.lang.*; import org.apereo.services.persondir.*; import org.apereo.services.persondir.support.*; | [
"java.util",
"org.apache.commons",
"org.apereo.services"
] | java.util; org.apache.commons; org.apereo.services; | 2,482,211 |
public List<Logging> findBypassel(long passel) throws SystemException {
return findBypassel(passel, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | List<Logging> function(long passel) throws SystemException { return findBypassel(passel, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } | /**
* Returns all the loggings where passel ≥ ?.
*
* @param passel the passel
* @return the matching loggings
* @throws SystemException if a system exception occurred
*/ | Returns all the loggings where passel ≥ ? | findBypassel | {
"repo_name": "fraunhoferfokus/govapps",
"path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/persistence/LoggingPersistenceImpl.java",
"license": "bsd-3-clause",
"size": 212106
} | [
"com.liferay.portal.kernel.dao.orm.QueryUtil",
"com.liferay.portal.kernel.exception.SystemException",
"de.fraunhofer.fokus.movepla.model.Logging",
"java.util.List"
] | import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.SystemException; import de.fraunhofer.fokus.movepla.model.Logging; import java.util.List; | import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.exception.*; import de.fraunhofer.fokus.movepla.model.*; import java.util.*; | [
"com.liferay.portal",
"de.fraunhofer.fokus",
"java.util"
] | com.liferay.portal; de.fraunhofer.fokus; java.util; | 1,075,486 |
public static MozuClient<com.mozu.api.contracts.productadmin.MasterCatalogCollection> getMasterCatalogsClient(AuthTicket authTicket) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.MasterCatalogUrl.getMasterCatalogsUrl();
String verb = "GET";
Class<?> clz = com.mozu.api.contracts.productadmin.MasterCatalogCollection.class;
MozuClient<com.mozu.api.contracts.productadmin.MasterCatalogCollection> mozuClient = new MozuClient(clz);
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
if (authTicket != null)
mozuClient.setUserAuth(authTicket);
return mozuClient;
} | static MozuClient<com.mozu.api.contracts.productadmin.MasterCatalogCollection> function(AuthTicket authTicket) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.MasterCatalogUrl.getMasterCatalogsUrl(); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.MasterCatalogCollection.class; MozuClient<com.mozu.api.contracts.productadmin.MasterCatalogCollection> mozuClient = new MozuClient(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); if (authTicket != null) mozuClient.setUserAuth(authTicket); return mozuClient; } | /**
* Retrieve the details of all master catalog associated with a tenant.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.MasterCatalogCollection> mozuClient=GetMasterCatalogsClient(authTicket);
* client.setBaseAddress(url);
* client.executeRequest();
* MasterCatalogCollection masterCatalogCollection = client.Result();
* </code></pre></p>
* @param authTicket User Auth Ticket
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.MasterCatalogCollection>
* @see com.mozu.api.contracts.productadmin.MasterCatalogCollection
*/ | Retrieve the details of all master catalog associated with a tenant. <code><code> MozuClient mozuClient=GetMasterCatalogsClient(authTicket); client.setBaseAddress(url); client.executeRequest(); MasterCatalogCollection masterCatalogCollection = client.Result(); </code></code> | getMasterCatalogsClient | {
"repo_name": "carsonreinke/mozu-java-sdk",
"path": "src/main/java/com/mozu/api/clients/commerce/catalog/admin/MasterCatalogClient.java",
"license": "mit",
"size": 5001
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuUrl",
"com.mozu.api.security.AuthTicket"
] | import com.mozu.api.MozuClient; import com.mozu.api.MozuUrl; import com.mozu.api.security.AuthTicket; | import com.mozu.api.*; import com.mozu.api.security.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,855,149 |
public void setLanguageName(String languageName) {
Assert.notNullParam(languageName, "languageName");
setLocale(new Locale(languageName, ""));
} | void function(String languageName) { Assert.notNullParam(languageName, STR); setLocale(new Locale(languageName, "")); } | /**
* Set the name of the language, it must be a <b>valid ISO Language Code</b>. See the language name in {@link Locale}.
* This method should only be used when <i>country</i> and <i>variant</i> are not important at all, otherwise
* {@link #setLocale(Locale)} must be used.
*/ | Set the name of the language, it must be a valid ISO Language Code. See the language name in <code>Locale</code>. This method should only be used when country and variant are not important at all, otherwise <code>#setLocale(Locale)</code> must be used | setLanguageName | {
"repo_name": "nortal/araneaframework",
"path": "src/org/araneaframework/framework/filter/StandardLocalizationFilterService.java",
"license": "apache-2.0",
"size": 6422
} | [
"java.util.Locale",
"org.araneaframework.core.Assert"
] | import java.util.Locale; import org.araneaframework.core.Assert; | import java.util.*; import org.araneaframework.core.*; | [
"java.util",
"org.araneaframework.core"
] | java.util; org.araneaframework.core; | 1,381,640 |
public AzioneGrafica esegui(double initialPointX, double initialPointY,
double angulation) {
double newAngulation = ((angulation + this.localAngulation) % 360);
return new RotazioneGrafica(newAngulation);
} | AzioneGrafica function(double initialPointX, double initialPointY, double angulation) { double newAngulation = ((angulation + this.localAngulation) % 360); return new RotazioneGrafica(newAngulation); } | /**
* Esegue l'azione. Calcola il valore finale a partire che provoca questa
* azione
*
* @param initialPointX
* punto iniziale
* @param initialPointY
* punto iniziale
* @param angulation
* angolazione
* @return istanza di AzioneGrafica che verra' stampata a video
*/ | Esegue l'azione. Calcola il valore finale a partire che provoca questa azione | esegui | {
"repo_name": "marcosperanza/logo",
"path": "src/main/java/org/logo/viewer/logo/graphic/Rotazione.java",
"license": "apache-2.0",
"size": 1938
} | [
"org.logo.viewer.logo.graphic.actions.AzioneGrafica",
"org.logo.viewer.logo.graphic.actions.RotazioneGrafica"
] | import org.logo.viewer.logo.graphic.actions.AzioneGrafica; import org.logo.viewer.logo.graphic.actions.RotazioneGrafica; | import org.logo.viewer.logo.graphic.actions.*; | [
"org.logo.viewer"
] | org.logo.viewer; | 1,247,913 |
public static Color of(Vector3f vector3f) {
return new Color(Math.round(vector3f.getX()), Math.round(vector3f.getY()), Math.round(vector3f.getZ()));
} | static Color function(Vector3f vector3f) { return new Color(Math.round(vector3f.getX()), Math.round(vector3f.getY()), Math.round(vector3f.getZ())); } | /**
* converts the provided {@link Vector3f} into a {@link Color} object.
*
* @param vector3f The vector of three floats representing color
* @return The color object
*/ | converts the provided <code>Vector3f</code> into a <code>Color</code> object | of | {
"repo_name": "JBYoshi/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/util/Color.java",
"license": "mit",
"size": 12935
} | [
"com.flowpowered.math.vector.Vector3f"
] | import com.flowpowered.math.vector.Vector3f; | import com.flowpowered.math.vector.*; | [
"com.flowpowered.math"
] | com.flowpowered.math; | 366,288 |
public List<CacheLocation> orderCacheLocations(final List<CacheLocation> cacheLocations, final Geolocation clientLocation) {
Collections.sort(cacheLocations, new CacheLocationComparator(clientLocation));
return cacheLocations;
} | List<CacheLocation> function(final List<CacheLocation> cacheLocations, final Geolocation clientLocation) { Collections.sort(cacheLocations, new CacheLocationComparator(clientLocation)); return cacheLocations; } | /**
* Returns a list {@link CacheLocation}s sorted by distance from the client.
* If the client's location could not be determined, then the list is
* unsorted.
*
* @param cacheLocations
* the collection of CacheLocations to order
* @return the ordered list of locations
*/ | Returns a list <code>CacheLocation</code>s sorted by distance from the client. If the client's location could not be determined, then the list is unsorted | orderCacheLocations | {
"repo_name": "jheitz200/traffic_control",
"path": "traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/router/TrafficRouter.java",
"license": "apache-2.0",
"size": 29320
} | [
"com.comcast.cdn.traffic_control.traffic_router.core.cache.CacheLocation",
"com.comcast.cdn.traffic_control.traffic_router.geolocation.Geolocation",
"java.util.Collections",
"java.util.List"
] | import com.comcast.cdn.traffic_control.traffic_router.core.cache.CacheLocation; import com.comcast.cdn.traffic_control.traffic_router.geolocation.Geolocation; import java.util.Collections; import java.util.List; | import com.comcast.cdn.traffic_control.traffic_router.core.cache.*; import com.comcast.cdn.traffic_control.traffic_router.geolocation.*; import java.util.*; | [
"com.comcast.cdn",
"java.util"
] | com.comcast.cdn; java.util; | 33,757 |
public static void shuffleAll(UnsafeConsumer<String> onEmpty) {
shuffleAll(DataManager.getInstance().getSongsRelay().firstOrError(), onEmpty, false);
} | static void function(UnsafeConsumer<String> onEmpty) { shuffleAll(DataManager.getInstance().getSongsRelay().firstOrError(), onEmpty, false); } | /**
* Shuffles all songs on device in album shuffle mode
*/ | Shuffles all songs on device in album shuffle mode | shuffleAll | {
"repo_name": "willcoughlin/Shuttle",
"path": "app/src/main/java/com/simplecity/amp_library/utils/MusicUtils.java",
"license": "gpl-3.0",
"size": 17119
} | [
"com.simplecity.amp_library.rx.UnsafeConsumer"
] | import com.simplecity.amp_library.rx.UnsafeConsumer; | import com.simplecity.amp_library.rx.*; | [
"com.simplecity.amp_library"
] | com.simplecity.amp_library; | 948,620 |
private OExtVar compileExtVar(Variable src) {
if (!src.isExternal())
return null;
OExtVar oextvar = new OExtVar(_oprocess);
oextvar.externalVariableId = src.getExternalId();
oextvar.debugInfo = createDebugInfo(src, null);
if (src.getExternalId() == null)
throw new CompilationException(__cmsgs.errMustSpecifyExternalVariableId(src.getName()));
if (src.getRelated() == null)
throw new CompilationException(__cmsgs.errMustSpecifyRelatedVariable(src.getName()));
oextvar.related = resolveVariable(src.getRelated());
return oextvar;
}
private static class StructureStack {
private Stack<OActivity> _stack = new Stack<OActivity>();
private Map<OActivity,BpelObject> _srcMap = new HashMap<OActivity,BpelObject>(); | OExtVar function(Variable src) { if (!src.isExternal()) return null; OExtVar oextvar = new OExtVar(_oprocess); oextvar.externalVariableId = src.getExternalId(); oextvar.debugInfo = createDebugInfo(src, null); if (src.getExternalId() == null) throw new CompilationException(__cmsgs.errMustSpecifyExternalVariableId(src.getName())); if (src.getRelated() == null) throw new CompilationException(__cmsgs.errMustSpecifyRelatedVariable(src.getName())); oextvar.related = resolveVariable(src.getRelated()); return oextvar; } private static class StructureStack { private Stack<OActivity> _stack = new Stack<OActivity>(); private Map<OActivity,BpelObject> _srcMap = new HashMap<OActivity,BpelObject>(); | /**
* Compile external variable declaration.
* @param src variable object
* @return compiled {@link OExtVar} representation.
*/ | Compile external variable declaration | compileExtVar | {
"repo_name": "hasithaa/wso2-ode",
"path": "bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java",
"license": "apache-2.0",
"size": 82528
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.Stack",
"org.apache.ode.bpel.compiler.api.CompilationException",
"org.apache.ode.bpel.compiler.bom.BpelObject",
"org.apache.ode.bpel.compiler.bom.Variable",
"org.apache.ode.bpel.o.OActivity",
"org.apache.ode.bpel.o.OExtVar"
] | import java.util.HashMap; import java.util.Map; import java.util.Stack; import org.apache.ode.bpel.compiler.api.CompilationException; import org.apache.ode.bpel.compiler.bom.BpelObject; import org.apache.ode.bpel.compiler.bom.Variable; import org.apache.ode.bpel.o.OActivity; import org.apache.ode.bpel.o.OExtVar; | import java.util.*; import org.apache.ode.bpel.compiler.api.*; import org.apache.ode.bpel.compiler.bom.*; import org.apache.ode.bpel.o.*; | [
"java.util",
"org.apache.ode"
] | java.util; org.apache.ode; | 1,824,264 |
public static Department[] getAll(SRConnection c, long acct)
throws SQLException {
long[] ids = DBDepartment.getIds(c, acct);
Department[] arr = new Department[ids.length];
for(int i = 0; i < arr.length; i++)
arr[i] = new Department(c, ids[i], acct);
return arr;
} | static Department[] function(SRConnection c, long acct) throws SQLException { long[] ids = DBDepartment.getIds(c, acct); Department[] arr = new Department[ids.length]; for(int i = 0; i < arr.length; i++) arr[i] = new Department(c, ids[i], acct); return arr; } | /**
* Returns an array of Department records associated with the specified
* account.
*
* @param c the connection
* @param acct the account ID
* @return an array of records, or an empty array if no matches were found
* @throws SQLException if a database access error occurs
*/ | Returns an array of Department records associated with the specified account | getAll | {
"repo_name": "mordigaldj/SmartRegister",
"path": "src/main/java/com/djm/smartreg/business/Department.java",
"license": "mit",
"size": 3686
} | [
"com.djm.smartreg.data.DBDepartment",
"com.djm.smartreg.data.SRConnection",
"java.sql.SQLException"
] | import com.djm.smartreg.data.DBDepartment; import com.djm.smartreg.data.SRConnection; import java.sql.SQLException; | import com.djm.smartreg.data.*; import java.sql.*; | [
"com.djm.smartreg",
"java.sql"
] | com.djm.smartreg; java.sql; | 1,079,173 |
private void deleteBuilds(List<Record> subrecords, Record lastSuccessBuild, Record lastStableBuild, Calendar cal)
throws IOException {
for (Record currentBuild : subrecords) {
if (allowDeleteBuild(lastSuccessBuild, lastStableBuild, currentBuild, cal)) {
Run currentRun = currentBuild.getBuild();
if (currentRun.isKeepLog()) {
LOGGER.log(FINER, "{0} is not GC-ed because it''s marked as a keeper", currentBuild.getFullDisplayName());
} else {
LOGGER.log(FINER, "{0} is to be removed", currentBuild.getFullDisplayName());
currentRun.delete();
}
}
}
}
/**
* Checks whether current build could be deleted. If current build equals to
* last Success Build or last Stable Build or currentBuild is configured to
* keep logs or currentBuild timestamp is before configured calendar value -
* return false, otherwise return true.
*
* @param lastSuccessBuild {@link Run}
* @param lastStableBuild {@link Run}
* @param currentBuild {@link Run}
* @param cal {@link Calendar} | void function(List<Record> subrecords, Record lastSuccessBuild, Record lastStableBuild, Calendar cal) throws IOException { for (Record currentBuild : subrecords) { if (allowDeleteBuild(lastSuccessBuild, lastStableBuild, currentBuild, cal)) { Run currentRun = currentBuild.getBuild(); if (currentRun.isKeepLog()) { LOGGER.log(FINER, STR, currentBuild.getFullDisplayName()); } else { LOGGER.log(FINER, STR, currentBuild.getFullDisplayName()); currentRun.delete(); } } } } /** * Checks whether current build could be deleted. If current build equals to * last Success Build or last Stable Build or currentBuild is configured to * keep logs or currentBuild timestamp is before configured calendar value - * return false, otherwise return true. * * @param lastSuccessBuild {@link Run} * @param lastStableBuild {@link Run} * @param currentBuild {@link Run} * @param cal {@link Calendar} | /**
* Performs builds deletion
*
* @param builds list of builds
* @param lastSuccessBuild last success build
* @param lastStableBuild last stable build
* @param cal calendar if configured
* @throws IOException if configured
*/ | Performs builds deletion | deleteBuilds | {
"repo_name": "eclipse/hudson.core",
"path": "hudson-core/src/main/java/hudson/tasks/LogRotator.java",
"license": "apache-2.0",
"size": 12039
} | [
"hudson.model.BuildHistory",
"hudson.model.Run",
"java.io.IOException",
"java.util.Calendar",
"java.util.List"
] | import hudson.model.BuildHistory; import hudson.model.Run; import java.io.IOException; import java.util.Calendar; import java.util.List; | import hudson.model.*; import java.io.*; import java.util.*; | [
"hudson.model",
"java.io",
"java.util"
] | hudson.model; java.io; java.util; | 666,413 |
public void blackListPossibleMatchesToString() {
Set<String> date = blackListPossibleMatches.keySet();
if (date.size() == 0) {
System.out.println("\nNo Black List Possible Matches");
return;
}
System.out.println("\nBlack List Possible Matches:");
for (String currentDate : date) {
System.out.println("Zeit: " + currentDate);
ArrayList<PossibleMatch> possibleMatch = blackListPossibleMatches.get(currentDate);
if (possibleMatch == null) {
System.out.println("No Black List Possible Matches.");
}
for (int i = 0; i < possibleMatch.size(); i++) {
System.out.println(" " + (i + 1) + ". : " + possibleMatch.get(i).toString());
}
}
} | void function() { Set<String> date = blackListPossibleMatches.keySet(); if (date.size() == 0) { System.out.println(STR); return; } System.out.println(STR); for (String currentDate : date) { System.out.println(STR + currentDate); ArrayList<PossibleMatch> possibleMatch = blackListPossibleMatches.get(currentDate); if (possibleMatch == null) { System.out.println(STR); } for (int i = 0; i < possibleMatch.size(); i++) { System.out.println(" " + (i + 1) + STR + possibleMatch.get(i).toString()); } } } | /**
* Gibt alle Matches von der Black List auf der Console aus.
*/ | Gibt alle Matches von der Black List auf der Console aus | blackListPossibleMatchesToString | {
"repo_name": "rubytobi/fim-ba",
"path": "src/main/java/Entity/Marketplace.java",
"license": "gpl-2.0",
"size": 62801
} | [
"java.util.ArrayList",
"java.util.Set"
] | import java.util.ArrayList; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,968,281 |
private QueryOutputConfig generateOutput(OutputStream outputStream) throws DesignGenerationException {
return new QueryOutputConfigGenerator(siddhiAppString).generateQueryOutputConfig(outputStream);
} | QueryOutputConfig function(OutputStream outputStream) throws DesignGenerationException { return new QueryOutputConfigGenerator(siddhiAppString).generateQueryOutputConfig(outputStream); } | /**
* Generates QueryOutputConfig from the given Siddhi OutputStream.
*
* @param outputStream Siddhi OutputStream
* @return QueryOutputConfig
* @throws DesignGenerationException Error while generating QueryOutputConfig
*/ | Generates QueryOutputConfig from the given Siddhi OutputStream | generateOutput | {
"repo_name": "wso2/carbon-analytics",
"path": "components/org.wso2.carbon.siddhi.editor.core/src/main/java/org/wso2/carbon/siddhi/editor/core/util/designview/designgenerator/generators/query/QueryConfigGenerator.java",
"license": "apache-2.0",
"size": 13606
} | [
"io.siddhi.query.api.execution.query.output.stream.OutputStream",
"org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.query.output.QueryOutputConfig",
"org.wso2.carbon.siddhi.editor.core.util.designview.designgenerator.generators.query.output.QueryOutputConfigGenerator",
"org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.DesignGenerationException"
] | import io.siddhi.query.api.execution.query.output.stream.OutputStream; import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.query.output.QueryOutputConfig; import org.wso2.carbon.siddhi.editor.core.util.designview.designgenerator.generators.query.output.QueryOutputConfigGenerator; import org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.DesignGenerationException; | import io.siddhi.query.api.execution.query.output.stream.*; import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.query.output.*; import org.wso2.carbon.siddhi.editor.core.util.designview.designgenerator.generators.query.output.*; import org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.*; | [
"io.siddhi.query",
"org.wso2.carbon"
] | io.siddhi.query; org.wso2.carbon; | 2,389,033 |
public String cancel() {
try {
deleteTempUploads();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "/secure/admin/product_list?faces-redirect=true";
} | String function() { try { deleteTempUploads(); } catch (IOException e) { e.printStackTrace(); } return STR; } | /**
* JSF method to cancel editing the selected product.
*/ | JSF method to cancel editing the selected product | cancel | {
"repo_name": "mbooth101/gpm",
"path": "src/main/java/com/gpm/mbean/admin/ProductAdminBean.java",
"license": "apache-2.0",
"size": 7463
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 421,795 |
public Builder onCancel(ClickHandler handler) {
registration = chain.wizard.addCancelClickHandler(handler);
chain.cancelHandlerRegistration = registration;
return this;
} | Builder function(ClickHandler handler) { registration = chain.wizard.addCancelClickHandler(handler); chain.cancelHandlerRegistration = registration; return this; } | /**
* Set a specific handler to be called when cancel is clicked.
*
* @param handler
* @return
*/ | Set a specific handler to be called when cancel is clicked | onCancel | {
"repo_name": "apruden/opal",
"path": "opal-gwt-client/src/main/java/org/obiba/opal/web/gwt/app/client/ui/wizard/WizardStepChain.java",
"license": "gpl-3.0",
"size": 9589
} | [
"com.google.gwt.event.dom.client.ClickHandler"
] | import com.google.gwt.event.dom.client.ClickHandler; | import com.google.gwt.event.dom.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 633,324 |
private SystemDef getSystemDef(String systemDefName) {
for (DatacollectionGroup group : externalGroupsMap.values()) {
for (SystemDef sd : group.getSystemDefCollection()) {
if (sd.getName().equals(systemDefName)) {
return sd;
}
}
}
return null;
} | SystemDef function(String systemDefName) { for (DatacollectionGroup group : externalGroupsMap.values()) { for (SystemDef sd : group.getSystemDefCollection()) { if (sd.getName().equals(systemDefName)) { return sd; } } } return null; } | /**
* Get a system definition from datacollection-group map.
*
* @param systemDefName the systemDef object name.
* @return the systemDef object.
*/ | Get a system definition from datacollection-group map | getSystemDef | {
"repo_name": "bugcy013/opennms-tmp-tools",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/DataCollectionConfigParser.java",
"license": "gpl-2.0",
"size": 14956
} | [
"org.opennms.netmgt.config.datacollection.DatacollectionGroup",
"org.opennms.netmgt.config.datacollection.SystemDef"
] | import org.opennms.netmgt.config.datacollection.DatacollectionGroup; import org.opennms.netmgt.config.datacollection.SystemDef; | import org.opennms.netmgt.config.datacollection.*; | [
"org.opennms.netmgt"
] | org.opennms.netmgt; | 2,705,752 |
EReference getAnnotation_AnnotationElements();
| EReference getAnnotation_AnnotationElements(); | /**
* Returns the meta object for the containment reference list '{@link org.ow2.mindEd.adl.textual.fractal.Annotation#getAnnotationElements <em>Annotation Elements</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Annotation Elements</em>'.
* @see org.ow2.mindEd.adl.textual.fractal.Annotation#getAnnotationElements()
* @see #getAnnotation()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.ow2.mindEd.adl.textual.fractal.Annotation#getAnnotationElements Annotation Elements</code>'. | getAnnotation_AnnotationElements | {
"repo_name": "StephaneSeyvoz/mindEd",
"path": "org.ow2.mindEd.adl.textual/src-gen/org/ow2/mindEd/adl/textual/fractal/FractalPackage.java",
"license": "lgpl-3.0",
"size": 141105
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,409,454 |
return new TestSuite(XYDataItemTests.class);
}
public XYDataItemTests(String name) {
super(name);
} | return new TestSuite(XYDataItemTests.class); } public XYDataItemTests(String name) { super(name); } | /**
* Returns the tests as a test suite.
*
* @return The test suite.
*/ | Returns the tests as a test suite | suite | {
"repo_name": "integrated/jfreechart",
"path": "tests/org/jfree/data/xy/junit/XYDataItemTests.java",
"license": "lgpl-2.1",
"size": 4024
} | [
"junit.framework.TestSuite"
] | import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 533,861 |
private BSPTree<Euclidean1D> previousInternalNode(BSPTree<Euclidean1D> node) {
if (childBefore(node).getCut() != null) {
// the next node is in the sub-tree
return leafBefore(node).getParent();
}
// there is nothing left deeper in the tree, we backtrack
while (isBeforeParent(node)) {
node = node.getParent();
}
return node.getParent();
} | BSPTree<Euclidean1D> function(BSPTree<Euclidean1D> node) { if (childBefore(node).getCut() != null) { return leafBefore(node).getParent(); } while (isBeforeParent(node)) { node = node.getParent(); } return node.getParent(); } | /** Get the previous internal node.
* @param node current internal node
* @return previous internal node in ascending order, or null
* if this is the first internal node
*/ | Get the previous internal node | previousInternalNode | {
"repo_name": "sdinot/hipparchus",
"path": "hipparchus-geometry/src/main/java/org/hipparchus/geometry/euclidean/oned/IntervalsSet.java",
"license": "apache-2.0",
"size": 23841
} | [
"org.hipparchus.geometry.partitioning.BSPTree"
] | import org.hipparchus.geometry.partitioning.BSPTree; | import org.hipparchus.geometry.partitioning.*; | [
"org.hipparchus.geometry"
] | org.hipparchus.geometry; | 1,126,400 |
private String getGenerateAccountRequest(PerunSession session, Map<String, String> parameters, int requestID) {
log.debug("Making request with ID: " + requestID + " to IS MU.");
String params = "";
if (parameters != null && !parameters.isEmpty()) {
if (parameters.get("urn:perun:user:attribute-def:core:firstName") != null && !parameters.get("urn:perun:user:attribute-def:core:firstName").isEmpty())
params += "<jmeno>" + parameters.get("urn:perun:user:attribute-def:core:firstName") + "</jmeno>\n";
if (parameters.get("urn:perun:user:attribute-def:core:lastName") != null && !parameters.get("urn:perun:user:attribute-def:core:lastName").isEmpty())
params += "<prijmeni>" + parameters.get("urn:perun:user:attribute-def:core:lastName") + "</prijmeni>\n";
if (parameters.get("urn:perun:user:attribute-def:core:titleBefore") != null && !parameters.get("urn:perun:user:attribute-def:core:titleBefore").isEmpty())
params += "<titul_pred>" + parameters.get("urn:perun:user:attribute-def:core:titleBefore") + "</titul_pred>\n";
if (parameters.get("urn:perun:user:attribute-def:core:titleAfter") != null && !parameters.get("urn:perun:user:attribute-def:core:titleAfter").isEmpty())
params += "<titul_za>" + parameters.get("urn:perun:user:attribute-def:core:titleAfter") + "</titul_za>\n";
if (parameters.get("urn:perun:user:attribute-def:def:birthDay") != null && !parameters.get("urn:perun:user:attribute-def:def:birthDay").isEmpty())
params += "<datum_narozeni>" + parameters.get("urn:perun:user:attribute-def:def:birthDay") + "</datum_narozeni>\n";
if (parameters.get("urn:perun:user:attribute-def:def:rc") != null && !parameters.get("urn:perun:user:attribute-def:def:rc").isEmpty())
params += "<rodne_cislo>" + parameters.get("urn:perun:user:attribute-def:def:rc") + "</rodne_cislo>\n";
if (parameters.get("urn:perun:member:attribute-def:def:mail") != null && !parameters.get("urn:perun:member:attribute-def:def:mail").isEmpty())
params += "<email>" + parameters.get("urn:perun:member:attribute-def:def:mail") + "</email>\n";
if (parameters.get("password") != null && !parameters.get("password").isEmpty())
params += "<heslo>" + parameters.get("password") + "</heslo>\n";
}
params += getUcoFromSessionUser(session);
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<request>\n" +
"<osoba reqid=\"" + requestID + "\">\n" +
"<uco></uco>\n" +
params +
"<operace>INS</operace>\n" +
"</osoba>\n" +
"</request>";
} | String function(PerunSession session, Map<String, String> parameters, int requestID) { log.debug(STR + requestID + STR); String params = STRurn:perun:user:attribute-def:core:firstNameSTRurn:perun:user:attribute-def:core:firstNameSTR<jmeno>STRurn:perun:user:attribute-def:core:firstNameSTR</jmeno>\nSTRurn:perun:user:attribute-def:core:lastNameSTRurn:perun:user:attribute-def:core:lastNameSTR<prijmeni>STRurn:perun:user:attribute-def:core:lastNameSTR</prijmeni>\nSTRurn:perun:user:attribute-def:core:titleBeforeSTRurn:perun:user:attribute-def:core:titleBeforeSTR<titul_pred>STRurn:perun:user:attribute-def:core:titleBeforeSTR</titul_pred>\nSTRurn:perun:user:attribute-def:core:titleAfterSTRurn:perun:user:attribute-def:core:titleAfterSTR<titul_za>STRurn:perun:user:attribute-def:core:titleAfterSTR</titul_za>\nSTRurn:perun:user:attribute-def:def:birthDaySTRurn:perun:user:attribute-def:def:birthDaySTR<datum_narozeni>STRurn:perun:user:attribute-def:def:birthDaySTR</datum_narozeni>\nSTRurn:perun:user:attribute-def:def:rcSTRurn:perun:user:attribute-def:def:rcSTR<rodne_cislo>STRurn:perun:user:attribute-def:def:rcSTR</rodne_cislo>\nSTRurn:perun:member:attribute-def:def:mailSTRurn:perun:member:attribute-def:def:mailSTR<email>STRurn:perun:member:attribute-def:def:mailSTR</email>\nSTRpasswordSTRpasswordSTR<heslo>STRpasswordSTR</heslo>\nSTR<?xml version=\"1.0\" encoding=\STR?>\nSTR<request>\nSTR<osoba reqid=\STR\">\nSTR<uco></uco>\n" + params + "<operace>INS</operace>\nSTR</osoba>\nSTR</request>"; } | /**
* Generate XML request body from passed parameters in order to generate account.
*
* @param session
* @param parameters request parameters to pass
* @param requestID unique ID of a request
* @return XML request body
*/ | Generate XML request body from passed parameters in order to generate account | getGenerateAccountRequest | {
"repo_name": "ondrejvelisek/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/impl/modules/pwdmgr/MuPasswordManagerModule.java",
"license": "bsd-2-clause",
"size": 16363
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"java.util.Map"
] | import cz.metacentrum.perun.core.api.PerunSession; import java.util.Map; | import cz.metacentrum.perun.core.api.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 2,416,323 |
@GET("keyword/{keyword_id}")
Call<Keyword> summary(
@Path("keyword_id") Integer keywordId,
@Query("append_to_response") AppendToResponse appendToResponse
); | @GET(STR) Call<Keyword> summary( @Path(STR) Integer keywordId, @Query(STR) AppendToResponse appendToResponse ); | /**
* Get keyword by id.
*
* @param keywordId A BaseKeyword TMDb id.
* @param appendToResponse <em>Optional.</em> extra requests to append to the result. <b>Accepted Value(s):</b> movies
*/ | Get keyword by id | summary | {
"repo_name": "UweTrottmann/tmdb-java",
"path": "src/main/java/com/uwetrottmann/tmdb2/services/KeywordsService.java",
"license": "unlicense",
"size": 2002
} | [
"com.uwetrottmann.tmdb2.entities.AppendToResponse",
"com.uwetrottmann.tmdb2.entities.Keyword"
] | import com.uwetrottmann.tmdb2.entities.AppendToResponse; import com.uwetrottmann.tmdb2.entities.Keyword; | import com.uwetrottmann.tmdb2.entities.*; | [
"com.uwetrottmann.tmdb2"
] | com.uwetrottmann.tmdb2; | 414,280 |
public static QDataSet eventsList( ) {
try {
QDataSet xx= Ops.timegen( "2015-01-01", "60s", 1440 );
QDataSet dxx= Ops.putProperty( Ops.replicate( 45, 1440 ), QDataSet.UNITS, Units.seconds );
QDataSet color= Ops.replicate( 0xFFAAAA, 1440 );
for ( int i=100; i<200; i++ ) ((WritableDataSet)color).putValue( i, 0xFFAAFF );
EnumerationUnits eu= EnumerationUnits.create("default");
QDataSet msgs= Ops.putProperty( Ops.replicate( eu.createDatum("on1").doubleValue(eu), 1440 ), QDataSet.UNITS, eu );
QDataSet result= Ops.bundle( xx, Ops.add(xx,dxx), color, msgs );
return result;
} catch (ParseException ex) {
throw new IllegalArgumentException(ex);
}
} | static QDataSet function( ) { try { QDataSet xx= Ops.timegen( STR, "60s", 1440 ); QDataSet dxx= Ops.putProperty( Ops.replicate( 45, 1440 ), QDataSet.UNITS, Units.seconds ); QDataSet color= Ops.replicate( 0xFFAAAA, 1440 ); for ( int i=100; i<200; i++ ) ((WritableDataSet)color).putValue( i, 0xFFAAFF ); EnumerationUnits eu= EnumerationUnits.create(STR); QDataSet msgs= Ops.putProperty( Ops.replicate( eu.createDatum("on1").doubleValue(eu), 1440 ), QDataSet.UNITS, eu ); QDataSet result= Ops.bundle( xx, Ops.add(xx,dxx), color, msgs ); return result; } catch (ParseException ex) { throw new IllegalArgumentException(ex); } } | /**
* return example events list. This is a four-column rank 2 dataset with
* start time, end time, RGB color, and ordinal data for the message.
* @return example events list.
*/ | return example events list. This is a four-column rank 2 dataset with start time, end time, RGB color, and ordinal data for the message | eventsList | {
"repo_name": "autoplot/app",
"path": "QDataSet/src/org/das2/qds/examples/Schemes.java",
"license": "gpl-2.0",
"size": 33083
} | [
"java.text.ParseException",
"org.das2.datum.EnumerationUnits",
"org.das2.datum.Units",
"org.das2.qds.QDataSet",
"org.das2.qds.WritableDataSet",
"org.das2.qds.ops.Ops"
] | import java.text.ParseException; import org.das2.datum.EnumerationUnits; import org.das2.datum.Units; import org.das2.qds.QDataSet; import org.das2.qds.WritableDataSet; import org.das2.qds.ops.Ops; | import java.text.*; import org.das2.datum.*; import org.das2.qds.*; import org.das2.qds.ops.*; | [
"java.text",
"org.das2.datum",
"org.das2.qds"
] | java.text; org.das2.datum; org.das2.qds; | 1,256,813 |
public void redrawMatrixes() {
for (MatrixVisualizerPane mvp : matrixList) {
mvp.drawMap();
}
} | void function() { for (MatrixVisualizerPane mvp : matrixList) { mvp.drawMap(); } } | /**
* Redraw all matrix.
*/ | Redraw all matrix | redrawMatrixes | {
"repo_name": "vsegouin/mow-it-now",
"path": "src/main/java/com/vsegouin/mowitnow/ui/gui/controllers/infos/TabMapController.java",
"license": "gpl-3.0",
"size": 4456
} | [
"com.vsegouin.mowitnow.ui.gui.components.visualization.MatrixVisualizerPane"
] | import com.vsegouin.mowitnow.ui.gui.components.visualization.MatrixVisualizerPane; | import com.vsegouin.mowitnow.ui.gui.components.visualization.*; | [
"com.vsegouin.mowitnow"
] | com.vsegouin.mowitnow; | 1,792,052 |
public void testToStringWithoutText() {
ClockLine line = new ClockLine();
Date d = Calendar.getInstance().getTime();
ClockInOutEnum clockStatus = ClockInOutEnum.IN;
line.setClockStatus(clockStatus);
line.setClockDate(d);
assertEquals("i " + ClockManager.getInstance().formatDate(d),
line.toString());
} | void function() { ClockLine line = new ClockLine(); Date d = Calendar.getInstance().getTime(); ClockInOutEnum clockStatus = ClockInOutEnum.IN; line.setClockStatus(clockStatus); line.setClockDate(d); assertEquals(STR + ClockManager.getInstance().formatDate(d), line.toString()); } | /**
* Test of toString method, of class ClockLine.
*/ | Test of toString method, of class ClockLine | testToStringWithoutText | {
"repo_name": "zendawg/timeclock4j",
"path": "libtimeclockj/src/test/java/org/statefive/timeclockj/ClockLineTest.java",
"license": "gpl-3.0",
"size": 2725
} | [
"java.util.Calendar",
"java.util.Date"
] | import java.util.Calendar; import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 241,033 |
private void setup(Collection<Comparable> values)
{
//clear the container.
cs.setColorCount(values.size());
colors = new HashMap<>();
//We have to determine the maximal size of a value.
Vector<Comparable> valuecopy = new Vector<Comparable>();
valuecopy.addAll(values);
Collections.sort(valuecopy);
//generate one Double value per value in the provided collection
double maxval = valuecopy.size()-1;
for(int i = 0; i < valuecopy.size(); i++)
{
Comparable val = valuecopy.get(i);
colors.put(val,cs.getColor(i/maxval));
}
}
| void function(Collection<Comparable> values) { cs.setColorCount(values.size()); colors = new HashMap<>(); Vector<Comparable> valuecopy = new Vector<Comparable>(); valuecopy.addAll(values); Collections.sort(valuecopy); double maxval = valuecopy.size()-1; for(int i = 0; i < valuecopy.size(); i++) { Comparable val = valuecopy.get(i); colors.put(val,cs.getColor(i/maxval)); } } | /**
* setup using a Collection of discrete values.
* @param values The Values to use
*/ | setup using a Collection of discrete values | setup | {
"repo_name": "sysbiolux/IDARE",
"path": "METANODE-CREATOR/src/main/java/idare/imagenode/ColorManagement/ColorMapTypes/DiscreteColorMap.java",
"license": "lgpl-3.0",
"size": 8362
} | [
"java.util.Collection",
"java.util.Collections",
"java.util.HashMap",
"java.util.Vector"
] | import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,427,699 |
@Override public T visitFieldDeclaration(@NotNull Java8Parser.FieldDeclarationContext ctx) { return visitChildren(ctx); } | @Override public T visitFieldDeclaration(@NotNull Java8Parser.FieldDeclarationContext ctx) { return visitChildren(ctx); } | /**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/ | The default implementation returns the result of calling <code>#visitChildren</code> on ctx | visitSuperSuffix | {
"repo_name": "lyncode/pal",
"path": "pal-core/src/main/java/org/paltest/pal/parser/impl/java8/Java8BaseVisitor.java",
"license": "apache-2.0",
"size": 27676
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,041,239 |
public Podcast getPodcastAndEpisodesById(int podcastId); | Podcast function(int podcastId); | /**
* Retrieve a podcast by its id.
*
* @param podcastId
* @return a podcast.
*/ | Retrieve a podcast by its id | getPodcastAndEpisodesById | {
"repo_name": "sslavescu/podcastpedia",
"path": "admin/src/main/java/org/podcastpedia/admin/dao/ReadDao.java",
"license": "mit",
"size": 3382
} | [
"org.podcastpedia.common.domain.Podcast"
] | import org.podcastpedia.common.domain.Podcast; | import org.podcastpedia.common.domain.*; | [
"org.podcastpedia.common"
] | org.podcastpedia.common; | 1,918,765 |
if (ourInstance == null) {
try {
ourInstance = new MonoAminoAcidMasses("MonoAAMasses.properties");
} catch (ConfigurationException e) {
logger.error(e);
}
}
return ourInstance;
}
private MonoAminoAcidMasses(String propertiesFile) throws ConfigurationException {
super(propertiesFile);
}
| if (ourInstance == null) { try { ourInstance = new MonoAminoAcidMasses(STR); } catch (ConfigurationException e) { logger.error(e); } } return ourInstance; } private MonoAminoAcidMasses(String propertiesFile) throws ConfigurationException { super(propertiesFile); } | /**
* Returns a singleton instance to access mono-isotopic amino acid masses.
*
* @return the singleton
*/ | Returns a singleton instance to access mono-isotopic amino acid masses | getInstance | {
"repo_name": "compomics/compomics-sigpep",
"path": "sigpep-model/src/main/java/com/compomics/sigpep/model/constants/MonoAminoAcidMasses.java",
"license": "apache-2.0",
"size": 1562
} | [
"org.apache.commons.configuration.ConfigurationException"
] | import org.apache.commons.configuration.ConfigurationException; | import org.apache.commons.configuration.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,184,703 |
public static LayersBuilder from(Collection<Layer> layers) {
return new LayersBuilder(layers);
} | static LayersBuilder function(Collection<Layer> layers) { return new LayersBuilder(layers); } | /**
* Returns a new LayersBuilder with all the provided layers included.
*/ | Returns a new LayersBuilder with all the provided layers included | from | {
"repo_name": "lstNull/Dividers",
"path": "dividers/src/main/java/com/karumi/dividers/LayersBuilder.java",
"license": "apache-2.0",
"size": 1504
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 775,599 |
protected static boolean queryCache(final Pair<CConnection, String> cacheKey,
final ImmutableSet<String> rawTableNames) {
return PostgreSQLDatabaseFunctions.m_cache.get(cacheKey).containsAll(rawTableNames);
} | static boolean function(final Pair<CConnection, String> cacheKey, final ImmutableSet<String> rawTableNames) { return PostgreSQLDatabaseFunctions.m_cache.get(cacheKey).containsAll(rawTableNames); } | /**
* Queries the local cache of table names.
*
* @param cacheKey the local cache of table names.
* @param rawTableNames the hash set of tables names for a given raw module.
* @return true if the cache contains all of the elements in the table names hash set.
*/ | Queries the local cache of table names | queryCache | {
"repo_name": "hoangcuongflp/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Database/PostgreSQL/Functions/PostgreSQLDatabaseFunctions.java",
"license": "apache-2.0",
"size": 23446
} | [
"com.google.common.collect.ImmutableSet",
"com.google.security.zynamics.binnavi.Database",
"com.google.security.zynamics.zylib.general.Pair"
] | import com.google.common.collect.ImmutableSet; import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.zylib.general.Pair; | import com.google.common.collect.*; import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.zylib.general.*; | [
"com.google.common",
"com.google.security"
] | com.google.common; com.google.security; | 2,581,594 |
public void setBlockBag(@Nullable BlockBag blockBag) {
this.blockBag = blockBag;
} | void function(@Nullable BlockBag blockBag) { this.blockBag = blockBag; } | /**
* Set the block bag.
*
* @param blockBag a block bag, which may be null if none is used
*/ | Set the block bag | setBlockBag | {
"repo_name": "HolodeckOne-Minecraft/WorldEdit",
"path": "worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java",
"license": "gpl-3.0",
"size": 3890
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 1,342,672 |
default <S> NonaFunction<A, B, C, D, E, F, G, H, I, S> andThen(final Function<? super R, ? extends S> after) {
Objects.requireNonNull(after, "after");
return (A a, B b, C c, D d, E e, F f, G g, H h, I i) -> after.apply(apply(a, b, c, d, e, f, g, h, i));
}
| default <S> NonaFunction<A, B, C, D, E, F, G, H, I, S> andThen(final Function<? super R, ? extends S> after) { Objects.requireNonNull(after, "after"); return (A a, B b, C c, D d, E e, F f, G g, H h, I i) -> after.apply(apply(a, b, c, d, e, f, g, h, i)); } | /**
* Returns a composed function that first applies this function to its
* input, and then applies the {@code after} function to the result. If
* evaluation of either function throws an exception, it is relayed to the
* caller of the composed function.
*
* @param <S>
* the type of output of the {@code after} function, and of the
* composed function
* @param after
* the function to apply after this function is applied
* @return a composed function that first applies this function and then
* applies the {@code after} function
* @throws NullPointerException
* if after is null
*/ | Returns a composed function that first applies this function to its input, and then applies the after function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function | andThen | {
"repo_name": "Gilandel/utils-commons",
"path": "src/main/java/fr/landel/utils/commons/function/NonaFunction.java",
"license": "apache-2.0",
"size": 3592
} | [
"java.util.Objects",
"java.util.function.Function"
] | import java.util.Objects; import java.util.function.Function; | import java.util.*; import java.util.function.*; | [
"java.util"
] | java.util; | 295,362 |
boolean plane_element_type(DiagnosticChain diagnostics, Map<Object, Object> context); | boolean plane_element_type(DiagnosticChain diagnostics, Map<Object, Object> context); | /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* planeElement->forAll(oclIsKindOf(Shape) or oclIsKindOf(Edge))
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @model
* @generated
*/ | planeElement->forAll(oclIsKindOf(Shape) or oclIsKindOf(Edge)) | plane_element_type | {
"repo_name": "lqjack/fixflow",
"path": "modules/fixflow-core/src/main/java/org/eclipse/dd/di/Plane.java",
"license": "apache-2.0",
"size": 2391
} | [
"java.util.Map",
"org.eclipse.emf.common.util.DiagnosticChain"
] | import java.util.Map; import org.eclipse.emf.common.util.DiagnosticChain; | import java.util.*; import org.eclipse.emf.common.util.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 1,003,814 |
public static ArrayList getAgents() {
return allAgents;
}
// constructors
public RemoteGfManagerAgent(GfManagerAgentConfig cfg) {
if (!(cfg.getTransport() instanceof RemoteTransportConfig)) {
throw new IllegalArgumentException(
String.format("Expected %s to be a RemoteTransportConfig",
cfg.getTransport()));
}
this.transport = (RemoteTransportConfig) cfg.getTransport();
this.displayName = cfg.getDisplayName();
this.alertListener = cfg.getAlertListener();
if (this.alertListener != null) {
if (this.alertListener instanceof JoinLeaveListener) {
addJoinLeaveListener((JoinLeaveListener) this.alertListener);
}
}
int tmp = cfg.getAlertLevel();
if (this.alertListener == null) {
tmp = Alert.OFF;
}
alertLevel = tmp;
// LOG: get LogWriter from the AdminDistributedSystemImpl -- used for
// AuthenticationFailedException
InternalLogWriter logWriter = cfg.getLogWriter();
if (logWriter == null) {
throw new NullPointerException("LogWriter must not be null");
}
if (logWriter.isSecure()) {
this.securityLogWriter = logWriter;
} else {
this.securityLogWriter = LogWriterFactory.toSecurityLogWriter(logWriter);
}
this.disconnectListener = cfg.getDisconnectListener();
this.joinProcessor = new JoinProcessor();
this.joinProcessor.start();
join();
snapshotDispatcher = new SnapshotResultDispatcher();
snapshotDispatcher.start();
// Note that this makes this instance externally visible.
// This is why this class is final.
addAgent(this);
} | static ArrayList function() { return allAgents; } public RemoteGfManagerAgent(GfManagerAgentConfig cfg) { if (!(cfg.getTransport() instanceof RemoteTransportConfig)) { throw new IllegalArgumentException( String.format(STR, cfg.getTransport())); } this.transport = (RemoteTransportConfig) cfg.getTransport(); this.displayName = cfg.getDisplayName(); this.alertListener = cfg.getAlertListener(); if (this.alertListener != null) { if (this.alertListener instanceof JoinLeaveListener) { addJoinLeaveListener((JoinLeaveListener) this.alertListener); } } int tmp = cfg.getAlertLevel(); if (this.alertListener == null) { tmp = Alert.OFF; } alertLevel = tmp; InternalLogWriter logWriter = cfg.getLogWriter(); if (logWriter == null) { throw new NullPointerException(STR); } if (logWriter.isSecure()) { this.securityLogWriter = logWriter; } else { this.securityLogWriter = LogWriterFactory.toSecurityLogWriter(logWriter); } this.disconnectListener = cfg.getDisconnectListener(); this.joinProcessor = new JoinProcessor(); this.joinProcessor.start(); join(); snapshotDispatcher = new SnapshotResultDispatcher(); snapshotDispatcher.start(); addAgent(this); } | /**
* Return a recent (though possibly incomplete) list of all existing agents
*
* @return list of agents
*/ | Return a recent (though possibly incomplete) list of all existing agents | getAgents | {
"repo_name": "pdxrunner/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java",
"license": "apache-2.0",
"size": 47337
} | [
"java.util.ArrayList",
"org.apache.geode.internal.admin.Alert",
"org.apache.geode.internal.admin.GfManagerAgentConfig",
"org.apache.geode.internal.admin.JoinLeaveListener",
"org.apache.geode.internal.logging.InternalLogWriter",
"org.apache.geode.internal.logging.LogWriterFactory"
] | import java.util.ArrayList; import org.apache.geode.internal.admin.Alert; import org.apache.geode.internal.admin.GfManagerAgentConfig; import org.apache.geode.internal.admin.JoinLeaveListener; import org.apache.geode.internal.logging.InternalLogWriter; import org.apache.geode.internal.logging.LogWriterFactory; | import java.util.*; import org.apache.geode.internal.admin.*; import org.apache.geode.internal.logging.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 215,662 |
public JsStatement widget()
{
return new JsQuery(getComponent()).$().chain("sortable", "'widget'");
} | JsStatement function() { return new JsQuery(getComponent()).$().chain(STR, STR); } | /**
* Method to returns the .ui-sortable element
*
* @return the associated JsStatement
*/ | Method to returns the .ui-sortable element | widget | {
"repo_name": "WiQuery/wiquery",
"path": "wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/sortable/SortableBehavior.java",
"license": "mit",
"size": 31703
} | [
"org.odlabs.wiquery.core.javascript.JsQuery",
"org.odlabs.wiquery.core.javascript.JsStatement"
] | import org.odlabs.wiquery.core.javascript.JsQuery; import org.odlabs.wiquery.core.javascript.JsStatement; | import org.odlabs.wiquery.core.javascript.*; | [
"org.odlabs.wiquery"
] | org.odlabs.wiquery; | 2,452,612 |
EReference getBroadcastEventAction_Event();
| EReference getBroadcastEventAction_Event(); | /**
* Returns the meta object for the reference list '{@link com.thalesgroup.trt.mde.vp.al.al.BroadcastEventAction#getEvent <em>Event</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Event</em>'.
* @see com.thalesgroup.trt.mde.vp.al.al.BroadcastEventAction#getEvent()
* @see #getBroadcastEventAction()
* @generated
*/ | Returns the meta object for the reference list '<code>com.thalesgroup.trt.mde.vp.al.al.BroadcastEventAction#getEvent Event</code>'. | getBroadcastEventAction_Event | {
"repo_name": "smadelenat/CapellaModeAutomata",
"path": "Language/ActionLanguage/com.thalesgroup.trt.mde.vp.al.model/src/com/thalesgroup/trt/mde/vp/al/al/AlPackage.java",
"license": "epl-1.0",
"size": 119399
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,554,195 |
public Subscription endTrialAt( String subscription, Date date ) {
return this.endTrialAt( new Subscription( subscription ), date );
} | Subscription function( String subscription, Date date ) { return this.endTrialAt( new Subscription( subscription ), date ); } | /**
* Stop the trial period of a subscription on a specific date.
* @param subscription
* the subscription.
* @param date
* the date, on which the subscription should end.
* @return the updated subscription.
*/ | Stop the trial period of a subscription on a specific date | endTrialAt | {
"repo_name": "vladaspasic/paymill-java",
"path": "src/main/java/com/paymill/services/SubscriptionService.java",
"license": "mit",
"size": 30755
} | [
"com.paymill.models.Subscription",
"java.util.Date"
] | import com.paymill.models.Subscription; import java.util.Date; | import com.paymill.models.*; import java.util.*; | [
"com.paymill.models",
"java.util"
] | com.paymill.models; java.util; | 470,649 |
public boolean onTriggered(World world, BlockPos pos, double posX, double posY, double posZ, EnumFacing side, @Nonnull EntityArmRidable ent, MechanicalArmTileEntity te); | boolean function(World world, BlockPos pos, double posX, double posY, double posZ, EnumFacing side, @Nonnull EntityArmRidable ent, MechanicalArmTileEntity te); | /**
* Call on the SERVER SIDE ONLY.
* @param world The World of the end.
* @param pos The BlockPos of the end.
* @param posX The exact X coordinate of the end.
* @param posY The exact Y coordinate of the end.
* @param posZ The exact Z coordinate of the end.
* @param side The signal specified EnumFacing to effect.
* @param ent The EntityArmRidable that the final entity would ride.
* @param te The TileEntity calling this method.
* @return Whether this did anything.
*/ | Call on the SERVER SIDE ONLY | onTriggered | {
"repo_name": "Da-Technomancer/Crossroads",
"path": "src/main/java/com/Da_Technomancer/crossroads/API/effects/mechArm/IMechArmEffect.java",
"license": "mit",
"size": 1065
} | [
"javax.annotation.Nonnull",
"net.minecraft.util.EnumFacing",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World"
] | import javax.annotation.Nonnull; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; | import javax.annotation.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"javax.annotation",
"net.minecraft.util",
"net.minecraft.world"
] | javax.annotation; net.minecraft.util; net.minecraft.world; | 1,457,867 |
public static void generateProxyCA(File keystore, String password, int validity) throws IOException {
File caCertCrt = new File(ROOT_CACERT_CRT);
File caCertUsr = new File(ROOT_CACERT_USR);
boolean fileExists = false;
if (!keystore.delete() && keystore.exists()) {
log.warn("Problem deleting the keystore '" + keystore + "'");
fileExists = true;
}
if (!caCertCrt.delete() && caCertCrt.exists()) {
log.warn("Problem deleting the certificate file '" + caCertCrt + "'");
fileExists = true;
}
if (!caCertUsr.delete() && caCertUsr.exists()) {
log.warn("Problem deleting the certificate file '" + caCertUsr + "'");
fileExists = true;
}
if (fileExists) {
log.warn("If problems occur when recording SSL, delete the files manually and retry.");
}
// Create the self-signed keypairs
KeyToolUtils.genkeypair(keystore, ROOTCA_ALIAS, password, validity, DNAME_ROOT_CA_KEY, "bc:c");
KeyToolUtils.genkeypair(keystore, INTERMEDIATE_CA_ALIAS, password, validity, DNAME_INTERMEDIATE_CA_KEY, "bc:c");
// Create cert for CA using root
ByteArrayOutputStream certReqOut = new ByteArrayOutputStream();
// generate the request
KeyToolUtils.keytool("-certreq", keystore, password, INTERMEDIATE_CA_ALIAS, null, certReqOut);
// generate the certificate and store in output file
InputStream certReqIn = new ByteArrayInputStream(certReqOut.toByteArray());
ByteArrayOutputStream genCertOut = new ByteArrayOutputStream();
KeyToolUtils.keytool("-gencert", keystore, password, ROOTCA_ALIAS, certReqIn, genCertOut, "-ext", "BC:0");
// import the signed CA cert into the store (root already there) - both are needed to sign the domain certificates
InputStream genCertIn = new ByteArrayInputStream(genCertOut.toByteArray());
KeyToolUtils.keytool("-importcert", keystore, password, INTERMEDIATE_CA_ALIAS, genCertIn, null);
// Export the Root CA for Firefox/Chrome/IE
KeyToolUtils.keytool("-exportcert", keystore, password, ROOTCA_ALIAS, null, null, "-rfc", "-file", ROOT_CACERT_CRT);
// Copy for Opera
if(caCertCrt.exists() && caCertCrt.canRead()) {
FileUtils.copyFile(caCertCrt, caCertUsr);
} else {
log.warn("Failed creating "+caCertCrt.getAbsolutePath()+", check 'keytool' utility in path is available and points to a JDK >= 7");
}
} | static void function(File keystore, String password, int validity) throws IOException { File caCertCrt = new File(ROOT_CACERT_CRT); File caCertUsr = new File(ROOT_CACERT_USR); boolean fileExists = false; if (!keystore.delete() && keystore.exists()) { log.warn(STR + keystore + "'"); fileExists = true; } if (!caCertCrt.delete() && caCertCrt.exists()) { log.warn(STR + caCertCrt + "'"); fileExists = true; } if (!caCertUsr.delete() && caCertUsr.exists()) { log.warn(STR + caCertUsr + "'"); fileExists = true; } if (fileExists) { log.warn(STR); } KeyToolUtils.genkeypair(keystore, ROOTCA_ALIAS, password, validity, DNAME_ROOT_CA_KEY, "bc:c"); KeyToolUtils.genkeypair(keystore, INTERMEDIATE_CA_ALIAS, password, validity, DNAME_INTERMEDIATE_CA_KEY, "bc:c"); ByteArrayOutputStream certReqOut = new ByteArrayOutputStream(); KeyToolUtils.keytool(STR, keystore, password, INTERMEDIATE_CA_ALIAS, null, certReqOut); InputStream certReqIn = new ByteArrayInputStream(certReqOut.toByteArray()); ByteArrayOutputStream genCertOut = new ByteArrayOutputStream(); KeyToolUtils.keytool(STR, keystore, password, ROOTCA_ALIAS, certReqIn, genCertOut, "-ext", "BC:0"); InputStream genCertIn = new ByteArrayInputStream(genCertOut.toByteArray()); KeyToolUtils.keytool(STR, keystore, password, INTERMEDIATE_CA_ALIAS, genCertIn, null); KeyToolUtils.keytool(STR, keystore, password, ROOTCA_ALIAS, null, null, "-rfc", "-file", ROOT_CACERT_CRT); if(caCertCrt.exists() && caCertCrt.canRead()) { FileUtils.copyFile(caCertCrt, caCertUsr); } else { log.warn(STR+caCertCrt.getAbsolutePath()+STR); } } | /**
* Creates a self-signed Root CA certificate and an intermediate CA certificate
* (signed by the Root CA certificate) that can be used to sign server certificates.
* The Root CA certificate file is exported to the same directory as the keystore
* in formats suitable for Firefox/Chrome/IE (.crt) and Opera (.usr).
*
* @param keystore the keystore in which to store everything
* @param password the password for keystore and keys
* @param validity the validity period in days, must be greater than 0
*
* @throws IOException if keytool was not configured, running keytool application failed or copying the keys failed
*/ | Creates a self-signed Root CA certificate and an intermediate CA certificate (signed by the Root CA certificate) that can be used to sign server certificates. The Root CA certificate file is exported to the same directory as the keystore in formats suitable for Firefox/Chrome/IE (.crt) and Opera (.usr) | generateProxyCA | {
"repo_name": "vherilier/jmeter",
"path": "src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java",
"license": "apache-2.0",
"size": 19394
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"org.apache.commons.io.FileUtils"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.FileUtils; | import java.io.*; import org.apache.commons.io.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 2,534,486 |
private Notification buildNotification() {
Notification.Builder builder = new Notification.Builder(getApplicationContext())
.setContentTitle(getString(R.string.timer_finished))
.setSmallIcon(R.drawable.sandclock_gray)
.setVibrate(new long[]{0, 500, 500, 500})
.extend(new Notification.WearableExtender()
.setHintHideIcon(true)
.setContentIcon(R.drawable.sandclock_gray));
return builder.build();
} | Notification function() { Notification.Builder builder = new Notification.Builder(getApplicationContext()) .setContentTitle(getString(R.string.timer_finished)) .setSmallIcon(R.drawable.sandclock_gray) .setVibrate(new long[]{0, 500, 500, 500}) .extend(new Notification.WearableExtender() .setHintHideIcon(true) .setContentIcon(R.drawable.sandclock_gray)); return builder.build(); } | /**
* Builds notification object
*
* @return Notification
*/ | Builds notification object | buildNotification | {
"repo_name": "brave-warrior/WearTimer",
"path": "wear/src/main/java/com/cologne/hackaton/wearstopwatch/service/TimerService.java",
"license": "apache-2.0",
"size": 4322
} | [
"android.app.Notification"
] | import android.app.Notification; | import android.app.*; | [
"android.app"
] | android.app; | 417,389 |
@Nullable
public static Scheme fromString(String scheme) {
return Arrays.stream(values()).filter(p -> p.name().equalsIgnoreCase(scheme)).findFirst().orElse(null);
}
}
public enum Protocol {
HTTP_1_0("http/1.0"),
HTTP_1_1("http/1.1"),
HTTP_2("h2"),
H2_PRIOR_KNOWLEDGE("h2_prior_knowledge"),
QUIC("quic");
private final String protocol;
Protocol(String protocol) {
this.protocol = protocol;
} | static Scheme function(String scheme) { return Arrays.stream(values()).filter(p -> p.name().equalsIgnoreCase(scheme)).findFirst().orElse(null); } } public enum Protocol { HTTP_1_0(STR), HTTP_1_1(STR), HTTP_2("h2"), H2_PRIOR_KNOWLEDGE(STR), QUIC("quic"); private final String protocol; Protocol(String protocol) { this.protocol = protocol; } | /**
* Builds an enum from string.
*/ | Builds an enum from string | fromString | {
"repo_name": "spring-cloud/spring-cloud-contract",
"path": "spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/http/ContractVerifierHttpMetaData.java",
"license": "apache-2.0",
"size": 4815
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 2,711,162 |
private void checkPageVersionsAreStored(Page versioningPage)
{
IPageManager pageManager = wicketTester.getSession().getPageManager();
int lastPageId = versioningPage.getPageId();
while (lastPageId >= 0)
{
assertNotNull(pageManager.getPage(lastPageId));
lastPageId--;
}
}
private static final class PageVersioningApplication extends WebApplication
{ | void function(Page versioningPage) { IPageManager pageManager = wicketTester.getSession().getPageManager(); int lastPageId = versioningPage.getPageId(); while (lastPageId >= 0) { assertNotNull(pageManager.getPage(lastPageId)); lastPageId--; } } private static final class PageVersioningApplication extends WebApplication { | /**
* Asserts that there is a version of the page for each operation that modified the page
*
* @param versioningPage
*/ | Asserts that there is a version of the page for each operation that modified the page | checkPageVersionsAreStored | {
"repo_name": "klopfdreh/wicket",
"path": "wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java",
"license": "apache-2.0",
"size": 4505
} | [
"org.apache.wicket.Page",
"org.apache.wicket.page.IPageManager",
"org.apache.wicket.protocol.http.WebApplication",
"org.junit.Assert"
] | import org.apache.wicket.Page; import org.apache.wicket.page.IPageManager; import org.apache.wicket.protocol.http.WebApplication; import org.junit.Assert; | import org.apache.wicket.*; import org.apache.wicket.page.*; import org.apache.wicket.protocol.http.*; import org.junit.*; | [
"org.apache.wicket",
"org.junit"
] | org.apache.wicket; org.junit; | 1,951,392 |
private void processS09Gravity(PacketBuffer payload) {
float gravity = payload.readFloat();
this.packetHandlerClient.setGravity(gravity);
}
| void function(PacketBuffer payload) { float gravity = payload.readFloat(); this.packetHandlerClient.setGravity(gravity); } | /**
* Processes a S09Gravity packet.
* @see PacketHandlerClient#setGravity(double)
*/ | Processes a S09Gravity packet | processS09Gravity | {
"repo_name": "MrNobody98/morecommands",
"path": "src/main/java/com/mrnobody/morecommands/network/PacketDispatcher.java",
"license": "lgpl-3.0",
"size": 27915
} | [
"net.minecraft.network.PacketBuffer"
] | import net.minecraft.network.PacketBuffer; | import net.minecraft.network.*; | [
"net.minecraft.network"
] | net.minecraft.network; | 1,649,928 |
@Test
public void testStatementArgs()
{
// Test with no parameters
assertEquals(new JsStatement().$(null, "#aComponent").chain(new EffectTest()).render()
.toString(), "$('#aComponent').anEffect();");
// Test with a parameter
assertEquals(new JsStatement().$(null, "#aComponent").chain(new EffectTest("'aaa'"))
.render().toString(), "$('#aComponent').anEffect('aaa');");
// Test with a speed and a parameter
assertEquals(
new JsStatement().$(null, "#aComponent")
.chain(new EffectTest(EffectSpeed.SLOW, "'aaa'")).render().toString(),
"$('#aComponent').anEffect('slow', 'aaa');");
// Test with a speed, a parameter and a callback
assertEquals(
new JsStatement()
.$(null, "#aComponent")
.chain(
new EffectTest(EffectSpeed.SLOW, JsScope.quickScope("alert('test');"), "'aaa'"))
.render().toString(),
"$('#aComponent').anEffect('slow', 'aaa', function() {\n\talert('test');\n});");
}
private class EffectTest extends Effect
{
private static final long serialVersionUID = 1L;
public EffectTest(CharSequence... parameters)
{
super(parameters);
}
public EffectTest(EffectSpeed effectSpeed, CharSequence... parameters)
{
super(effectSpeed, parameters);
}
public EffectTest(EffectSpeed effectSpeed, JsScope callback, CharSequence... parameters)
{
super(effectSpeed, callback, parameters);
// TODO Auto-generated constructor stub
} | void function() { assertEquals(new JsStatement().$(null, STR).chain(new EffectTest()).render() .toString(), STR); assertEquals(new JsStatement().$(null, STR).chain(new EffectTest("'aaa'")) .render().toString(), STR); assertEquals( new JsStatement().$(null, STR) .chain(new EffectTest(EffectSpeed.SLOW, "'aaa'")).render().toString(), STR); assertEquals( new JsStatement() .$(null, STR) .chain( new EffectTest(EffectSpeed.SLOW, JsScope.quickScope(STR), "'aaa'")) .render().toString(), STR); } private class EffectTest extends Effect { private static final long serialVersionUID = 1L; public EffectTest(CharSequence... parameters) { super(parameters); } public EffectTest(EffectSpeed effectSpeed, CharSequence... parameters) { super(effectSpeed, parameters); } public EffectTest(EffectSpeed effectSpeed, JsScope callback, CharSequence... parameters) { super(effectSpeed, callback, parameters); } | /**
* Test method for {@link org.odlabs.wiquery.core.effects.Effect#statementArgs()}.
*/ | Test method for <code>org.odlabs.wiquery.core.effects.Effect#statementArgs()</code> | testStatementArgs | {
"repo_name": "WiQuery/wiquery",
"path": "wiquery-core/src/test/java/org/odlabs/wiquery/core/effects/EffectTestCase.java",
"license": "mit",
"size": 3134
} | [
"org.junit.Assert",
"org.odlabs.wiquery.core.javascript.JsScope",
"org.odlabs.wiquery.core.javascript.JsStatement"
] | import org.junit.Assert; import org.odlabs.wiquery.core.javascript.JsScope; import org.odlabs.wiquery.core.javascript.JsStatement; | import org.junit.*; import org.odlabs.wiquery.core.javascript.*; | [
"org.junit",
"org.odlabs.wiquery"
] | org.junit; org.odlabs.wiquery; | 340,187 |
public static BufferedImage getImage(final String key, final float scale) {
BufferedImage image = getImageResource(key).getImage(scale);
if(image == null) {
logger.warning("getImage(" + key + ", " + scale + ") failed");
image = getImageResource(REPLACEMENT_IMAGE).getImage(scale);
if(image == null) {
FreeColClient.fatal("Failed getting replacement image.");
}
}
return image;
} | static BufferedImage function(final String key, final float scale) { BufferedImage image = getImageResource(key).getImage(scale); if(image == null) { logger.warning(STR + key + STR + scale + STR); image = getImageResource(REPLACEMENT_IMAGE).getImage(scale); if(image == null) { FreeColClient.fatal(STR); } } return image; } | /**
* Returns the image specified by the given name.
* Please, avoid using too many different scaling factors!
* For each is a scaled image cached here for a long time,
* which wastes memory if you are not careful.
*
* @param key The name of the resource to return.
* @param scale The size of the requested image (with 1 being normal size,
* 2 twice the size, 0.5 half the size etc). Rescaling
* will be performed unless using 1.
* @return The image identified by <code>resource</code>.
*/ | Returns the image specified by the given name. Please, avoid using too many different scaling factors! For each is a scaled image cached here for a long time, which wastes memory if you are not careful | getImage | {
"repo_name": "edijman/SOEN_6431_Colonization_Game",
"path": "src/net/sf/freecol/common/resources/ResourceManager.java",
"license": "gpl-2.0",
"size": 22462
} | [
"java.awt.image.BufferedImage",
"net.sf.freecol.client.FreeColClient"
] | import java.awt.image.BufferedImage; import net.sf.freecol.client.FreeColClient; | import java.awt.image.*; import net.sf.freecol.client.*; | [
"java.awt",
"net.sf.freecol"
] | java.awt; net.sf.freecol; | 731 |
@DELETE
@Path("{subjectClassKey}")
@SuppressWarnings("unchecked")
public void delete(@PathParam("subjectClassKey") String subjectClassKey) {
NetworkConfigService service = get(NetworkConfigService.class);
service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass())
.forEach(subject -> service.getConfigs(subject)
.forEach(config -> service.removeConfig(subject, config.getClass())));
} | @Path(STR) @SuppressWarnings(STR) void function(@PathParam(STR) String subjectClassKey) { NetworkConfigService service = get(NetworkConfigService.class); service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass()) .forEach(subject -> service.getConfigs(subject) .forEach(config -> service.removeConfig(subject, config.getClass()))); } | /**
* Clear all network configurations for a subject class.
*
* @param subjectClassKey subject class key
*/ | Clear all network configurations for a subject class | delete | {
"repo_name": "planoAccess/clonedONOS",
"path": "web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java",
"license": "apache-2.0",
"size": 14651
} | [
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"org.onosproject.net.config.NetworkConfigService"
] | import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.onosproject.net.config.NetworkConfigService; | import javax.ws.rs.*; import org.onosproject.net.config.*; | [
"javax.ws",
"org.onosproject.net"
] | javax.ws; org.onosproject.net; | 1,000,902 |
public synchronized void recordUploadedTarget(String target) {
Preconditions.checkArgument(knownTargets.contains(target));
Preconditions.checkArgument(!uploadedTargets.contains(target));
uploadedTargets.add(target);
uploadedTargetsToSignal.add(target);
} | synchronized void function(String target) { Preconditions.checkArgument(knownTargets.contains(target)); Preconditions.checkArgument(!uploadedTargets.contains(target)); uploadedTargets.add(target); uploadedTargetsToSignal.add(target); } | /**
* Once a target has been built and uploaded to the cache, it is now safe to signal to the
* coordinator that the target is finished.
*
* @param target
*/ | Once a target has been built and uploaded to the cache, it is now safe to signal to the coordinator that the target is finished | recordUploadedTarget | {
"repo_name": "LegNeato/buck",
"path": "src/com/facebook/buck/distributed/build_slave/MinionLocalBuildStateTracker.java",
"license": "apache-2.0",
"size": 8219
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,597,800 |
private void loginToTwitter() {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(CONSUMER_KEY);
builder.setOAuthConsumerSecret(CONSUMER_SECRET);
twitter4j.conf.Configuration configuration = builder.build();
TwitterFactory factory = new TwitterFactory(configuration);
sTwitter = factory.getInstance();
try {
sRequestToken = sTwitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
this.startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse(sRequestToken.getAuthenticationURL())));
} catch (TwitterException e) {
e.printStackTrace();
}
} | void function() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(CONSUMER_KEY); builder.setOAuthConsumerSecret(CONSUMER_SECRET); twitter4j.conf.Configuration configuration = builder.build(); TwitterFactory factory = new TwitterFactory(configuration); sTwitter = factory.getInstance(); try { sRequestToken = sTwitter.getOAuthRequestToken(TWITTER_CALLBACK_URL); this.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse(sRequestToken.getAuthenticationURL()))); } catch (TwitterException e) { e.printStackTrace(); } } | /**
* Opens Login window for user to login into Twitter.
*/ | Opens Login window for user to login into Twitter | loginToTwitter | {
"repo_name": "shrikantballal/twitterIntegration",
"path": "TwitterIntegration/src/com/twitter/integration/TwitterMainActivity.java",
"license": "mit",
"size": 10751
} | [
"android.content.Intent",
"android.net.Uri"
] | import android.content.Intent; import android.net.Uri; | import android.content.*; import android.net.*; | [
"android.content",
"android.net"
] | android.content; android.net; | 458,340 |
public void doGet (HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws IOException, ServletException {
logger.info("doGet");
// Create a GET request
GetMethod getMethodProxyRequest = new GetMethod(this.getProxyURL(httpServletRequest));
// Forward the request headers
setProxyRequestHeaders(httpServletRequest, getMethodProxyRequest);
// Execute the proxy request
this.executeProxyRequest(getMethodProxyRequest, httpServletRequest, httpServletResponse);
}
| void function (HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { logger.info("doGet"); GetMethod getMethodProxyRequest = new GetMethod(this.getProxyURL(httpServletRequest)); setProxyRequestHeaders(httpServletRequest, getMethodProxyRequest); this.executeProxyRequest(getMethodProxyRequest, httpServletRequest, httpServletResponse); } | /**
* Performs an HTTP GET request
* @param httpServletRequest The {@link HttpServletRequest} object passed
* in by the servlet engine representing the
* client request to be proxied
* @param httpServletResponse The {@link HttpServletResponse} object by which
* we can send a proxied response to the client
*/ | Performs an HTTP GET request | doGet | {
"repo_name": "msgilligan/grails-ajax-proxy-plugin",
"path": "src/java/net/edwardstx/ProxyServlet.java",
"license": "apache-2.0",
"size": 19770
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.commons.httpclient.methods.GetMethod"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.httpclient.methods.GetMethod; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.commons.httpclient.methods.*; | [
"java.io",
"javax.servlet",
"org.apache.commons"
] | java.io; javax.servlet; org.apache.commons; | 144,389 |
protected float[] generateTransformedValuesBarChart(ArrayList<? extends Entry> entries,
int dataSet) {
float[] valuePoints = new float[entries.size() * 2];
int setCount = mOriginalData.getDataSetCount();
BarData bd = (BarData) mOriginalData;
float space = bd.getGroupSpace();
for (int j = 0; j < valuePoints.length; j += 2) {
Entry e = entries.get(j / 2);
// calculate the x-position, depending on datasetcount
float x = e.getXIndex() + (j / 2 * (setCount - 1)) + dataSet + 0.5f + space * (j / 2)
+ space / 2f;
float y = e.getVal();
valuePoints[j] = x;
valuePoints[j + 1] = y * mPhaseY;
}
transformPointArray(valuePoints);
return valuePoints;
} | float[] function(ArrayList<? extends Entry> entries, int dataSet) { float[] valuePoints = new float[entries.size() * 2]; int setCount = mOriginalData.getDataSetCount(); BarData bd = (BarData) mOriginalData; float space = bd.getGroupSpace(); for (int j = 0; j < valuePoints.length; j += 2) { Entry e = entries.get(j / 2); float x = e.getXIndex() + (j / 2 * (setCount - 1)) + dataSet + 0.5f + space * (j / 2) + space / 2f; float y = e.getVal(); valuePoints[j] = x; valuePoints[j + 1] = y * mPhaseY; } transformPointArray(valuePoints); return valuePoints; } | /**
* Transforms an arraylist of Entry into a float array containing the x and
* y values transformed with all matrices for the BARCHART.
*
* @param entries
* @param dataSet the dataset index
* @return
*/ | Transforms an arraylist of Entry into a float array containing the x and y values transformed with all matrices for the BARCHART | generateTransformedValuesBarChart | {
"repo_name": "MPieter/Notification-Analyser",
"path": "NotificationAnalyser/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java",
"license": "mit",
"size": 71102
} | [
"com.github.mikephil.charting.data.BarData",
"com.github.mikephil.charting.data.Entry",
"java.util.ArrayList"
] | import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.Entry; import java.util.ArrayList; | import com.github.mikephil.charting.data.*; import java.util.*; | [
"com.github.mikephil",
"java.util"
] | com.github.mikephil; java.util; | 1,274,524 |
@Trivial
public static <U> CompletableFuture<U> failedFuture(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedFuture"));
} | static <U> CompletableFuture<U> function(Throwable x) { throw new UnsupportedOperationException(Tr.formatMessage(tc, STR, STR)); } | /**
* Because CompletableFuture.failedFuture is static, this is not a true override.
* It will be difficult for the user to invoke this method because they would need to get the class
* of the CompletableFuture implementation and locate the static failedFuture method on that.
*
* @throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead.
*/ | Because CompletableFuture.failedFuture is static, this is not a true override. It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static failedFuture method on that | failedFuture | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ManagedCompletableFuture.java",
"license": "epl-1.0",
"size": 82857
} | [
"com.ibm.websphere.ras.Tr",
"java.util.concurrent.CompletableFuture"
] | import com.ibm.websphere.ras.Tr; import java.util.concurrent.CompletableFuture; | import com.ibm.websphere.ras.*; import java.util.concurrent.*; | [
"com.ibm.websphere",
"java.util"
] | com.ibm.websphere; java.util; | 1,171,954 |
public static Object referenceInsert(RuntimeServices rsvc,
InternalContextAdapter context, String reference, Object value)
{
// app level cartridges have already been initialized
EventCartridge ev1 = rsvc.getApplicationEventCartridge();
Iterator applicationEventHandlerIterator =
(ev1 == null) ? null: ev1.getReferenceInsertionEventHandlers();
EventCartridge ev2 = context.getEventCartridge();
initializeEventCartridge(rsvc, ev2);
Iterator contextEventHandlerIterator =
(ev2 == null) ? null: ev2.getReferenceInsertionEventHandlers();
try
{
EventHandlerMethodExecutor methodExecutor = null;
if( applicationEventHandlerIterator != null )
{
methodExecutor =
new ReferenceInsertionEventHandler.referenceInsertExecutor(context, reference, value);
iterateOverEventHandlers(applicationEventHandlerIterator, methodExecutor);
}
if( contextEventHandlerIterator != null )
{
if( methodExecutor == null )
methodExecutor =
new ReferenceInsertionEventHandler.referenceInsertExecutor(context, reference, value);
iterateOverEventHandlers(contextEventHandlerIterator, methodExecutor);
}
return methodExecutor != null ? methodExecutor.getReturnValue() : value;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw ExceptionUtils.createRuntimeException("Exception in event handler.",e);
}
}
| static Object function(RuntimeServices rsvc, InternalContextAdapter context, String reference, Object value) { EventCartridge ev1 = rsvc.getApplicationEventCartridge(); Iterator applicationEventHandlerIterator = (ev1 == null) ? null: ev1.getReferenceInsertionEventHandlers(); EventCartridge ev2 = context.getEventCartridge(); initializeEventCartridge(rsvc, ev2); Iterator contextEventHandlerIterator = (ev2 == null) ? null: ev2.getReferenceInsertionEventHandlers(); try { EventHandlerMethodExecutor methodExecutor = null; if( applicationEventHandlerIterator != null ) { methodExecutor = new ReferenceInsertionEventHandler.referenceInsertExecutor(context, reference, value); iterateOverEventHandlers(applicationEventHandlerIterator, methodExecutor); } if( contextEventHandlerIterator != null ) { if( methodExecutor == null ) methodExecutor = new ReferenceInsertionEventHandler.referenceInsertExecutor(context, reference, value); iterateOverEventHandlers(contextEventHandlerIterator, methodExecutor); } return methodExecutor != null ? methodExecutor.getReturnValue() : value; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw ExceptionUtils.createRuntimeException(STR,e); } } | /**
* Called before a reference is inserted. All event handlers are called in
* sequence. The default implementation inserts the reference as is.
*
* This is a major hotspot method called by ASTReference render.
*
* @param reference reference from template about to be inserted
* @param value value about to be inserted (after toString() )
* @param rsvc current instance of RuntimeServices
* @param context The internal context adapter.
* @return Object on which toString() should be called for output.
*/ | Called before a reference is inserted. All event handlers are called in sequence. The default implementation inserts the reference as is. This is a major hotspot method called by ASTReference render | referenceInsert | {
"repo_name": "besom/bbossgroups-mvn",
"path": "bboss_velocity/src/main/java/bboss/org/apache/velocity/app/event/EventHandlerUtil.java",
"license": "apache-2.0",
"size": 18077
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,222,849 |
public static void lockOrientation(Boolean landscape) {
Platform.getAppContext().lockOrientation(landscape);
}
| static void function(Boolean landscape) { Platform.getAppContext().lockOrientation(landscape); } | /**
* Locks the devices into a specific orientation preventing the user from
* changing the orientation.
*
* @param landscape
* true for landscape; false or portrait and null for the current
* orientation
*/ | Locks the devices into a specific orientation preventing the user from changing the orientation | lockOrientation | {
"repo_name": "appnativa/rare",
"path": "source/rare/core/com/appnativa/rare/ui/UIScreen.java",
"license": "gpl-3.0",
"size": 23506
} | [
"com.appnativa.rare.Platform"
] | import com.appnativa.rare.Platform; | import com.appnativa.rare.*; | [
"com.appnativa.rare"
] | com.appnativa.rare; | 35,186 |
public String getTotalPeople()
{
return Validator.check(totalPeople, "N/A");
} | String function() { return Validator.check(totalPeople, "N/A"); } | /**
* get the total number of students for this assessment
*
* @return the number
*/ | get the total number of students for this assessment | getTotalPeople | {
"repo_name": "rodriguezdevera/sakai",
"path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java",
"license": "apache-2.0",
"size": 33629
} | [
"org.sakaiproject.tool.assessment.ui.bean.util.Validator"
] | import org.sakaiproject.tool.assessment.ui.bean.util.Validator; | import org.sakaiproject.tool.assessment.ui.bean.util.*; | [
"org.sakaiproject.tool"
] | org.sakaiproject.tool; | 1,721,582 |
public void onFetchAccountsClick(View v) throws UnsupportedEncodingException {
sendRequest("SELECT Name FROM Account");
}
| void function(View v) throws UnsupportedEncodingException { sendRequest(STR); } | /**
* Called when "Fetch Accounts" button is clicked
*
* @param v
* @throws UnsupportedEncodingException
*/ | Called when "Fetch Accounts" button is clicked | onFetchAccountsClick | {
"repo_name": "huminzhi/SalesforceMobileSDK-Android",
"path": "native/TemplateApp/src/com/salesforce/samples/templateapp/MainActivity.java",
"license": "apache-2.0",
"size": 5203
} | [
"android.view.View",
"java.io.UnsupportedEncodingException"
] | import android.view.View; import java.io.UnsupportedEncodingException; | import android.view.*; import java.io.*; | [
"android.view",
"java.io"
] | android.view; java.io; | 2,118,605 |
private void dumpNode(StringBuffer result, boolean recursive, int indent, int index)
{
// write indent
for (int i = 0; i < indent; i++)
{
result.append('\t');
}
// render Node
if (parent != null)
{
if (getOptions().isQualifier())
{
result.append('?');
result.append(name);
}
else if (getParent().getOptions().isArray())
{
result.append('[');
result.append(index);
result.append(']');
}
else
{
result.append(name);
}
}
else
{
// applies only to the root node
result.append("ROOT NODE");
if (name != null && name.length() > 0)
{
// the "about" attribute
result.append(" (");
result.append(name);
result.append(')');
}
}
if (value != null && value.length() > 0)
{
result.append(" = \"");
result.append(value);
result.append('"');
}
// render options if at least one is set
if (getOptions().containsOneOf(0xffffffff))
{
result.append("\t(");
result.append(getOptions().toString());
result.append(" : ");
result.append(getOptions().getOptionsString());
result.append(')');
}
result.append('\n');
// render qualifier
if (recursive && hasQualifier())
{
XMPNode[] quals = (XMPNode[]) getQualifier()
.toArray(new XMPNode[getQualifierLength()]);
int i = 0;
while (quals.length > i &&
(XMPConst.XML_LANG.equals(quals[i].getName()) ||
"rdf:type".equals(quals[i].getName()))
)
{
i++;
}
Arrays.sort(quals, i, quals.length);
for (i = 0; i < quals.length; i++)
{
XMPNode qualifier = quals[i];
qualifier.dumpNode(result, recursive, indent + 2, i + 1);
}
}
// render children
if (recursive && hasChildren())
{
XMPNode[] children = (XMPNode[]) getChildren()
.toArray(new XMPNode[getChildrenLength()]);
if (!getOptions().isArray())
{
Arrays.sort(children);
}
for (int i = 0; i < children.length; i++)
{
XMPNode child = children[i];
child.dumpNode(result, recursive, indent + 1, i + 1);
}
}
}
| void function(StringBuffer result, boolean recursive, int indent, int index) { for (int i = 0; i < indent; i++) { result.append('\t'); } if (parent != null) { if (getOptions().isQualifier()) { result.append('?'); result.append(name); } else if (getParent().getOptions().isArray()) { result.append('['); result.append(index); result.append(']'); } else { result.append(name); } } else { result.append(STR); if (name != null && name.length() > 0) { result.append(STR); result.append(name); result.append(')'); } } if (value != null && value.length() > 0) { result.append(STRSTR'); } if (getOptions().containsOneOf(0xffffffff)) { result.append("\t("); result.append(getOptions().toString()); result.append(STR); result.append(getOptions().getOptionsString()); result.append(')'); } result.append('\n'); if (recursive && hasQualifier()) { XMPNode[] quals = (XMPNode[]) getQualifier() .toArray(new XMPNode[getQualifierLength()]); int i = 0; while (quals.length > i && (XMPConst.XML_LANG.equals(quals[i].getName()) STR.equals(quals[i].getName())) ) { i++; } Arrays.sort(quals, i, quals.length); for (i = 0; i < quals.length; i++) { XMPNode qualifier = quals[i]; qualifier.dumpNode(result, recursive, indent + 2, i + 1); } } if (recursive && hasChildren()) { XMPNode[] children = (XMPNode[]) getChildren() .toArray(new XMPNode[getChildrenLength()]); if (!getOptions().isArray()) { Arrays.sort(children); } for (int i = 0; i < children.length; i++) { XMPNode child = children[i]; child.dumpNode(result, recursive, indent + 1, i + 1); } } } | /**
* Dumps this node and its qualifier and children recursively.
* <em>Note:</em> It creats empty options on every node.
*
* @param result the buffer to append the dump.
* @param recursive Flag is qualifier and child nodes shall be rendered too
* @param indent the current indent level.
* @param index the index within the parent node (important for arrays)
*/ | Dumps this node and its qualifier and children recursively. Note: It creats empty options on every node | dumpNode | {
"repo_name": "bdaum/zoraPD",
"path": "xmp/src/com/adobe/xmp/impl/XMPNode.java",
"license": "gpl-2.0",
"size": 19706
} | [
"com.adobe.xmp.XMPConst",
"java.util.Arrays"
] | import com.adobe.xmp.XMPConst; import java.util.Arrays; | import com.adobe.xmp.*; import java.util.*; | [
"com.adobe.xmp",
"java.util"
] | com.adobe.xmp; java.util; | 1,371,302 |
public static ClusteringSettings readClusteringSettings(int flags) {
return new ConfigurationReader<>(GuiProtosHelper.defaultClusteringSettings).read(flags);
} | static ClusteringSettings function(int flags) { return new ConfigurationReader<>(GuiProtosHelper.defaultClusteringSettings).read(flags); } | /**
* Read the ClusteringSettings from the settings file in the settings directory.
*
* @param flags the flags
* @return the ClusteringSettings
*/ | Read the ClusteringSettings from the settings file in the settings directory | readClusteringSettings | {
"repo_name": "aherbert/GDSC-SMLM",
"path": "src/main/java/uk/ac/sussex/gdsc/smlm/ij/settings/SettingsManager.java",
"license": "gpl-3.0",
"size": 46108
} | [
"uk.ac.sussex.gdsc.smlm.data.config.GUIProtos",
"uk.ac.sussex.gdsc.smlm.data.config.GuiProtosHelper"
] | import uk.ac.sussex.gdsc.smlm.data.config.GUIProtos; import uk.ac.sussex.gdsc.smlm.data.config.GuiProtosHelper; | import uk.ac.sussex.gdsc.smlm.data.config.*; | [
"uk.ac.sussex"
] | uk.ac.sussex; | 1,638,272 |
@Test
public void testZeroLenReplicas() throws IOException, InterruptedException {
if(LOG.isDebugEnabled()) {
LOG.debug("Running " + GenericTestUtils.getMethodName());
}
DataNode spyDN = spy(dn);
doReturn(new ReplicaRecoveryInfo(block.getBlockId(), 0,
block.getGenerationStamp(), ReplicaState.FINALIZED)).when(spyDN).
initReplicaRecovery(any(RecoveringBlock.class));
Daemon d = spyDN.recoverBlocks("fake NN", initRecoveringBlocks());
d.join();
DatanodeProtocol dnP = dn.getActiveNamenodeForBP(POOL_ID);
verify(dnP).commitBlockSynchronization(
block, RECOVERY_ID, 0, true, true, DatanodeID.EMPTY_ARRAY, null);
} | void function() throws IOException, InterruptedException { if(LOG.isDebugEnabled()) { LOG.debug(STR + GenericTestUtils.getMethodName()); } DataNode spyDN = spy(dn); doReturn(new ReplicaRecoveryInfo(block.getBlockId(), 0, block.getGenerationStamp(), ReplicaState.FINALIZED)).when(spyDN). initReplicaRecovery(any(RecoveringBlock.class)); Daemon d = spyDN.recoverBlocks(STR, initRecoveringBlocks()); d.join(); DatanodeProtocol dnP = dn.getActiveNamenodeForBP(POOL_ID); verify(dnP).commitBlockSynchronization( block, RECOVERY_ID, 0, true, true, DatanodeID.EMPTY_ARRAY, null); } | /**
* BlockRecoveryFI_07. max replica length from all DNs is zero.
*
* @throws IOException in case of an error
*/ | BlockRecoveryFI_07. max replica length from all DNs is zero | testZeroLenReplicas | {
"repo_name": "tecknowledgeable/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java",
"license": "apache-2.0",
"size": 24850
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.DatanodeID",
"org.apache.hadoop.hdfs.server.common.HdfsServerConstants",
"org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand",
"org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol",
"org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo",
"org.apache.hadoop.test.GenericTestUtils",
"org.apache.hadoop.util.Daemon",
"org.mockito.Mockito"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; import org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand; import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol; import org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.Daemon; import org.mockito.Mockito; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.hdfs.server.protocol.*; import org.apache.hadoop.test.*; import org.apache.hadoop.util.*; import org.mockito.*; | [
"java.io",
"org.apache.hadoop",
"org.mockito"
] | java.io; org.apache.hadoop; org.mockito; | 937,305 |
public void init() throws IOException {
if (usbManager.hasPermission(usbDevice))
setupDevice();
else
throw new IllegalStateException("Missing permission to access usb device: " + usbDevice);
}
/**
* Sets the device up. Claims interface and initiates the device connection.
* Chooses the right{@link com.github.mjdev.libaums.UsbCommunication}
* depending on the Android version (
* {@link com.github.mjdev.libaums.UsbMassStorageDevice.HoneyCombMr1Communication}
* or (
* {@link com.github.mjdev.libaums.UsbMassStorageDevice.JellyBeanMr2Communication} | void function() throws IOException { if (usbManager.hasPermission(usbDevice)) setupDevice(); else throw new IllegalStateException(STR + usbDevice); } /** * Sets the device up. Claims interface and initiates the device connection. * Chooses the right{@link com.github.mjdev.libaums.UsbCommunication} * depending on the Android version ( * {@link com.github.mjdev.libaums.UsbMassStorageDevice.HoneyCombMr1Communication} * or ( * {@link com.github.mjdev.libaums.UsbMassStorageDevice.JellyBeanMr2Communication} | /**
* Initializes the mass storage device and determines different things like
* for example the MBR or the file systems for the different partitions.
*
* @throws IOException
* If reading from the physical device fails.
* @throws IllegalStateException
* If permission to communicate with the underlying
* {@link UsbDevice} is missing.
* @see #getUsbDevice()
*/ | Initializes the mass storage device and determines different things like for example the MBR or the file systems for the different partitions | init | {
"repo_name": "jmue/libaums",
"path": "libaums/src/main/java/com/github/mjdev/libaums/UsbMassStorageDevice.java",
"license": "apache-2.0",
"size": 12275
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,348,127 |
public void setEndIPAddress(final InetAddress endIPAddressValue) {
this.endIPAddress = endIPAddressValue;
}
private String name; | void function(final InetAddress endIPAddressValue) { this.endIPAddress = endIPAddressValue; } private String name; | /**
* Required. Gets or sets the new ending IP address for this Firewall Rule.
* @param endIPAddressValue The EndIPAddress value.
*/ | Required. Gets or sets the new ending IP address for this Firewall Rule | setEndIPAddress | {
"repo_name": "flydream2046/azure-sdk-for-java",
"path": "service-management/azure-svc-mgmt-sql/src/main/java/com/microsoft/windowsazure/management/sql/models/FirewallRuleUpdateParameters.java",
"license": "apache-2.0",
"size": 3623
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 619,008 |
@Nullable private GridNearTxRemote startNearRemoteTx(ClassLoader ldr, UUID nodeId,
GridDhtTxPrepareRequest req) throws IgniteCheckedException {
if (!F.isEmpty(req.nearWrites())) {
GridNearTxRemote tx = ctx.tm().nearTx(req.version());
if (tx == null) {
tx = new GridNearTxRemote(
ctx,
req.topologyVersion(),
ldr,
nodeId,
req.nearNodeId(),
req.version(),
null,
req.system(),
req.policy(),
req.concurrency(),
req.isolation(),
req.isInvalidate(),
req.timeout(),
req.nearWrites(),
req.txSize(),
req.subjectId(),
req.taskNameHash()
);
tx.writeVersion(req.writeVersion());
if (!tx.empty()) {
tx = ctx.tm().onCreated(null, tx);
if (tx == null || !ctx.tm().onStarted(tx))
throw new IgniteTxRollbackCheckedException("Attempt to start a completed transaction: " + tx);
}
}
else
tx.addEntries(ldr, req.nearWrites());
tx.ownedVersions(req.owned());
// Prepare prior to reordering, so the pending locks added
// in prepare phase will get properly ordered as well.
tx.prepareRemoteTx();
if (req.last())
tx.state(PREPARED);
return tx;
}
return null;
} | @Nullable GridNearTxRemote function(ClassLoader ldr, UUID nodeId, GridDhtTxPrepareRequest req) throws IgniteCheckedException { if (!F.isEmpty(req.nearWrites())) { GridNearTxRemote tx = ctx.tm().nearTx(req.version()); if (tx == null) { tx = new GridNearTxRemote( ctx, req.topologyVersion(), ldr, nodeId, req.nearNodeId(), req.version(), null, req.system(), req.policy(), req.concurrency(), req.isolation(), req.isInvalidate(), req.timeout(), req.nearWrites(), req.txSize(), req.subjectId(), req.taskNameHash() ); tx.writeVersion(req.writeVersion()); if (!tx.empty()) { tx = ctx.tm().onCreated(null, tx); if (tx == null !ctx.tm().onStarted(tx)) throw new IgniteTxRollbackCheckedException(STR + tx); } } else tx.addEntries(ldr, req.nearWrites()); tx.ownedVersions(req.owned()); tx.prepareRemoteTx(); if (req.last()) tx.state(PREPARED); return tx; } return null; } | /**
* Called while processing dht tx prepare request.
*
* @param ldr Loader.
* @param nodeId Sender node ID.
* @param req Request.
* @return Remote transaction.
* @throws IgniteCheckedException If failed.
*/ | Called while processing dht tx prepare request | startNearRemoteTx | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java",
"license": "apache-2.0",
"size": 72309
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest",
"org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxRemote",
"org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException",
"org.apache.ignite.internal.util.typedef.F",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxRemote; import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; import org.apache.ignite.internal.util.typedef.F; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 13,053 |
void helpCenterNoticeList() {
Intent intent = new Intent(this, HelpCenterNoticeActivity.class);
startActivity(intent);
} | void helpCenterNoticeList() { Intent intent = new Intent(this, HelpCenterNoticeActivity.class); startActivity(intent); } | /**
* Launch Help Center Notice List activity.
*/ | Launch Help Center Notice List activity | helpCenterNoticeList | {
"repo_name": "haruio/haru-sdk-android",
"path": "test/src/main/java/com/haru/test/MainActivity.java",
"license": "mit",
"size": 5228
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 1,367,203 |
public static void unbindResources(
OcResourceHandle ocResourceCollectionHandle,
List<OcResourceHandle> ocResourceHandleList) throws OcException {
OcPlatform.initCheck();
if (ocResourceHandleList == null) {
throw new OcException(ErrorCode.INVALID_PARAM, "ocResourceHandleList cannot be null");
}
OcPlatform.unbindResources0(
ocResourceCollectionHandle,
ocResourceHandleList.toArray(
new OcResourceHandle[ocResourceHandleList.size()])
);
} | static void function( OcResourceHandle ocResourceCollectionHandle, List<OcResourceHandle> ocResourceHandleList) throws OcException { OcPlatform.initCheck(); if (ocResourceHandleList == null) { throw new OcException(ErrorCode.INVALID_PARAM, STR); } OcPlatform.unbindResources0( ocResourceCollectionHandle, ocResourceHandleList.toArray( new OcResourceHandle[ocResourceHandleList.size()]) ); } | /**
* Unbind resources from a collection resource.
*
* @param ocResourceCollectionHandle Handle to the collection resource
* @param ocResourceHandleList List of resource handles to be unbound from the collection
* resource
* @throws OcException if failure
*/ | Unbind resources from a collection resource | unbindResources | {
"repo_name": "iotivity/iotivity",
"path": "java/iotivity-java/src/main/java/org/iotivity/base/OcPlatform.java",
"license": "apache-2.0",
"size": 48068
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 280,839 |
protected static final PropertyChangeListener getChildPropertyChangeListener(
Object child)
{
if (child instanceof PropertyChangeListener)
return (PropertyChangeListener) child;
else
return null;
} | static final PropertyChangeListener function( Object child) { if (child instanceof PropertyChangeListener) return (PropertyChangeListener) child; else return null; } | /**
* Returns <code>child</code> as an instance of
* {@link PropertyChangeListener}, or <code>null</code> if <code>child</code>
* does not implement that interface.
*
* @param child the child (<code>null</code> permitted).
*
* @return The child cast to {@link PropertyChangeListener}.
*/ | Returns <code>child</code> as an instance of <code>PropertyChangeListener</code>, or <code>null</code> if <code>child</code> does not implement that interface | getChildPropertyChangeListener | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/java/beans/beancontext/BeanContextSupport.java",
"license": "gpl-2.0",
"size": 32730
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 1,408,787 |
public String organization(OrganizationRequest request) {
return call(
new GetRequest(path("organization"))
.setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
} | String function(OrganizationRequest request) { return call( new GetRequest(path(STR)) .setParam(STR, request.getOrganization()) .setMediaType(MediaTypes.JSON) ).content(); } | /**
*
* This is part of the internal API.
* This is a GET request.
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/organization">Further information about this action online (including a response example)</a>
* @since 6.3
*/ | This is part of the internal API. This is a GET request | organization | {
"repo_name": "Godin/sonar",
"path": "sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java",
"license": "lgpl-3.0",
"size": 3452
} | [
"org.sonarqube.ws.MediaTypes",
"org.sonarqube.ws.client.GetRequest"
] | import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.client.GetRequest; | import org.sonarqube.ws.*; import org.sonarqube.ws.client.*; | [
"org.sonarqube.ws"
] | org.sonarqube.ws; | 2,622,818 |
public boolean isIdentityInLearningArea(Identity identity, String areaName, OLATResourceable ores); | boolean function(Identity identity, String areaName, OLATResourceable ores); | /**
* Checks if an identity is in any learning areas with the given name in any of the courses group contexts
*
* @param identity
* @param areaName
* @return true if user is in such an area, false otherwhise
*/ | Checks if an identity is in any learning areas with the given name in any of the courses group contexts | isIdentityInLearningArea | {
"repo_name": "huihoo/olat",
"path": "olat7.8/src/main/java/org/olat/lms/group/learn/CourseGroupManager.java",
"license": "apache-2.0",
"size": 13988
} | [
"org.olat.data.basesecurity.Identity",
"org.olat.system.commons.resource.OLATResourceable"
] | import org.olat.data.basesecurity.Identity; import org.olat.system.commons.resource.OLATResourceable; | import org.olat.data.basesecurity.*; import org.olat.system.commons.resource.*; | [
"org.olat.data",
"org.olat.system"
] | org.olat.data; org.olat.system; | 410,170 |
@NonNull
public static String formatShortDate(final long date) {
final DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getContext());
return dateFormat.format(date);
} | static String function(final long date) { final DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getContext()); return dateFormat.format(date); } | /**
* Generate a numeric date string according to system-wide settings (locale, date format)
* such as "10/20/2010".
*
* @param date
* milliseconds since the epoch
* @return the formatted string
*/ | Generate a numeric date string according to system-wide settings (locale, date format) such as "10/20/2010" | formatShortDate | {
"repo_name": "S-Bartfast/cgeo",
"path": "main/src/cgeo/geocaching/utils/Formatter.java",
"license": "apache-2.0",
"size": 14923
} | [
"java.text.DateFormat"
] | import java.text.DateFormat; | import java.text.*; | [
"java.text"
] | java.text; | 376,078 |
@Deprecated
public void createLinkedNoteStoreClientAsync(LinkedNotebook notebook, OnClientCallback<AsyncLinkedNoteStoreClient> callback) {
AsyncReflector.execute(this, callback, "createLinkedNoteStoreClient", notebook);
} | void function(LinkedNotebook notebook, OnClientCallback<AsyncLinkedNoteStoreClient> callback) { AsyncReflector.execute(this, callback, STR, notebook); } | /**
* Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} asynchronously.
*
* @param notebook
* @param callback
*/ | Creates a LinkedNoteStoreClient from a <code>LinkedNotebook</code> asynchronously | createLinkedNoteStoreClientAsync | {
"repo_name": "AlexBravo/evernote-sdk-android",
"path": "library/src/main/java/com/evernote/client/android/ClientFactory.java",
"license": "apache-2.0",
"size": 11980
} | [
"com.evernote.edam.type.LinkedNotebook"
] | import com.evernote.edam.type.LinkedNotebook; | import com.evernote.edam.type.*; | [
"com.evernote.edam"
] | com.evernote.edam; | 2,433,992 |
public RexLiteral makeIntervalLiteral(
BigDecimal v,
SqlIntervalQualifier intervalQualifier) {
return makeLiteral(
v,
typeFactory.createSqlIntervalType(intervalQualifier),
intervalQualifier.typeName());
} | RexLiteral function( BigDecimal v, SqlIntervalQualifier intervalQualifier) { return makeLiteral( v, typeFactory.createSqlIntervalType(intervalQualifier), intervalQualifier.typeName()); } | /**
* Creates a literal representing an interval value, for example
* {@code INTERVAL '3-7' YEAR TO MONTH}.
*/ | Creates a literal representing an interval value, for example INTERVAL '3-7' YEAR TO MONTH | makeIntervalLiteral | {
"repo_name": "sreev/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/rex/RexBuilder.java",
"license": "apache-2.0",
"size": 47253
} | [
"java.math.BigDecimal",
"org.apache.calcite.sql.SqlIntervalQualifier"
] | import java.math.BigDecimal; import org.apache.calcite.sql.SqlIntervalQualifier; | import java.math.*; import org.apache.calcite.sql.*; | [
"java.math",
"org.apache.calcite"
] | java.math; org.apache.calcite; | 2,374,070 |
@Override
public InternationalString getTitle() {
return null;
} | InternationalString function() { return null; } | /**
* ISO 19115 metadata property not specified by GPX.
* This is part of the properties returned by {@code getReferences()}.
* It would be the license title if that information was provided.
*
* @return the license name.
*/ | ISO 19115 metadata property not specified by GPX. This is part of the properties returned by getReferences(). It would be the license title if that information was provided | getTitle | {
"repo_name": "apache/sis",
"path": "storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java",
"license": "apache-2.0",
"size": 16279
} | [
"org.opengis.util.InternationalString"
] | import org.opengis.util.InternationalString; | import org.opengis.util.*; | [
"org.opengis.util"
] | org.opengis.util; | 271,563 |
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
generateResponse(request, response);
} // doPost
| void function(HttpServletRequest request, HttpServletResponse response) throws IOException { generateResponse(request, response); } | /** Creates the response for a HTTP POST request.
* @param request fields from the client input form
* @param response data to be sent back the user's browser
* @throws IOException for IO erros
*/ | Creates the response for a HTTP POST request | doPost | {
"repo_name": "gfis/xtool",
"path": "src/main/java/org/teherba/xtool/web/XtoolServlet.java",
"license": "apache-2.0",
"size": 12620
} | [
"java.io.IOException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 1,000,535 |
public List<IToken> getTokens() {
return tokens;
} | List<IToken> function() { return tokens; } | /**
* Returns the tokens of the file which contains the comment.
*/ | Returns the tokens of the file which contains the comment | getTokens | {
"repo_name": "vimaier/conqat",
"path": "org.conqat.engine.text/src/org/conqat/engine/text/comments/Comment.java",
"license": "apache-2.0",
"size": 4195
} | [
"java.util.List",
"org.conqat.lib.scanner.IToken"
] | import java.util.List; import org.conqat.lib.scanner.IToken; | import java.util.*; import org.conqat.lib.scanner.*; | [
"java.util",
"org.conqat.lib"
] | java.util; org.conqat.lib; | 967,759 |
public static final Map<String, String> executeQueryFirstRow(String sqlQuery, String jndi) {
if ( !isMysqlReady(jndi) ) {
return null;
}
Connection conn = null;
Statement stat = null;
ResultSet resultSet = null;
try {
BoneCPDataSource dataSource = dataSourceMap.get(jndi);
conn = dataSource.getConnection();
stat = conn.createStatement();
resultSet = stat.executeQuery(sqlQuery);
HashMap<String, String> map = new HashMap<String, String>();
if ( resultSet.next() ) {
ResultSetMetaData rsmd = resultSet.getMetaData();
int count = rsmd.getColumnCount();
for ( int i=1; i<=count; i++ ) {
map.put(rsmd.getColumnName(i), resultSet.getString(i));
}
return map;
}
} catch (SQLException e) {
logger.warn("Failed to execute sql: {}. Exception {}", sqlQuery,
e.getMessage());
} finally {
if ( stat != null ) {
try {
stat.close();
} catch (SQLException e) {
}
}
if ( conn != null ) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
return null;
}
| static final Map<String, String> function(String sqlQuery, String jndi) { if ( !isMysqlReady(jndi) ) { return null; } Connection conn = null; Statement stat = null; ResultSet resultSet = null; try { BoneCPDataSource dataSource = dataSourceMap.get(jndi); conn = dataSource.getConnection(); stat = conn.createStatement(); resultSet = stat.executeQuery(sqlQuery); HashMap<String, String> map = new HashMap<String, String>(); if ( resultSet.next() ) { ResultSetMetaData rsmd = resultSet.getMetaData(); int count = rsmd.getColumnCount(); for ( int i=1; i<=count; i++ ) { map.put(rsmd.getColumnName(i), resultSet.getString(i)); } return map; } } catch (SQLException e) { logger.warn(STR, sqlQuery, e.getMessage()); } finally { if ( stat != null ) { try { stat.close(); } catch (SQLException e) { } } if ( conn != null ) { try { conn.close(); } catch (SQLException e) { } } } return null; } | /**
* The query result will be read into heap memory so do not
* query a big table.
*
* @param sqlQuery
* @return
*/ | The query result will be read into heap memory so do not query a big table | executeQueryFirstRow | {
"repo_name": "wangqi/gameserver",
"path": "server/src/main/java/com/xinqihd/sns/gameserver/db/mysql/MysqlUtil.java",
"license": "apache-2.0",
"size": 7105
} | [
"com.jolbox.bonecp.BoneCPDataSource",
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.ResultSetMetaData",
"java.sql.SQLException",
"java.sql.Statement",
"java.util.HashMap",
"java.util.Map"
] | import com.jolbox.bonecp.BoneCPDataSource; import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.HashMap; import java.util.Map; | import com.jolbox.bonecp.*; import java.sql.*; import java.util.*; | [
"com.jolbox.bonecp",
"java.sql",
"java.util"
] | com.jolbox.bonecp; java.sql; java.util; | 2,793,606 |
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
super.onStruckByLightning(lightningBolt);
this.dataWatcher.updateObject(17, Byte.valueOf((byte)1));
} | void function(EntityLightningBolt lightningBolt) { super.onStruckByLightning(lightningBolt); this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); } | /**
* Called when a lightning bolt hits the entity.
*/ | Called when a lightning bolt hits the entity | onStruckByLightning | {
"repo_name": "TorchPowered/CraftBloom",
"path": "src/net/minecraft/entity/monster/EntityCreeper.java",
"license": "mit",
"size": 9564
} | [
"net.minecraft.entity.effect.EntityLightningBolt"
] | import net.minecraft.entity.effect.EntityLightningBolt; | import net.minecraft.entity.effect.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 1,483,272 |
public static void initInterventi(){
ResultSet myResutlSet = DataBaseUtility.Utility.getInterventi();
try{
while(myResutlSet.next()){
interventi.add(new Intervento(myResutlSet.getString("idIntervento")));
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
myResutlSet = DataBaseUtility.Utility.getInfoInterventi();
try{
for(int i=0; i<interventi.size() && myResutlSet.next(); i++){
interventi.get(i).setDurata(myResutlSet.getInt("durata"));
interventi.get(i).setIdImpianto(myResutlSet.getString("idImpianto"));
}
//Competenze necessarie per ogni intervento
for(int i=0;i<interventi.size();i++){
myResutlSet = DataBaseUtility.Utility.getCopetenzeIntervento(interventi.get(i).getId());
while(myResutlSet.next()){
interventi.get(i).setCompentenza(myResutlSet.getString("idCompetenza"));
}
}
}catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
DataBaseUtility.Utility.dbCloseConnection();
}
| static void function(){ ResultSet myResutlSet = DataBaseUtility.Utility.getInterventi(); try{ while(myResutlSet.next()){ interventi.add(new Intervento(myResutlSet.getString(STR))); } } catch (SQLException e) { e.printStackTrace(); System.out.println(e.getMessage()); } myResutlSet = DataBaseUtility.Utility.getInfoInterventi(); try{ for(int i=0; i<interventi.size() && myResutlSet.next(); i++){ interventi.get(i).setDurata(myResutlSet.getInt(STR)); interventi.get(i).setIdImpianto(myResutlSet.getString(STR)); } for(int i=0;i<interventi.size();i++){ myResutlSet = DataBaseUtility.Utility.getCopetenzeIntervento(interventi.get(i).getId()); while(myResutlSet.next()){ interventi.get(i).setCompentenza(myResutlSet.getString(STR)); } } }catch (SQLException e) { e.printStackTrace(); System.out.println(e.getMessage()); } DataBaseUtility.Utility.dbCloseConnection(); } | /**
* Metodo per l'estrazione di tutti gli interventi dal DB e dell'inizializzazione dei valori di
* durata e idImpianto dei singoli interventi
*/ | Metodo per l'estrazione di tutti gli interventi dal DB e dell'inizializzazione dei valori di durata e idImpianto dei singoli interventi | initInterventi | {
"repo_name": "alotronto/nextFFM-No-GUI",
"path": "src/DataStructure/Utility.java",
"license": "apache-2.0",
"size": 31688
} | [
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,436,802 |
public final boolean isQueued(Thread thread) {
if (thread == null)
throw new NullPointerException();
for (Node p = tail; p != null; p = p.prev)
if (p.thread == thread)
return true;
return false;
} | final boolean function(Thread thread) { if (thread == null) throw new NullPointerException(); for (Node p = tail; p != null; p = p.prev) if (p.thread == thread) return true; return false; } | /**
* Returns true if the given thread is currently queued.
*
* <p>This implementation traverses the queue to determine
* presence of the given thread.
*
* @param thread the thread
* @return {@code true} if the given thread is on the queue
* @throws NullPointerException if the thread is null
*/ | Returns true if the given thread is currently queued. This implementation traverses the queue to determine presence of the given thread | isQueued | {
"repo_name": "mirego/j2objc",
"path": "jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java",
"license": "apache-2.0",
"size": 71570
} | [
"java.util.concurrent.locks.AbstractQueuedSynchronizer"
] | import java.util.concurrent.locks.AbstractQueuedSynchronizer; | import java.util.concurrent.locks.*; | [
"java.util"
] | java.util; | 1,026,616 |
public boolean isConstrainedEvent(MouseEvent event) {
return (event != null) ? event.isShiftDown() : false;
} | boolean function(MouseEvent event) { return (event != null) ? event.isShiftDown() : false; } | /**
* Note: This is not used during drag and drop operations due to limitations of the underlying
* API. To enable this for move operations set dragEnabled to false.
*
* @param event
* @return Returns true if the given event is constrained.
*/ | Note: This is not used during drag and drop operations due to limitations of the underlying API. To enable this for move operations set dragEnabled to false | isConstrainedEvent | {
"repo_name": "ModelWriter/WP3",
"path": "Source/eu.modelwriter.visualization.jgrapx/src/com/mxgraph/swing/mxGraphComponent.java",
"license": "epl-1.0",
"size": 106155
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,708,873 |
public Date getDate()
{
return null;
} | Date function() { return null; } | /**
* Returns the date the event happened. Keep in mind this might be and approximate date, and not all fields may
* actually be known. Also, it is recommended to get the formatted date string from {@link #getDateString()} rather
* than just formatting the date this method returns.
*
* @return the date the event happened
*
* @see #getDateString
* @see #isAbout
*/ | Returns the date the event happened. Keep in mind this might be and approximate date, and not all fields may actually be known. Also, it is recommended to get the formatted date string from <code>#getDateString()</code> rather than just formatting the date this method returns | getDate | {
"repo_name": "hendrixjoseph/FamilyTree",
"path": "src/main/java/edu/wright/hendrix11/familyTree/entity/event/Event.java",
"license": "mit",
"size": 4456
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,750,179 |
public List<BlockSnapshot> getReplacedBlockSnapshots()
{
return blockSnapshots;
}
}
@Cancelable
public static class NeighborNotifyEvent extends BlockEvent
{
private final EnumSet<EnumFacing> notifiedSides;
public NeighborNotifyEvent(World world, BlockPos pos, IBlockState state, EnumSet<EnumFacing> notifiedSides)
{
super(world, pos, state);
this.notifiedSides = notifiedSides;
} | List<BlockSnapshot> function() { return blockSnapshots; } } public static class NeighborNotifyEvent extends BlockEvent { private final EnumSet<EnumFacing> notifiedSides; public NeighborNotifyEvent(World world, BlockPos pos, IBlockState state, EnumSet<EnumFacing> notifiedSides) { super(world, pos, state); this.notifiedSides = notifiedSides; } | /**
* Gets a list of BlockSnapshots for all blocks which were replaced by the
* placement of the new blocks. Most of these blocks will just be of type AIR.
*
* @return immutable list of replaced BlockSnapshots
*/ | Gets a list of BlockSnapshots for all blocks which were replaced by the placement of the new blocks. Most of these blocks will just be of type AIR | getReplacedBlockSnapshots | {
"repo_name": "jdpadrnos/MinecraftForge",
"path": "src/main/java/net/minecraftforge/event/world/BlockEvent.java",
"license": "lgpl-2.1",
"size": 10411
} | [
"java.util.EnumSet",
"java.util.List",
"net.minecraft.block.state.IBlockState",
"net.minecraft.util.EnumFacing",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World",
"net.minecraftforge.common.util.BlockSnapshot"
] | import java.util.EnumSet; import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.util.BlockSnapshot; | import java.util.*; import net.minecraft.block.state.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; import net.minecraftforge.common.util.*; | [
"java.util",
"net.minecraft.block",
"net.minecraft.util",
"net.minecraft.world",
"net.minecraftforge.common"
] | java.util; net.minecraft.block; net.minecraft.util; net.minecraft.world; net.minecraftforge.common; | 569,160 |
public void open(File file, float volume) {
try {
clip.stop();
clip.close();
audio = AudioSystem.getAudioInputStream(file);
clip.open(audio);
volumeControl = (FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN);
setVolume(volume);
clip.start();
if(isLoop)
clip.loop(Clip.LOOP_CONTINUOUSLY);
else
clip.loop(0);
}
catch(UnsupportedAudioFileException uae) {
System.out.println(uae);
}
catch(IOException ioe) {
System.out.println(ioe);
System.out.println(file);
}
catch(LineUnavailableException lua) {
System.out.println(lua);
}
}
| void function(File file, float volume) { try { clip.stop(); clip.close(); audio = AudioSystem.getAudioInputStream(file); clip.open(audio); volumeControl = (FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN); setVolume(volume); clip.start(); if(isLoop) clip.loop(Clip.LOOP_CONTINUOUSLY); else clip.loop(0); } catch(UnsupportedAudioFileException uae) { System.out.println(uae); } catch(IOException ioe) { System.out.println(ioe); System.out.println(file); } catch(LineUnavailableException lua) { System.out.println(lua); } } | /**
* Will open a new file for a certain volume.
*
* @param file - File of audio to open
* @param volume - Volume of audio to play from 100 to 0
*/ | Will open a new file for a certain volume | open | {
"repo_name": "BradleyCai/VN-RW",
"path": "src/main/VNSound.java",
"license": "mit",
"size": 5547
} | [
"java.io.File",
"java.io.IOException",
"javax.sound.sampled.AudioSystem",
"javax.sound.sampled.Clip",
"javax.sound.sampled.FloatControl",
"javax.sound.sampled.LineUnavailableException",
"javax.sound.sampled.UnsupportedAudioFileException"
] | import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; | import java.io.*; import javax.sound.sampled.*; | [
"java.io",
"javax.sound"
] | java.io; javax.sound; | 1,822,009 |
public static Polygon generateBufferPolygon(Ellipse targetFeature, MapInstance mapInstance, double buffer) {
try {
Ellipse bufferEllipse = new Ellipse();
bufferEllipse.setSemiMinor(targetFeature.getSemiMinor() + buffer);
bufferEllipse.setSemiMajor(targetFeature.getSemiMajor() + buffer);
bufferEllipse.setAzimuth(targetFeature.getAzimuth());
bufferEllipse.setAltitudeMode(targetFeature.getAltitudeMode());
bufferEllipse.getPositions().addAll(targetFeature.getPositions());
bufferEllipse.setFillStyle( mapInstance.getEmpResources().getBufferFillStyle(mapInstance));
List<IFeature> featureList = mapInstance.getMilStdRenderer().getFeatureRenderableShapes(mapInstance, bufferEllipse, false);
if((null == featureList) || (1 != featureList.size()) || (!(featureList.get(0) instanceof Polygon))) {
Log.d(TAG, "SEC Renderer didn't return a Polygon");
return null;
}
return (Polygon) featureList.get(0);
} catch(Exception e) {
Log.e(TAG, "generateBufferPolygon Ellipse buffer " + buffer, e);
}
return null;
} | static Polygon function(Ellipse targetFeature, MapInstance mapInstance, double buffer) { try { Ellipse bufferEllipse = new Ellipse(); bufferEllipse.setSemiMinor(targetFeature.getSemiMinor() + buffer); bufferEllipse.setSemiMajor(targetFeature.getSemiMajor() + buffer); bufferEllipse.setAzimuth(targetFeature.getAzimuth()); bufferEllipse.setAltitudeMode(targetFeature.getAltitudeMode()); bufferEllipse.getPositions().addAll(targetFeature.getPositions()); bufferEllipse.setFillStyle( mapInstance.getEmpResources().getBufferFillStyle(mapInstance)); List<IFeature> featureList = mapInstance.getMilStdRenderer().getFeatureRenderableShapes(mapInstance, bufferEllipse, false); if((null == featureList) (1 != featureList.size()) (!(featureList.get(0) instanceof Polygon))) { Log.d(TAG, STR); return null; } return (Polygon) featureList.get(0); } catch(Exception e) { Log.e(TAG, STR + buffer, e); } return null; } | /**
* Generates a buffer around the Ellipse Feature as follows:
* Creates a new Ellipse object, copies all attributes adding the buffer value to major/minor axis
* Sets the Fill Style
* Invokes the SEC renderer to create a Polygon
* @param targetFeature
* @param mapInstance
* @param buffer The buffer distance in meters.
* @return
*/ | Generates a buffer around the Ellipse Feature as follows: Creates a new Ellipse object, copies all attributes adding the buffer value to major/minor axis Sets the Fill Style Invokes the SEC renderer to create a Polygon | generateBufferPolygon | {
"repo_name": "missioncommand/emp3-android",
"path": "mapengine/worldwind/apk/src/main/java/mil/emp3/worldwind/feature/support/BufferGenerator.java",
"license": "apache-2.0",
"size": 14058
} | [
"android.util.Log",
"java.util.List",
"mil.emp3.api.Ellipse",
"mil.emp3.api.Polygon",
"mil.emp3.api.interfaces.IFeature",
"mil.emp3.worldwind.MapInstance"
] | import android.util.Log; import java.util.List; import mil.emp3.api.Ellipse; import mil.emp3.api.Polygon; import mil.emp3.api.interfaces.IFeature; import mil.emp3.worldwind.MapInstance; | import android.util.*; import java.util.*; import mil.emp3.api.*; import mil.emp3.api.interfaces.*; import mil.emp3.worldwind.*; | [
"android.util",
"java.util",
"mil.emp3.api",
"mil.emp3.worldwind"
] | android.util; java.util; mil.emp3.api; mil.emp3.worldwind; | 1,770,024 |
public void setNumberOfElements(final int n)
throws IllegalArgumentException {
if (n <= 0) {
throw MathRuntimeException.createIllegalArgumentException(
"invalid number of elements {0} (must be positive)",
n);
}
this.numberOfElements = n;
}
| void function(final int n) throws IllegalArgumentException { if (n <= 0) { throw MathRuntimeException.createIllegalArgumentException( STR, n); } this.numberOfElements = n; } | /**
* Set the number of elements (e.g. corpus size) for the distribution.
* The parameter value must be positive; otherwise an
* <code>IllegalArgumentException</code> is thrown.
*
* @param n the number of elements
* @exception IllegalArgumentException if n ≤ 0
*/ | Set the number of elements (e.g. corpus size) for the distribution. The parameter value must be positive; otherwise an <code>IllegalArgumentException</code> is thrown | setNumberOfElements | {
"repo_name": "justinwm/astor",
"path": "examples/Math-issue-288/src/main/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java",
"license": "gpl-2.0",
"size": 6221
} | [
"org.apache.commons.math.MathRuntimeException"
] | import org.apache.commons.math.MathRuntimeException; | import org.apache.commons.math.*; | [
"org.apache.commons"
] | org.apache.commons; | 95,975 |
private static String getNextToken(String delim) {
String input;
String retVal = "&";
try {
if ((st == null) || !st.hasMoreElements()) {
if (source == null) {
source = new BufferedReader(new InputStreamReader(System.in));
}
input = source.readLine();
st = new StringTokenizer(input);
}
if (delim == null) {
delim = " \t\n\r\f";
}
retVal = st.nextToken(delim);
} catch (NoSuchElementException e1) {
// si ocurre una excepción, no hacer nada
} catch (IOException e2) {
// si ocurre una excepción, no hacer nada
}
return retVal;
} | static String function(String delim) { String input; String retVal = "&"; try { if ((st == null) !st.hasMoreElements()) { if (source == null) { source = new BufferedReader(new InputStreamReader(System.in)); } input = source.readLine(); st = new StringTokenizer(input); } if (delim == null) { delim = STR; } retVal = st.nextToken(delim); } catch (NoSuchElementException e1) { } catch (IOException e2) { } return retVal; } | /**
* Metodo utilizado para obtener el siguiente elemento del objeto
* parseador de la entrada. Los elementos estaran definidos por el
* delimitador que se recibe como parametro.
* @param delim delimitador a utilizar durante el parseo de la entrada. Si
* el parametro es <code>null</code> se tomarán los delimitadores
* indicados en {@link #readString() readString()}.
* @return siguiente elemento del parseador de cadenas, considerando como
* separadores al par&aacute;metro recibido.
* @see #getNextToken()
* @see #st
* @see "Documentaci&oacute;n de la clase <code>StringTokenizer</code> en el
* sitio oficial de Java: <a href="<a href="http://java.sun.com" target="_blank">http://java.sun.com</a>"><a href="http://java.sun.com" target="_blank">http://java.sun.com</a></a>."
*/ | Metodo utilizado para obtener el siguiente elemento del objeto parseador de la entrada. Los elementos estaran definidos por el delimitador que se recibe como parametro | getNextToken | {
"repo_name": "federxs/aed-primero",
"path": "Matrices/Matrices/src/matrices/In.java",
"license": "apache-2.0",
"size": 7037
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.util.NoSuchElementException",
"java.util.StringTokenizer"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.NoSuchElementException; import java.util.StringTokenizer; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 26,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.