method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public DcmElement putIS(int tag, int value) { return put(StringElement.createIS(tag, value)); }
DcmElement function(int tag, int value) { return put(StringElement.createIS(tag, value)); }
/** * Description of the Method * * @param tag Description of the Parameter * @param value Description of the Parameter * @return Description of the Return Value */
Description of the Method
putIS
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/tags/DCM4CHE_1_4_2/src/java/org/dcm4cheri/data/DcmObjectImpl.java", "license": "apache-2.0", "size": 83021 }
[ "org.dcm4che.data.DcmElement" ]
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.*;
[ "org.dcm4che.data" ]
org.dcm4che.data;
1,519,916
public Serializable getConfig() { return config; }
Serializable function() { return config; }
/** * Returns any additional configuration passed to the factory as part of the context. * @return optional additional configuration */
Returns any additional configuration passed to the factory as part of the context
getConfig
{ "repo_name": "b-cuts/esper", "path": "esper/src/main/java/com/espertech/esper/client/ConfigurationPlugInVirtualDataWindow.java", "license": "gpl-2.0", "size": 2704 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
2,649,595
public void removeSubscriptionById(int subscription_id) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); String sqlQuery = SQLConstants.REMOVE_SUBSCRIPTION_BY_ID_SQL; ps = conn.prepareStatement(sqlQuery); ps.setInt(1, subscription_id); ps.executeUpdate(); conn.commit(); } catch (SQLException e) { if (conn != null) { try { conn.rollback(); } catch (SQLException e1) { log.error("Failed to rollback remove subscription ", e1); } } handleException("Failed to remove subscription data ", e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
void function(int subscription_id) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); String sqlQuery = SQLConstants.REMOVE_SUBSCRIPTION_BY_ID_SQL; ps = conn.prepareStatement(sqlQuery); ps.setInt(1, subscription_id); ps.executeUpdate(); conn.commit(); } catch (SQLException e) { if (conn != null) { try { conn.rollback(); } catch (SQLException e1) { log.error(STR, e1); } } handleException(STR, e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
/** * Removes a subscription by id by force without considering the subscription blocking state of the user * * @param subscription_id id of subscription * @throws APIManagementException */
Removes a subscription by id by force without considering the subscription blocking state of the user
removeSubscriptionById
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 811404 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
1,772,913
OutgoingElementsBuilder withCapabilities(List<Capability> capabilities);
OutgoingElementsBuilder withCapabilities(List<Capability> capabilities);
/** * Allows declaring the capabilities this outgoing configuration provides * @param capabilities the capabilities */
Allows declaring the capabilities this outgoing configuration provides
withCapabilities
{ "repo_name": "gradle/gradle", "path": "subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/OutgoingElementsBuilder.java", "license": "apache-2.0", "size": 4812 }
[ "java.util.List", "org.gradle.api.capabilities.Capability" ]
import java.util.List; import org.gradle.api.capabilities.Capability;
import java.util.*; import org.gradle.api.capabilities.*;
[ "java.util", "org.gradle.api" ]
java.util; org.gradle.api;
743,911
private ImmutableMap getLabelsForPod(final int executionId, Map<String, String> flowParam) { final ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); mapBuilder.put(CLUSTER_LABEL_NAME, this.clusterName); mapBuilder.put(EXECUTION_ID_LABEL_NAME, EXECUTION_ID_LABEL_PREFIX + executionId); mapBuilder.put(APP_LABEL_NAME, POD_APPLICATION_TAG); // Note that the service label must match the selector used for the corresponding service if (isServiceRequired()) { mapBuilder.put("service", String.join("-", SERVICE_SELECTOR_PREFIX, clusterQualifiedExecId(this.clusterName, executionId))); } // Set the label for disabling pod-cleanup. if (flowParam != null && !flowParam.isEmpty() && flowParam .containsKey(FlowParameters.FLOW_PARAM_DISABLE_POD_CLEANUP)) { mapBuilder.put(DISABLE_CLEANUP_LABEL_NAME, flowParam.get(FlowParameters.FLOW_PARAM_DISABLE_POD_CLEANUP)); } return mapBuilder.build(); }
ImmutableMap function(final int executionId, Map<String, String> flowParam) { final ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); mapBuilder.put(CLUSTER_LABEL_NAME, this.clusterName); mapBuilder.put(EXECUTION_ID_LABEL_NAME, EXECUTION_ID_LABEL_PREFIX + executionId); mapBuilder.put(APP_LABEL_NAME, POD_APPLICATION_TAG); if (isServiceRequired()) { mapBuilder.put(STR, String.join("-", SERVICE_SELECTOR_PREFIX, clusterQualifiedExecId(this.clusterName, executionId))); } if (flowParam != null && !flowParam.isEmpty() && flowParam .containsKey(FlowParameters.FLOW_PARAM_DISABLE_POD_CLEANUP)) { mapBuilder.put(DISABLE_CLEANUP_LABEL_NAME, flowParam.get(FlowParameters.FLOW_PARAM_DISABLE_POD_CLEANUP)); } return mapBuilder.build(); }
/** * Create labels that should be applied to the Pod. * * @return */
Create labels that should be applied to the Pod
getLabelsForPod
{ "repo_name": "azkaban/azkaban", "path": "azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java", "license": "apache-2.0", "size": 56420 }
[ "com.google.common.collect.ImmutableMap", "java.util.Map" ]
import com.google.common.collect.ImmutableMap; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,776,788
public MIMETypedStream getMethodsXML(Context context, String PID, String sDefPID, Date asOfDateTime) throws ServerException { //m_ipRestriction.enforce(context); return da.getMethodsXML(context, PID, sDefPID, asOfDateTime); }
MIMETypedStream function(Context context, String PID, String sDefPID, Date asOfDateTime) throws ServerException { return da.getMethodsXML(context, PID, sDefPID, asOfDateTime); }
/** * Get an XML encoding of the service defintions for a given dynamic * disseminator that is associated with the digital object. The dynamic * disseminator is identified by the sDefPID. * * @param context * @param PID * identifier of digital object being reflected upon * @param sDefPID * identifier of dynamic service definition * @param asOfDateTime * @return MIME-typed stream containing XML-encoded method definitions * @throws ServerException */
Get an XML encoding of the service defintions for a given dynamic disseminator that is associated with the digital object. The dynamic disseminator is identified by the sDefPID
getMethodsXML
{ "repo_name": "fcrepo3/fcrepo", "path": "fcrepo-server/src/main/java/org/fcrepo/server/access/DynamicAccessModule.java", "license": "apache-2.0", "size": 13832 }
[ "java.util.Date", "org.fcrepo.server.Context", "org.fcrepo.server.errors.ServerException", "org.fcrepo.server.storage.types.MIMETypedStream" ]
import java.util.Date; import org.fcrepo.server.Context; import org.fcrepo.server.errors.ServerException; import org.fcrepo.server.storage.types.MIMETypedStream;
import java.util.*; import org.fcrepo.server.*; import org.fcrepo.server.errors.*; import org.fcrepo.server.storage.types.*;
[ "java.util", "org.fcrepo.server" ]
java.util; org.fcrepo.server;
298,472
public final Parameter getParameter(final String aName) { for (final Iterator i = parameters.iterator(); i.hasNext();) { final Parameter p = (Parameter) i.next(); if (aName.equalsIgnoreCase(p.getName())) { return p; } } return null; }
final Parameter function(final String aName) { for (final Iterator i = parameters.iterator(); i.hasNext();) { final Parameter p = (Parameter) i.next(); if (aName.equalsIgnoreCase(p.getName())) { return p; } } return null; }
/** * Returns the first parameter with the specified name. * @param aName name of the parameter * @return the first matching parameter or null if no matching parameters */
Returns the first parameter with the specified name
getParameter
{ "repo_name": "vbonamy/ical4j", "path": "src/main/java/net/fortuna/ical4j/model/ParameterList.java", "license": "bsd-3-clause", "size": 7787 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
469,698
public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException { List<StatisticsDescriptor> sdl = getStatistics(); if (cd == null) return (sdl.size() > 0); UUID cdUUID = cd.getUUID(); for (StatisticsDescriptor statDesc : sdl) { if (cdUUID.equals(statDesc.getReferenceID())) { return true; } } return false; } /** * For this conglomerate (index), return the selectivity of the first * numKeys. This basically returns the reciprocal of the number of unique * values in the leading numKey columns of the index. It is assumed that * statistics exist for the conglomerate if this function is called. * However, no locks are held to prevent the statistics from being dropped, * so the method also handles the case of missing statistics by using a * heuristic to estimate the selectivity. * * @param cd ConglomerateDescriptor (Index) whose * cardinality we are interested in. * @param numKeys Number of leading columns of the index for which * cardinality is desired.
boolean function(ConglomerateDescriptor cd) throws StandardException { List<StatisticsDescriptor> sdl = getStatistics(); if (cd == null) return (sdl.size() > 0); UUID cdUUID = cd.getUUID(); for (StatisticsDescriptor statDesc : sdl) { if (cdUUID.equals(statDesc.getReferenceID())) { return true; } } return false; } /** * For this conglomerate (index), return the selectivity of the first * numKeys. This basically returns the reciprocal of the number of unique * values in the leading numKey columns of the index. It is assumed that * statistics exist for the conglomerate if this function is called. * However, no locks are held to prevent the statistics from being dropped, * so the method also handles the case of missing statistics by using a * heuristic to estimate the selectivity. * * @param cd ConglomerateDescriptor (Index) whose * cardinality we are interested in. * @param numKeys Number of leading columns of the index for which * cardinality is desired.
/** * Are there statistics for this particular conglomerate. * * @param cd Conglomerate/Index for which we want to check if statistics * exist. cd can be null in which case user wants to know if there are any * statistics at all on the table. */
Are there statistics for this particular conglomerate
statisticsExist
{ "repo_name": "apache/derby", "path": "java/org.apache.derby.engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java", "license": "apache-2.0", "size": 46207 }
[ "java.util.List", "org.apache.derby.shared.common.error.StandardException" ]
import java.util.List; import org.apache.derby.shared.common.error.StandardException;
import java.util.*; import org.apache.derby.shared.common.error.*;
[ "java.util", "org.apache.derby" ]
java.util; org.apache.derby;
167,365
@Test public void testAddExternalId() { final SimpleLegalEntity le = LE.clone(); assertEquals(le.getExternalIdBundle(), ID_BUNDLE); le.addExternalId(ExternalId.of("eid", "9")); assertEquals(le.getExternalIdBundle().size(), 3); final Set<String> ids = le.getExternalIdBundle().getValues(ExternalScheme.of("eid")); Assert.assertEqualsNoOrder(ids, Arrays.asList("1", "2", "9")); }
void function() { final SimpleLegalEntity le = LE.clone(); assertEquals(le.getExternalIdBundle(), ID_BUNDLE); le.addExternalId(ExternalId.of("eid", "9")); assertEquals(le.getExternalIdBundle().size(), 3); final Set<String> ids = le.getExternalIdBundle().getValues(ExternalScheme.of("eid")); Assert.assertEqualsNoOrder(ids, Arrays.asList("1", "2", "9")); }
/** * Tests adding an external id. */
Tests adding an external id
testAddExternalId
{ "repo_name": "McLeodMoores/starling", "path": "projects/core/src/test/java/com/opengamma/core/legalentity/impl/SimpleLegalEntityTest.java", "license": "apache-2.0", "size": 11007 }
[ "com.opengamma.id.ExternalId", "com.opengamma.id.ExternalScheme", "com.opengamma.test.Assert", "java.util.Arrays", "java.util.Set", "org.testng.Assert" ]
import com.opengamma.id.ExternalId; import com.opengamma.id.ExternalScheme; import com.opengamma.test.Assert; import java.util.Arrays; import java.util.Set; import org.testng.Assert;
import com.opengamma.id.*; import com.opengamma.test.*; import java.util.*; import org.testng.*;
[ "com.opengamma.id", "com.opengamma.test", "java.util", "org.testng" ]
com.opengamma.id; com.opengamma.test; java.util; org.testng;
2,116,032
public void onRemoveTypeOfPlantsAction() throws IOException { List<TypeOfPlants> typesOfPlants = null; try { typesOfPlants = this.followUpYourGardenServices.getTypeOfPlantsServices().getTypesOfPlants(); } catch (ClassNotFoundException | SQLException | IOException e1) { this.processException(e1); } FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fr/loicdelorme/followUpYourGarden/views/ContentSelector.fxml")); Stage stage = new Stage(); stage.setScene(new Scene(loader.load())); ContentSelectorController<TypeOfPlants> controller = loader.getController(); controller.initializeData(typesOfPlants, ContentSelectorType.REMOVE_TYPE_OF_PLANTS, stage, this.bundle); stage.showAndWait(); TypeOfPlants typeOfPlantsToRemove = controller.getSelectedValue(); if (typeOfPlantsToRemove != null) { try { this.followUpYourGardenServices.getTypeOfPlantsServices().removeTypeOfPlants(typeOfPlantsToRemove); this.displayInformation(this.bundle.getString("operationSuccess"), this.bundle.getString("typeOfPlantsRemovalSuccess")); } catch (ClassNotFoundException | SQLException | IOException e2) { this.processException(e2); } } }
void function() throws IOException { List<TypeOfPlants> typesOfPlants = null; try { typesOfPlants = this.followUpYourGardenServices.getTypeOfPlantsServices().getTypesOfPlants(); } catch (ClassNotFoundException SQLException IOException e1) { this.processException(e1); } FXMLLoader loader = new FXMLLoader(this.getClass().getResource(STR)); Stage stage = new Stage(); stage.setScene(new Scene(loader.load())); ContentSelectorController<TypeOfPlants> controller = loader.getController(); controller.initializeData(typesOfPlants, ContentSelectorType.REMOVE_TYPE_OF_PLANTS, stage, this.bundle); stage.showAndWait(); TypeOfPlants typeOfPlantsToRemove = controller.getSelectedValue(); if (typeOfPlantsToRemove != null) { try { this.followUpYourGardenServices.getTypeOfPlantsServices().removeTypeOfPlants(typeOfPlantsToRemove); this.displayInformation(this.bundle.getString(STR), this.bundle.getString(STR)); } catch (ClassNotFoundException SQLException IOException e2) { this.processException(e2); } } }
/** * The on click remove type of plants action. * * @throws IOException * If the file can't be opened. */
The on click remove type of plants action
onRemoveTypeOfPlantsAction
{ "repo_name": "LoicDelorme/Follow-Up-Your-Garden", "path": "src/fr/loicdelorme/followUpYourGarden/controllers/TasksToBeCarryOutScheduleController.java", "license": "mit", "size": 21804 }
[ "fr.loicdelorme.followUpYourGarden.core.models.ContentSelectorType", "fr.loicdelorme.followUpYourGarden.core.models.TypeOfPlants", "java.io.IOException", "java.sql.SQLException", "java.util.List" ]
import fr.loicdelorme.followUpYourGarden.core.models.ContentSelectorType; import fr.loicdelorme.followUpYourGarden.core.models.TypeOfPlants; import java.io.IOException; import java.sql.SQLException; import java.util.List;
import fr.loicdelorme.*; import java.io.*; import java.sql.*; import java.util.*;
[ "fr.loicdelorme", "java.io", "java.sql", "java.util" ]
fr.loicdelorme; java.io; java.sql; java.util;
1,637,050
public void testAllObservers(IChunk d) { //do all of the players if (d.getIWorld().getWorld().playerEntities != null) { for (Object _p : d.getIWorld().getWorld().playerEntities) { EntityPlayer mp = (EntityPlayer)_p; updater.flagUpdates(new Coord(((int) mp.posX) >> 4, -1, ((int) mp.posZ) >> 4), d); } } //do any other flagged observers if (d.getIWorld().getObservers() != null) { for (Observer o : d.getIWorld().getObservers()) { updater.flagUpdates(new Coord(o.c.x >> 4, o.range, o.c.z >> 4), d); } } } public void notifyThreadOvertime(long overtime) {}
void function(IChunk d) { if (d.getIWorld().getWorld().playerEntities != null) { for (Object _p : d.getIWorld().getWorld().playerEntities) { EntityPlayer mp = (EntityPlayer)_p; updater.flagUpdates(new Coord(((int) mp.posX) >> 4, -1, ((int) mp.posZ) >> 4), d); } } if (d.getIWorld().getObservers() != null) { for (Observer o : d.getIWorld().getObservers()) { updater.flagUpdates(new Coord(o.c.x >> 4, o.range, o.c.z >> 4), d); } } } public void notifyThreadOvertime(long overtime) {}
/** * Tests all of the players, and all of the observers that may be registered within the IWorld instances * @param d */
Tests all of the players, and all of the observers that may be registered within the IWorld instances
testAllObservers
{ "repo_name": "ddorstijn/FiniteFluids", "path": "OldMod/src/main/java/com/mcfht/rfo/RFO.java", "license": "lgpl-2.1", "size": 8999 }
[ "com.mcfht.rfo.datastructure.DataInterfaces", "com.mcfht.rfo.utils.Coord", "com.mcfht.rfo.utils.Observer", "net.minecraft.entity.player.EntityPlayer" ]
import com.mcfht.rfo.datastructure.DataInterfaces; import com.mcfht.rfo.utils.Coord; import com.mcfht.rfo.utils.Observer; import net.minecraft.entity.player.EntityPlayer;
import com.mcfht.rfo.datastructure.*; import com.mcfht.rfo.utils.*; import net.minecraft.entity.player.*;
[ "com.mcfht.rfo", "net.minecraft.entity" ]
com.mcfht.rfo; net.minecraft.entity;
1,436,604
MessageBundle bundle = messageBundleFactory.getBundle(spec, context.getLocale(), context.getIgnoreCache()); String dir = bundle.getLanguageDirection(); Substitutions substituter = new Substitutions(); substituter.addSubstitutions(Substitutions.Type.MESSAGE, bundle.getMessages()); BidiSubstituter.addSubstitutions(substituter, dir); substituter.addSubstitution(Substitutions.Type.MODULE, "ID", Integer.toString(context.getModuleId())); UserPrefSubstituter.addSubstitutions(substituter, spec, context.getUserPrefs()); return spec.substitute(substituter); }
MessageBundle bundle = messageBundleFactory.getBundle(spec, context.getLocale(), context.getIgnoreCache()); String dir = bundle.getLanguageDirection(); Substitutions substituter = new Substitutions(); substituter.addSubstitutions(Substitutions.Type.MESSAGE, bundle.getMessages()); BidiSubstituter.addSubstitutions(substituter, dir); substituter.addSubstitution(Substitutions.Type.MODULE, "ID", Integer.toString(context.getModuleId())); UserPrefSubstituter.addSubstitutions(substituter, spec, context.getUserPrefs()); return spec.substitute(substituter); }
/** * Substitutes all hangman variables into the gadget spec. * * @return A new GadgetSpec, with all fields substituted as needed. */
Substitutes all hangman variables into the gadget spec
substitute
{ "repo_name": "inevo/shindig-1.1-BETA5-incubating", "path": "java/gadgets/src/main/java/org/apache/shindig/gadgets/variables/VariableSubstituter.java", "license": "apache-2.0", "size": 2303 }
[ "org.apache.shindig.gadgets.spec.MessageBundle" ]
import org.apache.shindig.gadgets.spec.MessageBundle;
import org.apache.shindig.gadgets.spec.*;
[ "org.apache.shindig" ]
org.apache.shindig;
2,565,030
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller<PollResult<Void>, Void> beginDelete( String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context) { return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).getSyncPoller(); }
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> function( String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context) { return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).getSyncPoller(); }
/** * Deletes a VM scale set. * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the VM scale set. * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ApiErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */
Deletes a VM scale set
beginDelete
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachineScaleSetsClientImpl.java", "license": "mit", "size": 352067 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*;
[ "com.azure.core" ]
com.azure.core;
2,864,370
public static DateTimeFormatter getDateDisplayFormat() { return DateTimeFormat.forPattern("dd/MM/YYYY"); }
static DateTimeFormatter function() { return DateTimeFormat.forPattern(STR); }
/** * Returns the {@link org.joda.time.format.DateTimeFormatter} that is used for display purposes. * <p/> * Format: DD/MM/YYYY * * @return */
Returns the <code>org.joda.time.format.DateTimeFormatter</code> that is used for display purposes. Format: DD/MM/YYYY
getDateDisplayFormat
{ "repo_name": "Mithrandir21/RelationshipPoints", "path": "relationshipcorelibrary/src/main/java/com/bam/relationshipcorelibrary/Core/TimeRelated/DateTimeUTC.java", "license": "gpl-3.0", "size": 5743 }
[ "org.joda.time.format.DateTimeFormat", "org.joda.time.format.DateTimeFormatter" ]
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.*;
[ "org.joda.time" ]
org.joda.time;
359,738
private static void processGenre(ShowInfo showInfo, Element eShowInfo) { NodeList nlGenres = eShowInfo.getElementsByTagName("genre"); for (int loop = 0; loop < nlGenres.getLength(); loop++) { Node nGenre = nlGenres.item(loop); if (nGenre.getNodeType() == Node.ELEMENT_NODE) { Element eGenre = (Element) nGenre; if (eGenre.getFirstChild() != null) { showInfo.addGenre(eGenre.getFirstChild().getNodeValue()); } } } }
static void function(ShowInfo showInfo, Element eShowInfo) { NodeList nlGenres = eShowInfo.getElementsByTagName("genre"); for (int loop = 0; loop < nlGenres.getLength(); loop++) { Node nGenre = nlGenres.item(loop); if (nGenre.getNodeType() == Node.ELEMENT_NODE) { Element eGenre = (Element) nGenre; if (eGenre.getFirstChild() != null) { showInfo.addGenre(eGenre.getFirstChild().getNodeValue()); } } } }
/** * Process Genres * * @param showInfo * @param eShowInfo */
Process Genres
processGenre
{ "repo_name": "Omertron/api-tvrage", "path": "src/main/java/com/omertron/tvrageapi/tools/TVRageParser.java", "license": "gpl-3.0", "size": 13222 }
[ "com.omertron.tvrageapi.model.ShowInfo", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import com.omertron.tvrageapi.model.ShowInfo; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import com.omertron.tvrageapi.model.*; import org.w3c.dom.*;
[ "com.omertron.tvrageapi", "org.w3c.dom" ]
com.omertron.tvrageapi; org.w3c.dom;
895,471
public void read(boolean lock) throws xBaseJException, IOException { if (current_record == count) throw new xBaseJException("End Of File"); current_record++; if (lock) lockRecord(); gotoRecord(current_record); }
void function(boolean lock) throws xBaseJException, IOException { if (current_record == count) throw new xBaseJException(STR); current_record++; if (lock) lockRecord(); gotoRecord(current_record); }
/** * used to read the next record, after the current record pointer, in the * database. when done the record pointer and field contents will be * changed. * * @param lock * - boolean lock record indicator * @throws xBaseJException * usually the end of file condition * @throws IOException * Java error caused by called methods */
used to read the next record, after the current record pointer, in the database. when done the record pointer and field contents will be changed
read
{ "repo_name": "datacleaner/metamodel_extras", "path": "dbase/src/main/java/org/xBaseJ/DBF.java", "license": "lgpl-3.0", "size": 73588 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,218,923
Rectangle2D r = getBounds(); double x = r.getX(); double y = r.getY(); double a = (r.getWidth() + 1) / 2; double b = (r.getHeight() + 1) / 2; // x0,y0 - center of ellipse double x0 = x + a; double y0 = y + b; // x1, y1 - point double x1 = p.getX(); double y1 = p.getY(); // calculate straight line equation through point and ellipse center // y = d * x + h double dx = x1 - x0; double dy = y1 - y0; if (dx == 0) return new Point((int) x0, (int) (y0 + b * dy / Math.abs(dy))); double d = dy / dx; double h = y0 - d * x0; // calculate intersection double e = a * a * d * d + b * b; double f = - 2 * x0 * e; double g = a * a * d * d * x0 * x0 + b * b * x0 * x0 - a * a * b * b; double det = Math.sqrt(f * f - 4 * e * g); // two solutions (perimeter points) double xout1 = (-f + det) / (2 * e); double xout2 = (-f - det) / (2 * e); double yout1 = d * xout1 + h; double yout2 = d * xout2 + h; double dist1Squ = Math.pow((xout1 - x1), 2) + Math.pow((yout1 - y1), 2); double dist2Squ = Math.pow((xout2 - x1), 2) + Math.pow((yout2 - y1), 2); // correct solution double xout, yout; if (dist1Squ < dist2Squ) { xout = xout1; yout = yout1; } else { xout = xout2; yout = yout2; } return getAttributes().createPoint(xout, yout); }
Rectangle2D r = getBounds(); double x = r.getX(); double y = r.getY(); double a = (r.getWidth() + 1) / 2; double b = (r.getHeight() + 1) / 2; double x0 = x + a; double y0 = y + b; double x1 = p.getX(); double y1 = p.getY(); double dx = x1 - x0; double dy = y1 - y0; if (dx == 0) return new Point((int) x0, (int) (y0 + b * dy / Math.abs(dy))); double d = dy / dx; double h = y0 - d * x0; double e = a * a * d * d + b * b; double f = - 2 * x0 * e; double g = a * a * d * d * x0 * x0 + b * b * x0 * x0 - a * a * b * b; double det = Math.sqrt(f * f - 4 * e * g); double xout1 = (-f + det) / (2 * e); double xout2 = (-f - det) / (2 * e); double yout1 = d * xout1 + h; double yout2 = d * xout2 + h; double dist1Squ = Math.pow((xout1 - x1), 2) + Math.pow((yout1 - y1), 2); double dist2Squ = Math.pow((xout2 - x1), 2) + Math.pow((yout2 - y1), 2); double xout, yout; if (dist1Squ < dist2Squ) { xout = xout1; yout = yout1; } else { xout = xout2; yout = yout2; } return getAttributes().createPoint(xout, yout); }
/** * Returns the intersection of the bounding rectangle and the * straight line between the source and the specified point p. * The specified point is expected not to intersect the bounds. */
Returns the intersection of the bounding rectangle and the straight line between the source and the specified point p. The specified point is expected not to intersect the bounds
getPerimeterPoint
{ "repo_name": "Baltasarq/Gia", "path": "src/JGraph/examples/com/jgraph/example/fastgraph/FastCircleView.java", "license": "mit", "size": 4966 }
[ "java.awt.Point", "java.awt.geom.Rectangle2D" ]
import java.awt.Point; import java.awt.geom.Rectangle2D;
import java.awt.*; import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,224,343
public static <T> Queue<T> newMpscQueue(final int maxCapacity) { return Mpsc.newMpscQueue(maxCapacity); }
static <T> Queue<T> function(final int maxCapacity) { return Mpsc.newMpscQueue(maxCapacity); }
/** * Create a new {@link Queue} which is safe to use for multiple producers (different threads) and a single * consumer (one thread!). */
Create a new <code>Queue</code> which is safe to use for multiple producers (different threads) and a single consumer (one thread!)
newMpscQueue
{ "repo_name": "gerdriesselmann/netty", "path": "common/src/main/java/io/netty/util/internal/PlatformDependent.java", "license": "apache-2.0", "size": 52979 }
[ "java.util.Queue" ]
import java.util.Queue;
import java.util.*;
[ "java.util" ]
java.util;
1,677,740
public boolean optimizedParam( List<CalibrationObservation> observations , List<Point2D_F64> grid , Zhang99ParamAll initial , Zhang99ParamAll found , UnconstrainedLeastSquares optimizer ) { if( optimizer == null ) { // optimizer = FactoryOptimization.leastSquaresTrustRegion(1, // RegionStepType.DOG_LEG_FTF,true); optimizer = FactoryOptimization.leastSquaresLM(1e-3,true); // optimizer = FactoryOptimization.leastSquareLevenberg(1e-3); } double model[] = new double[ initial.numParameters() ]; initial.convertToParam(model); Zhang99OptimizationFunction func = new Zhang99OptimizationFunction( initial.createNew(), grid,observations); Zhang99OptimizationJacobian jacobian = new Zhang99OptimizationJacobian( initial.assumeZeroSkew,initial.radial.length,initial.includeTangential, observations,grid); optimizer.setFunction(func,jacobian); optimizer.initialize(model,1e-10,1e-25*observations.size()); for( int i = 0; i < 500; i++ ) { if( optimizer.iterate() ) { break; } else { if( i % 25 == 0 ) status("Progress "+(100*i/500.0)+"%"); } } double param[] = optimizer.getParameters(); found.setFromParam(param); return true; } /** * Converts results fond in the linear algorithms into {@link Zhang99ParamAll}
boolean function( List<CalibrationObservation> observations , List<Point2D_F64> grid , Zhang99ParamAll initial , Zhang99ParamAll found , UnconstrainedLeastSquares optimizer ) { if( optimizer == null ) { optimizer = FactoryOptimization.leastSquaresLM(1e-3,true); } double model[] = new double[ initial.numParameters() ]; initial.convertToParam(model); Zhang99OptimizationFunction func = new Zhang99OptimizationFunction( initial.createNew(), grid,observations); Zhang99OptimizationJacobian jacobian = new Zhang99OptimizationJacobian( initial.assumeZeroSkew,initial.radial.length,initial.includeTangential, observations,grid); optimizer.setFunction(func,jacobian); optimizer.initialize(model,1e-10,1e-25*observations.size()); for( int i = 0; i < 500; i++ ) { if( optimizer.iterate() ) { break; } else { if( i % 25 == 0 ) status(STR+(100*i/500.0)+"%"); } } double param[] = optimizer.getParameters(); found.setFromParam(param); return true; } /** * Converts results fond in the linear algorithms into {@link Zhang99ParamAll}
/** * Use non-linear optimization to improve the parameter estimates * * @param observations Observations of calibration points in each image * @param grid Location of calibration points on calibration target * @param initial Initial estimate of calibration parameters. * @param found The refined calibration parameters. * @param optimizer Algorithm used to optimize parameters */
Use non-linear optimization to improve the parameter estimates
optimizedParam
{ "repo_name": "bladestery/Sapphire", "path": "example_apps/AndroidStudioMinnie/sapphire/src/main/java/boofcv/alg/geo/calibration/CalibrationPlanarGridZhang99.java", "license": "mit", "size": 9914 }
[ "java.util.List", "org.ddogleg.optimization.FactoryOptimization", "org.ddogleg.optimization.UnconstrainedLeastSquares" ]
import java.util.List; import org.ddogleg.optimization.FactoryOptimization; import org.ddogleg.optimization.UnconstrainedLeastSquares;
import java.util.*; import org.ddogleg.optimization.*;
[ "java.util", "org.ddogleg.optimization" ]
java.util; org.ddogleg.optimization;
1,041,807
public static ReactorResult<Document> getAllbiboPresentedat_as(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource) { return Base.getAll_as(model, instanceResource, PRESENTEDAT, Document.class); }
static ReactorResult<Document> function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource) { return Base.getAll_as(model, instanceResource, PRESENTEDAT, Document.class); }
/** * Get all values of property Presentedat as a ReactorResult of Document * @param model an RDF2Go model * @param resource an RDF2Go resource * @return a ReactorResult of $type which can conveniently be converted to iterator, list or array * * [Generated from RDFReactor template rule #get11static-reactorresult] */
Get all values of property Presentedat as a ReactorResult of Document
getAllbiboPresentedat_as
{ "repo_name": "alexgarciac/testbiotea", "path": "src/ws/biotea/ld2rdf/rdf/model/bibo/BiboEvent.java", "license": "apache-2.0", "size": 20852 }
[ "org.ontoware.rdf2go.model.Model", "org.ontoware.rdfreactor.runtime.Base", "org.ontoware.rdfreactor.runtime.ReactorResult" ]
import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base; import org.ontoware.rdfreactor.runtime.ReactorResult;
import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdf2go", "org.ontoware.rdfreactor" ]
org.ontoware.rdf2go; org.ontoware.rdfreactor;
1,725,730
protected boolean getSessionRestoreState(Bundle savedInstanceState) { final SharedPreferences prefs = getSharedPreferences(); boolean shouldRestore = false; final int versionCode = getVersionCode(); if (getSessionRestoreResumeOnce(prefs)) { shouldRestore = true; } else if (mLastSessionCrashed) { if (incrementCrashCount(prefs) <= getSessionStoreMaxCrashResumes(prefs) && getSessionRestoreAfterCrashPreference(prefs)) { shouldRestore = true; } else { shouldRestore = false; } } else if (prefs.getInt(PREFS_VERSION_CODE, 0) != versionCode) { // If the version has changed, the user has done an upgrade, so restore // previous tabs. prefs.edit().putInt(PREFS_VERSION_CODE, versionCode).apply(); shouldRestore = true; } else if (savedInstanceState != null || getSessionRestorePreference(prefs).equals("always") || getRestartFromIntent()) { // We're coming back from a background kill by the OS, the user // has chosen to always restore, or we restarted. shouldRestore = true; } return shouldRestore; }
boolean function(Bundle savedInstanceState) { final SharedPreferences prefs = getSharedPreferences(); boolean shouldRestore = false; final int versionCode = getVersionCode(); if (getSessionRestoreResumeOnce(prefs)) { shouldRestore = true; } else if (mLastSessionCrashed) { if (incrementCrashCount(prefs) <= getSessionStoreMaxCrashResumes(prefs) && getSessionRestoreAfterCrashPreference(prefs)) { shouldRestore = true; } else { shouldRestore = false; } } else if (prefs.getInt(PREFS_VERSION_CODE, 0) != versionCode) { prefs.edit().putInt(PREFS_VERSION_CODE, versionCode).apply(); shouldRestore = true; } else if (savedInstanceState != null getSessionRestorePreference(prefs).equals(STR) getRestartFromIntent()) { shouldRestore = true; } return shouldRestore; }
/** * Determine whether the session should be restored. * * @param savedInstanceState Saved instance state given to the activity * @return Whether to restore */
Determine whether the session should be restored
getSessionRestoreState
{ "repo_name": "bill-mccloskey/searchfox", "path": "tests/tests/files/GeckoApp.java", "license": "mpl-2.0", "size": 104036 }
[ "android.content.SharedPreferences", "android.os.Bundle" ]
import android.content.SharedPreferences; import android.os.Bundle;
import android.content.*; import android.os.*;
[ "android.content", "android.os" ]
android.content; android.os;
1,772,690
public static IMethodBinding findDeclaredMethod( ITypeBinding type, String methodName, String... paramTypes) { outer: for (IMethodBinding method : type.getDeclaredMethods()) { if (method.getName().equals(methodName)) { ITypeBinding[] foundParamTypes = method.getParameterTypes(); if (paramTypes.length == foundParamTypes.length) { for (int i = 0; i < paramTypes.length; i++) { if (!paramTypes[i].equals(foundParamTypes[i].getQualifiedName())) { continue outer; } } return method; } } } return null; }
static IMethodBinding function( ITypeBinding type, String methodName, String... paramTypes) { outer: for (IMethodBinding method : type.getDeclaredMethods()) { if (method.getName().equals(methodName)) { ITypeBinding[] foundParamTypes = method.getParameterTypes(); if (paramTypes.length == foundParamTypes.length) { for (int i = 0; i < paramTypes.length; i++) { if (!paramTypes[i].equals(foundParamTypes[i].getQualifiedName())) { continue outer; } } return method; } } } return null; }
/** * Returns the method binding for a specific method of a specific type. */
Returns the method binding for a specific method of a specific type
findDeclaredMethod
{ "repo_name": "Sellegit/j2objc", "path": "translator/src/main/java/com/google/devtools/j2objc/util/BindingUtil.java", "license": "apache-2.0", "size": 30958 }
[ "org.eclipse.jdt.core.dom.IMethodBinding", "org.eclipse.jdt.core.dom.ITypeBinding" ]
import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
1,346,948
void activate() throws SQLException;
void activate() throws SQLException;
/** * The activate method is called when the instance is activated * from its &quot;passive&quot; state. * @throws SQLException if something goes wrong with the activation. * When this happens, a call will be issued to {@link #remove()} and * the object will no longer be part of the pool. */
The activate method is called when the instance is activated from its &quot;passive&quot; state
activate
{ "repo_name": "zhangh43/incubator-hawq", "path": "src/pl/pljava/src/java/pljava/org/postgresql/pljava/PooledObject.java", "license": "apache-2.0", "size": 1206 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,136,384
@Test public void testOddLengthID3ChunkFile() { Exception exceptionCaught = null; File orig = new File("testdata", "test144.aif"); if (!orig.isFile()) { System.err.println("Unable to test file - not available" + orig); return; } TagOptionSingleton.getInstance().setWavOptions(WavOptions.READ_ID3_ONLY_AND_SYNC); TagOptionSingleton.getInstance().setWavSaveOptions(WavSaveOptions.SAVE_BOTH_AND_SYNC); File testFile = TestUtil.copyAudioToTmp("test144.aif", new File("test144Odd.aif")); try { AudioFile f = AudioFileIO.read(testFile); f.getTag().or(NullTag.INSTANCE).deleteField(FieldKey.ACOUSTID_ID); f.getTag().or(NullTag.INSTANCE).deleteField(FieldKey.ACOUSTID_FINGERPRINT); f.save(); f = AudioFileIO.read(testFile); f.getTag().or(NullTag.INSTANCE).setField(FieldKey.ARTIST, "freddy"); f.save(); f = AudioFileIO.read(testFile); System.out.println(f.getTag()); assertEquals(f.getTag().or(NullTag.INSTANCE).getFirst(FieldKey.ARTIST), "freddy"); } catch (Exception e) { e.printStackTrace(); exceptionCaught = e; } Assert.assertNull(exceptionCaught); }
@Test void function() { Exception exceptionCaught = null; File orig = new File(STR, STR); if (!orig.isFile()) { System.err.println(STR + orig); return; } TagOptionSingleton.getInstance().setWavOptions(WavOptions.READ_ID3_ONLY_AND_SYNC); TagOptionSingleton.getInstance().setWavSaveOptions(WavSaveOptions.SAVE_BOTH_AND_SYNC); File testFile = TestUtil.copyAudioToTmp(STR, new File(STR)); try { AudioFile f = AudioFileIO.read(testFile); f.getTag().or(NullTag.INSTANCE).deleteField(FieldKey.ACOUSTID_ID); f.getTag().or(NullTag.INSTANCE).deleteField(FieldKey.ACOUSTID_FINGERPRINT); f.save(); f = AudioFileIO.read(testFile); f.getTag().or(NullTag.INSTANCE).setField(FieldKey.ARTIST, STR); f.save(); f = AudioFileIO.read(testFile); System.out.println(f.getTag()); assertEquals(f.getTag().or(NullTag.INSTANCE).getFirst(FieldKey.ARTIST), STR); } catch (Exception e) { e.printStackTrace(); exceptionCaught = e; } Assert.assertNull(exceptionCaught); }
/** * Starts of with Id3chunk which is odd but doesnt have padding byte but at end of file * so can still read, then we write to it padding bit added and when read/write again we * correctly work out ID3chunk is still at end of file. */
Starts of with Id3chunk which is odd but doesnt have padding byte but at end of file so can still read, then we write to it padding bit added and when read/write again we correctly work out ID3chunk is still at end of file
testOddLengthID3ChunkFile
{ "repo_name": "pandasys/ealvatag", "path": "ealvatag/src/test/java/ealvatag/tag/aiff/AiffAudioTagTest.java", "license": "lgpl-3.0", "size": 28680 }
[ "java.io.File", "org.junit.Assert", "org.junit.Test" ]
import java.io.File; import org.junit.Assert; import org.junit.Test;
import java.io.*; import org.junit.*;
[ "java.io", "org.junit" ]
java.io; org.junit;
1,402,486
EReference getForkType_Documentation();
EReference getForkType_Documentation();
/** * Returns the meta object for the containment reference list '{@link org.ebxml.business.process.ForkType#getDocumentation <em>Documentation</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Documentation</em>'. * @see org.ebxml.business.process.ForkType#getDocumentation() * @see #getForkType() * @generated */
Returns the meta object for the containment reference list '<code>org.ebxml.business.process.ForkType#getDocumentation Documentation</code>'.
getForkType_Documentation
{ "repo_name": "GRA-UML/tool", "path": "plugins/org.ijis.gra.ebxml.ebBPSS/src/main/java/org/ebxml/business/process/ProcessPackage.java", "license": "epl-1.0", "size": 274455 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,355,804
public static synchronized void warmCodec(String mimeType, boolean secure) { try { getMediaCodecInfo(mimeType, secure); } catch (DecoderQueryException e) { // Codec warming is best effort, so we can swallow the exception. Log.e(TAG, "Codec warming failed", e); } }
static synchronized void function(String mimeType, boolean secure) { try { getMediaCodecInfo(mimeType, secure); } catch (DecoderQueryException e) { Log.e(TAG, STR, e); } }
/** * Optional call to warm the codec cache for a given mime type. * <p> * Calling this method may speed up subsequent calls to {@link #getDecoderInfo(String, boolean)}. * * @param mimeType The mime type. * @param secure Whether the decoder is required to support secure decryption. Always pass false * unless secure decryption really is required. */
Optional call to warm the codec cache for a given mime type. Calling this method may speed up subsequent calls to <code>#getDecoderInfo(String, boolean)</code>
warmCodec
{ "repo_name": "ajrulez/ExoPlayer", "path": "library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java", "license": "apache-2.0", "size": 13465 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,336,979
public StampedAndroidManifest mergeWithDeps( AndroidDataContext dataContext, AndroidSemantics androidSemantics, RuleErrorConsumer errorConsumer, ResourceDependencies resourceDeps, Map<String, String> manifestValues, @Nullable String manifestMerger) { Map<Artifact, Label> mergeeManifests = getMergeeManifests( resourceDeps.getResourceContainers(), dataContext.getAndroidConfig().getManifestMergerOrder()); Artifact newManifest; if (useLegacyMerging(errorConsumer, dataContext.getAndroidConfig(), manifestMerger)) { newManifest = androidSemantics .maybeDoLegacyManifestMerging(mergeeManifests, dataContext, manifest) .orElse(manifest); } else if (!mergeeManifests.isEmpty() || !manifestValues.isEmpty()) { newManifest = dataContext.getUniqueDirectoryArtifact("_merged", "AndroidManifest.xml"); new ManifestMergerActionBuilder() .setManifest(manifest) .setMergeeManifests(mergeeManifests) .setLibrary(false) .setManifestValues(manifestValues) .setCustomPackage(pkg) .setManifestOutput(newManifest) .setLogOut(dataContext.getUniqueDirectoryArtifact("_merged", "manifest_merger_log.txt")) .build(dataContext); } else { newManifest = manifest; } return new StampedAndroidManifest(newManifest, pkg, exported); }
StampedAndroidManifest function( AndroidDataContext dataContext, AndroidSemantics androidSemantics, RuleErrorConsumer errorConsumer, ResourceDependencies resourceDeps, Map<String, String> manifestValues, @Nullable String manifestMerger) { Map<Artifact, Label> mergeeManifests = getMergeeManifests( resourceDeps.getResourceContainers(), dataContext.getAndroidConfig().getManifestMergerOrder()); Artifact newManifest; if (useLegacyMerging(errorConsumer, dataContext.getAndroidConfig(), manifestMerger)) { newManifest = androidSemantics .maybeDoLegacyManifestMerging(mergeeManifests, dataContext, manifest) .orElse(manifest); } else if (!mergeeManifests.isEmpty() !manifestValues.isEmpty()) { newManifest = dataContext.getUniqueDirectoryArtifact(STR, STR); new ManifestMergerActionBuilder() .setManifest(manifest) .setMergeeManifests(mergeeManifests) .setLibrary(false) .setManifestValues(manifestValues) .setCustomPackage(pkg) .setManifestOutput(newManifest) .setLogOut(dataContext.getUniqueDirectoryArtifact(STR, STR)) .build(dataContext); } else { newManifest = manifest; } return new StampedAndroidManifest(newManifest, pkg, exported); }
/** * Merges the manifest with any dependent manifests * * <p>The manifest will also be stamped with any manifest values specified * * <p>If there is no merging to be done and no manifest values are specified, the manifest will * remain unstamped. * * @param manifestMerger if not null, a string dictating which manifest merger to use */
Merges the manifest with any dependent manifests The manifest will also be stamped with any manifest values specified If there is no merging to be done and no manifest values are specified, the manifest will remain unstamped
mergeWithDeps
{ "repo_name": "dslomov/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/android/AndroidManifest.java", "license": "apache-2.0", "size": 16046 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.cmdline.Label", "com.google.devtools.build.lib.packages.RuleErrorConsumer", "java.util.Map", "javax.annotation.Nullable" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.packages.RuleErrorConsumer; import java.util.Map; import javax.annotation.Nullable;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.cmdline.*; import com.google.devtools.build.lib.packages.*; import java.util.*; import javax.annotation.*;
[ "com.google.devtools", "java.util", "javax.annotation" ]
com.google.devtools; java.util; javax.annotation;
572,559
final int targetLength(final int dimension) { long size = 1; for (int i=0; i<dimension; i++) { size *= targetSize[i]; } return toIntExact(size); }
final int targetLength(final int dimension) { long size = 1; for (int i=0; i<dimension; i++) { size *= targetSize[i]; } return toIntExact(size); }
/** * Returns the total number of values to be read from the sub-region while applying the subsampling. * This method takes in account only the given number of dimensions. */
Returns the total number of values to be read from the sub-region while applying the subsampling. This method takes in account only the given number of dimensions
targetLength
{ "repo_name": "apache/sis", "path": "storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java", "license": "apache-2.0", "size": 10846 }
[ "java.lang.Math" ]
import java.lang.Math;
import java.lang.*;
[ "java.lang" ]
java.lang;
2,613,615
@Override public FinishApplicationMasterResponse finishApplicationMaster( FinishApplicationMasterRequest request) throws YarnException, IOException { LOG.info("Finishing application master. Tracking Url:" + request.getTrackingUrl()); RequestInterceptorChainWrapper pipeline = authorizeAndGetInterceptorChain(); return pipeline.getRootInterceptor().finishApplicationMaster(request); }
FinishApplicationMasterResponse function( FinishApplicationMasterRequest request) throws YarnException, IOException { LOG.info(STR + request.getTrackingUrl()); RequestInterceptorChainWrapper pipeline = authorizeAndGetInterceptorChain(); return pipeline.getRootInterceptor().finishApplicationMaster(request); }
/** * This is called by the AMs started on this node to unregister from the RM. * This method does the initial authorization and then forwards the request to * the application instance specific intercepter chain. */
This is called by the AMs started on this node to unregister from the RM. This method does the initial authorization and then forwards the request to the application instance specific intercepter chain
finishApplicationMaster
{ "repo_name": "WIgor/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/AMRMProxyService.java", "license": "apache-2.0", "size": 23228 }
[ "java.io.IOException", "org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest", "org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse", "org.apache.hadoop.yarn.exceptions.YarnException" ]
import java.io.IOException; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; import org.apache.hadoop.yarn.exceptions.YarnException;
import java.io.*; import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,482,625
public void setCurrentItemOrArmor(int slotIn, ItemStack stack) { super.setCurrentItemOrArmor(slotIn, stack); if (!this.worldObj.isRemote && slotIn == 0) { this.setCombatTask(); } }
void function(int slotIn, ItemStack stack) { super.setCurrentItemOrArmor(slotIn, stack); if (!this.worldObj.isRemote && slotIn == 0) { this.setCombatTask(); } }
/** * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot */
Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot
setCurrentItemOrArmor
{ "repo_name": "dogjaw2233/tiu-s-mod", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/monster/EntitySkeleton.java", "license": "lgpl-2.1", "size": 14082 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
305,468
public List<Cursor> getInactiveCursors() { List<Cursor> cursors = new ArrayList<Cursor>(); cursors.addAll(unusedCursors); return cursors; }
List<Cursor> function() { List<Cursor> cursors = new ArrayList<Cursor>(); cursors.addAll(unusedCursors); return cursors; }
/** * Request the {@link CursorManager} for a list of {@link Cursor}s that are not currently * active. </p> * These {@link Cursor}s are declared in the settings.xml but do not have an {@link * IoDevice} attached to them. * * @return the list of inactive {@link Cursor}s */
Request the <code>CursorManager</code> for a list of <code>Cursor</code>s that are not currently active. These <code>Cursor</code>s are declared in the settings.xml but do not have an <code>IoDevice</code> attached to them
getInactiveCursors
{ "repo_name": "parthmehta209/GearVRf", "path": "GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java", "license": "apache-2.0", "size": 33968 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
711,744
public static void rumble(int padID, double state) { final EmulationActivity emulationActivity = sEmulationActivity.get(); if (emulationActivity == null) { Log.warning("[NativeLibrary] EmulationActivity is null"); return; } Rumble.checkRumble(padID, state); }
static void function(int padID, double state) { final EmulationActivity emulationActivity = sEmulationActivity.get(); if (emulationActivity == null) { Log.warning(STR); return; } Rumble.checkRumble(padID, state); }
/** * Rumble sent from native. Currently only supports phone rumble. * * @param padID Ignored for now. Future use would be to pass rumble to a connected controller * @param state Ignored for now since phone rumble can't just be 'turned' on/off */
Rumble sent from native. Currently only supports phone rumble
rumble
{ "repo_name": "lioncash/dolphin", "path": "Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java", "license": "gpl-2.0", "size": 19586 }
[ "org.dolphinemu.dolphinemu.activities.EmulationActivity", "org.dolphinemu.dolphinemu.utils.Log", "org.dolphinemu.dolphinemu.utils.Rumble" ]
import org.dolphinemu.dolphinemu.activities.EmulationActivity; import org.dolphinemu.dolphinemu.utils.Log; import org.dolphinemu.dolphinemu.utils.Rumble;
import org.dolphinemu.dolphinemu.activities.*; import org.dolphinemu.dolphinemu.utils.*;
[ "org.dolphinemu.dolphinemu" ]
org.dolphinemu.dolphinemu;
750,689
public static java.util.Set extractUserAssessFavouritesSet(ims.domain.ILightweightDomainFactory domainFactory, ims.assessment.vo.UserAssessmentFavouritesShortVoCollection voCollection) { return extractUserAssessFavouritesSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.assessment.vo.UserAssessmentFavouritesShortVoCollection voCollection) { return extractUserAssessFavouritesSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.assessment.configuration.domain.objects.UserAssessFavourites set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.assessment.configuration.domain.objects.UserAssessFavourites set from the value object collection
extractUserAssessFavouritesSet
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/assessment/vo/domain/UserAssessmentFavouritesShortVoAssembler.java", "license": "agpl-3.0", "size": 18628 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
655,897
public boolean evaluate() { return true; } }; private static final long serialVersionUID = 1L; private IWizardStep activeStep; private final List<ICondition> conditions = new ArrayList<ICondition>(); private final ArrayListStack<IWizardStep> history = new ArrayListStack<IWizardStep>(); private final List<IWizardStep> steps = new ArrayList<IWizardStep>(); public WizardModel() { }
boolean function() { return true; } }; private static final long serialVersionUID = 1L; private IWizardStep activeStep; private final List<ICondition> conditions = new ArrayList<ICondition>(); private final ArrayListStack<IWizardStep> history = new ArrayListStack<IWizardStep>(); private final List<IWizardStep> steps = new ArrayList<IWizardStep>(); public WizardModel() { }
/** * Always returns true. * * @return True */
Always returns true
evaluate
{ "repo_name": "martin-g/wicket-osgi", "path": "wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardModel.java", "license": "apache-2.0", "size": 7787 }
[ "java.util.ArrayList", "java.util.List", "org.apache.wicket.util.collections.ArrayListStack" ]
import java.util.ArrayList; import java.util.List; import org.apache.wicket.util.collections.ArrayListStack;
import java.util.*; import org.apache.wicket.util.collections.*;
[ "java.util", "org.apache.wicket" ]
java.util; org.apache.wicket;
1,493,509
private Shell getActiveWindowShell() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow(); return activeWindow.getShell(); }
Shell function() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow(); return activeWindow.getShell(); }
/** * Returns the active window shell. * * @return the active window shell. */
Returns the active window shell
getActiveWindowShell
{ "repo_name": "d-case/d-case_editor", "path": "net.dependableos.dcase.diagram/src/net/dependableos/dcase/diagram/ui/editpolicies/BasicNodeOpenEditPolicy.java", "license": "epl-1.0", "size": 14429 }
[ "org.eclipse.swt.widgets.Shell", "org.eclipse.ui.IWorkbench", "org.eclipse.ui.IWorkbenchWindow", "org.eclipse.ui.PlatformUI" ]
import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI;
import org.eclipse.swt.widgets.*; import org.eclipse.ui.*;
[ "org.eclipse.swt", "org.eclipse.ui" ]
org.eclipse.swt; org.eclipse.ui;
364,033
public void dataset2Table(DefaultPieDataset dataset){ double value; rowNumber = dataset.getItemCount(); columnNumber = 2; example = new String[rowNumber][columnNumber]; columnNames = new String[columnNumber]; columnNames[0]="Name"; columnNames[1]="Value"; for (int i=0; i<rowNumber; i++){ try{ example[i][0] = (String)(dataset.getKey(i)); } catch(Exception e){ example[i][0] = "nNaN"; } try{ value = dataset.getValue(i).doubleValue(); example[i][1] = Double.toString(value);} catch(Exception e){ example[i][1] = "NaN"; } } dataTable = new JTable(example, columnNames); return; }
void function(DefaultPieDataset dataset){ double value; rowNumber = dataset.getItemCount(); columnNumber = 2; example = new String[rowNumber][columnNumber]; columnNames = new String[columnNumber]; columnNames[0]="Name"; columnNames[1]="Value"; for (int i=0; i<rowNumber; i++){ try{ example[i][0] = (String)(dataset.getKey(i)); } catch(Exception e){ example[i][0] = "nNaN"; } try{ value = dataset.getValue(i).doubleValue(); example[i][1] = Double.toString(value);} catch(Exception e){ example[i][1] = "NaN"; } } dataTable = new JTable(example, columnNames); return; }
/** * use the data from a DefaultPieDataset to fill a JTable * @param dataset */
use the data from a DefaultPieDataset to fill a JTable
dataset2Table
{ "repo_name": "SOCR/HTML5_WebSite", "path": "SOCR2.8/src/edu/ucla/stat/SOCR/chart/data/DataConvertor.java", "license": "lgpl-3.0", "size": 26356 }
[ "javax.swing.JTable", "org.jfree.data.general.DefaultPieDataset" ]
import javax.swing.JTable; import org.jfree.data.general.DefaultPieDataset;
import javax.swing.*; import org.jfree.data.general.*;
[ "javax.swing", "org.jfree.data" ]
javax.swing; org.jfree.data;
1,999,125
public String getUserUuid() throws SystemException;
String function() throws SystemException;
/** * Returns the user uuid of this dossier process. * * @return the user uuid of this dossier process * @throws SystemException if a system exception occurred */
Returns the user uuid of this dossier process
getUserUuid
{ "repo_name": "thongdv/OEPv2", "path": "portlets/oep-core-processmgt-portlet/docroot/WEB-INF/service/org/oep/core/processmgt/model/DossierProcessModel.java", "license": "apache-2.0", "size": 7492 }
[ "com.liferay.portal.kernel.exception.SystemException" ]
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.exception.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,224,778
private void clearOldStoredRegistrationToken() { Log.d(LOG_TAG, "Remove old registration token"); getPushSharedPreferences() .edit() .remove(PREFS_PUSHER_REGISTRATION_TOKEN_KEY) .apply(); }
void function() { Log.d(LOG_TAG, STR); getPushSharedPreferences() .edit() .remove(PREFS_PUSHER_REGISTRATION_TOKEN_KEY) .apply(); }
/** * Remove the old registration token */
Remove the old registration token
clearOldStoredRegistrationToken
{ "repo_name": "vector-im/riot-android", "path": "vector/src/main/java/im/vector/push/PushManager.java", "license": "apache-2.0", "size": 55873 }
[ "org.matrix.androidsdk.core.Log" ]
import org.matrix.androidsdk.core.Log;
import org.matrix.androidsdk.core.*;
[ "org.matrix.androidsdk" ]
org.matrix.androidsdk;
1,721,054
void relocate(ServiceProvisionListener listener, Uuid uuid) throws ServiceBeanManagerException;
void relocate(ServiceProvisionListener listener, Uuid uuid) throws ServiceBeanManagerException;
/** * Relocate (move) a ServiceBean instance to another compute resource * * @param listener A ServiceProvisionListener that will be notified of * the result of the relocate request * @param uuid The uuid of a * {@link org.rioproject.deploy.ServiceBeanInstantiator} to relocate * to. If null, the OperationalStringManager will determine a suitable * resource * * @throws ServiceBeanManagerException if any errors occur communicating with the * OperationalStringManager, or with the OperationalStringManager's * processing of the request */
Relocate (move) a ServiceBean instance to another compute resource
relocate
{ "repo_name": "dreedyman/Rio", "path": "rio-lib/src/main/groovy/org/rioproject/servicebean/ServiceBeanManager.java", "license": "apache-2.0", "size": 6576 }
[ "net.jini.id.Uuid", "org.rioproject.deploy.ServiceProvisionListener" ]
import net.jini.id.Uuid; import org.rioproject.deploy.ServiceProvisionListener;
import net.jini.id.*; import org.rioproject.deploy.*;
[ "net.jini.id", "org.rioproject.deploy" ]
net.jini.id; org.rioproject.deploy;
410,654
public double solve(final double scalarMin, final double scalarMax, final double okError, final double okFraction, final int numberIterations, Monitor monitor) { if (monitor == null) { monitor = Monitor.NULL_MONITOR; } monitor.report(0.0); int nter = numberIterations; if (nter < 6) { nter = 6; } final double[] xs = {0.0, 0.25, 0.75, 1.0}; // Assume bias toward endpoints final double[] fs = new double[4]; for (int i = 0; i < fs.length; ++i) { fs[i] = function(xs[i], scalarMin, scalarMax); } int iter = 4; double xmin; double error = 1.0; double previousError = 1.0; while (true) { monitor.report(((double) iter) / nter); // Find new minimum point final int imin = sort(xs, fs); xmin = xs[imin]; // update error estimate final double previousPreviousError = previousError; previousError = error; if (imin == 0) { error = xs[1] - xs[0]; } else if (imin == 3) { error = xs[3] - xs[2]; } else if (imin == 1 || imin == 2) { error = xs[imin + 1] - xs[imin - 1]; } else { assert (false) : ("impossible imin=" + imin); } final double fraction = Almost.FLOAT.divide(error, xmin, 0.0); // Is it time to stop and use the current answer? if (iter >= nter || (error < okError && fraction < okFraction) || monitor.isCanceled()) { // LOG.fine("DONE"); break; } // Find next point to evaluate function double xnew = Float.MAX_VALUE; if (imin == 0) { // Move fast toward left endpoint assert (xs[imin] == 0.0) : ("Left endpoint should be zero, not " + xs[imin]); xnew = xs[1] * 0.1; // LOG.fine("Move rapidly to left"); } else if (imin == 3) { // Move fast toward right endpoint assert (xs[imin] == 1.0) : ("Right endpoint should be one, not " + xs[imin]); xnew = 1.0 - 0.1 * (1.0 - xs[2]); // LOG.fine("Move rapidly to right"); } else if (imin == 1 || imin == 2) { // Have bounded minimum boolean goodConvergence = false; if (error < previousPreviousError * 0.501) { // converging linearly? // Try parabolic method for hyperlinear convergence. // LOG.fine("good convergence so far"); try { xnew = minParabola(xs[imin - 1], fs[imin - 1], xs[imin], fs[imin], xs[imin + 1], fs[imin + 1]); // LOG.fine("Good parabola "); goodConvergence = true; } catch (BadParabolaException e) { // LOG.fine("Bad parabola: "+e.getLocalizedMessage()); goodConvergence = false; } } if (!goodConvergence) { // Converging badly. Resort to golden section. if (xs[imin] - xs[imin - 1] >= xs[imin + 1] - xs[imin]) { // Left side is larger. // LOG.fine("left side is larger"); xnew = xs[imin - 1] + GOLD * (xs[imin] - xs[imin - 1]); } else { // Right side is larger // LOG.fine("right side is larger"); xnew = xs[imin + 1] - GOLD * (xs[imin + 1] - xs[imin]); } } } else { assert (false) : ("Impossible imin=" + imin); } // LOG.fine("xnew="+xnew); assert (xnew != Float.MAX_VALUE) : ("bad xnew"); // evaluate function at new point double fnew = Float.MAX_VALUE; // don't repeat a calculation for (int i = 0; i < xs.length; ++i) { if (Almost.FLOAT.equal(xnew, xs[i])) { // LOG.fine("Recycle xs["+i+"]="+xs[i]+" fs["+i+"]="+xs[i]); fnew = fs[i]; } } if (fnew == Float.MAX_VALUE) { // call expensive function fnew = function(xnew, scalarMin, scalarMax); } // LOG.fine("fnew="+fnew); // save on top of discarded value before resorting if (imin < 2) { xs[3] = xnew; fs[3] = fnew; // LOG.fine("updated xs[3]="+xs[3]+ " fs[3]="+fs[3]); } else { xs[0] = xnew; fs[0] = fnew; // LOG.fine("updated xs[0]="+xs[0]+ " fs[0]="+fs[0]); } // completed an iteration ++iter; } assert (xmin >= 0.0 && xmin <= 1.0) : ("Impossible xmin=" + xmin); final double result = scalarMin + xmin * (scalarMax - scalarMin); // LOG.fine("result="+result); monitor.report(1.0); return result; } private final double[] _doubleTemp = new double[4]; // reused after profiling
double function(final double scalarMin, final double scalarMax, final double okError, final double okFraction, final int numberIterations, Monitor monitor) { if (monitor == null) { monitor = Monitor.NULL_MONITOR; } monitor.report(0.0); int nter = numberIterations; if (nter < 6) { nter = 6; } final double[] xs = {0.0, 0.25, 0.75, 1.0}; final double[] fs = new double[4]; for (int i = 0; i < fs.length; ++i) { fs[i] = function(xs[i], scalarMin, scalarMax); } int iter = 4; double xmin; double error = 1.0; double previousError = 1.0; while (true) { monitor.report(((double) iter) / nter); final int imin = sort(xs, fs); xmin = xs[imin]; final double previousPreviousError = previousError; previousError = error; if (imin == 0) { error = xs[1] - xs[0]; } else if (imin == 3) { error = xs[3] - xs[2]; } else if (imin == 1 imin == 2) { error = xs[imin + 1] - xs[imin - 1]; } else { assert (false) : (STR + imin); } final double fraction = Almost.FLOAT.divide(error, xmin, 0.0); if (iter >= nter (error < okError && fraction < okFraction) monitor.isCanceled()) { break; } double xnew = Float.MAX_VALUE; if (imin == 0) { assert (xs[imin] == 0.0) : (STR + xs[imin]); xnew = xs[1] * 0.1; } else if (imin == 3) { assert (xs[imin] == 1.0) : (STR + xs[imin]); xnew = 1.0 - 0.1 * (1.0 - xs[2]); } else if (imin == 1 imin == 2) { boolean goodConvergence = false; if (error < previousPreviousError * 0.501) { try { xnew = minParabola(xs[imin - 1], fs[imin - 1], xs[imin], fs[imin], xs[imin + 1], fs[imin + 1]); goodConvergence = true; } catch (BadParabolaException e) { goodConvergence = false; } } if (!goodConvergence) { if (xs[imin] - xs[imin - 1] >= xs[imin + 1] - xs[imin]) { xnew = xs[imin - 1] + GOLD * (xs[imin] - xs[imin - 1]); } else { xnew = xs[imin + 1] - GOLD * (xs[imin + 1] - xs[imin]); } } } else { assert (false) : (STR + imin); } assert (xnew != Float.MAX_VALUE) : (STR); double fnew = Float.MAX_VALUE; for (int i = 0; i < xs.length; ++i) { if (Almost.FLOAT.equal(xnew, xs[i])) { fnew = fs[i]; } } if (fnew == Float.MAX_VALUE) { fnew = function(xnew, scalarMin, scalarMax); } if (imin < 2) { xs[3] = xnew; fs[3] = fnew; } else { xs[0] = xnew; fs[0] = fnew; } ++iter; } assert (xmin >= 0.0 && xmin <= 1.0) : (STR + xmin); final double result = scalarMin + xmin * (scalarMax - scalarMin); monitor.report(1.0); return result; } private final double[] _doubleTemp = new double[4];
/** * Minimize a function of scalar and return the optimum value. * * @param scalarMin The minimum value allowed for the argument scalar. * @param scalarMax The maximum value allowed for the argument scalar. * @param okError The unknown error in scalar should be less than this * fraction of the range: dscalar/(scalarMax-scalarMin) &lt;= okError, * where dscalar is the error bound on the returned value of scalar. * @param okFraction The error in scalar should be less than * this fraction of the minimum possible range for scalar: * dscalar &lt;= okFraction*(scalar-scalarMin), * where dscalar is the error bound on the returned value of scalar. * @param numberIterations The maximum number of iterations if greater * than 6. The optimization performs at least 6 iterations -- * the minimum necessary for a genuinely parabolic function. * I recommend at least 20. * @param monitor For reporting progress. Ignored if null. * @return The optimum value minimizing the function. */
Minimize a function of scalar and return the optimum value
solve
{ "repo_name": "ctrueden/jtk", "path": "src/main/java/edu/mines/jtk/opt/ScalarSolver.java", "license": "epl-1.0", "size": 16178 }
[ "edu.mines.jtk.util.Almost", "edu.mines.jtk.util.Monitor" ]
import edu.mines.jtk.util.Almost; import edu.mines.jtk.util.Monitor;
import edu.mines.jtk.util.*;
[ "edu.mines.jtk" ]
edu.mines.jtk;
1,887,246
private TransplantForm(String id, IModel<Transplant> transplantIModel, List<Component> componentsToUpdate) { super(id, transplantIModel); RadarRequiredDateTextField date = new RadarRequiredDateTextField("date", this, componentsToUpdate); add(date); RadarRequiredDropdownChoice modality = new RadarRequiredDropdownChoice("modality", transplantManager.getTransplantModalitites(), new ChoiceRenderer("description", "id"), this, componentsToUpdate); add(modality); YesNoRadioGroup recurr = new YesNoRadioGroup("recurr") { @Override public boolean isEnabled() { Transplant transplant = TransplantForm.this.getModelObject(); if (transplant != null) { if (transplant.getDateFailureRejectData() != null && transplant.getId() != null) { if (transplant.getDateFailureRejectData().getFailureDate() != null) { return false; } } } return true; }
TransplantForm(String id, IModel<Transplant> transplantIModel, List<Component> componentsToUpdate) { super(id, transplantIModel); RadarRequiredDateTextField date = new RadarRequiredDateTextField("date", this, componentsToUpdate); add(date); RadarRequiredDropdownChoice modality = new RadarRequiredDropdownChoice(STR, transplantManager.getTransplantModalitites(), new ChoiceRenderer(STR, "id"), this, componentsToUpdate); add(modality); YesNoRadioGroup recurr = new YesNoRadioGroup(STR) { public boolean function() { Transplant transplant = TransplantForm.this.getModelObject(); if (transplant != null) { if (transplant.getDateFailureRejectData() != null && transplant.getId() != null) { if (transplant.getDateFailureRejectData().getFailureDate() != null) { return false; } } } return true; }
/** * disable input if editing and date of failure is set */
disable input if editing and date of failure is set
isEnabled
{ "repo_name": "robworth/patientview", "path": "patientview-parent/radar/src/main/java/org/patientview/radar/web/panels/followup/RrtTherapyPanel.java", "license": "gpl-3.0", "size": 23936 }
[ "java.util.List", "org.apache.wicket.Component", "org.apache.wicket.markup.html.form.ChoiceRenderer", "org.apache.wicket.model.IModel", "org.patientview.radar.model.Transplant", "org.patientview.radar.web.components.RadarRequiredDateTextField", "org.patientview.radar.web.components.RadarRequiredDropdownChoice", "org.patientview.radar.web.components.YesNoRadioGroup" ]
import java.util.List; import org.apache.wicket.Component; import org.apache.wicket.markup.html.form.ChoiceRenderer; import org.apache.wicket.model.IModel; import org.patientview.radar.model.Transplant; import org.patientview.radar.web.components.RadarRequiredDateTextField; import org.patientview.radar.web.components.RadarRequiredDropdownChoice; import org.patientview.radar.web.components.YesNoRadioGroup;
import java.util.*; import org.apache.wicket.*; import org.apache.wicket.markup.html.form.*; import org.apache.wicket.model.*; import org.patientview.radar.model.*; import org.patientview.radar.web.components.*;
[ "java.util", "org.apache.wicket", "org.patientview.radar" ]
java.util; org.apache.wicket; org.patientview.radar;
1,827,198
return Collection.class.isAssignableFrom(clazz); }
return Collection.class.isAssignableFrom(clazz); }
/** * TODO Auto-generated method documentation * * @param clazz * @return boolean */
TODO Auto-generated method documentation
supports
{ "repo_name": "DISID/disid-proofs", "path": "spring-roo-entity-format/src/main/java/org/springframework/roo/entityformat/validation/CollectionValidator.java", "license": "gpl-3.0", "size": 2250 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
793,802
public void execute(final CCTask task, final List sources, final Map targets, final TargetInfo linkTarget) { try { projectWriter.writeProject(outFile, task, this, sources, targets, linkTarget); } catch (BuildException ex) { if (failOnError) { throw ex; } else { task.log(ex.toString()); } } catch (Exception ex) { if (failOnError) { throw new BuildException(ex); } else { task.log(ex.toString()); } } }
void function(final CCTask task, final List sources, final Map targets, final TargetInfo linkTarget) { try { projectWriter.writeProject(outFile, task, this, sources, targets, linkTarget); } catch (BuildException ex) { if (failOnError) { throw ex; } else { task.log(ex.toString()); } } catch (Exception ex) { if (failOnError) { throw new BuildException(ex); } else { task.log(ex.toString()); } } }
/** * Executes the task. Compiles the given files. * * @param task cc task * @param sources source files (includes headers) * @param targets compilation targets * @param linkTarget link target */
Executes the task. Compiles the given files
execute
{ "repo_name": "1spatial/cpptasks-parallel", "path": "src/main/java/net/sf/antcontrib/cpptasks/ide/ProjectDef.java", "license": "apache-2.0", "size": 8895 }
[ "java.util.List", "java.util.Map", "net.sf.antcontrib.cpptasks.CCTask", "net.sf.antcontrib.cpptasks.TargetInfo", "org.apache.tools.ant.BuildException" ]
import java.util.List; import java.util.Map; import net.sf.antcontrib.cpptasks.CCTask; import net.sf.antcontrib.cpptasks.TargetInfo; import org.apache.tools.ant.BuildException;
import java.util.*; import net.sf.antcontrib.cpptasks.*; import org.apache.tools.ant.*;
[ "java.util", "net.sf.antcontrib", "org.apache.tools" ]
java.util; net.sf.antcontrib; org.apache.tools;
1,307,018
void onActivityResult(int requestCode, int resultCode, Intent data);
void onActivityResult(int requestCode, int resultCode, Intent data);
/** * Handle the sign result by either finishing the calling activity or sending an {@link * IdpProvider.IdpCallback} response. */
Handle the sign result by either finishing the calling activity or sending an <code>IdpProvider.IdpCallback</code> response
onActivityResult
{ "repo_name": "samtstern/FirebaseUI-Android", "path": "auth/src/main/java/com/firebase/ui/auth/provider/Provider.java", "license": "apache-2.0", "size": 794 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
934,025
private void setUpDataDir() { // Create primary data dir if it does not exist File dataDir = new File(config.getDataDir()); FileUtils.createDir(dataDir); // Create secondary data dir if it does not exist File secondaryDataDir = new File(config.getSecondaryDataDir()); FileUtils.createDir(secondaryDataDir); }
void function() { File dataDir = new File(config.getDataDir()); FileUtils.createDir(dataDir); File secondaryDataDir = new File(config.getSecondaryDataDir()); FileUtils.createDir(secondaryDataDir); }
/** * Delete and recreate the data directory. */
Delete and recreate the data directory
setUpDataDir
{ "repo_name": "dmitrypekar/hdfs", "path": "hdfs-executor/src/main/java/org/apache/mesos/hdfs/executor/AbstractNodeExecutor.java", "license": "apache-2.0", "size": 12766 }
[ "java.io.File", "org.apache.mesos.file.FileUtils" ]
import java.io.File; import org.apache.mesos.file.FileUtils;
import java.io.*; import org.apache.mesos.file.*;
[ "java.io", "org.apache.mesos" ]
java.io; org.apache.mesos;
2,771,445
public void addAll(List<T> items) { mDataSet.addAll(items); notifyDataSetChanged(); }
void function(List<T> items) { mDataSet.addAll(items); notifyDataSetChanged(); }
/** * add all items * @param items */
add all items
addAll
{ "repo_name": "free-iot/freeiot-android", "path": "app/src/main/java/com/pandocloud/freeiot/ui/base/EasyBaseAdapter.java", "license": "mit", "size": 2613 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,045,488
Map<String, RecommendedElasticPool> listRecommendedElasticPools();
Map<String, RecommendedElasticPool> listRecommendedElasticPools();
/** * Returns all the recommended elastic pools for the server. * * @return list of recommended elastic pools for the server */
Returns all the recommended elastic pools for the server
listRecommendedElasticPools
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlServer.java", "license": "mit", "size": 16626 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,202,712
public NumberReplicas countNodes(Block b) { int decommissioned = 0; int live = 0; int corrupt = 0; int excess = 0; int stale = 0; Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b); for(DatanodeStorageInfo storage : blocksMap.getStorages(b, State.NORMAL)) { final DatanodeDescriptor node = storage.getDatanodeDescriptor(); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; } else if (node.isDecommissionInProgress() || node.isDecommissioned()) { decommissioned++; } else { LightWeightLinkedSet<Block> blocksExcess = excessReplicateMap.get(node .getDatanodeUuid()); if (blocksExcess != null && blocksExcess.contains(b)) { excess++; } else { live++; } } if (storage.areBlockContentsStale()) { stale++; } } return new NumberReplicas(live, decommissioned, corrupt, excess, stale); }
NumberReplicas function(Block b) { int decommissioned = 0; int live = 0; int corrupt = 0; int excess = 0; int stale = 0; Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b); for(DatanodeStorageInfo storage : blocksMap.getStorages(b, State.NORMAL)) { final DatanodeDescriptor node = storage.getDatanodeDescriptor(); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; } else if (node.isDecommissionInProgress() node.isDecommissioned()) { decommissioned++; } else { LightWeightLinkedSet<Block> blocksExcess = excessReplicateMap.get(node .getDatanodeUuid()); if (blocksExcess != null && blocksExcess.contains(b)) { excess++; } else { live++; } } if (storage.areBlockContentsStale()) { stale++; } } return new NumberReplicas(live, decommissioned, corrupt, excess, stale); }
/** * Return the number of nodes hosting a given block, grouped * by the state of those replicas. */
Return the number of nodes hosting a given block, grouped by the state of those replicas
countNodes
{ "repo_name": "Wajihulhassan/Hadoop-2.7.0", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java", "license": "apache-2.0", "size": 146618 }
[ "java.util.Collection", "org.apache.hadoop.hdfs.protocol.Block", "org.apache.hadoop.hdfs.server.protocol.DatanodeStorage", "org.apache.hadoop.hdfs.util.LightWeightLinkedSet" ]
import java.util.Collection; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.util.LightWeightLinkedSet;
import java.util.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.protocol.*; import org.apache.hadoop.hdfs.util.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
384,559
EAttribute getProfileEqualityConstraint_MaximumGap();
EAttribute getProfileEqualityConstraint_MaximumGap();
/** * Returns the meta object for the attribute '{@link gov.nasa.ensemble.core.plan.resources.profile.ProfileEqualityConstraint#getMaximumGap <em>Maximum Gap</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Maximum Gap</em>'. * @see gov.nasa.ensemble.core.plan.resources.profile.ProfileEqualityConstraint#getMaximumGap() * @see #getProfileEqualityConstraint() * @generated */
Returns the meta object for the attribute '<code>gov.nasa.ensemble.core.plan.resources.profile.ProfileEqualityConstraint#getMaximumGap Maximum Gap</code>'.
getProfileEqualityConstraint_MaximumGap
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.ensemble.core.plan.resources/src/gov/nasa/ensemble/core/plan/resources/profile/ProfilePackage.java", "license": "apache-2.0", "size": 58239 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
129,096
private void init(Locker locker) throws DatabaseException { trace(Level.FINEST, "SecondaryDatabase open"); secondaryConfig = (SecondaryConfig) configuration; primaryDb.addTrigger(secondaryTrigger, false); Database foreignDb = secondaryConfig.getForeignKeyDatabase(); if (foreignDb != null) { foreignDb.addTrigger(foreignKeyTrigger, true); } if (secondaryConfig.getAllowPopulate()) { Cursor secCursor = null; Cursor priCursor = null; try { secCursor = new Cursor(this, locker, null); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); OperationStatus status = secCursor.position(key, data, LockMode.DEFAULT, true); if (status == OperationStatus.NOTFOUND) { priCursor = new Cursor(primaryDb, locker, null); status = priCursor.position(key, data, LockMode.DEFAULT, true); while (status == OperationStatus.SUCCESS) { updateSecondary(locker, secCursor, key, null, data); status = priCursor.retrieveNext(key, data, LockMode.DEFAULT, GetMode.NEXT); } } } finally { if (secCursor != null) { secCursor.close(); } if (priCursor != null) { priCursor.close(); } } } }
void function(Locker locker) throws DatabaseException { trace(Level.FINEST, STR); secondaryConfig = (SecondaryConfig) configuration; primaryDb.addTrigger(secondaryTrigger, false); Database foreignDb = secondaryConfig.getForeignKeyDatabase(); if (foreignDb != null) { foreignDb.addTrigger(foreignKeyTrigger, true); } if (secondaryConfig.getAllowPopulate()) { Cursor secCursor = null; Cursor priCursor = null; try { secCursor = new Cursor(this, locker, null); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); OperationStatus status = secCursor.position(key, data, LockMode.DEFAULT, true); if (status == OperationStatus.NOTFOUND) { priCursor = new Cursor(primaryDb, locker, null); status = priCursor.position(key, data, LockMode.DEFAULT, true); while (status == OperationStatus.SUCCESS) { updateSecondary(locker, secCursor, key, null, data); status = priCursor.retrieveNext(key, data, LockMode.DEFAULT, GetMode.NEXT); } } } finally { if (secCursor != null) { secCursor.close(); } if (priCursor != null) { priCursor.close(); } } } }
/** * Adds secondary to primary's list, and populates the secondary if needed. */
Adds secondary to primary's list, and populates the secondary if needed
init
{ "repo_name": "ckaestne/LEADT", "path": "CIDE_Samples/cide_samples/Berkeley DB JE/src/com/sleepycat/je/SecondaryDatabase.java", "license": "gpl-3.0", "size": 31607 }
[ "com.sleepycat.je.dbi.GetMode", "com.sleepycat.je.txn.Locker", "java.util.logging.Level" ]
import com.sleepycat.je.dbi.GetMode; import com.sleepycat.je.txn.Locker; import java.util.logging.Level;
import com.sleepycat.je.dbi.*; import com.sleepycat.je.txn.*; import java.util.logging.*;
[ "com.sleepycat.je", "java.util" ]
com.sleepycat.je; java.util;
882,276
default AdvancedTimerEndpointBuilder timer(Timer timer) { doSetProperty("timer", timer); return this; }
default AdvancedTimerEndpointBuilder timer(Timer timer) { doSetProperty("timer", timer); return this; }
/** * To use a custom Timer. * * The option is a: &lt;code&gt;java.util.Timer&lt;/code&gt; type. * * Group: advanced * * @param timer the value to set * @return the dsl builder */
To use a custom Timer. The option is a: &lt;code&gt;java.util.Timer&lt;/code&gt; type. Group: advanced
timer
{ "repo_name": "nikhilvibhav/camel", "path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TimerEndpointBuilderFactory.java", "license": "apache-2.0", "size": 18718 }
[ "java.util.Timer" ]
import java.util.Timer;
import java.util.*;
[ "java.util" ]
java.util;
278,931
private static void gatherDescriptionParticipants(Query_c query, Object monitor) { for(NonRootModelElement element : descriptionElementsInScope) { Object uiElement = getUIInstance(element); // now create the necessary participant query.Createparticipant(uiElement.getClass().getName(), ((NonRootModelElement) uiElement).getInstanceKey(), ((NonRootModelElement) uiElement).getModelRoot().getId(), ActionLanguageDescriptionUtil .getDescriptionAttributeValue(element)); IProgressMonitor progressMonitor = (IProgressMonitor) monitor; if(progressMonitor.isCanceled()) { return; } } }
static void function(Query_c query, Object monitor) { for(NonRootModelElement element : descriptionElementsInScope) { Object uiElement = getUIInstance(element); query.Createparticipant(uiElement.getClass().getName(), ((NonRootModelElement) uiElement).getInstanceKey(), ((NonRootModelElement) uiElement).getModelRoot().getId(), ActionLanguageDescriptionUtil .getDescriptionAttributeValue(element)); IProgressMonitor progressMonitor = (IProgressMonitor) monitor; if(progressMonitor.isCanceled()) { return; } } }
/** * Locate all elements that have a Descrip attribute, which are within the * configured scope. Create the necessary Participant element for each. * * @param query * @param monitor */
Locate all elements that have a Descrip attribute, which are within the configured scope. Create the necessary Participant element for each
gatherDescriptionParticipants
{ "repo_name": "jason-rhodes/bridgepoint", "path": "src/org.xtuml.bp.core/src/org/xtuml/bp/core/Search_c.java", "license": "apache-2.0", "size": 11447 }
[ "org.eclipse.core.runtime.IProgressMonitor", "org.xtuml.bp.core.common.NonRootModelElement", "org.xtuml.bp.core.util.ActionLanguageDescriptionUtil" ]
import org.eclipse.core.runtime.IProgressMonitor; import org.xtuml.bp.core.common.NonRootModelElement; import org.xtuml.bp.core.util.ActionLanguageDescriptionUtil;
import org.eclipse.core.runtime.*; import org.xtuml.bp.core.common.*; import org.xtuml.bp.core.util.*;
[ "org.eclipse.core", "org.xtuml.bp" ]
org.eclipse.core; org.xtuml.bp;
427,514
public void set(int x, int y, RainbowImage img) { graphics.set(x, y, img); }
void function(int x, int y, RainbowImage img) { graphics.set(x, y, img); }
/** * Efficient method of drawing an image's pixels directly to this surface. * No variations are employed, meaning that any scale, tint, or imageMode * settings will be ignored. */
Efficient method of drawing an image's pixels directly to this surface. No variations are employed, meaning that any scale, tint, or imageMode settings will be ignored
set
{ "repo_name": "juankysoriano/rainbow", "path": "rainbow-lib/src/main/java/com/juankysoriano/rainbow/core/drawing/RainbowDrawer.java", "license": "lgpl-3.0", "size": 51728 }
[ "com.juankysoriano.rainbow.core.graphics.RainbowImage" ]
import com.juankysoriano.rainbow.core.graphics.RainbowImage;
import com.juankysoriano.rainbow.core.graphics.*;
[ "com.juankysoriano.rainbow" ]
com.juankysoriano.rainbow;
1,675,088
@Test public void testOnNodeAdded_Fedetated() throws Exception { createPowerTarget(); ConversionTable conversionTable = PowerMockito .spy(new ConversionTable()); conversionTable.addEntryConnectionType("OriginalNetworkId", Federator.ORIGINAL_NETWORK); conversionTable.addEntryConnectionType("FederatedNetworkId", Federator.FEDERATED_NETWORK); PowerMockito.doReturn(conversionTable).when(target, "conversionTable"); NetworkInterface netIf = Mockito.spy(new NetworkInterface(dispatcher, "OriginalNetworkId")); HashMap<String, NetworkInterface> netMap = new HashMap<>(); netMap.put("FederatedNetworkId", netIf); PowerMockito.doReturn(netMap).when(target, "networkInterfaces"); Node node = new Node("NodeId"); target.onNodeAdded("FederatedNetworkId", node); verify(conversionTable, never()).addEntryNode(anyString(), anyString(), anyString(), anyString()); PowerMockito.verifyPrivate(target, never()).invoke("networkInterfaces"); }
void function() throws Exception { createPowerTarget(); ConversionTable conversionTable = PowerMockito .spy(new ConversionTable()); conversionTable.addEntryConnectionType(STR, Federator.ORIGINAL_NETWORK); conversionTable.addEntryConnectionType(STR, Federator.FEDERATED_NETWORK); PowerMockito.doReturn(conversionTable).when(target, STR); NetworkInterface netIf = Mockito.spy(new NetworkInterface(dispatcher, STR)); HashMap<String, NetworkInterface> netMap = new HashMap<>(); netMap.put(STR, netIf); PowerMockito.doReturn(netMap).when(target, STR); Node node = new Node(STR); target.onNodeAdded(STR, node); verify(conversionTable, never()).addEntryNode(anyString(), anyString(), anyString(), anyString()); PowerMockito.verifyPrivate(target, never()).invoke(STR); }
/** * Test method for {@link org.o3project.odenos.component.federator.Federator#onNodeAdded(java.lang.String, org.o3project.odenos.core.component.network.topology.Node)}. * @throws Exception throws Exception in targets */
Test method for <code>org.o3project.odenos.component.federator.Federator#onNodeAdded(java.lang.String, org.o3project.odenos.core.component.network.topology.Node)</code>
testOnNodeAdded_Fedetated
{ "repo_name": "haizawa/odenos", "path": "src/test/java/org/o3project/odenos/component/federator/FederatorTest.java", "license": "apache-2.0", "size": 77248 }
[ "java.util.HashMap", "org.mockito.Matchers", "org.mockito.Mockito", "org.o3project.odenos.core.component.ConversionTable", "org.o3project.odenos.core.component.NetworkInterface", "org.o3project.odenos.core.component.network.topology.Node", "org.powermock.api.mockito.PowerMockito" ]
import java.util.HashMap; import org.mockito.Matchers; import org.mockito.Mockito; import org.o3project.odenos.core.component.ConversionTable; import org.o3project.odenos.core.component.NetworkInterface; import org.o3project.odenos.core.component.network.topology.Node; import org.powermock.api.mockito.PowerMockito;
import java.util.*; import org.mockito.*; import org.o3project.odenos.core.component.*; import org.o3project.odenos.core.component.network.topology.*; import org.powermock.api.mockito.*;
[ "java.util", "org.mockito", "org.o3project.odenos", "org.powermock.api" ]
java.util; org.mockito; org.o3project.odenos; org.powermock.api;
2,784,421
protected IFigure setupContentPane(IFigure nodeShape) { if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); } return nodeShape; // use nodeShape itself as contentPane }
IFigure function(IFigure nodeShape) { if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); } return nodeShape; }
/** * Default implementation treats passed figure as content pane. * Respects layout one may have set for generated figure. * @param nodeShape instance of generated figure class * @generated */
Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure
setupContentPane
{ "repo_name": "nwnpallewela/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/parts/EntitlementOnAcceptContainerEditPart.java", "license": "apache-2.0", "size": 6776 }
[ "org.eclipse.draw2d.IFigure", "org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout" ]
import org.eclipse.draw2d.IFigure; import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.draw2d.*; import org.eclipse.gmf.runtime.draw2d.ui.figures.*;
[ "org.eclipse.draw2d", "org.eclipse.gmf" ]
org.eclipse.draw2d; org.eclipse.gmf;
2,034,487
Node getMatchedNode();
Node getMatchedNode();
/** * Retrieves the node in the source tree that matched * the template obtained via getMatchedTemplate(). * * @return the node in the source tree that matched * the template obtained via getMatchedTemplate(). */
Retrieves the node in the source tree that matched the template obtained via getMatchedTemplate()
getMatchedNode
{ "repo_name": "kcsl/immutability-benchmark", "path": "benchmark-applications/reiminfer-oopsla-2012/source/Xalan/src/org/apache/xalan/transformer/TransformState.java", "license": "mit", "size": 4240 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
15,935
static List<S3ObjectSummary> listObjectsChronologically(AmazonS3Client s3Client, S3ConfigBean s3ConfigBean, PathMatcher pathMatcher, AmazonS3Source.S3Offset s3Offset, int fetchSize) throws AmazonClientException {
static List<S3ObjectSummary> listObjectsChronologically(AmazonS3Client s3Client, S3ConfigBean s3ConfigBean, PathMatcher pathMatcher, AmazonS3Source.S3Offset s3Offset, int fetchSize) throws AmazonClientException {
/** * Lists objects from AmazonS3 in chronological order [lexicographical order if 2 files have same timestamp] which are * later than or equal to the timestamp of the previous offset object * * @param s3Client * @param s3ConfigBean * @param pathMatcher glob patterns to match file name against * @param s3Offset current offset which provides the timestamp of the previous object * @param fetchSize number of objects to fetch in one go * @return * @throws AmazonClientException */
Lists objects from AmazonS3 in chronological order [lexicographical order if 2 files have same timestamp] which are later than or equal to the timestamp of the previous offset object
listObjectsChronologically
{ "repo_name": "kiritbasu/datacollector", "path": "aws-lib/src/main/java/com/streamsets/pipeline/stage/origin/s3/AmazonS3Util.java", "license": "apache-2.0", "size": 6582 }
[ "com.amazonaws.AmazonClientException", "com.amazonaws.services.s3.AmazonS3Client", "com.amazonaws.services.s3.model.S3ObjectSummary", "java.nio.file.PathMatcher", "java.util.List" ]
import com.amazonaws.AmazonClientException; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.model.S3ObjectSummary; import java.nio.file.PathMatcher; import java.util.List;
import com.amazonaws.*; import com.amazonaws.services.s3.*; import com.amazonaws.services.s3.model.*; import java.nio.file.*; import java.util.*;
[ "com.amazonaws", "com.amazonaws.services", "java.nio", "java.util" ]
com.amazonaws; com.amazonaws.services; java.nio; java.util;
320,549
private EnvelopeType createSampleEnvelope( net.opengis.gml.profiles.gml4wcs.v_1_0_0.ObjectFactory gmlFactory, DirectPositionType lowerLeft, DirectPositionType upperRight, String crs) { EnvelopeType envelope = gmlFactory.createEnvelopeType(); return envelope.withSrsName(crs).withPos(lowerLeft, upperRight); }
EnvelopeType function( net.opengis.gml.profiles.gml4wcs.v_1_0_0.ObjectFactory gmlFactory, DirectPositionType lowerLeft, DirectPositionType upperRight, String crs) { EnvelopeType envelope = gmlFactory.createEnvelopeType(); return envelope.withSrsName(crs).withPos(lowerLeft, upperRight); }
/** * Creates a sample envelope. * * @param gmlFactory * Factory to build GML types. * @return The assembled sample EnvelopeType */
Creates a sample envelope
createSampleEnvelope
{ "repo_name": "juanrapoport/ogc-schemas", "path": "wcs/1.0.0/src/test/java/net/opengis/wcs/v_1_0_0/tests/WCS_V_1_0_0_Test.java", "license": "bsd-2-clause", "size": 11614 }
[ "net.opengis.gml.profiles.gml4wcs.v_1_0_0.DirectPositionType", "net.opengis.gml.profiles.gml4wcs.v_1_0_0.EnvelopeType" ]
import net.opengis.gml.profiles.gml4wcs.v_1_0_0.DirectPositionType; import net.opengis.gml.profiles.gml4wcs.v_1_0_0.EnvelopeType;
import net.opengis.gml.profiles.gml4wcs.v_1_0_0.*;
[ "net.opengis.gml" ]
net.opengis.gml;
2,689,431
@Override public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException { Sequence result = Sequence.EMPTY_SEQUENCE; // get the ftp connection details String host = args[0].getStringValue(); String username = args[1].getStringValue(); String password = args[2].getStringValue(); final FTPClient ftp = new FTPClient(); try { ftp.connect(host); log.debug("Connected to: " + host + ". " + ftp.getReplyString()); // After connection attempt, you should check the reply code to verify // success. int reply = ftp.getReplyCode(); if(!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); log.warn("FTP server refused connection."); } else { // store the Connection and return the uid handle of the Connection result = new IntegerValue(FTPClientModule.storeConnection(context, ftp)); } } catch(IOException se) { if(ftp.isConnected()) { try { ftp.disconnect(); } catch(IOException ioe) { log.error(ioe.getMessage(), ioe); } } } return result; }
Sequence function( Sequence[] args, Sequence contextSequence ) throws XPathException { Sequence result = Sequence.EMPTY_SEQUENCE; String host = args[0].getStringValue(); String username = args[1].getStringValue(); String password = args[2].getStringValue(); final FTPClient ftp = new FTPClient(); try { ftp.connect(host); log.debug(STR + host + STR + ftp.getReplyString()); int reply = ftp.getReplyCode(); if(!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); log.warn(STR); } else { result = new IntegerValue(FTPClientModule.storeConnection(context, ftp)); } } catch(IOException se) { if(ftp.isConnected()) { try { ftp.disconnect(); } catch(IOException ioe) { log.error(ioe.getMessage(), ioe); } } } return result; }
/** * evaluate the call to the xquery get-connection() function, it is really the main entry point of this class. * * @param args arguments from the get-connection() function call * @param contextSequence the Context Sequence to operate on (not used here internally!) * * @return A xs:long representing a handle to the connection * * @throws XPathException DOCUMENT ME! * * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) */
evaluate the call to the xquery get-connection() function, it is really the main entry point of this class
eval
{ "repo_name": "shabanovd/exist", "path": "extensions/modules/src/org/exist/xquery/modules/ftpclient/GetConnectionFunction.java", "license": "lgpl-2.1", "size": 4323 }
[ "java.io.IOException", "org.apache.commons.net.ftp.FTPClient", "org.apache.commons.net.ftp.FTPReply", "org.exist.xquery.XPathException", "org.exist.xquery.value.IntegerValue", "org.exist.xquery.value.Sequence" ]
import java.io.IOException; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPReply; import org.exist.xquery.XPathException; import org.exist.xquery.value.IntegerValue; import org.exist.xquery.value.Sequence;
import java.io.*; import org.apache.commons.net.ftp.*; import org.exist.xquery.*; import org.exist.xquery.value.*;
[ "java.io", "org.apache.commons", "org.exist.xquery" ]
java.io; org.apache.commons; org.exist.xquery;
498,359
public Plugin getPlugins() { return pluginAggregator; }
Plugin function() { return pluginAggregator; }
/** * Gets the plugins. * * @return the plugins */
Gets the plugins
getPlugins
{ "repo_name": "littleJava/mybatis-maven-generator", "path": "src/main/java/org/mybatis/generator/config/Context.java", "license": "apache-2.0", "size": 24014 }
[ "org.mybatis.generator.api.Plugin" ]
import org.mybatis.generator.api.Plugin;
import org.mybatis.generator.api.*;
[ "org.mybatis.generator" ]
org.mybatis.generator;
115,876
@Override public ChannelPromise setFailure(Throwable cause) { if (allowFailure()) { ++doneCount; lastFailure = cause; if (allPromisesDone()) { return setPromise(); } } return this; }
ChannelPromise function(Throwable cause) { if (allowFailure()) { ++doneCount; lastFailure = cause; if (allPromisesDone()) { return setPromise(); } } return this; }
/** * Fail this object if it has not already been failed. * <p> * This method will NOT throw an {@link IllegalStateException} if called multiple times * because that may be expected. */
Fail this object if it has not already been failed. This method will NOT throw an <code>IllegalStateException</code> if called multiple times because that may be expected
setFailure
{ "repo_name": "bryce-anderson/netty", "path": "codec-http2/src/main/java/io/netty/handler/codec/http2/Http2CodecUtil.java", "license": "apache-2.0", "size": 16778 }
[ "io.netty.channel.ChannelPromise" ]
import io.netty.channel.ChannelPromise;
import io.netty.channel.*;
[ "io.netty.channel" ]
io.netty.channel;
1,828,027
public Trade processRecordATrade(Stock stock) throws Exception { // store return value Trade trade; logger.info("\n\nPlease enter quantity of shared you want to BUY or SELL for " + stock.getStrStockSymbol()); double dUserSharesQuantity = getUserInputForSharesQuantity(); logger.info("\n\nPlease enter a price value for a " + stock.getStrStockSymbol() + " (in pennies)"); // get price value double dPrice = getUserPriceInput(); String strMessage = "\n\nWould you like to BUY OR SELL:\n"; strMessage += "1. BUY\n"; strMessage += "2. SELL\n"; strMessage += "\n"; logger.info(strMessage); // get user trade type TradeType tradeType = getUserInputForTradeType(); // create new trade trade = new Trade(stock, getCurrentDate(), dUserSharesQuantity, tradeType, dPrice); // return trade return trade; }
Trade function(Stock stock) throws Exception { Trade trade; logger.info(STR + stock.getStrStockSymbol()); double dUserSharesQuantity = getUserInputForSharesQuantity(); logger.info(STR + stock.getStrStockSymbol() + STR); double dPrice = getUserPriceInput(); String strMessage = STR; strMessage += STR; strMessage += STR; strMessage += "\n"; logger.info(strMessage); TradeType tradeType = getUserInputForTradeType(); trade = new Trade(stock, getCurrentDate(), dUserSharesQuantity, tradeType, dPrice); return trade; }
/** * Helper method that will prepare a trade object * * @param stock stock object * @return trade object * @throws Exception if price value will be illegal and if quantity of shares value will be illegal */
Helper method that will prepare a trade object
processRecordATrade
{ "repo_name": "vkrivcov/jpm-super-simple-stocks", "path": "src/main/java/com/jpm/stocks/util/SimpleStocksAppHelper.java", "license": "mit", "size": 8531 }
[ "com.jpm.stocks.model.Stock", "com.jpm.stocks.model.Trade", "com.jpm.stocks.model.TradeType" ]
import com.jpm.stocks.model.Stock; import com.jpm.stocks.model.Trade; import com.jpm.stocks.model.TradeType;
import com.jpm.stocks.model.*;
[ "com.jpm.stocks" ]
com.jpm.stocks;
1,357,788
if (sender instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) sender; return player.mcServer.getConfigurationManager().func_152596_g(player.getGameProfile()); } return false; }
if (sender instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) sender; return player.mcServer.getConfigurationManager().func_152596_g(player.getGameProfile()); } return false; }
/** * Determines if the a command sender is allowed to execute commands. * * @param sender the command sender. * @return true if the sender can execute the command, false if not. */
Determines if the a command sender is allowed to execute commands
isOperator
{ "repo_name": "Chekote/Blink", "path": "src/main/java/com/monkeyinabucket/forge/blink/command/Helper.java", "license": "mit", "size": 695 }
[ "net.minecraft.entity.player.EntityPlayerMP" ]
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
2,465,752
private String getMapPath(String outputFile) { String basePath = ""; if (outputFile.isEmpty()) { // If we have a js_module_binary rule, output the maps // at modulename_props_map.out, etc. if (!config.moduleOutputPathPrefix.isEmpty()) { basePath = config.moduleOutputPathPrefix; } else { basePath = "jscompiler"; } } else { // Get the path of the output file. File file = new File(outputFile); String outputFileName = file.getName(); // Strip the .js from the name. if (outputFileName.endsWith(".js")) { outputFileName = outputFileName.substring(0, outputFileName.length() - 3); } String fileParent = file.getParent(); if (fileParent == null) { basePath = outputFileName; } else { basePath = file.getParent() + File.separatorChar + outputFileName; } } return basePath; }
String function(String outputFile) { String basePath = STRjscompilerSTR.js")) { outputFileName = outputFileName.substring(0, outputFileName.length() - 3); } String fileParent = file.getParent(); if (fileParent == null) { basePath = outputFileName; } else { basePath = file.getParent() + File.separatorChar + outputFileName; } } return basePath; }
/** * Returns the path at which to output map file(s) based on the path at which * the JS binary will be placed. * * @return The path in which to place the generated map file(s). */
Returns the path at which to output map file(s) based on the path at which the JS binary will be placed
getMapPath
{ "repo_name": "GerHobbelt/closure-compiler", "path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java", "license": "apache-2.0", "size": 97801 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
166,459
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<PolicySetDefinitionInner>> getAtManagementGroupWithResponseAsync( String policySetDefinitionName, String managementGroupId);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<PolicySetDefinitionInner>> getAtManagementGroupWithResponseAsync( String policySetDefinitionName, String managementGroupId);
/** * This operation retrieves the policy set definition in the given management group with the given name. * * @param policySetDefinitionName The name of the policy set definition to get. * @param managementGroupId The ID of the management group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the policy set definition along with {@link Response} on successful completion of {@link Mono}. */
This operation retrieves the policy set definition in the given management group with the given name
getAtManagementGroupWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/PolicySetDefinitionsClient.java", "license": "mit", "size": 44671 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.resources.fluent.models.PolicySetDefinitionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.resources.fluent.models.PolicySetDefinitionInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.resources.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
118,205
protected void upgrade( String target, boolean downgradeable ) throws ProcessException { setupControlTables(); String version = dbVersion.getVersion(); if( target == null ) { LinkedHashSet<String> targets = getTargets( true, null, downgradeable ); if( targets.size() > 1 ) { throw new FatalException( "More than one possible target found, you should specify a target." ); } Assert.notEmpty( targets ); target = targets.iterator().next(); } else if( target.endsWith( "*" ) ) { String targetPrefix = target.substring( 0, target.length() - 1 ); LinkedHashSet<String> targets = getTargets( true, targetPrefix, downgradeable ); if( targets.size() > 1 ) { throw new FatalException( "More than one possible target found for " + target ); } if( targets.isEmpty() ) { throw new FatalException( "Target " + target + " is not reachable from version " + StringUtils.defaultString( version, "<no version>" ) ); } target = targets.iterator().next(); } else { LinkedHashSet<String> targets = getTargets( false, null, downgradeable ); Assert.notEmpty( targets ); // TODO Refactor this, put this in getTargets() boolean found = false; for( String t : targets ) { if( Objects.equals( t, target ) ) { found = true; break; } } if( !found ) { throw new FatalException( "Target " + target + " is not reachable from version " + StringUtils.defaultString( version, "<no version>" ) ); } } if( Objects.equals( target, version ) ) { progress.noUpgradeNeeded(); return; } upgrade( version, target, downgradeable ); }
void function( String target, boolean downgradeable ) throws ProcessException { setupControlTables(); String version = dbVersion.getVersion(); if( target == null ) { LinkedHashSet<String> targets = getTargets( true, null, downgradeable ); if( targets.size() > 1 ) { throw new FatalException( STR ); } Assert.notEmpty( targets ); target = targets.iterator().next(); } else if( target.endsWith( "*" ) ) { String targetPrefix = target.substring( 0, target.length() - 1 ); LinkedHashSet<String> targets = getTargets( true, targetPrefix, downgradeable ); if( targets.size() > 1 ) { throw new FatalException( STR + target ); } if( targets.isEmpty() ) { throw new FatalException( STR + target + STR + StringUtils.defaultString( version, STR ) ); } target = targets.iterator().next(); } else { LinkedHashSet<String> targets = getTargets( false, null, downgradeable ); Assert.notEmpty( targets ); boolean found = false; for( String t : targets ) { if( Objects.equals( t, target ) ) { found = true; break; } } if( !found ) { throw new FatalException( STR + target + STR + StringUtils.defaultString( version, STR ) ); } } if( Objects.equals( target, version ) ) { progress.noUpgradeNeeded(); return; } upgrade( version, target, downgradeable ); }
/** * Perform upgrade to the given target version. The target version can end with an '*', indicating whatever tip * version that matches the target prefix. * * @param target The target requested. * @param downgradeable Indicates that downgrade paths are allowed to reach the given target. * @throws ProcessException When the execution of a command throws an {@link SQLException}. */
Perform upgrade to the given target version. The target version can end with an '*', indicating whatever tip version that matches the target prefix
upgrade
{ "repo_name": "sindicate/solidbase", "path": "src/main/java/solidbase/core/UpgradeProcessor.java", "license": "apache-2.0", "size": 19259 }
[ "java.util.LinkedHashSet", "java.util.Objects", "org.apache.commons.lang3.StringUtils" ]
import java.util.LinkedHashSet; import java.util.Objects; import org.apache.commons.lang3.StringUtils;
import java.util.*; import org.apache.commons.lang3.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
1,111,545
public static DataResult trustChannelConsume(Org org, Org trustOrg, User user, ListControl lc) { SelectMode m = ModeFactory.getMode("Channel_queries", "trust_channel_consume"); Map params = new HashMap(); params.put("org_id", trustOrg.getId()); params.put("user_id", user.getId()); params.put("org_id2", org.getId()); DataResult dr = makeDataResult(params, params, lc, m); return dr; }
static DataResult function(Org org, Org trustOrg, User user, ListControl lc) { SelectMode m = ModeFactory.getMode(STR, STR); Map params = new HashMap(); params.put(STR, trustOrg.getId()); params.put(STR, user.getId()); params.put(STR, org.getId()); DataResult dr = makeDataResult(params, params, lc, m); return dr; }
/** * Returns a list of ChannelTreeNodes containing all channels * the trusted org is consuming from a specific org * @param org Org that is sharing the channels * @param trustOrg org that is consuming the shared channels * @param user User of the sharing Org * @param lc ListControl to use * @return list of ChannelTreeNode's */
Returns a list of ChannelTreeNodes containing all channels the trusted org is consuming from a specific org
trustChannelConsume
{ "repo_name": "dmacvicar/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java", "license": "gpl-2.0", "size": 105505 }
[ "com.redhat.rhn.common.db.datasource.DataResult", "com.redhat.rhn.common.db.datasource.ModeFactory", "com.redhat.rhn.common.db.datasource.SelectMode", "com.redhat.rhn.domain.org.Org", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.listview.ListControl", "java.util.HashMap", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import com.redhat.rhn.domain.org.Org; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.listview.ListControl; import java.util.HashMap; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.org.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.listview.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,311,965
public static void addToAggregation(Aggregation aggregation, AggregationKey key, long value) { BTraceRuntime.addToAggregation(aggregation, key, value); }
static void function(Aggregation aggregation, AggregationKey key, long value) { BTraceRuntime.addToAggregation(aggregation, key, value); }
/** * Adds a value to the aggregation with a grouping key. This method should be used when the * aggregation should effectively perform a "group by" on the key value. The aggregation will * calculate a separate aggregated value for each unique aggregation key. * * @param aggregation the aggregation to which the value should be added * @param key the grouping aggregation key */
Adds a value to the aggregation with a grouping key. This method should be used when the aggregation should effectively perform a "group by" on the key value. The aggregation will calculate a separate aggregated value for each unique aggregation key
addToAggregation
{ "repo_name": "jbachorik/btrace", "path": "btrace-core/src/main/java/org/openjdk/btrace/core/BTraceUtils.java", "license": "gpl-2.0", "size": 226306 }
[ "org.openjdk.btrace.core.aggregation.Aggregation", "org.openjdk.btrace.core.aggregation.AggregationKey" ]
import org.openjdk.btrace.core.aggregation.Aggregation; import org.openjdk.btrace.core.aggregation.AggregationKey;
import org.openjdk.btrace.core.aggregation.*;
[ "org.openjdk.btrace" ]
org.openjdk.btrace;
1,052,440
public static boolean isSurfacelessContextExtensionSupported() { if (Util.SDK_INT < 17) { return false; } EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); @Nullable String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS); return eglExtensions != null && eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT); }
static boolean function() { if (Util.SDK_INT < 17) { return false; } EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); @Nullable String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS); return eglExtensions != null && eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT); }
/** * Returns whether creating a GL context with {@value #EXTENSION_SURFACELESS_CONTEXT} is possible. */
Returns whether creating a GL context with #EXTENSION_SURFACELESS_CONTEXT is possible
isSurfacelessContextExtensionSupported
{ "repo_name": "amzn/exoplayer-amazon-port", "path": "library/core/src/main/java/com/google/android/exoplayer2/util/GlUtil.java", "license": "apache-2.0", "size": 14290 }
[ "android.opengl.EGLDisplay", "androidx.annotation.Nullable" ]
import android.opengl.EGLDisplay; import androidx.annotation.Nullable;
import android.opengl.*; import androidx.annotation.*;
[ "android.opengl", "androidx.annotation" ]
android.opengl; androidx.annotation;
1,847,867
public String executePrivilegedOperation(List<String> prefixCommands, PrivilegedOperation operation, File workingDir, Map<String, String> env, boolean grabOutput, boolean inheritParentEnv) throws PrivilegedOperationException { String[] fullCommandArray = getPrivilegedOperationExecutionCommand (prefixCommands, operation); ShellCommandExecutor exec = new ShellCommandExecutor(fullCommandArray, workingDir, env, 0L, inheritParentEnv); try { exec.execute(); if (LOG.isDebugEnabled()) { LOG.debug("command array:"); LOG.debug(Arrays.toString(fullCommandArray)); LOG.debug("Privileged Execution Operation Output:"); LOG.debug(exec.getOutput()); } } catch (ExitCodeException e) { if (operation.isFailureLoggingEnabled()) { StringBuilder logBuilder = new StringBuilder("Shell execution returned " + "exit code: ") .append(exec.getExitCode()) .append(". Privileged Execution Operation Stderr: ") .append(System.lineSeparator()) .append(e.getMessage()) .append(System.lineSeparator()) .append("Stdout: " + exec.getOutput()) .append(System.lineSeparator()); logBuilder.append("Full command array for failed execution: ") .append(System.lineSeparator()); logBuilder.append(Arrays.toString(fullCommandArray)); LOG.warn(logBuilder.toString()); } //stderr from shell executor seems to be stuffed into the exception //'message' - so, we have to extract it and set it as the error out throw new PrivilegedOperationException(e, e.getExitCode(), exec.getOutput(), e.getMessage()); } catch (IOException e) { LOG.warn("IOException executing command: ", e); throw new PrivilegedOperationException(e); } if (grabOutput) { return exec.getOutput(); } return null; }
String function(List<String> prefixCommands, PrivilegedOperation operation, File workingDir, Map<String, String> env, boolean grabOutput, boolean inheritParentEnv) throws PrivilegedOperationException { String[] fullCommandArray = getPrivilegedOperationExecutionCommand (prefixCommands, operation); ShellCommandExecutor exec = new ShellCommandExecutor(fullCommandArray, workingDir, env, 0L, inheritParentEnv); try { exec.execute(); if (LOG.isDebugEnabled()) { LOG.debug(STR); LOG.debug(Arrays.toString(fullCommandArray)); LOG.debug(STR); LOG.debug(exec.getOutput()); } } catch (ExitCodeException e) { if (operation.isFailureLoggingEnabled()) { StringBuilder logBuilder = new StringBuilder(STR + STR) .append(exec.getExitCode()) .append(STR) .append(System.lineSeparator()) .append(e.getMessage()) .append(System.lineSeparator()) .append(STR + exec.getOutput()) .append(System.lineSeparator()); logBuilder.append(STR) .append(System.lineSeparator()); logBuilder.append(Arrays.toString(fullCommandArray)); LOG.warn(logBuilder.toString()); } throw new PrivilegedOperationException(e, e.getExitCode(), exec.getOutput(), e.getMessage()); } catch (IOException e) { LOG.warn(STR, e); throw new PrivilegedOperationException(e); } if (grabOutput) { return exec.getOutput(); } return null; }
/** * Executes a privileged operation. It is up to the callers to ensure that * each privileged operation's parameters are constructed correctly. The * parameters are passed verbatim to the container-executor binary. * * @param prefixCommands in some cases ( e.g priorities using nice ), * prefix commands are necessary * @param operation the type and arguments for the operation to be executed * @param workingDir (optional) working directory for execution * @param env (optional) env of the command will include specified vars * @param grabOutput return (possibly large) shell command output * @param inheritParentEnv inherit the env vars from the parent process * @return stdout contents from shell executor - useful for some privileged * operations - e.g --tc_read * @throws org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationException */
Executes a privileged operation. It is up to the callers to ensure that each privileged operation's parameters are constructed correctly. The parameters are passed verbatim to the container-executor binary
executePrivilegedOperation
{ "repo_name": "xiao-chen/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/privileged/PrivilegedOperationExecutor.java", "license": "apache-2.0", "size": 10459 }
[ "java.io.File", "java.io.IOException", "java.util.Arrays", "java.util.List", "java.util.Map", "org.apache.hadoop.util.Shell" ]
import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.hadoop.util.Shell;
import java.io.*; import java.util.*; import org.apache.hadoop.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,225,082
protected void removeFromPortMap(IOFSwitch sw, long mac, short vlan) { if (vlan == (short) 0xffff) { vlan = 0; } Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw); if (swMap != null) swMap.remove(new MacVlanPair(mac, vlan)); }
void function(IOFSwitch sw, long mac, short vlan) { if (vlan == (short) 0xffff) { vlan = 0; } Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw); if (swMap != null) swMap.remove(new MacVlanPair(mac, vlan)); }
/** * Removes a host from the MAC/VLAN->SwitchPort mapping * @param sw The switch to remove the mapping from * @param mac The MAC address of the host to remove * @param vlan The VLAN that the host is on */
Removes a host from the MAC/VLAN->SwitchPort mapping
removeFromPortMap
{ "repo_name": "rjellinek/floodlight", "path": "src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java", "license": "apache-2.0", "size": 27734 }
[ "java.util.Map", "net.floodlightcontroller.core.IOFSwitch", "net.floodlightcontroller.core.types.MacVlanPair" ]
import java.util.Map; import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.core.types.MacVlanPair;
import java.util.*; import net.floodlightcontroller.core.*; import net.floodlightcontroller.core.types.*;
[ "java.util", "net.floodlightcontroller.core" ]
java.util; net.floodlightcontroller.core;
1,667,436
public static void recordDownloadPageOpen(@DownloadOpenSource int source, @Nullable Tab tab) { RecordHistogram.recordEnumeratedHistogram( "Android.DownloadPage.OpenSource", source, DownloadOpenSource.MAX_VALUE); // Below there are metrics per profile type, so there should be a tab to get profile. if (tab == null) return; Profile profile = Profile.fromWebContents(tab.getWebContents()); @BrowserProfileType int type = Profile.getBrowserProfileTypeFromProfile(profile); RecordHistogram.recordEnumeratedHistogram( "Download.OpenDownloads.PerProfileType", type, BrowserProfileType.MAX_VALUE + 1); if (source == DownloadOpenSource.MENU) { RecordHistogram.recordEnumeratedHistogram( "Download.OpenDownloadsFromMenu.PerProfileType", type, BrowserProfileType.MAX_VALUE + 1); } }
static void function(@DownloadOpenSource int source, @Nullable Tab tab) { RecordHistogram.recordEnumeratedHistogram( STR, source, DownloadOpenSource.MAX_VALUE); if (tab == null) return; Profile profile = Profile.fromWebContents(tab.getWebContents()); int type = Profile.getBrowserProfileTypeFromProfile(profile); RecordHistogram.recordEnumeratedHistogram( STR, type, BrowserProfileType.MAX_VALUE + 1); if (source == DownloadOpenSource.MENU) { RecordHistogram.recordEnumeratedHistogram( STR, type, BrowserProfileType.MAX_VALUE + 1); } }
/** * Records download home open metrics. * @param source The source where the user opened the download media file. * @param tab The active tab when opening download manager to reach profile. */
Records download home open metrics
recordDownloadPageOpen
{ "repo_name": "scheib/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/download/DownloadMetrics.java", "license": "bsd-3-clause", "size": 4733 }
[ "androidx.annotation.Nullable", "org.chromium.base.metrics.RecordHistogram", "org.chromium.chrome.browser.profiles.Profile", "org.chromium.chrome.browser.tab.Tab", "org.chromium.components.profile_metrics.BrowserProfileType" ]
import androidx.annotation.Nullable; import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.components.profile_metrics.BrowserProfileType;
import androidx.annotation.*; import org.chromium.base.metrics.*; import org.chromium.chrome.browser.profiles.*; import org.chromium.chrome.browser.tab.*; import org.chromium.components.profile_metrics.*;
[ "androidx.annotation", "org.chromium.base", "org.chromium.chrome", "org.chromium.components" ]
androidx.annotation; org.chromium.base; org.chromium.chrome; org.chromium.components;
1,802,027
public static String extractLastProgressId(String progressJson) { // TODO we should parse this bad JSON as a list of Progres objects and find the last one Pattern regex = Pattern.compile("\"id\"\\s*:\\s*\"([^\"]+)"); Matcher matcher = regex.matcher(progressJson); String answer = null; while (matcher.find()) { answer = matcher.group(1); } return answer; }
static String function(String progressJson) { Pattern regex = Pattern.compile("\"id\STR([^\"]+)"); Matcher matcher = regex.matcher(progressJson); String answer = null; while (matcher.find()) { answer = matcher.group(1); } return answer; }
/** * Given a sequence of Progress JSON objects, finds the last id attribute in the last object */
Given a sequence of Progress JSON objects, finds the last id attribute in the last object
extractLastProgressId
{ "repo_name": "EricWittmann/fabric8", "path": "components/docker-api/src/main/java/io/fabric8/docker/api/Dockers.java", "license": "apache-2.0", "size": 4564 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,626,391
public List<Property> getPredicateProperties() { if(predicateProperties == null) { predicateProperties = new ArrayList<Property>(); } return predicateProperties; }
List<Property> function() { if(predicateProperties == null) { predicateProperties = new ArrayList<Property>(); } return predicateProperties; }
/** * INTERNAL: * Return the list of predicate properties. Lazy initializes the list. * @return */
Return the list of predicate properties. Lazy initializes the list
getPredicateProperties
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/TypeInfo.java", "license": "epl-1.0", "size": 36207 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
966,166
public String getCreateColumnSQL(int sqlType, int length, int precision, int scale) { String type = null; switch (sqlType) { case Types.BOOLEAN: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.BIT, length, precision, scale); break; case Types.DATE: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.TIMESTAMP, length, precision, scale); break; case Types.TIME: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.TIMESTAMP, length, precision, scale); break; case Types.DOUBLE: type = getCreateColumnSQLImpl(Types.DOUBLE, length, precision, scale); break; case Types.NUMERIC: type = getCreateColumnSQLImpl(Types.NUMERIC, length, precision, scale); break; default: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); break; } if (type == null) type = getDefaultCreateTableSQL(sqlType, length, precision, scale); return type; }
String function(int sqlType, int length, int precision, int scale) { String type = null; switch (sqlType) { case Types.BOOLEAN: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.BIT, length, precision, scale); break; case Types.DATE: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.TIMESTAMP, length, precision, scale); break; case Types.TIME: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); if (type == null) type = getCreateColumnSQLImpl(Types.TIMESTAMP, length, precision, scale); break; case Types.DOUBLE: type = getCreateColumnSQLImpl(Types.DOUBLE, length, precision, scale); break; case Types.NUMERIC: type = getCreateColumnSQLImpl(Types.NUMERIC, length, precision, scale); break; default: type = getCreateColumnSQLImpl(sqlType, length, precision, scale); break; } if (type == null) type = getDefaultCreateTableSQL(sqlType, length, precision, scale); return type; }
/** * to Return SQL for the table with the given * SQL type. Takes, length, precision and scale. */
to Return SQL for the table with the given SQL type. Takes, length, precision and scale
getCreateColumnSQL
{ "repo_name": "WelcomeHUME/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/jdbc/GenericMetaData.java", "license": "gpl-2.0", "size": 13024 }
[ "java.sql.Types" ]
import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,544,933
public void setTempoList(TempoList tempoList) { // System.out // .println("************************************************ TempoList has been set " // + tempoList); this.tempoList = tempoList; } /* * private static String bytesout(byte[] b) { StringBuffer sb = new * StringBuffer("["); for (int i = 0; i < b.length; i++) { * //sb.append(hexDigit(b[i]>>4)+hexDigit(b[i]&0xf)+", "); * sb.append(Integer.toHexString(b[i])+", "); } sb.append("]"); return * sb.toString(); }
void function(TempoList tempoList) { this.tempoList = tempoList; } /* * private static String bytesout(byte[] b) { StringBuffer sb = new * StringBuffer("["); for (int i = 0; i < b.length; i++) { * * sb.append(Integer.toHexString(b[i])+STR); } sb.append("]"); return * sb.toString(); }
/** * * Set the tempoList to get the tempo when the time is warped. * * @param tempoList */
Set the tempoList to get the tempo when the time is warped
setTempoList
{ "repo_name": "petersalomonsen/frinika", "path": "src/com/frinika/sequencer/FrinikaSequencerPlayer.java", "license": "gpl-2.0", "size": 26131 }
[ "com.frinika.sequencer.model.tempo.TempoList" ]
import com.frinika.sequencer.model.tempo.TempoList;
import com.frinika.sequencer.model.tempo.*;
[ "com.frinika.sequencer" ]
com.frinika.sequencer;
2,888,201
@Test(dataProvider = "loadEnumData") public void testSupportedEnumerations(TestEnum param) throws Exception { ITypesPrx svc = root.getSession().getTypesService(); String type = param.getType(); Set<String> original = param.getOriginal(); List<IObject> fromDB = svc.allEnumerations(type); int total = 0; if (type.endsWith("EventTypeI")) { //Bootstrap event is added to the DB during the init process //see psql-footer.vm Assert.assertEquals(fromDB.size()-1, original.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (original.contains(value) && !value.equals("Bootstrap")) { total++; } } Assert.assertEquals(fromDB.size()-1, total); } else if (type.endsWith("FormatI")) { //original should be 0 Assert.assertEquals(original.size(), 0); Set<String> values = getSupportedFormats(); Assert.assertTrue(values.size() <= fromDB.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (values.contains(value)) { total++; } } Assert.assertEquals(values.size(), total); } else { Assert.assertEquals(fromDB.size(), original.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (original.contains(value)) { total++; } } Assert.assertEquals(fromDB.size(), total); } } class TestEnum { private String type; private Set<String> original; TestEnum(String type, Set<String> original) { this.type = type; this.original = original; }
@Test(dataProvider = STR) void function(TestEnum param) throws Exception { ITypesPrx svc = root.getSession().getTypesService(); String type = param.getType(); Set<String> original = param.getOriginal(); List<IObject> fromDB = svc.allEnumerations(type); int total = 0; if (type.endsWith(STR)) { Assert.assertEquals(fromDB.size()-1, original.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (original.contains(value) && !value.equals(STR)) { total++; } } Assert.assertEquals(fromDB.size()-1, total); } else if (type.endsWith(STR)) { Assert.assertEquals(original.size(), 0); Set<String> values = getSupportedFormats(); Assert.assertTrue(values.size() <= fromDB.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (values.contains(value)) { total++; } } Assert.assertEquals(values.size(), total); } else { Assert.assertEquals(fromDB.size(), original.size()); for (int i = 0; i < fromDB.size(); i++) { String value = getEnumValue(fromDB.get(i)); Assert.assertNotNull(value); if (original.contains(value)) { total++; } } Assert.assertEquals(fromDB.size(), total); } } class TestEnum { private String type; private Set<String> original; TestEnum(String type, Set<String> original) { this.type = type; this.original = original; }
/** * Tests the retrieval of the various enumerations. * @throws Exception */
Tests the retrieval of the various enumerations
testSupportedEnumerations
{ "repo_name": "simleo/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/ConfigurationServiceTest.java", "license": "gpl-2.0", "size": 11475 }
[ "java.util.List", "java.util.Set", "org.testng.Assert", "org.testng.annotations.Test" ]
import java.util.List; import java.util.Set; import org.testng.Assert; import org.testng.annotations.Test;
import java.util.*; import org.testng.*; import org.testng.annotations.*;
[ "java.util", "org.testng", "org.testng.annotations" ]
java.util; org.testng; org.testng.annotations;
2,276,848
private void doDiscovery() { Log.d(TAG, "doDiscovery()"); // Indicate scanning in the title setProgressBarIndeterminateVisibility(true); setTitle(R.string.scanning); // Turn on sub-title for new devices findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE); // If we're already discovering, stop it if (mBtAdapter.isDiscovering()) { mBtAdapter.cancelDiscovery(); } // Request discover from BluetoothAdapter mBtAdapter.startDiscovery(); }
void function() { Log.d(TAG, STR); setProgressBarIndeterminateVisibility(true); setTitle(R.string.scanning); findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE); if (mBtAdapter.isDiscovering()) { mBtAdapter.cancelDiscovery(); } mBtAdapter.startDiscovery(); }
/** * Start device discover with the BluetoothAdapter */
Start device discover with the BluetoothAdapter
doDiscovery
{ "repo_name": "noirmist/Bluetooth-Sensor-Transmitter", "path": "Receiver/app/src/main/java/me/jungwoo/noirmist/receiver/DeviceListActivity.java", "license": "apache-2.0", "size": 7965 }
[ "android.util.Log", "android.view.View" ]
import android.util.Log; import android.view.View;
import android.util.*; import android.view.*;
[ "android.util", "android.view" ]
android.util; android.view;
2,433,213
public float getHinge1AngleRate() { if ( hinge1AngleRate == null ) { hinge1AngleRate = (SFFloat)getField( "hinge1AngleRate" ); } return( hinge1AngleRate.getValue( ) ); }
float function() { if ( hinge1AngleRate == null ) { hinge1AngleRate = (SFFloat)getField( STR ); } return( hinge1AngleRate.getValue( ) ); }
/** Return the hinge1AngleRate float value. * @return The hinge1AngleRate float value. */
Return the hinge1AngleRate float value
getHinge1AngleRate
{ "repo_name": "Norkart/NK-VirtualGlobe", "path": "Xj3D/src/java/org/xj3d/sai/internal/node/rigidbodyphysics/SAIDoubleAxisHingeJoint.java", "license": "gpl-2.0", "size": 15538 }
[ "org.web3d.x3d.sai.SFFloat" ]
import org.web3d.x3d.sai.SFFloat;
import org.web3d.x3d.sai.*;
[ "org.web3d.x3d" ]
org.web3d.x3d;
1,178,683
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (iMoveMode == DBConstants.INIT_MOVE) this.retrieveValue(); if (iMoveMode == DBConstants.SCREEN_MOVE) this.saveValue(); return iErrorCode; }
int function(boolean bDisplayOption, int iMoveMode) { int iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (iMoveMode == DBConstants.INIT_MOVE) this.retrieveValue(); if (iMoveMode == DBConstants.SCREEN_MOVE) this.saveValue(); return iErrorCode; }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */
The Field has Changed
fieldChanged
{ "repo_name": "jbundle/jbundle", "path": "base/base/src/main/java/org/jbundle/base/field/event/StickyValueHandler.java", "license": "gpl-3.0", "size": 5369 }
[ "org.jbundle.base.model.DBConstants" ]
import org.jbundle.base.model.DBConstants;
import org.jbundle.base.model.*;
[ "org.jbundle.base" ]
org.jbundle.base;
2,221,184
public static Iterator<WorkspaceResource> getResourceIterator(ResourceStore.Module moduleResourceStore) { List<Iterator<WorkspaceResource>> iteratorList = new ArrayList<Iterator<WorkspaceResource>>(); for (final ModuleName moduleName : moduleResourceStore.getModuleNames()) { iteratorList.add(getResourceIterator(moduleResourceStore, moduleName)); } return iteratorList.isEmpty() ? EmptyIterator.<WorkspaceResource>emptyIterator() : new IteratorChain<WorkspaceResource>(iteratorList); }
static Iterator<WorkspaceResource> function(ResourceStore.Module moduleResourceStore) { List<Iterator<WorkspaceResource>> iteratorList = new ArrayList<Iterator<WorkspaceResource>>(); for (final ModuleName moduleName : moduleResourceStore.getModuleNames()) { iteratorList.add(getResourceIterator(moduleResourceStore, moduleName)); } return iteratorList.isEmpty() ? EmptyIterator.<WorkspaceResource>emptyIterator() : new IteratorChain<WorkspaceResource>(iteratorList); }
/** * Get an iterator over the resources in a store. * * @param moduleResourceStore the store for which to return the iterator. * * @return an iterator over the resources in the store. * Note that the InputStream in the WorkspaceResource returned by the iterator is allowed to be null. */
Get an iterator over the resources in a store
getResourceIterator
{ "repo_name": "levans/Open-Quark", "path": "src/CAL_Platform/src/org/openquark/cal/services/ModuleResourceStoreHelper.java", "license": "bsd-3-clause", "size": 7212 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.openquark.cal.compiler.ModuleName", "org.openquark.util.EmptyIterator", "org.openquark.util.IteratorChain" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.openquark.cal.compiler.ModuleName; import org.openquark.util.EmptyIterator; import org.openquark.util.IteratorChain;
import java.util.*; import org.openquark.cal.compiler.*; import org.openquark.util.*;
[ "java.util", "org.openquark.cal", "org.openquark.util" ]
java.util; org.openquark.cal; org.openquark.util;
253,517
public void removeRemotePanelKeyListener(final KeyListener listener) { this.remotePanel.removeKeyListener(listener); }
void function(final KeyListener listener) { this.remotePanel.removeKeyListener(listener); }
/** * Removes an element from the list of listeners of the remote panel. * * @param listener * the listener to remove */
Removes an element from the list of listeners of the remote panel
removeRemotePanelKeyListener
{ "repo_name": "Eliosoft/elios", "path": "src/main/java/net/eliosoft/elios/gui/views/RemoteView.java", "license": "gpl-3.0", "size": 11402 }
[ "java.awt.event.KeyListener" ]
import java.awt.event.KeyListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
374,856
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { boolean rebuild = false; if (alav.getNamespaceURI() == null) { String ln = alav.getLocalName(); if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) { rebuild = true; } else if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; // X & Y are ignored on outermost SVG. boolean isOutermost = doc.getRootElement() == e; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); float y = _y.getCheckedValue(); AffineTransform positionTransform = AffineTransform.getTranslateInstance(x, y); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; cgn.setPositionTransform(positionTransform); return; } } else if (ln.equals(SVG_VIEW_BOX_ATTRIBUTE) || ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; boolean isOutermost = doc.getRootElement() == e; // X & Y are ignored on outermost SVG. float x = 0; float y = 0; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); y = _y.getCheckedValue(); } // 'width' attribute - default is 100% AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) se.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - default is 100% AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) se.getHeight(); float h = _height.getCheckedValue(); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; // 'viewBox' and "preserveAspectRatio' attributes SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox(); SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio(); AffineTransform newVT = ViewBox.getPreserveAspectRatioTransform (e, vb, par, w, h, ctx); AffineTransform oldVT = cgn.getViewingTransform(); if ((newVT.getScaleX() != oldVT.getScaleX()) || (newVT.getScaleY() != oldVT.getScaleY()) || (newVT.getShearX() != oldVT.getShearX()) || (newVT.getShearY() != oldVT.getShearY())) rebuild = true; else { // Only differs in translate. cgn.setViewingTransform(newVT); // 'overflow' and 'clip' Shape clip = null; if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { // clip:auto clip = new Rectangle2D.Float(x, y, w, h); } else { // clip:rect(<x> <y> <w> <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { AffineTransform at; at = cgn.getPositionTransform(); if (at == null) at = new AffineTransform(); else at = new AffineTransform(at); at.concatenate(newVT); at = at.createInverse(); // clip in user space clip = at.createTransformedShape(clip); Filter filter = cgn.getGraphicsNodeRable(true); cgn.setClip(new ClipRable8Bit(filter, clip)); } catch (NoninvertibleTransformException ex) {} } } } if (rebuild) { CompositeGraphicsNode gn = node.getParent(); gn.remove(node); disposeTree(e, false); handleElementAdded(gn, e.getParentNode(), e); return; } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); } public static class SVGSVGElementViewport implements Viewport { private float width; private float height; public SVGSVGElementViewport(float w, float h) { this.width = w; this.height = h; }
void function (AnimatedLiveAttributeValue alav) { try { boolean rebuild = false; if (alav.getNamespaceURI() == null) { String ln = alav.getLocalName(); if (ln.equals(SVG_WIDTH_ATTRIBUTE) ln.equals(SVG_HEIGHT_ATTRIBUTE)) { rebuild = true; } else if (ln.equals(SVG_X_ATTRIBUTE) ln.equals(SVG_Y_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; boolean isOutermost = doc.getRootElement() == e; if (!isOutermost) { AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); float x = _x.getCheckedValue(); AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); float y = _y.getCheckedValue(); AffineTransform positionTransform = AffineTransform.getTranslateInstance(x, y); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; cgn.setPositionTransform(positionTransform); return; } } else if (ln.equals(SVG_VIEW_BOX_ATTRIBUTE) ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; boolean isOutermost = doc.getRootElement() == e; float x = 0; float y = 0; if (!isOutermost) { AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); x = _x.getCheckedValue(); AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); y = _y.getCheckedValue(); } AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) se.getWidth(); float w = _width.getCheckedValue(); AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) se.getHeight(); float h = _height.getCheckedValue(); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox(); SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio(); AffineTransform newVT = ViewBox.getPreserveAspectRatioTransform (e, vb, par, w, h, ctx); AffineTransform oldVT = cgn.getViewingTransform(); if ((newVT.getScaleX() != oldVT.getScaleX()) (newVT.getScaleY() != oldVT.getScaleY()) (newVT.getShearX() != oldVT.getShearX()) (newVT.getShearY() != oldVT.getShearY())) rebuild = true; else { cgn.setViewingTransform(newVT); Shape clip = null; if (CSSUtilities.convertOverflow(e)) { float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { clip = new Rectangle2D.Float(x, y, w, h); } else { clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { AffineTransform at; at = cgn.getPositionTransform(); if (at == null) at = new AffineTransform(); else at = new AffineTransform(at); at.concatenate(newVT); at = at.createInverse(); clip = at.createTransformedShape(clip); Filter filter = cgn.getGraphicsNodeRable(true); cgn.setClip(new ClipRable8Bit(filter, clip)); } catch (NoninvertibleTransformException ex) {} } } } if (rebuild) { CompositeGraphicsNode gn = node.getParent(); gn.remove(node); disposeTree(e, false); handleElementAdded(gn, e.getParentNode(), e); return; } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); } public static class SVGSVGElementViewport implements Viewport { private float width; private float height; public SVGSVGElementViewport(float w, float h) { this.width = w; this.height = h; }
/** * Invoked when the animated value of an animatable attribute has changed. */
Invoked when the animated value of an animatable attribute has changed
handleAnimatedAttributeChanged
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/bridge/SVGSVGElementBridge.java", "license": "apache-2.0", "size": 34622 }
[ "java.awt.Shape", "java.awt.geom.AffineTransform", "java.awt.geom.NoninvertibleTransformException", "java.awt.geom.Rectangle2D", "org.apache.batik.dom.svg.AbstractSVGAnimatedLength", "org.apache.batik.dom.svg.AnimatedLiveAttributeValue", "org.apache.batik.dom.svg.LiveAttributeException", "org.apache.batik.dom.svg.SVGOMAnimatedRect", "org.apache.batik.dom.svg.SVGOMSVGElement", "org.apache.batik.ext.awt.image.renderable.ClipRable8Bit", "org.apache.batik.ext.awt.image.renderable.Filter", "org.apache.batik.gvt.CanvasGraphicsNode", "org.apache.batik.gvt.CompositeGraphicsNode", "org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio", "org.w3c.dom.svg.SVGDocument" ]
import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; import java.awt.geom.Rectangle2D; import org.apache.batik.dom.svg.AbstractSVGAnimatedLength; import org.apache.batik.dom.svg.AnimatedLiveAttributeValue; import org.apache.batik.dom.svg.LiveAttributeException; import org.apache.batik.dom.svg.SVGOMAnimatedRect; import org.apache.batik.dom.svg.SVGOMSVGElement; import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit; import org.apache.batik.ext.awt.image.renderable.Filter; import org.apache.batik.gvt.CanvasGraphicsNode; import org.apache.batik.gvt.CompositeGraphicsNode; import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio; import org.w3c.dom.svg.SVGDocument;
import java.awt.*; import java.awt.geom.*; import org.apache.batik.dom.svg.*; import org.apache.batik.ext.awt.image.renderable.*; import org.apache.batik.gvt.*; import org.w3c.dom.svg.*;
[ "java.awt", "org.apache.batik", "org.w3c.dom" ]
java.awt; org.apache.batik; org.w3c.dom;
519,170
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source) { zoom((upperPercent + lowerPercent) / 2.0); }
void function(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source) { zoom((upperPercent + lowerPercent) / 2.0); }
/** * Zooms in on the range axes. * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. * @param state the plot state. * @param source the source point (in Java2D coordinates). */
Zooms in on the range axes
zoomRangeAxes
{ "repo_name": "JSansalone/JFreeChart", "path": "source/org/jfree/chart/plot/PolarPlot.java", "license": "lgpl-2.1", "size": 68880 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,870,716
public static <T> T tryPop(AtomicReference<ImmutableLinkedStack<T>> location) { while (true) { ImmutableLinkedStack<T> priorCollection = location.get(); Requires.notNull(priorCollection, "location"); if (priorCollection.isEmpty()) { return null; } if (location.compareAndSet(priorCollection, priorCollection.pop())) { return priorCollection.peek(); } } }
static <T> T function(AtomicReference<ImmutableLinkedStack<T>> location) { while (true) { ImmutableLinkedStack<T> priorCollection = location.get(); Requires.notNull(priorCollection, STR); if (priorCollection.isEmpty()) { return null; } if (location.compareAndSet(priorCollection, priorCollection.pop())) { return priorCollection.peek(); } } }
/** * Pops a value from a stack. * * @param <T> The type of elements stored in the stack. * @param location The variable or field to atomically update. * @return The value popped from the stack, if it was non-empty; otherwise {@code null} if the stack was empty. */
Pops a value from a stack
tryPop
{ "repo_name": "tunnelvisionlabs/java-immutable", "path": "src/com/tvl/util/ImmutableAtomic.java", "license": "mit", "size": 39400 }
[ "java.util.concurrent.atomic.AtomicReference" ]
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
932,048
public static int getDefaultBreakTimeSec() { return defaultBreakTimeSec.getValue(); } private static IntegerConfigValue defaultBreakTimeSec = new IntegerConfigValue( "transitclock.core.defaultBreakTimeSec", 0, "How long driver is expected to have a break for a stop.");
static int function() { return defaultBreakTimeSec.getValue(); } private static IntegerConfigValue defaultBreakTimeSec = new IntegerConfigValue( STR, 0, STR);
/** * Returns how long driver is expected to have a break for a stop. * * @return */
Returns how long driver is expected to have a break for a stop
getDefaultBreakTimeSec
{ "repo_name": "TheTransitClock/transitime", "path": "transitclock/src/main/java/org/transitclock/configData/CoreConfig.java", "license": "gpl-3.0", "size": 31328 }
[ "org.transitclock.config.IntegerConfigValue" ]
import org.transitclock.config.IntegerConfigValue;
import org.transitclock.config.*;
[ "org.transitclock.config" ]
org.transitclock.config;
2,043,253
public static <T> OneWayList<T> transform2(List<T> list){ OneWayList<T> result = null; OneWayList<T> p = null; for(T obj : list){ OneWayList<T> l = new OneWayList<T>(obj, null); if(result == null){ result = p = l; } else { p.tail = l; p = l; } } return result; }
static <T> OneWayList<T> function(List<T> list){ OneWayList<T> result = null; OneWayList<T> p = null; for(T obj : list){ OneWayList<T> l = new OneWayList<T>(obj, null); if(result == null){ result = p = l; } else { p.tail = l; p = l; } } return result; }
/** * Transforms given list into a OneWayList without any modification * to it * * Method introduced during revision by Paolo Contessi * * @param list Input list to be transformed * @return An equivalent OneWayList */
Transforms given list into a OneWayList without any modification to it Method introduced during revision by Paolo Contessi
transform2
{ "repo_name": "zakski/project-soisceal", "path": "scala-core/src/main/java/com/szadowsz/gospel/util/OneWayList.java", "license": "lgpl-3.0", "size": 2266 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,729,755
private Export export; @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Basic( optional = true ) @JoinColumn(name = "export_id", nullable = true ) public Export getExport() { return this.export; }
Export export; @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Basic( optional = true ) @JoinColumn(name = STR, nullable = true ) public Export function() { return this.export; }
/** * Return the value associated with the column: export. * @return A Export object (this.export) */
Return the value associated with the column: export
getExport
{ "repo_name": "servinglynk/hmis-lynk-open-source", "path": "hmis-model-v2014/src/main/java/com/servinglynk/hmis/warehouse/model/v2014/EnrollmentCoc.java", "license": "mpl-2.0", "size": 9404 }
[ "javax.persistence.Basic", "javax.persistence.CascadeType", "javax.persistence.FetchType", "javax.persistence.JoinColumn", "javax.persistence.ManyToOne" ]
import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
46,446
public ComparableObjectItem remove(int index) { return super.remove(index); }
ComparableObjectItem function(int index) { return super.remove(index); }
/** * Removes the item with the specified index. * * @param index the item index. * * @since 1.0.14 */
Removes the item with the specified index
remove
{ "repo_name": "ilyessou/jfreechart", "path": "source/org/jfree/data/time/ohlc/OHLCSeries.java", "license": "lgpl-2.1", "size": 3897 }
[ "org.jfree.data.ComparableObjectItem" ]
import org.jfree.data.ComparableObjectItem;
import org.jfree.data.*;
[ "org.jfree.data" ]
org.jfree.data;
550,995
public void setId(TLIntVector value) { this.id = value; }
void function(TLIntVector value) { this.id = value; }
/** * Sets id. * * @param value the value */
Sets id
setId
{ "repo_name": "rubenlagus/TelegramApi", "path": "src/main/java/org/telegram/api/functions/messages/TLRequestMessagesGetMessages.java", "license": "mit", "size": 2014 }
[ "org.telegram.tl.TLIntVector" ]
import org.telegram.tl.TLIntVector;
import org.telegram.tl.*;
[ "org.telegram.tl" ]
org.telegram.tl;
2,366,169
private boolean readAtomPayload(ExtractorInput input, PositionHolder positionHolder) throws IOException, InterruptedException { long atomPayloadSize = atomSize - atomHeaderBytesRead; long atomEndPosition = input.getPosition() + atomPayloadSize; boolean seekRequired = false; if (atomData != null) { input.readFully(atomData.data, atomHeaderBytesRead, (int) atomPayloadSize); if (atomType == Atom.TYPE_ftyp) { isQuickTime = processFtypAtom(atomData); } else if (!containerAtoms.isEmpty()) { containerAtoms.peek().add(new Atom.LeafAtom(atomType, atomData)); } } else { // We don't need the data. Skip or seek, depending on how large the atom is. if (atomPayloadSize < RELOAD_MINIMUM_SEEK_DISTANCE) { input.skipFully((int) atomPayloadSize); } else { positionHolder.position = input.getPosition() + atomPayloadSize; seekRequired = true; } } processAtomEnded(atomEndPosition); return seekRequired && parserState != STATE_READING_SAMPLE; }
boolean function(ExtractorInput input, PositionHolder positionHolder) throws IOException, InterruptedException { long atomPayloadSize = atomSize - atomHeaderBytesRead; long atomEndPosition = input.getPosition() + atomPayloadSize; boolean seekRequired = false; if (atomData != null) { input.readFully(atomData.data, atomHeaderBytesRead, (int) atomPayloadSize); if (atomType == Atom.TYPE_ftyp) { isQuickTime = processFtypAtom(atomData); } else if (!containerAtoms.isEmpty()) { containerAtoms.peek().add(new Atom.LeafAtom(atomType, atomData)); } } else { if (atomPayloadSize < RELOAD_MINIMUM_SEEK_DISTANCE) { input.skipFully((int) atomPayloadSize); } else { positionHolder.position = input.getPosition() + atomPayloadSize; seekRequired = true; } } processAtomEnded(atomEndPosition); return seekRequired && parserState != STATE_READING_SAMPLE; }
/** * Processes the atom payload. If {@link #atomData} is null and the size is at or above the * threshold {@link #RELOAD_MINIMUM_SEEK_DISTANCE}, {@code true} is returned and the caller should * restart loading at the position in {@code positionHolder}. Otherwise, the atom is read/skipped. */
Processes the atom payload. If <code>#atomData</code> is null and the size is at or above the threshold <code>#RELOAD_MINIMUM_SEEK_DISTANCE</code>, true is returned and the caller should restart loading at the position in positionHolder. Otherwise, the atom is read/skipped
readAtomPayload
{ "repo_name": "tntcrowd/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java", "license": "apache-2.0", "size": 28906 }
[ "com.google.android.exoplayer2.extractor.ExtractorInput", "com.google.android.exoplayer2.extractor.PositionHolder", "java.io.IOException" ]
import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.extractor.PositionHolder; import java.io.IOException;
import com.google.android.exoplayer2.extractor.*; import java.io.*;
[ "com.google.android", "java.io" ]
com.google.android; java.io;
19,955
void setDatabase(Database value);
void setDatabase(Database value);
/** * Sets the value of the '{@link org.yatech.sqlitedb.modeler.model.trigger.Trigger#getDatabase <em>Database</em>}' container reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Database</em>' container reference. * @see #getDatabase() * @generated */
Sets the value of the '<code>org.yatech.sqlitedb.modeler.model.trigger.Trigger#getDatabase Database</code>' container reference.
setDatabase
{ "repo_name": "yatechorg/sqlite-db-modeler-plugin-4android", "path": "org.yatech.sqlitedb.modeler.model/gen/org/yatech/sqlitedb/modeler/model/trigger/Trigger.java", "license": "mit", "size": 1783 }
[ "org.yatech.sqlitedb.modeler.model.Database" ]
import org.yatech.sqlitedb.modeler.model.Database;
import org.yatech.sqlitedb.modeler.model.*;
[ "org.yatech.sqlitedb" ]
org.yatech.sqlitedb;
1,841,542
FlushRequestBuilder prepareFlush(String... indices);
FlushRequestBuilder prepareFlush(String... indices);
/** * Explicitly flush one or more indices (releasing memory from the node). */
Explicitly flush one or more indices (releasing memory from the node)
prepareFlush
{ "repo_name": "qwerty4030/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java", "license": "apache-2.0", "size": 31749 }
[ "org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder" ]
import org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder;
import org.elasticsearch.action.admin.indices.flush.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,787,197
NumberFormat nf = NumberFormat.getPercentInstance(); StringBuilder outBuffer = new StringBuilder(); outBuffer.append("Value \t Freq. \t Pct. \t Cum Pct. \n"); Iterator<Comparable<?>> iter = freqTable.keySet().iterator(); while (iter.hasNext()) { Comparable<?> value = iter.next(); outBuffer.append(value); outBuffer.append('\t'); outBuffer.append(getCount(value)); outBuffer.append('\t'); outBuffer.append(nf.format(getPct(value))); outBuffer.append('\t'); outBuffer.append(nf.format(getCumPct(value))); outBuffer.append('\n'); } return outBuffer.toString(); }
NumberFormat nf = NumberFormat.getPercentInstance(); StringBuilder outBuffer = new StringBuilder(); outBuffer.append(STR); Iterator<Comparable<?>> iter = freqTable.keySet().iterator(); while (iter.hasNext()) { Comparable<?> value = iter.next(); outBuffer.append(value); outBuffer.append('\t'); outBuffer.append(getCount(value)); outBuffer.append('\t'); outBuffer.append(nf.format(getPct(value))); outBuffer.append('\t'); outBuffer.append(nf.format(getCumPct(value))); outBuffer.append('\n'); } return outBuffer.toString(); }
/** * Return a string representation of this frequency * distribution. * * @return a string representation. */
Return a string representation of this frequency distribution
toString
{ "repo_name": "SpoonLabs/astor", "path": "examples/math_2/src/main/java/org/apache/commons/math3/stat/Frequency.java", "license": "gpl-2.0", "size": 21124 }
[ "java.text.NumberFormat", "java.util.Iterator" ]
import java.text.NumberFormat; import java.util.Iterator;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
2,204,593
public Set<Integer> getTIDset() { return transactionsIds; }
Set<Integer> function() { return transactionsIds; }
/** * Get the set of transactions ids containing this itemset * @return a tidset as a Set<Integer> */
Get the set of transactions ids containing this itemset
getTIDset
{ "repo_name": "automenta/java_dann", "path": "src/syncleus/dann/learn/pattern/algorithms/frequentpatterns/two_phase/ItemsetTP.java", "license": "agpl-3.0", "size": 4405 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
900,516
private void processRpcRequest(RpcRequestHeaderProto header, DataInputStream dis) throws WrappedRpcServerException, InterruptedException { Class<? extends Writable> rpcRequestClass = getRpcRequestWrapper(header.getRpcKind()); if (rpcRequestClass == null) { LOG.warn("Unknown rpc kind " + header.getRpcKind() + " from client " + getHostAddress()); final String err = "Unknown rpc kind in rpc header" + header.getRpcKind(); throw new WrappedRpcServerException( RpcErrorCodeProto.FATAL_INVALID_RPC_HEADER, err); } Writable rpcRequest; try { //Read the rpc request rpcRequest = ReflectionUtils.newInstance(rpcRequestClass, conf); rpcRequest.readFields(dis); } catch (Throwable t) { // includes runtime exception from newInstance LOG.warn("Unable to read call parameters for client " + getHostAddress() + "on connection protocol " + this.protocolName + " for rpcKind " + header.getRpcKind(), t); String err = "IPC server unable to read call parameters: "+ t.getMessage(); throw new WrappedRpcServerException( RpcErrorCodeProto.FATAL_DESERIALIZING_REQUEST, err); } Call call = new Call(header.getCallId(), header.getRetryCount(), rpcRequest, this, ProtoUtil.convert(header.getRpcKind()), header .getClientId().toByteArray()); callQueue.put(call); // queue the call; maybe blocked here incRpcCount(); // Increment the rpc count }
void function(RpcRequestHeaderProto header, DataInputStream dis) throws WrappedRpcServerException, InterruptedException { Class<? extends Writable> rpcRequestClass = getRpcRequestWrapper(header.getRpcKind()); if (rpcRequestClass == null) { LOG.warn(STR + header.getRpcKind() + STR + getHostAddress()); final String err = STR + header.getRpcKind(); throw new WrappedRpcServerException( RpcErrorCodeProto.FATAL_INVALID_RPC_HEADER, err); } Writable rpcRequest; try { rpcRequest = ReflectionUtils.newInstance(rpcRequestClass, conf); rpcRequest.readFields(dis); } catch (Throwable t) { LOG.warn(STR + getHostAddress() + STR + this.protocolName + STR + header.getRpcKind(), t); String err = STR+ t.getMessage(); throw new WrappedRpcServerException( RpcErrorCodeProto.FATAL_DESERIALIZING_REQUEST, err); } Call call = new Call(header.getCallId(), header.getRetryCount(), rpcRequest, this, ProtoUtil.convert(header.getRpcKind()), header .getClientId().toByteArray()); callQueue.put(call); incRpcCount(); }
/** * Process an RPC Request - the connection headers and context must * have been already read * @param header - RPC request header * @param dis - stream to request payload * @throws WrappedRpcServerException - due to fatal rpc layer issues such * as invalid header or deserialization error. In this case a RPC fatal * status response will later be sent back to client. * @throws InterruptedException */
Process an RPC Request - the connection headers and context must have been already read
processRpcRequest
{ "repo_name": "sungsoo/hadoop-2.4.0", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java", "license": "apache-2.0", "size": 102570 }
[ "java.io.DataInputStream", "org.apache.hadoop.io.Writable", "org.apache.hadoop.ipc.protobuf.RpcHeaderProtos", "org.apache.hadoop.util.ProtoUtil", "org.apache.hadoop.util.ReflectionUtils" ]
import java.io.DataInputStream; import org.apache.hadoop.io.Writable; import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos; import org.apache.hadoop.util.ProtoUtil; import org.apache.hadoop.util.ReflectionUtils;
import java.io.*; import org.apache.hadoop.io.*; import org.apache.hadoop.ipc.protobuf.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
301,107
public void processStream( PDPage aPage, PDResources resources, COSStream cosStream ) throws IOException { graphicsState = new PDGraphicsState(aPage.findCropBox()); textMatrix = null; textLineMatrix = null; graphicsStack.clear(); streamResourcesStack.clear(); processSubStream( aPage, resources, cosStream ); }
void function( PDPage aPage, PDResources resources, COSStream cosStream ) throws IOException { graphicsState = new PDGraphicsState(aPage.findCropBox()); textMatrix = null; textLineMatrix = null; graphicsStack.clear(); streamResourcesStack.clear(); processSubStream( aPage, resources, cosStream ); }
/** * This will process the contents of the stream. * * @param aPage The page. * @param resources The location to retrieve resources. * @param cosStream the Stream to execute. * * * @throws IOException if there is an error accessing the stream. */
This will process the contents of the stream
processStream
{ "repo_name": "myrridin/qz-print", "path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/util/PDFStreamEngine.java", "license": "lgpl-2.1", "size": 24838 }
[ "java.io.IOException", "org.apache.pdfbox.cos.COSStream", "org.apache.pdfbox.pdmodel.PDPage", "org.apache.pdfbox.pdmodel.PDResources", "org.apache.pdfbox.pdmodel.graphics.PDGraphicsState" ]
import java.io.IOException; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState;
import java.io.*; import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdmodel.*; import org.apache.pdfbox.pdmodel.graphics.*;
[ "java.io", "org.apache.pdfbox" ]
java.io; org.apache.pdfbox;
223,273
public boolean addProtocolHandlerListener(final ProtocolHandlerListener listener) { return listenerHandler.addProtocolHandlerListener(listener); }
boolean function(final ProtocolHandlerListener listener) { return listenerHandler.addProtocolHandlerListener(listener); }
/** * DOCUMENT ME! * * @param listener DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
addProtocolHandlerListener
{ "repo_name": "cismet/cismet-gui-commons", "path": "src/main/java/de/cismet/commons/gui/protocol/ProtocolHandler.java", "license": "lgpl-3.0", "size": 15059 }
[ "de.cismet.commons.gui.protocol.listener.ProtocolHandlerListener" ]
import de.cismet.commons.gui.protocol.listener.ProtocolHandlerListener;
import de.cismet.commons.gui.protocol.listener.*;
[ "de.cismet.commons" ]
de.cismet.commons;
2,330,026
private static void configureWagon( Wagon wagon, String repositoryId, Settings settings, PlexusContainer container, Log log ) throws TransferFailedException { log.debug( " configureWagon " ); // MSITE-25: Make sure that the server settings are inserted for ( Server server : settings.getServers() ) { String id = server.getId(); log.debug( "configureWagon server " + id ); if ( id != null && id.equals( repositoryId ) && ( server.getConfiguration() != null ) ) { final PlexusConfiguration plexusConf = new XmlPlexusConfiguration( (Xpp3Dom) server.getConfiguration() ); ComponentConfigurator componentConfigurator = null; try { componentConfigurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, "basic" ); if ( isMaven3OrMore() ) { componentConfigurator.configureComponent( wagon, plexusConf, container.getContainerRealm() ); } else { configureWagonWithMaven2( componentConfigurator, wagon, plexusConf, container ); } } catch ( final ComponentLookupException e ) { throw new TransferFailedException( "While configuring wagon for \'" + repositoryId + "\': Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.", e ); } catch ( ComponentConfigurationException e ) { throw new TransferFailedException( "While configuring wagon for \'" + repositoryId + "\': Unable to apply wagon configuration.", e ); } finally { if ( componentConfigurator != null ) { try { container.release( componentConfigurator ); } catch ( ComponentLifecycleException e ) { log.error( "Problem releasing configurator - ignoring: " + e.getMessage() ); } } } } } }
static void function( Wagon wagon, String repositoryId, Settings settings, PlexusContainer container, Log log ) throws TransferFailedException { log.debug( STR ); for ( Server server : settings.getServers() ) { String id = server.getId(); log.debug( STR + id ); if ( id != null && id.equals( repositoryId ) && ( server.getConfiguration() != null ) ) { final PlexusConfiguration plexusConf = new XmlPlexusConfiguration( (Xpp3Dom) server.getConfiguration() ); ComponentConfigurator componentConfigurator = null; try { componentConfigurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, "basic" ); if ( isMaven3OrMore() ) { componentConfigurator.configureComponent( wagon, plexusConf, container.getContainerRealm() ); } else { configureWagonWithMaven2( componentConfigurator, wagon, plexusConf, container ); } } catch ( final ComponentLookupException e ) { throw new TransferFailedException( STR + repositoryId + STR + STR, e ); } catch ( ComponentConfigurationException e ) { throw new TransferFailedException( STR + repositoryId + STR, e ); } finally { if ( componentConfigurator != null ) { try { container.release( componentConfigurator ); } catch ( ComponentLifecycleException e ) { log.error( STR + e.getMessage() ); } } } } } }
/** * Configure the Wagon with the information from serverConfigurationMap ( which comes from settings.xml ) * * @param wagon * @param repositoryId * @param settings * @param container * @param log * @throws TransferFailedException * @todo Remove when {@link WagonManager#getWagon(Repository) is available}. It's available in Maven 2.0.5. */
Configure the Wagon with the information from serverConfigurationMap ( which comes from settings.xml )
configureWagon
{ "repo_name": "mcculls/maven-plugins", "path": "maven-site-plugin/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java", "license": "apache-2.0", "size": 33382 }
[ "org.apache.maven.plugin.logging.Log", "org.apache.maven.settings.Server", "org.apache.maven.settings.Settings", "org.apache.maven.wagon.TransferFailedException", "org.apache.maven.wagon.Wagon", "org.codehaus.plexus.PlexusContainer", "org.codehaus.plexus.component.configurator.ComponentConfigurationException", "org.codehaus.plexus.component.configurator.ComponentConfigurator", "org.codehaus.plexus.component.repository.exception.ComponentLifecycleException", "org.codehaus.plexus.component.repository.exception.ComponentLookupException", "org.codehaus.plexus.configuration.PlexusConfiguration", "org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration", "org.codehaus.plexus.util.xml.Xpp3Dom" ]
import org.apache.maven.plugin.logging.Log; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.Wagon; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.configurator.ComponentConfigurationException; import org.codehaus.plexus.component.configurator.ComponentConfigurator; import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.apache.maven.plugin.logging.*; import org.apache.maven.settings.*; import org.apache.maven.wagon.*; import org.codehaus.plexus.*; import org.codehaus.plexus.component.configurator.*; import org.codehaus.plexus.component.repository.exception.*; import org.codehaus.plexus.configuration.*; import org.codehaus.plexus.configuration.xml.*; import org.codehaus.plexus.util.xml.*;
[ "org.apache.maven", "org.codehaus.plexus" ]
org.apache.maven; org.codehaus.plexus;
712,570
public void updateFields(View v) { updateFields(); }
void function(View v) { updateFields(); }
/** * Updates the description, the preview window and the editor window. * * @param v needed for xml to find method */
Updates the description, the preview window and the editor window
updateFields
{ "repo_name": "NightMadness/GoIV", "path": "app/src/main/java/com/kamron/pogoiv/clipboard/ClipboardModifierActivity.java", "license": "gpl-3.0", "size": 11317 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,657,724