method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private boolean saveRideToDisk(RouteCalculator ride, String rideId){ // If a file already exists, delete it. File file = new File(ridesDirName, rideId); if (file.exists()) if (!file.delete()) return false; // Create the file and copy the rides JSON translation to it try { FileWriter fw; if (null != (fw = new FileWriter(file))) { fw.write(RouteCalculator.toJSON(ride.getRoute())); fw.close(); rideInfoManager.addRideInfo(ride, rideId); return true; } } catch(IOException ex) { Log.e(MODULE_TAG, ex.getMessage()); } return false; }
boolean function(RouteCalculator ride, String rideId){ File file = new File(ridesDirName, rideId); if (file.exists()) if (!file.delete()) return false; try { FileWriter fw; if (null != (fw = new FileWriter(file))) { fw.write(RouteCalculator.toJSON(ride.getRoute())); fw.close(); rideInfoManager.addRideInfo(ride, rideId); return true; } } catch(IOException ex) { Log.e(MODULE_TAG, ex.getMessage()); } return false; }
/** * Saves the ride to disk, and gives it the specified name * @param ride the ride to be saved * @param rideId the ride's identifier * @return true if ride was saved to disk, false otherwise. */
Saves the ride to disk, and gives it the specified name
saveRideToDisk
{ "repo_name": "PedalPDX/android-client", "path": "RouteTracker/src/main/java/edu/pdx/cs/pedal/routetracker/DataLayer.java", "license": "mit", "size": 7521 }
[ "android.util.Log", "java.io.File", "java.io.FileWriter", "java.io.IOException" ]
import android.util.Log; import java.io.File; import java.io.FileWriter; import java.io.IOException;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
944,097
public void setContentDispositionFormData(String name, String filename) { Assert.notNull(name, "'name' must not be null"); StringBuilder builder = new StringBuilder("form-data; name=\""); builder.append(name).append('\"'); if (filename != null) { builder.append("; filename=\""); builder.append(filename).append('\"'); } set(CONTENT_DISPOSITION, builder.toString()); }
void function(String name, String filename) { Assert.notNull(name, STR); StringBuilder builder = new StringBuilder(STRSTR'); if (filename != null) { builder.append(STRSTR'); } set(CONTENT_DISPOSITION, builder.toString()); }
/** * Set the (new) value of the {@code Content-Disposition} header * for {@code form-data}. * @param name the control name * @param filename the filename (may be {@code null}) */
Set the (new) value of the Content-Disposition header for form-data
setContentDispositionFormData
{ "repo_name": "spring-projects/spring-android", "path": "spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java", "license": "apache-2.0", "size": 34317 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,278,657
for (User user : users) { if (user.getName().equalsIgnoreCase(name)) { return user; } } // Otherwise try to load them User user = new User(name); user.setIsWaitingOnLevelSync(true); config.getLevels().loadLevelToUser(user); return user; }
for (User user : users) { if (user.getName().equalsIgnoreCase(name)) { return user; } } User user = new User(name); user.setIsWaitingOnLevelSync(true); config.getLevels().loadLevelToUser(user); return user; }
/** * Get a user with the given name * * @param name Name * @return User with name */
Get a user with the given name
getUser
{ "repo_name": "m1enkrafftman/AntiCheatPlus", "path": "src/main/java/net/dynamicdev/anticheat/manage/UserManager.java", "license": "gpl-3.0", "size": 8705 }
[ "net.dynamicdev.anticheat.util.User" ]
import net.dynamicdev.anticheat.util.User;
import net.dynamicdev.anticheat.util.*;
[ "net.dynamicdev.anticheat" ]
net.dynamicdev.anticheat;
2,568,258
public int unmarshal(byte[] buf, int offset, int end) { if (end > buf.length) end = buf.length; int i = offset; try { byte header = buf[i++]; if (header == (byte) 0) { this.userData = new FixtureUserData(); i = this.userData.unmarshal(buf, i, end); header = buf[i++]; } if (header == (byte) 1) { int length = 0; for (int shift = 0; true; shift += 7) { byte b = buf[i++]; length |= (b & 0x7f) << shift; if (shift == 28 || b >= 0) break; } if (length > Fixture.colferListMax) throw new SecurityException(format("colfer: mikron.Fixture.coords length %d exceeds %d elements", length, Fixture.colferListMax)); Coord[] a = new Coord[length]; for (int ai = 0; ai < length; ai++) { Coord o = new Coord(); i = o.unmarshal(buf, i, end); a[ai] = o; } this.coords = a; header = buf[i++]; } if (header != (byte) 0x7f) throw new InputMismatchException(format("colfer: unknown header at byte %d", i - 1)); } finally { if (i > end && end - offset < Fixture.colferSizeMax) throw new BufferUnderflowException(); if (i - offset > Fixture.colferSizeMax) throw new SecurityException(format("colfer: mikron.Fixture exceeds %d bytes", Fixture.colferSizeMax)); if (i > end) throw new BufferUnderflowException(); } return i; }
int function(byte[] buf, int offset, int end) { if (end > buf.length) end = buf.length; int i = offset; try { byte header = buf[i++]; if (header == (byte) 0) { this.userData = new FixtureUserData(); i = this.userData.unmarshal(buf, i, end); header = buf[i++]; } if (header == (byte) 1) { int length = 0; for (int shift = 0; true; shift += 7) { byte b = buf[i++]; length = (b & 0x7f) << shift; if (shift == 28 b >= 0) break; } if (length > Fixture.colferListMax) throw new SecurityException(format(STR, length, Fixture.colferListMax)); Coord[] a = new Coord[length]; for (int ai = 0; ai < length; ai++) { Coord o = new Coord(); i = o.unmarshal(buf, i, end); a[ai] = o; } this.coords = a; header = buf[i++]; } if (header != (byte) 0x7f) throw new InputMismatchException(format(STR, i - 1)); } finally { if (i > end && end - offset < Fixture.colferSizeMax) throw new BufferUnderflowException(); if (i - offset > Fixture.colferSizeMax) throw new SecurityException(format(STR, Fixture.colferSizeMax)); if (i > end) throw new BufferUnderflowException(); } return i; }
/** * Deserializes the object. * @param buf the data source. * @param offset the initial index for {@code buf}, inclusive. * @param end the index limit for {@code buf}, exclusive. * @return the final index for {@code buf}, exclusive. * @throws BufferUnderflowException when {@code buf} is incomplete. (EOF) * @throws SecurityException on an upper limit breach defined by either {@link #colferSizeMax} or {@link #colferListMax}. * @throws InputMismatchException when the data does not match this object's schema. */
Deserializes the object
unmarshal
{ "repo_name": "moxaj/mikron", "path": "src/benchmark/java/mikron/colf/Fixture.java", "license": "epl-1.0", "size": 9037 }
[ "java.nio.BufferUnderflowException", "java.util.InputMismatchException" ]
import java.nio.BufferUnderflowException; import java.util.InputMismatchException;
import java.nio.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
1,528,794
@Test public void testApplyUndo_Object() throws GarageException, IOException { final GaragePath<NamedObject> oldPath = fromPath("/2/d/z", tgt.root); final CmdGarageRename<NamedObject> cut = new CmdGarageRename<>(md, oldPath, ANY_NAME); cut.apply(); verify(md).post(new GarageMessage<>(GarageMessageType.RENAMED, oldPath)); assertEquals(ANY_NAME, tgt.z.getName()); assertTrue(oldPath.toPath().endsWith(ANY_NAME)); reset(md); cut.undo(); verify(md).post(new GarageMessage<>(GarageMessageType.RENAMED, oldPath)); tgt.assertUnmodified(); }
void function() throws GarageException, IOException { final GaragePath<NamedObject> oldPath = fromPath(STR, tgt.root); final CmdGarageRename<NamedObject> cut = new CmdGarageRename<>(md, oldPath, ANY_NAME); cut.apply(); verify(md).post(new GarageMessage<>(GarageMessageType.RENAMED, oldPath)); assertEquals(ANY_NAME, tgt.z.getName()); assertTrue(oldPath.toPath().endsWith(ANY_NAME)); reset(md); cut.undo(); verify(md).post(new GarageMessage<>(GarageMessageType.RENAMED, oldPath)); tgt.assertUnmodified(); }
/** * We can rename values */
We can rename values
testApplyUndo_Object
{ "repo_name": "EmilyBjoerk/lsml", "path": "src/test/java/org/lisoft/lsml/command/CmdGarageRenameTest.java", "license": "gpl-3.0", "size": 7297 }
[ "java.io.IOException", "org.junit.Assert", "org.lisoft.lsml.messages.GarageMessage", "org.lisoft.lsml.messages.GarageMessageType", "org.lisoft.lsml.model.NamedObject", "org.lisoft.lsml.model.garage.GarageException", "org.lisoft.lsml.model.garage.GaragePath", "org.mockito.Mockito" ]
import java.io.IOException; import org.junit.Assert; import org.lisoft.lsml.messages.GarageMessage; import org.lisoft.lsml.messages.GarageMessageType; import org.lisoft.lsml.model.NamedObject; import org.lisoft.lsml.model.garage.GarageException; import org.lisoft.lsml.model.garage.GaragePath; import org.mockito.Mockito;
import java.io.*; import org.junit.*; import org.lisoft.lsml.messages.*; import org.lisoft.lsml.model.*; import org.lisoft.lsml.model.garage.*; import org.mockito.*;
[ "java.io", "org.junit", "org.lisoft.lsml", "org.mockito" ]
java.io; org.junit; org.lisoft.lsml; org.mockito;
491,933
public void seriesChanged(SeriesChangeEvent event) { this.lastEvent = event; }
void function(SeriesChangeEvent event) { this.lastEvent = event; }
/** * Records the last event. * * @param event the event. */
Records the last event
seriesChanged
{ "repo_name": "integrated/jfreechart", "path": "tests/org/jfree/data/xy/junit/XIntervalSeriesTests.java", "license": "lgpl-2.1", "size": 10608 }
[ "org.jfree.data.general.SeriesChangeEvent" ]
import org.jfree.data.general.SeriesChangeEvent;
import org.jfree.data.general.*;
[ "org.jfree.data" ]
org.jfree.data;
1,795,195
public TPersonInDomainBean getBean(IdentityMap createdBeans) { TPersonInDomainBean result = (TPersonInDomainBean) createdBeans.get(this); if (result != null ) { // we have already created a bean for this object, return it return result; } // no bean exists for this object; create a new one result = new TPersonInDomainBean(); createdBeans.put(this, result); result.setObjectID(getObjectID()); result.setPerson(getPerson()); result.setDomain(getDomain()); result.setDescription(getDescription()); result.setUuid(getUuid()); if (aTPerson != null) { TPersonBean relatedBean = aTPerson.getBean(createdBeans); result.setTPersonBean(relatedBean); } if (aTDomain != null) { TDomainBean relatedBean = aTDomain.getBean(createdBeans); result.setTDomainBean(relatedBean); } result.setModified(isModified()); result.setNew(isNew()); return result; }
TPersonInDomainBean function(IdentityMap createdBeans) { TPersonInDomainBean result = (TPersonInDomainBean) createdBeans.get(this); if (result != null ) { return result; } result = new TPersonInDomainBean(); createdBeans.put(this, result); result.setObjectID(getObjectID()); result.setPerson(getPerson()); result.setDomain(getDomain()); result.setDescription(getDescription()); result.setUuid(getUuid()); if (aTPerson != null) { TPersonBean relatedBean = aTPerson.getBean(createdBeans); result.setTPersonBean(relatedBean); } if (aTDomain != null) { TDomainBean relatedBean = aTDomain.getBean(createdBeans); result.setTDomainBean(relatedBean); } result.setModified(isModified()); result.setNew(isNew()); return result; }
/** * Creates a TPersonInDomainBean with the contents of this object * intended for internal use only * @param createdBeans a IdentityMap which maps objects * to already created beans * @return a TPersonInDomainBean with the contents of this object */
Creates a TPersonInDomainBean with the contents of this object intended for internal use only
getBean
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTPersonInDomain.java", "license": "gpl-3.0", "size": 28899 }
[ "com.aurel.track.beans.TDomainBean", "com.aurel.track.beans.TPersonBean", "com.aurel.track.beans.TPersonInDomainBean", "org.apache.commons.collections.map.IdentityMap" ]
import com.aurel.track.beans.TDomainBean; import com.aurel.track.beans.TPersonBean; import com.aurel.track.beans.TPersonInDomainBean; import org.apache.commons.collections.map.IdentityMap;
import com.aurel.track.beans.*; import org.apache.commons.collections.map.*;
[ "com.aurel.track", "org.apache.commons" ]
com.aurel.track; org.apache.commons;
1,105,382
public static void restartWithTheme(Activity activity, int theme, boolean force) { if (theme < _START_RESOURCES_ID) { if (ThemeManager._THEME_MODIFIER > 0) { theme |= ThemeManager._THEME_MODIFIER; } theme &= ThemeManager._THEME_MASK; } if (force || ThemeManager.getTheme(activity) != theme) { Intent intent = new Intent(activity.getIntent()); intent.setClass(activity, activity.getClass()); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(ThemeManager._THEME_TAG, theme); intent.putExtra(KEY_INSTANCE_STATE, activity.saveInstanceState()); intent.putExtra(KEY_CREATED_BY_THEME_MANAGER, true); if (activity.isRestricted()) { Application app = Application.getLastInstance(); if (app != null && !app.isRestricted()) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); app.superStartActivity(intent, -1, null); } } else { if (!activity.isFinishing()) { activity.finish(); activity.overridePendingTransition(0, 0); } if (activity instanceof SuperStartActivity) { ((SuperStartActivity) activity).superStartActivity(intent, -1, null); } else { activity.startActivity(intent); } } } }
static void function(Activity activity, int theme, boolean force) { if (theme < _START_RESOURCES_ID) { if (ThemeManager._THEME_MODIFIER > 0) { theme = ThemeManager._THEME_MODIFIER; } theme &= ThemeManager._THEME_MASK; } if (force ThemeManager.getTheme(activity) != theme) { Intent intent = new Intent(activity.getIntent()); intent.setClass(activity, activity.getClass()); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(ThemeManager._THEME_TAG, theme); intent.putExtra(KEY_INSTANCE_STATE, activity.saveInstanceState()); intent.putExtra(KEY_CREATED_BY_THEME_MANAGER, true); if (activity.isRestricted()) { Application app = Application.getLastInstance(); if (app != null && !app.isRestricted()) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); app.superStartActivity(intent, -1, null); } } else { if (!activity.isFinishing()) { activity.finish(); activity.overridePendingTransition(0, 0); } if (activity instanceof SuperStartActivity) { ((SuperStartActivity) activity).superStartActivity(intent, -1, null); } else { activity.startActivity(intent); } } } }
/** * Like {@link #restartWithTheme(Activity, int)}, but if third arg is true - * restart activity regardless theme. * * @param activity Activity * @param theme Theme flags for check * @param force Force restart activity */
Like <code>#restartWithTheme(Activity, int)</code>, but if third arg is true - restart activity regardless theme
restartWithTheme
{ "repo_name": "wfxiang08/android-HoloEverywhere", "path": "library/src/org/holoeverywhere/ThemeManager.java", "license": "mit", "size": 27224 }
[ "android.content.Intent", "org.holoeverywhere.app.Activity", "org.holoeverywhere.app.Application" ]
import android.content.Intent; import org.holoeverywhere.app.Activity; import org.holoeverywhere.app.Application;
import android.content.*; import org.holoeverywhere.app.*;
[ "android.content", "org.holoeverywhere.app" ]
android.content; org.holoeverywhere.app;
463,383
@Test public void testGetTerms() { Set<Term> terms = new HashSet<Term>(); final TermSource mo = this.vocabularyService.getSource(SOURCE_NAME, SOURCE_VERSION); final Category protocolType = this.vocabularyService.getCategory(mo, CATEGORY_NAME); terms = this.vocabularyService.getTerms(protocolType); assertTrue(!terms.isEmpty()); assertEquals(NUM_PROT_TYPES, terms.size()); terms = this.vocabularyService.getTerms(protocolType, "term4"); assertEquals(2, terms.size()); terms = this.vocabularyService.getTerms(protocolType, "term4a"); assertEquals(1, terms.size()); terms = this.vocabularyService.getTerms(protocolType, "gibberish"); assertEquals(0, terms.size()); final Term term = this.vocabularyService.getTerm(source, "term1"); assertNotNull(term); assertEquals("term1", term.getValue()); assertEquals(source.getNameAndVersion(), term.getSource().getNameAndVersion()); }
void function() { Set<Term> terms = new HashSet<Term>(); final TermSource mo = this.vocabularyService.getSource(SOURCE_NAME, SOURCE_VERSION); final Category protocolType = this.vocabularyService.getCategory(mo, CATEGORY_NAME); terms = this.vocabularyService.getTerms(protocolType); assertTrue(!terms.isEmpty()); assertEquals(NUM_PROT_TYPES, terms.size()); terms = this.vocabularyService.getTerms(protocolType, "term4"); assertEquals(2, terms.size()); terms = this.vocabularyService.getTerms(protocolType, STR); assertEquals(1, terms.size()); terms = this.vocabularyService.getTerms(protocolType, STR); assertEquals(0, terms.size()); final Term term = this.vocabularyService.getTerm(source, "term1"); assertNotNull(term); assertEquals("term1", term.getValue()); assertEquals(source.getNameAndVersion(), term.getSource().getNameAndVersion()); }
/** * Test to ensure that entries are returned for the categoryName "ProtocolType". */
Test to ensure that entries are returned for the categoryName "ProtocolType"
testGetTerms
{ "repo_name": "NCIP/caarray", "path": "software/caarray-ejb.jar/src/test/java/gov/nih/nci/caarray/application/vocabulary/VocabularyServiceTest.java", "license": "bsd-3-clause", "size": 13566 }
[ "gov.nih.nci.caarray.domain.vocabulary.Category", "gov.nih.nci.caarray.domain.vocabulary.Term", "gov.nih.nci.caarray.domain.vocabulary.TermSource", "java.util.HashSet", "java.util.Set", "org.junit.Assert" ]
import gov.nih.nci.caarray.domain.vocabulary.Category; import gov.nih.nci.caarray.domain.vocabulary.Term; import gov.nih.nci.caarray.domain.vocabulary.TermSource; import java.util.HashSet; import java.util.Set; import org.junit.Assert;
import gov.nih.nci.caarray.domain.vocabulary.*; import java.util.*; import org.junit.*;
[ "gov.nih.nci", "java.util", "org.junit" ]
gov.nih.nci; java.util; org.junit;
2,845,766
if (server != null && CloudSolrServer.class.isAssignableFrom(server.getClass())) { CloudSolrServer cs = (CloudSolrServer) server; if (StringUtils.isBlank(cs.getDefaultCollection())) { cs.setDefaultCollection(PRIMARY); } if (reindexServer != null) { //If we already have a reindex server set, make sure it's not the same instance as the primary if (server == reindexServer) { throw new IllegalArgumentException("The primary and reindex CloudSolrServers are the same instances. " + "They must be different instances. Each instance must have a different defaultCollection or " + "the defaultCollection must be unspecified and Broadleaf will set it."); } if (CloudSolrServer.class.isAssignableFrom(reindexServer.getClass())) { //Make sure that the primary and reindex servers are not using the same default collection name if (cs.getDefaultCollection().equals(((CloudSolrServer) reindexServer).getDefaultCollection())) { throw new IllegalStateException("Primary and Reindex servers cannot have the same defaultCollection: " + cs.getDefaultCollection()); } } } } primaryServer = server; }
if (server != null && CloudSolrServer.class.isAssignableFrom(server.getClass())) { CloudSolrServer cs = (CloudSolrServer) server; if (StringUtils.isBlank(cs.getDefaultCollection())) { cs.setDefaultCollection(PRIMARY); } if (reindexServer != null) { if (server == reindexServer) { throw new IllegalArgumentException(STR + STR + STR); } if (CloudSolrServer.class.isAssignableFrom(reindexServer.getClass())) { if (cs.getDefaultCollection().equals(((CloudSolrServer) reindexServer).getDefaultCollection())) { throw new IllegalStateException(STR + cs.getDefaultCollection()); } } } } primaryServer = server; }
/** * Sets the primary SolrServer instance to communicate with Solr. This is typically one of the following: * <code>org.apache.solr.client.solrj.embedded.EmbeddedSolrServer</code>, * <code>org.apache.solr.client.solrj.impl.HttpSolrServer</code>, * <code>org.apache.solr.client.solrj.impl.LBHttpSolrServer</code>, * or <code>org.apache.solr.client.solrj.impl.CloudSolrServer</code> * * @param server */
Sets the primary SolrServer instance to communicate with Solr. This is typically one of the following: <code>org.apache.solr.client.solrj.embedded.EmbeddedSolrServer</code>, <code>org.apache.solr.client.solrj.impl.HttpSolrServer</code>, <code>org.apache.solr.client.solrj.impl.LBHttpSolrServer</code>, or <code>org.apache.solr.client.solrj.impl.CloudSolrServer</code>
setPrimaryServer
{ "repo_name": "cloudbearings/BroadleafCommerce", "path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/search/service/solr/SolrContext.java", "license": "apache-2.0", "size": 8554 }
[ "org.apache.commons.lang.StringUtils", "org.apache.solr.client.solrj.impl.CloudSolrServer" ]
import org.apache.commons.lang.StringUtils; import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.commons.lang.*; import org.apache.solr.client.solrj.impl.*;
[ "org.apache.commons", "org.apache.solr" ]
org.apache.commons; org.apache.solr;
752,623
public static ClusterSet make(AudioFeatureSet featureSet, ClusterSet clusterset, Parameter parameter) throws DiarizationException, IOException { logger.info("Adjust the bounady of segmentation"); ArrayList<Segment> segmentList = clusterset.getSegmentVectorRepresentation(); int indexOfEnergy = parameter.getParameterInputFeature().getFeaturesDescription().getIndexOfEnergy(); // adjust segment boundaries if (indexOfEnergy < 0) { throw new DiarizationException("SAdjSeg: main() error: energy not present"); } int size = segmentList.size(); int nb = 0; Iterator<Segment> itSeg = segmentList.iterator(); while (itSeg.hasNext() && (nb < (size - 1))) { Segment seg = itSeg.next(); featureSet.setCurrentShow(seg.getShowName()); moveStartAndEndOfSegment(featureSet, seg, indexOfEnergy); nb++; } ClusterSet res = new ClusterSet(); res.addVector(segmentList); return res; }
static ClusterSet function(AudioFeatureSet featureSet, ClusterSet clusterset, Parameter parameter) throws DiarizationException, IOException { logger.info(STR); ArrayList<Segment> segmentList = clusterset.getSegmentVectorRepresentation(); int indexOfEnergy = parameter.getParameterInputFeature().getFeaturesDescription().getIndexOfEnergy(); if (indexOfEnergy < 0) { throw new DiarizationException(STR); } int size = segmentList.size(); int nb = 0; Iterator<Segment> itSeg = segmentList.iterator(); while (itSeg.hasNext() && (nb < (size - 1))) { Segment seg = itSeg.next(); featureSet.setCurrentShow(seg.getShowName()); moveStartAndEndOfSegment(featureSet, seg, indexOfEnergy); nb++; } ClusterSet res = new ClusterSet(); res.addVector(segmentList); return res; }
/** * Make: the process. * * @param featureSet the feature set * @param clusterset the clusterset * @param parameter the parameter * @return the cluster set * @throws DiarizationException the diarization exception * @throws IOException Signals that an I/O exception has occurred. */
Make: the process
make
{ "repo_name": "Adirockzz95/GenderDetect", "path": "src/src/fr/lium/spkDiarization/tools/SAdjSeg.java", "license": "gpl-3.0", "size": 8387 }
[ "fr.lium.spkDiarization.lib.DiarizationException", "fr.lium.spkDiarization.libClusteringData.ClusterSet", "fr.lium.spkDiarization.libClusteringData.Segment", "fr.lium.spkDiarization.libFeature.AudioFeatureSet", "fr.lium.spkDiarization.parameter.Parameter", "java.io.IOException", "java.util.ArrayList", "java.util.Iterator" ]
import fr.lium.spkDiarization.lib.DiarizationException; import fr.lium.spkDiarization.libClusteringData.ClusterSet; import fr.lium.spkDiarization.libClusteringData.Segment; import fr.lium.spkDiarization.libFeature.AudioFeatureSet; import fr.lium.spkDiarization.parameter.Parameter; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator;
import fr.lium.*; import java.io.*; import java.util.*;
[ "fr.lium", "java.io", "java.util" ]
fr.lium; java.io; java.util;
1,763,802
public Map<String, Object> getWeaponStats() { if(!this.isPublic()) { return null; } if(this.weaponStats == null) { this.weaponStats = new HashMap<String, Object>(); for(String weaponNode : WEAPONS) { XMLData weaponData = this.xmlData.getElement("stats", "weapons", weaponNode); AlienSwarmWeapon weapon = new AlienSwarmWeapon(weaponData); this.weaponStats.put(weapon.getName(), weapon); } } return this.weaponStats; }
Map<String, Object> function() { if(!this.isPublic()) { return null; } if(this.weaponStats == null) { this.weaponStats = new HashMap<String, Object>(); for(String weaponNode : WEAPONS) { XMLData weaponData = this.xmlData.getElement("stats", STR, weaponNode); AlienSwarmWeapon weapon = new AlienSwarmWeapon(weaponData); this.weaponStats.put(weapon.getName(), weapon); } } return this.weaponStats; }
/** * Returns the stats for individual weapons for this user containing all * Alien Swarm weapons * <p> * If the weapon stats haven't been parsed already, parsing is done now. * * @return The weapon stats for this player */
Returns the stats for individual weapons for this user containing all Alien Swarm weapons If the weapon stats haven't been parsed already, parsing is done now
getWeaponStats
{ "repo_name": "tomtomssi/Steam-API", "path": "src/main/java/com/github/koraktor/steamcondenser/community/alien_swarm/AlienSwarmStats.java", "license": "bsd-3-clause", "size": 11105 }
[ "com.github.koraktor.steamcondenser.community.XMLData", "java.util.HashMap", "java.util.Map" ]
import com.github.koraktor.steamcondenser.community.XMLData; import java.util.HashMap; import java.util.Map;
import com.github.koraktor.steamcondenser.community.*; import java.util.*;
[ "com.github.koraktor", "java.util" ]
com.github.koraktor; java.util;
67,824
public static ReplyCallback cbError() { CallbackCapture.callbackError(); return null; }
static ReplyCallback function() { CallbackCapture.callbackError(); return null; }
/** * Creates a new CallbackReply. * * @return The CallbackReply. */
Creates a new CallbackReply
cbError
{ "repo_name": "allanbank/mongodb-async-driver", "path": "src/test/java/com/allanbank/mongodb/client/connection/CallbackReply.java", "license": "apache-2.0", "size": 3051 }
[ "com.allanbank.mongodb.CallbackCapture", "com.allanbank.mongodb.client.callback.ReplyCallback" ]
import com.allanbank.mongodb.CallbackCapture; import com.allanbank.mongodb.client.callback.ReplyCallback;
import com.allanbank.mongodb.*; import com.allanbank.mongodb.client.callback.*;
[ "com.allanbank.mongodb" ]
com.allanbank.mongodb;
428,590
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "pgaufillet/topcased-req", "path": "plugins/org.topcased.typesmodel/src/org/topcased/typesmodel/model/inittypes/provider/TypeItemProvider.java", "license": "epl-1.0", "size": 6903 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,457,989
private void saveArgument(Prefix prefix, String value) { if (this.tokenizedArguments.containsKey(prefix)) { this.tokenizedArguments.get(prefix).add(value); return; } List<String> values = new ArrayList<>(); values.add(value); this.tokenizedArguments.put(prefix, values); } public static class Prefix { final String prefix; Prefix(String prefix) { this.prefix = prefix; }
void function(Prefix prefix, String value) { if (this.tokenizedArguments.containsKey(prefix)) { this.tokenizedArguments.get(prefix).add(value); return; } List<String> values = new ArrayList<>(); values.add(value); this.tokenizedArguments.put(prefix, values); } public static class Prefix { final String prefix; Prefix(String prefix) { this.prefix = prefix; }
/** * Stores the value of the given prefix in the state of this tokenizer */
Stores the value of the given prefix in the state of this tokenizer
saveArgument
{ "repo_name": "CS2103JAN2017-T11-B2/main", "path": "src/main/java/seedu/todolist/logic/parser/ArgumentTokenizer.java", "license": "mit", "size": 7511 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,021,454
private PlanTableEntry createValueJoinEntry(PlanTableEntry leftEntry, PlanTableEntry rightEntry, CNF joinPredicate) { List<Pair<String, String>> leftProperties = new ArrayList<>(); List<Pair<String, String>> rightProperties = new ArrayList<>(); for (CNFElement e : joinPredicate.getPredicates()) { ComparisonExpression comparison = e.getPredicates().get(0); Pair<String, String> joinProperty = extractJoinProperty(comparison.getLhs()); if (leftEntry.getAllVariables().contains(joinProperty.getKey())) { leftProperties.add(joinProperty); } else { rightProperties.add(joinProperty); } joinProperty = extractJoinProperty(comparison.getRhs()); if (leftEntry.getAllVariables().contains(joinProperty.getKey())) { leftProperties.add(joinProperty); } else { rightProperties.add(joinProperty); } } ValueJoinNode node = new ValueJoinNode( leftEntry.getQueryPlan().getRoot(), rightEntry.getQueryPlan().getRoot(), leftProperties, rightProperties, vertexStrategy, edgeStrategy ); Set<String> processedVariables = leftEntry.getProcessedVariables(); processedVariables.addAll(rightEntry.getProcessedVariables()); CNF predicates = mergePredicates(leftEntry, rightEntry); return new PlanTableEntry( GRAPH, processedVariables, predicates, new QueryPlanEstimator(new QueryPlan(node), queryHandler, graphStatistics) ); } /** * Turns a QueryComparable into a {@code Pair<Variable, PropertyKey>}
PlanTableEntry function(PlanTableEntry leftEntry, PlanTableEntry rightEntry, CNF joinPredicate) { List<Pair<String, String>> leftProperties = new ArrayList<>(); List<Pair<String, String>> rightProperties = new ArrayList<>(); for (CNFElement e : joinPredicate.getPredicates()) { ComparisonExpression comparison = e.getPredicates().get(0); Pair<String, String> joinProperty = extractJoinProperty(comparison.getLhs()); if (leftEntry.getAllVariables().contains(joinProperty.getKey())) { leftProperties.add(joinProperty); } else { rightProperties.add(joinProperty); } joinProperty = extractJoinProperty(comparison.getRhs()); if (leftEntry.getAllVariables().contains(joinProperty.getKey())) { leftProperties.add(joinProperty); } else { rightProperties.add(joinProperty); } } ValueJoinNode node = new ValueJoinNode( leftEntry.getQueryPlan().getRoot(), rightEntry.getQueryPlan().getRoot(), leftProperties, rightProperties, vertexStrategy, edgeStrategy ); Set<String> processedVariables = leftEntry.getProcessedVariables(); processedVariables.addAll(rightEntry.getProcessedVariables()); CNF predicates = mergePredicates(leftEntry, rightEntry); return new PlanTableEntry( GRAPH, processedVariables, predicates, new QueryPlanEstimator(new QueryPlan(node), queryHandler, graphStatistics) ); } /** * Turns a QueryComparable into a {@code Pair<Variable, PropertyKey>}
/** * Creates an {@link ValueJoinNode} from the specified arguments. * * @param leftEntry left entry * @param rightEntry right entry * @param joinPredicate join predicate * * @return new value join node */
Creates an <code>ValueJoinNode</code> from the specified arguments
createValueJoinEntry
{ "repo_name": "smee/gradoop", "path": "gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/single/cypher/planning/planner/greedy/GreedyPlanner.java", "license": "apache-2.0", "size": 24467 }
[ "java.util.ArrayList", "java.util.List", "java.util.Set", "org.apache.commons.lang3.tuple.Pair", "org.gradoop.flink.model.impl.operators.matching.common.query.predicates.CNFElement", "org.gradoop.flink.model.impl.operators.matching.common.query.predicates.QueryComparable", "org.gradoop.flink.model.impl.operators.matching.common.query.predicates.expressions.ComparisonExpression", "org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.estimation.QueryPlanEstimator", "org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.plantable.PlanTableEntry", "org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.QueryPlan", "org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.binary.ValueJoinNode" ]
import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.commons.lang3.tuple.Pair; import org.gradoop.flink.model.impl.operators.matching.common.query.predicates.CNFElement; import org.gradoop.flink.model.impl.operators.matching.common.query.predicates.QueryComparable; import org.gradoop.flink.model.impl.operators.matching.common.query.predicates.expressions.ComparisonExpression; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.estimation.QueryPlanEstimator; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.plantable.PlanTableEntry; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.QueryPlan; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.binary.ValueJoinNode;
import java.util.*; import org.apache.commons.lang3.tuple.*; import org.gradoop.flink.model.impl.operators.matching.common.query.predicates.*; import org.gradoop.flink.model.impl.operators.matching.common.query.predicates.expressions.*; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.estimation.*; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.plantable.*; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.*; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.binary.*;
[ "java.util", "org.apache.commons", "org.gradoop.flink" ]
java.util; org.apache.commons; org.gradoop.flink;
972,574
public static SortedBidiMap decorate(SortedBidiMap map) { if (map instanceof Unmodifiable) { return map; } return new UnmodifiableSortedBidiMap(map); } //----------------------------------------------------------------------- private UnmodifiableSortedBidiMap(SortedBidiMap map) { super(map); }
static SortedBidiMap function(SortedBidiMap map) { if (map instanceof Unmodifiable) { return map; } return new UnmodifiableSortedBidiMap(map); } private UnmodifiableSortedBidiMap(SortedBidiMap map) { super(map); }
/** * Factory method to create an unmodifiable map. * <p> * If the map passed in is already unmodifiable, it is returned. * * @param map the map to decorate, must not be null * @return an unmodifiable SortedBidiMap * @throws IllegalArgumentException if map is null */
Factory method to create an unmodifiable map. If the map passed in is already unmodifiable, it is returned
decorate
{ "repo_name": "leodmurillo/sonar", "path": "plugins/sonar-squid-java-plugin/test-resources/commons-collections-3.2.1/src/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java", "license": "lgpl-3.0", "size": 5490 }
[ "org.apache.commons.collections.SortedBidiMap", "org.apache.commons.collections.Unmodifiable" ]
import org.apache.commons.collections.SortedBidiMap; import org.apache.commons.collections.Unmodifiable;
import org.apache.commons.collections.*;
[ "org.apache.commons" ]
org.apache.commons;
1,432,674
private static void unloadEmbeddedDriver() { // Attempt to unload the embedded driver and engine // but only if we're not having a J2ME configuration i.e. no DriverManager, so check... if (TestUtil.HAVE_DRIVER_CLASS) try { DriverManager.getConnection("jdbc:derby:;shutdown=true"); } catch (SQLException se) { // Ignore any exception thrown } // Call the garbage collector as spesified in the Derby doc // for how to get rid of the classes that has been loaded System.gc(); }
static void function() { if (TestUtil.HAVE_DRIVER_CLASS) try { DriverManager.getConnection(STR); } catch (SQLException se) { } System.gc(); }
/** * Unloads the embedded JDBC driver and Derby engine in case * is has already been loaded. * The purpose for doing this is that using an embedded engine * that already is loaded makes it impossible to set new * system properties for each individual suite or test. */
Unloads the embedded JDBC driver and Derby engine in case is has already been loaded. The purpose for doing this is that using an embedded engine that already is loaded makes it impossible to set new system properties for each individual suite or test
unloadEmbeddedDriver
{ "repo_name": "scnakandala/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java", "license": "apache-2.0", "size": 66721 }
[ "java.sql.DriverManager", "java.sql.SQLException", "org.apache.derbyTesting.functionTests.util.TestUtil" ]
import java.sql.DriverManager; import java.sql.SQLException; import org.apache.derbyTesting.functionTests.util.TestUtil;
import java.sql.*; import org.apache.*;
[ "java.sql", "org.apache" ]
java.sql; org.apache;
1,988,923
public Node asNode(final Resource r) { return r.asNode(); }
Node function(final Resource r) { return r.asNode(); }
/** * Convert an RDF resource to an RDF node * * @param r * @return */
Convert an RDF resource to an RDF node
asNode
{ "repo_name": "mikedurbin/fcrepo4", "path": "fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java", "license": "apache-2.0", "size": 8121 }
[ "com.hp.hpl.jena.graph.Node", "com.hp.hpl.jena.rdf.model.Resource" ]
import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
298,155
public List<Object> searchDirectories(String searchString, Long firstRecord);
List<Object> function(String searchString, Long firstRecord);
/** * Search for a {@link List} of {@link RemoteContainer}s for the given * searchString. The first item in the returned {@link List} is a count of * the total number of directories found for the given search criteria. The * second entry is a {@link List} of {@link RemoteContainer} results. * * @param searchString * @param firstRecord * @return */
Search for a <code>List</code> of <code>RemoteContainer</code>s for the given searchString. The first item in the returned <code>List</code> is a count of the total number of directories found for the given search criteria. The second entry is a <code>List</code> of <code>RemoteContainer</code> results
searchDirectories
{ "repo_name": "LeeMidyette/alfresco-jive-toolkit", "path": "jive-components/alfresco-connector/src/main/java/org/alfresco/jive/cmis/dao/AlfrescoNavigationDAO.java", "license": "apache-2.0", "size": 5322 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,743,209
System.err.println(message); HelpFormatter help = new HelpFormatter(); help.printHelp(LOG_LEVEL, OPTIONS, true); }
System.err.println(message); HelpFormatter help = new HelpFormatter(); help.printHelp(LOG_LEVEL, OPTIONS, true); }
/** * Prints the help message. * * @param message message before standard usage information */
Prints the help message
printHelp
{ "repo_name": "calvinjia/tachyon", "path": "shell/src/main/java/alluxio/cli/LogLevel.java", "license": "apache-2.0", "size": 15064 }
[ "org.apache.commons.cli.HelpFormatter" ]
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.*;
[ "org.apache.commons" ]
org.apache.commons;
2,257,888
public static byte[] toGeometryBytes(Geometry geometry) { byte[] bytes = null; ByteWriter writer = new ByteWriter(); try { writer.setByteOrder(ByteOrder.BIG_ENDIAN); GeometryWriter.writeGeometry(writer, geometry); bytes = writer.getBytes(); } catch (IOException e) { Log.e(GeometryUtility.class.getSimpleName(), "Problem reading observation.", e); } finally { writer.close(); } return bytes; }
static byte[] function(Geometry geometry) { byte[] bytes = null; ByteWriter writer = new ByteWriter(); try { writer.setByteOrder(ByteOrder.BIG_ENDIAN); GeometryWriter.writeGeometry(writer, geometry); bytes = writer.getBytes(); } catch (IOException e) { Log.e(GeometryUtility.class.getSimpleName(), STR, e); } finally { writer.close(); } return bytes; }
/** * Convert a Geometry to well-known binary bytes * * @param geometry geometry * @return well-known binary bytes */
Convert a Geometry to well-known binary bytes
toGeometryBytes
{ "repo_name": "ngageoint/mage-android-sdk", "path": "sdk/src/main/java/mil/nga/giat/mage/sdk/utils/GeometryUtility.java", "license": "apache-2.0", "size": 1459 }
[ "android.util.Log", "java.io.IOException", "java.nio.ByteOrder", "mil.nga.sf.Geometry", "mil.nga.sf.util.ByteWriter", "mil.nga.sf.wkb.GeometryWriter" ]
import android.util.Log; import java.io.IOException; import java.nio.ByteOrder; import mil.nga.sf.Geometry; import mil.nga.sf.util.ByteWriter; import mil.nga.sf.wkb.GeometryWriter;
import android.util.*; import java.io.*; import java.nio.*; import mil.nga.sf.*; import mil.nga.sf.util.*; import mil.nga.sf.wkb.*;
[ "android.util", "java.io", "java.nio", "mil.nga.sf" ]
android.util; java.io; java.nio; mil.nga.sf;
322,564
final File file = ReaderUtils.getFileFromInput(input); if (file != null) { final String fileName = file.getName().toLowerCase(); final String[] extensions = getDefaultFileExtensions(); for (final String extension : extensions) { if (fileName.endsWith(extension.toLowerCase()) && !fileName.equals(extension.toLowerCase())) { return DecodeQualification.INTENDED; } } } return DecodeQualification.UNABLE; }
final File file = ReaderUtils.getFileFromInput(input); if (file != null) { final String fileName = file.getName().toLowerCase(); final String[] extensions = getDefaultFileExtensions(); for (final String extension : extensions) { if (fileName.endsWith(extension.toLowerCase()) && !fileName.equals(extension.toLowerCase())) { return DecodeQualification.INTENDED; } } } return DecodeQualification.UNABLE; }
/** * Checks whether the given object is an acceptable input for this product reader and if so, the method checks if it * is capable of decoding the input's content. */
Checks whether the given object is an acceptable input for this product reader and if so, the method checks if it is capable of decoding the input's content
getDecodeQualification
{ "repo_name": "lveci/nest", "path": "nest-reader-dem/src/main/java/org/esa/nest/dataio/dem/ace/ACEReaderPlugIn.java", "license": "gpl-3.0", "size": 4815 }
[ "java.io.File", "org.esa.beam.framework.dataio.DecodeQualification", "org.esa.nest.gpf.ReaderUtils" ]
import java.io.File; import org.esa.beam.framework.dataio.DecodeQualification; import org.esa.nest.gpf.ReaderUtils;
import java.io.*; import org.esa.beam.framework.dataio.*; import org.esa.nest.gpf.*;
[ "java.io", "org.esa.beam", "org.esa.nest" ]
java.io; org.esa.beam; org.esa.nest;
1,402,376
public static TemplateModel execBuiltIn(String builtInName, TemplateModel value, Environment env) throws TemplateModelException { return execBuiltIn(builtInName, value, null, env); }
static TemplateModel function(String builtInName, TemplateModel value, Environment env) throws TemplateModelException { return execBuiltIn(builtInName, value, null, env); }
/** * Executes an arbitrary FTL built-in. */
Executes an arbitrary FTL built-in
execBuiltIn
{ "repo_name": "ilscipio/scipio-erp", "path": "framework/webapp/src/com/ilscipio/scipio/ce/webapp/ftl/lang/LangFtlUtil.java", "license": "apache-2.0", "size": 88244 }
[ "freemarker.core.Environment", "freemarker.template.TemplateModel", "freemarker.template.TemplateModelException" ]
import freemarker.core.Environment; import freemarker.template.TemplateModel; import freemarker.template.TemplateModelException;
import freemarker.core.*; import freemarker.template.*;
[ "freemarker.core", "freemarker.template" ]
freemarker.core; freemarker.template;
1,629,935
@Nullable MvpnChoice parseMvpn(NlriType type, ByteBuf buffer);
@Nullable MvpnChoice parseMvpn(NlriType type, ByteBuf buffer);
/** * Decode input buffer to BGP Mvpn. * * @param type Nlri Type * @param buffer encoded MvpnChoice body in Bytebuf * @return MvpnChoice */
Decode input buffer to BGP Mvpn
parseMvpn
{ "repo_name": "opendaylight/bgpcep", "path": "bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/spi/nlri/MvpnRegistry.java", "license": "epl-1.0", "size": 1187 }
[ "io.netty.buffer.ByteBuf", "org.eclipse.jdt.annotation.Nullable", "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType", "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice" ]
import io.netty.buffer.ByteBuf; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice;
import io.netty.buffer.*; import org.eclipse.jdt.annotation.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.*;
[ "io.netty.buffer", "org.eclipse.jdt", "org.opendaylight.yang" ]
io.netty.buffer; org.eclipse.jdt; org.opendaylight.yang;
2,158,756
Future<WebSiteAsyncOperationResponse> cloneMethodAsync(String resourceGroupName, String webSiteName, String slotName, WebSiteCloneParameters parameters);
Future<WebSiteAsyncOperationResponse> cloneMethodAsync(String resourceGroupName, String webSiteName, String slotName, WebSiteCloneParameters parameters);
/** * You can clone a web site by using a PUT request that includes the name of * the web site and other information in the request body. (see * http://msdn.microsoft.com/en-us/library/windowsazure/dn166986.aspx for * more information) * * @param resourceGroupName Required. The name of the resource group. * @param webSiteName Required. The name of the web site. * @param slotName Optional. The name of the slot. * @param parameters Required. Parameters supplied to the clone Web Site * operation. * @return The website operation response. */
You can clone a web site by using a PUT request that includes the name of the web site and other information in the request body. (see HREF for more information)
cloneMethodAsync
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "resource-management/azure-mgmt-websites/src/main/java/com/microsoft/azure/management/websites/WebSiteOperations.java", "license": "apache-2.0", "size": 60715 }
[ "com.microsoft.azure.management.websites.models.WebSiteAsyncOperationResponse", "com.microsoft.azure.management.websites.models.WebSiteCloneParameters", "java.util.concurrent.Future" ]
import com.microsoft.azure.management.websites.models.WebSiteAsyncOperationResponse; import com.microsoft.azure.management.websites.models.WebSiteCloneParameters; import java.util.concurrent.Future;
import com.microsoft.azure.management.websites.models.*; import java.util.concurrent.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,280,632
public SLExpressionNode createReadProperty(SLExpressionNode receiverNode, SLExpressionNode nameNode) { final SLExpressionNode result = SLReadPropertyNodeGen.create(receiverNode, nameNode); final int startPos = receiverNode.getSourceSection().getCharIndex(); final int endPos = nameNode.getSourceSection().getCharEndIndex(); result.setSourceSection(source.createSection(startPos, endPos - startPos)); return new ExpressionWrapperNode(result, new ReadPropertyShadowInstrument()); }
SLExpressionNode function(SLExpressionNode receiverNode, SLExpressionNode nameNode) { final SLExpressionNode result = SLReadPropertyNodeGen.create(receiverNode, nameNode); final int startPos = receiverNode.getSourceSection().getCharIndex(); final int endPos = nameNode.getSourceSection().getCharEndIndex(); result.setSourceSection(source.createSection(startPos, endPos - startPos)); return new ExpressionWrapperNode(result, new ReadPropertyShadowInstrument()); }
/** * Returns an {@link SLReadPropertyNode} for the given parameters. * * @param receiverNode The receiver of the property access * @param nameNode The name of the property being accessed * @return An SLExpressionNode for the given parameters. */
Returns an <code>SLReadPropertyNode</code> for the given parameters
createReadProperty
{ "repo_name": "azadmanesh/sl-tracer", "path": "truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java", "license": "gpl-2.0", "size": 24522 }
[ "com.oracle.truffle.sl.nodes.SLExpressionNode", "com.oracle.truffle.sl.nodes.access.SLReadPropertyNodeGen", "com.oracle.truffle.sl.tracer.ExpressionWrapperNode", "com.oracle.truffle.sl.tracer.ReadPropertyShadowInstrument" ]
import com.oracle.truffle.sl.nodes.SLExpressionNode; import com.oracle.truffle.sl.nodes.access.SLReadPropertyNodeGen; import com.oracle.truffle.sl.tracer.ExpressionWrapperNode; import com.oracle.truffle.sl.tracer.ReadPropertyShadowInstrument;
import com.oracle.truffle.sl.nodes.*; import com.oracle.truffle.sl.nodes.access.*; import com.oracle.truffle.sl.tracer.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
1,273,419
@Test public void testTruncateSegmentationValues_aboveLimit() { Map<String, Object> values = new HashMap<>(); values.put("a1", "1"); values.put("a2", "2"); values.put("a3", "3"); values.put("a4", "4"); Utils.truncateSegmentationValues(values, 2, "someTag", mock(ModuleLog.class)); Assert.assertEquals(2, values.size()); //after inspecting what is returned in the debugger, it should have the values of "a2" and "a4" //Assert.assertEquals("2", values.get("a2")); //Assert.assertEquals("4", values.get("a4")); }
void function() { Map<String, Object> values = new HashMap<>(); values.put("a1", "1"); values.put("a2", "2"); values.put("a3", "3"); values.put("a4", "4"); Utils.truncateSegmentationValues(values, 2, STR, mock(ModuleLog.class)); Assert.assertEquals(2, values.size()); }
/** * Make sure that values are truncated when they are more then the limit */
Make sure that values are truncated when they are more then the limit
testTruncateSegmentationValues_aboveLimit
{ "repo_name": "Countly/countly-sdk-android", "path": "sdk/src/androidTest/java/ly/count/android/sdk/UtilsTests.java", "license": "mit", "size": 6160 }
[ "java.util.HashMap", "java.util.Map", "org.junit.Assert", "org.mockito.Mockito" ]
import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.mockito.Mockito;
import java.util.*; import org.junit.*; import org.mockito.*;
[ "java.util", "org.junit", "org.mockito" ]
java.util; org.junit; org.mockito;
2,657,099
public void setUniformf (String name, float value1, float value2) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform2f(location, value1, value2); }
void function (String name, float value1, float value2) { GL20 gl = Gdx.gl20; checkManaged(); int location = fetchUniformLocation(name); gl.glUniform2f(location, value1, value2); }
/** Sets the uniform with the given name. The {@link ShaderProgram} must be bound for this to work. * * @param name the name of the uniform * @param value1 the first value * @param value2 the second value */
Sets the uniform with the given name. The <code>ShaderProgram</code> must be bound for this to work
setUniformf
{ "repo_name": "MadcowD/libgdx", "path": "gdx/src/com/badlogic/gdx/graphics/glutils/ShaderProgram.java", "license": "apache-2.0", "size": 31675 }
[ "com.badlogic.gdx.Gdx" ]
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
1,451,071
private String getFitText(String text, float width, Paint paint) { String newText = text; int length = text.length(); int diff = 0; while (paint.measureText(newText) > width && diff < length) { diff++; newText = text.substring(0, length - diff) + "..."; } if (diff == length) { newText = "..."; } return newText; }
String function(String text, float width, Paint paint) { String newText = text; int length = text.length(); int diff = 0; while (paint.measureText(newText) > width && diff < length) { diff++; newText = text.substring(0, length - diff) + "..."; } if (diff == length) { newText = "..."; } return newText; }
/** * Calculates the best text to fit into the available space. * * @param text the entire text * @param width the width to fit the text into * @param paint the paint * @return the text to fit into the space */
Calculates the best text to fit into the available space
getFitText
{ "repo_name": "antonio/Anki-Android", "path": "src/org/achartengine/chart/AbstractChart.java", "license": "gpl-3.0", "size": 15538 }
[ "android.graphics.Paint" ]
import android.graphics.Paint;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,984,895
public boolean isComplete() throws IOException;
boolean function() throws IOException;
/** * Check if the job is finished or not. * This is a non-blocking call. * * @return <code>true</code> if the job is complete, else <code>false</code>. * @throws IOException */
Check if the job is finished or not. This is a non-blocking call
isComplete
{ "repo_name": "jayantgolhar/Hadoop-0.21.0", "path": "mapred/src/java/org/apache/hadoop/mapred/RunningJob.java", "license": "apache-2.0", "size": 6722 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,955,192
public void setDir (Directionality dir) { cc.setDir(dir); }
void function (Directionality dir) { cc.setDir(dir); }
/** * Sets the directionality of the content of this code (for both opening/closing tags). * @param dir the new directionality of the content of this code. */
Sets the directionality of the content of this code (for both opening/closing tags)
setDir
{ "repo_name": "ysavourel/liom", "path": "src/main/java/net/sf/okapi/liom/api/core/CTag.java", "license": "apache-2.0", "size": 13805 }
[ "org.oasisopen.liom.api.core.Directionality" ]
import org.oasisopen.liom.api.core.Directionality;
import org.oasisopen.liom.api.core.*;
[ "org.oasisopen.liom" ]
org.oasisopen.liom;
2,079,022
public File getFile(String pInput, File pTempDir);
File function(String pInput, File pTempDir);
/** * Get a file from this file system * @param pInput name of file to retrieve * @param pTempDir local directory to put the file in to * @return a File object for the newly copied file */
Get a file from this file system
getFile
{ "repo_name": "bl-dpt/chutney-hadoopwrapper", "path": "src/main/java/eu/scape_project/tb/chutney/fs/ChutneyFS.java", "license": "apache-2.0", "size": 2132 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,087,124
protected static char skipWhitespace(MojangsonReaderHelper reader) throws IOException { for (;;) { char c = reader.read(); if (!Character.isWhitespace(c)) { return c; } } } protected static class MojangsonReaderHelper { protected final String mojangson; protected int next = 0; public MojangsonReaderHelper(String mojangson) { this.mojangson = mojangson; }
static char function(MojangsonReaderHelper reader) throws IOException { for (;;) { char c = reader.read(); if (!Character.isWhitespace(c)) { return c; } } } protected static class MojangsonReaderHelper { protected final String mojangson; protected int next = 0; public MojangsonReaderHelper(String mojangson) { this.mojangson = mojangson; }
/** * Skips whitespace chars <br> * After finishing reader current position will point to first non-whitespace char <br> * Returns first non-whitespace char read * @param reader reader * @return first non-whitespace char read * @throws IOException */
Skips whitespace chars After finishing reader current position will point to first non-whitespace char Returns first non-whitespace char read
skipWhitespace
{ "repo_name": "ProtocolSupport/ProtocolSupport", "path": "src/protocolsupport/protocol/types/nbt/mojangson/MojangsonParser.java", "license": "agpl-3.0", "size": 11171 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,301,650
private int[][] getTopicArray(int segIdx, int maxTopics) { if (segIdx < 0) { return new int[0][0]; } int numTopics = getNumTopics(segIdx); if ((maxTopics > 0) && (numTopics > maxTopics)) { numTopics = maxTopics; } int[][] topics = new int[numTopics][2]; ByteBuffer buf = getIndirectRecordEntry(segIdx,4+8*numTopics); for(int i=0; i<numTopics; i++){ topics[i][0] = buf.getInt(4+8*i); topics[i][1] = buf.getInt(8+8*i); } return topics; }
int[][] function(int segIdx, int maxTopics) { if (segIdx < 0) { return new int[0][0]; } int numTopics = getNumTopics(segIdx); if ((maxTopics > 0) && (numTopics > maxTopics)) { numTopics = maxTopics; } int[][] topics = new int[numTopics][2]; ByteBuffer buf = getIndirectRecordEntry(segIdx,4+8*numTopics); for(int i=0; i<numTopics; i++){ topics[i][0] = buf.getInt(4+8*i); topics[i][1] = buf.getInt(8+8*i); } return topics; }
/** * Reads the topics and other metadata for a segment from the * (memory-mapped) metadata file. Returns the info in a * two-dimensional array (one row per topic). * @param segIdx The FSA index (hash value) for the segment. * @param maxTopics Max number of topics to return, 0 for all topics. * @return Number of topics for the segment. */
Reads the topics and other metadata for a segment from the (memory-mapped) metadata file. Returns the info in a two-dimensional array (one row per topic)
getTopicArray
{ "repo_name": "vespa-engine/vespa", "path": "fsa/src/main/java/com/yahoo/fsa/topicpredictor/TopicPredictor.java", "license": "apache-2.0", "size": 5477 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,113,451
public void testMultipleResources() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); XMPPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); // Add a new roster entry Roster roster = conn4.getRoster(); roster.createEntry(getBareJID(0), "gato11", null); // Wait up to 2 seconds long initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && ( !roster.getPresence(getBareJID(0)).isAvailable() || !getConnection(1).getRoster().getPresence(getBareJID(0)).isAvailable())) { Thread.sleep(100); } // Check that a presence is returned for the new contact Presence presence = roster.getPresence(getBareJID(0)); assertTrue("Returned a null Presence for an existing user", presence.isAvailable()); // Check that a presence is returned for the new contact presence = getConnection(1).getRoster().getPresence(getBareJID(0)); assertTrue("Returned a null Presence for an existing user", presence.isAvailable()); // Delete user from roster roster.removeEntry(roster.getEntry(getBareJID(0))); // Wait up to 2 seconds initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && ( roster.getPresence(getBareJID(0)).getType() != Presence.Type.unavailable || getConnection(1).getRoster().getPresence(getBareJID(0)).getType() != Presence.Type.unavailable)) { Thread.sleep(100); } // Check that no presence is returned for the removed contact presence = roster.getPresence(getBareJID(0)); assertFalse("Available presence was returned for removed contact", presence.isAvailable()); assertEquals("Returned Presence for removed contact has incorrect type", Presence.Type.unavailable, presence.getType()); // Check that no presence is returned for the removed contact presence = getConnection(1).getRoster().getPresence(getBareJID(0)); assertFalse("Available presence was returned for removed contact", presence.isAvailable()); assertEquals("Returned Presence for removed contact has incorrect type", Presence.Type.unavailable, presence.getType()); }
void function() throws Exception { ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); XMPPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); Roster roster = conn4.getRoster(); roster.createEntry(getBareJID(0), STR, null); long initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && ( !roster.getPresence(getBareJID(0)).isAvailable() !getConnection(1).getRoster().getPresence(getBareJID(0)).isAvailable())) { Thread.sleep(100); } Presence presence = roster.getPresence(getBareJID(0)); assertTrue(STR, presence.isAvailable()); presence = getConnection(1).getRoster().getPresence(getBareJID(0)); assertTrue(STR, presence.isAvailable()); roster.removeEntry(roster.getEntry(getBareJID(0))); initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && ( roster.getPresence(getBareJID(0)).getType() != Presence.Type.unavailable getConnection(1).getRoster().getPresence(getBareJID(0)).getType() != Presence.Type.unavailable)) { Thread.sleep(100); } presence = roster.getPresence(getBareJID(0)); assertFalse(STR, presence.isAvailable()); assertEquals(STR, Presence.Type.unavailable, presence.getType()); presence = getConnection(1).getRoster().getPresence(getBareJID(0)); assertFalse(STR, presence.isAvailable()); assertEquals(STR, Presence.Type.unavailable, presence.getType()); }
/** * User1 is connected from 2 resources. User1 adds User0 to his roster. Ensure * that both resources of user1 get the available presence of User0. Remove User0 * from User1's roster and check presences again. */
User1 is connected from 2 resources. User1 adds User0 to his roster. Ensure that both resources of user1 get the available presence of User0. Remove User0 from User1's roster and check presences again
testMultipleResources
{ "repo_name": "mcaprari/smack", "path": "test/org/jivesoftware/smack/RosterSmackTest.java", "license": "apache-2.0", "size": 28753 }
[ "org.jivesoftware.smack.packet.Presence" ]
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.*;
[ "org.jivesoftware.smack" ]
org.jivesoftware.smack;
1,278,391
public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; }
void function(NodeService nodeService) { this.nodeService = nodeService; }
/** * Sets the Node Service * * @param nodeService */
Sets the Node Service
setNodeService
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/repository/source/java/org/alfresco/repo/workflow/WorkflowServiceImpl.java", "license": "lgpl-3.0", "size": 54613 }
[ "org.alfresco.service.cmr.repository.NodeService" ]
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.*;
[ "org.alfresco.service" ]
org.alfresco.service;
340,889
@SafeVarargs public static <T> List<? extends T> asList(T... elements) { final ArrayList<? extends T, ? super T> resultList = ArrayList.<T, T>create(); for (final T e : elements) { resultList.add(e); } return resultList; }
static <T> List<? extends T> function(T... elements) { final ArrayList<? extends T, ? super T> resultList = ArrayList.<T, T>create(); for (final T e : elements) { resultList.add(e); } return resultList; }
/** * Creates a List based on the items given in elements. The list has the same order as the elements * * @param elements The elements of the list * @param <T> The Type of the list * @return A list containing all elements in the order the elements are * @since 1.0 */
Creates a List based on the items given in elements. The list has the same order as the elements
asList
{ "repo_name": "Blahord/BetterCollections", "path": "src/main/java/com/github/blahord/bettercollections/util/Lists.java", "license": "apache-2.0", "size": 5179 }
[ "com.github.blahord.bettercollections.list.ArrayList", "com.github.blahord.bettercollections.list.List" ]
import com.github.blahord.bettercollections.list.ArrayList; import com.github.blahord.bettercollections.list.List;
import com.github.blahord.bettercollections.list.*;
[ "com.github.blahord" ]
com.github.blahord;
2,280,618
private String getReplacement(Matcher matcher) { for (int i = 1; i <= matcher.groupCount(); i++) { if (matcher.group(i) != null) { return replacementValues[--i]; } } return null; }
String function(Matcher matcher) { for (int i = 1; i <= matcher.groupCount(); i++) { if (matcher.group(i) != null) { return replacementValues[--i]; } } return null; }
/** * Gets the replacement for the given Matcher. Gets the index of the group * that matched and returns the replacement value for that index from the * array of replacements. * * @param matcher * @return */
Gets the replacement for the given Matcher. Gets the index of the group that matched and returns the replacement value for that index from the array of replacements
getReplacement
{ "repo_name": "Jolicost/ChattyTpp", "path": "src/chatty/util/Replacer.java", "license": "apache-2.0", "size": 2874 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
417,192
public InputStream getMainConfigurationInputStream(String world) throws IOException { return this.getInputStream(null, world); } /** * Returns the input stream for main configuration of the world.
InputStream function(String world) throws IOException { return this.getInputStream(null, world); } /** * Returns the input stream for main configuration of the world.
/** * Returns the input stream for main configuration of the world. * * @param world The world where this configuration applies. * @return The stream to the file. * @throws IOException If an IO-Operation fails. */
Returns the input stream for main configuration of the world
getMainConfigurationInputStream
{ "repo_name": "StuxSoftware/SimpleDev", "path": "Configuration/src/main/java/net/stuxcrystal/simpledev/configuration/storage/ModuleConfigurationLoader.java", "license": "apache-2.0", "size": 14613 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,725,229
private boolean isWindows() { final String os = environment.containsKey(OS_NAME) ? environment.get(OS_NAME) : System.getProperty(OS_NAME); return !StringUtils.isBlank(os) && os.toLowerCase().contains("win"); }
boolean function() { final String os = environment.containsKey(OS_NAME) ? environment.get(OS_NAME) : System.getProperty(OS_NAME); return !StringUtils.isBlank(os) && os.toLowerCase().contains("win"); }
/** * Returns whether current OS family is Windows. * * @return true if the current task is executed on Windows */
Returns whether current OS family is Windows
isWindows
{ "repo_name": "jmnarloch/gocd-gradle-plugin", "path": "src/main/java/io/jmnarloch/cd/go/plugin/gradle/GradleTaskConfigParser.java", "license": "apache-2.0", "size": 11913 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
2,682,250
public static boolean symlinkLocalRepositoryContents( Path repositoryDirectory, Path targetDirectory, Environment env) throws RepositoryFunctionException { try { for (Path target : targetDirectory.getDirectoryEntries()) { Path symlinkPath = repositoryDirectory.getRelative(target.getBaseName()); if (createSymbolicLink(symlinkPath, target, env) == null) { return false; } } } catch (IOException e) { throw new RepositoryFunctionException(e, Transience.TRANSIENT); } return true; }
static boolean function( Path repositoryDirectory, Path targetDirectory, Environment env) throws RepositoryFunctionException { try { for (Path target : targetDirectory.getDirectoryEntries()) { Path symlinkPath = repositoryDirectory.getRelative(target.getBaseName()); if (createSymbolicLink(symlinkPath, target, env) == null) { return false; } } } catch (IOException e) { throw new RepositoryFunctionException(e, Transience.TRANSIENT); } return true; }
/** * Given a targetDirectory /some/path/to/y that contains files z, w, and v, create the following * directory structure: * <pre> * .external-repository/ * x/ * WORKSPACE * BUILD -> &lt;build_root&gt;/x.BUILD * z -> /some/path/to/y/z * w -> /some/path/to/y/w * v -> /some/path/to/y/v * </pre> */
Given a targetDirectory /some/path/to/y that contains files z, w, and v, create the following directory structure: <code> .external-repository x WORKSPACE BUILD -> &lt;build_root&gt;/x.BUILD z -> /some/path/to/y/z w -> /some/path/to/y/w v -> /some/path/to/y/v </code>
symlinkLocalRepositoryContents
{ "repo_name": "kamalmarhubi/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryFunction.java", "license": "apache-2.0", "size": 14825 }
[ "com.google.devtools.build.lib.vfs.Path", "com.google.devtools.build.skyframe.SkyFunctionException", "java.io.IOException" ]
import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.skyframe.SkyFunctionException; import java.io.IOException;
import com.google.devtools.build.lib.vfs.*; import com.google.devtools.build.skyframe.*; import java.io.*;
[ "com.google.devtools", "java.io" ]
com.google.devtools; java.io;
1,744,650
public JobCheckpointingSettings getCheckpointingSettings() { return snapshotSettings; }
JobCheckpointingSettings function() { return snapshotSettings; }
/** * Gets the settings for asynchronous snapshots. This method returns null, when checkpointing is * not enabled. * * @return The snapshot settings */
Gets the settings for asynchronous snapshots. This method returns null, when checkpointing is not enabled
getCheckpointingSettings
{ "repo_name": "kl0u/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java", "license": "apache-2.0", "size": 22898 }
[ "org.apache.flink.runtime.jobgraph.tasks.JobCheckpointingSettings" ]
import org.apache.flink.runtime.jobgraph.tasks.JobCheckpointingSettings;
import org.apache.flink.runtime.jobgraph.tasks.*;
[ "org.apache.flink" ]
org.apache.flink;
2,840,942
public Paint getDividerPaint() { return this.dividerPaint; }
Paint function() { return this.dividerPaint; }
/** * Returns the paint used to draw the dividers. * * @return The paint. */
Returns the paint used to draw the dividers
getDividerPaint
{ "repo_name": "SpoonLabs/astor", "path": "examples/chart_11/source/org/jfree/chart/axis/PeriodAxisLabelInfo.java", "license": "gpl-2.0", "size": 12841 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
29,396
final Context appContext = context.getApplicationContext(); return Observable .create(new Observable.OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> subscriber) { int pid = PreferenceManager.getDefaultSharedPreferences(appContext) .getInt(SHARED_PREFERENCES_KEY_CJDROUTE_PID, INVALID_PID); subscriber.onNext(pid); subscriber.onCompleted(); }
final Context appContext = context.getApplicationContext(); return Observable .create(new Observable.OnSubscribe<Integer>() { public void call(Subscriber<? super Integer> subscriber) { int pid = PreferenceManager.getDefaultSharedPreferences(appContext) .getInt(SHARED_PREFERENCES_KEY_CJDROUTE_PID, INVALID_PID); subscriber.onNext(pid); subscriber.onCompleted(); }
/** * {@link Observable} for the PID of any currently running cjdroute process. If none is running, * this {@link Observable} will complete without calling {@link Subscriber#onNext(Object)}. * * @param context The {@link Context}. * @return The {@link Observable}. */
<code>Observable</code> for the PID of any currently running cjdroute process. If none is running, this <code>Observable</code> will complete without calling <code>Subscriber#onNext(Object)</code>
running
{ "repo_name": "hyperboria/android", "path": "src/main/java/berlin/meshnet/cjdns/Cjdroute.java", "license": "gpl-3.0", "size": 15298 }
[ "android.content.Context", "android.preference.PreferenceManager" ]
import android.content.Context; import android.preference.PreferenceManager;
import android.content.*; import android.preference.*;
[ "android.content", "android.preference" ]
android.content; android.preference;
327,706
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { Annotation a = new Annotation(Type.getType(desc)); classNode.addAnnotation(a); return new AnnotationImporter(a); }
AnnotationVisitor function(String desc, boolean visible) { Annotation a = new Annotation(Type.getType(desc)); classNode.addAnnotation(a); return new AnnotationImporter(a); }
/** * Visited for each annotation on the class. The annotation is added to the * class and imported. * * @param desc Name of the annotation class. * @param visible Whether the annotation is visible at runtime. * @return An ASM annotation visitor, if further details are required. */
Visited for each annotation on the class. The annotation is added to the class and imported
visitAnnotation
{ "repo_name": "anhth12/java-gpu", "path": "src/java/bytecode/ClassImporter.java", "license": "apache-2.0", "size": 9085 }
[ "org.objectweb.asm.AnnotationVisitor" ]
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.*;
[ "org.objectweb.asm" ]
org.objectweb.asm;
1,161,711
public void setProtocol(Protocol protocol) { this._harvestProtocol = protocol; }
void function(Protocol protocol) { this._harvestProtocol = protocol; }
/** * Sets protocol. * @param protocol protocol */
Sets protocol
setProtocol
{ "repo_name": "usgin/usgin-geoportal", "path": "src/com/esri/gpt/catalog/harvest/repository/HrRecord.java", "license": "apache-2.0", "size": 17972 }
[ "com.esri.gpt.control.webharvest.protocol.Protocol" ]
import com.esri.gpt.control.webharvest.protocol.Protocol;
import com.esri.gpt.control.webharvest.protocol.*;
[ "com.esri.gpt" ]
com.esri.gpt;
732,187
public ByteArrayOutputStream renderReport( HttpServletRequest request, IReportDocument reportDocument, long pageNumber, boolean masterPage, boolean svgFlag, List activeIds, Locale locale, boolean rtl ) throws RemoteException { ByteArrayOutputStream out = new ByteArrayOutputStream( ); renderReport( out, request, reportDocument, null, pageNumber, null, masterPage, svgFlag, activeIds, locale, rtl, null ); return out; }
ByteArrayOutputStream function( HttpServletRequest request, IReportDocument reportDocument, long pageNumber, boolean masterPage, boolean svgFlag, List activeIds, Locale locale, boolean rtl ) throws RemoteException { ByteArrayOutputStream out = new ByteArrayOutputStream( ); renderReport( out, request, reportDocument, null, pageNumber, null, masterPage, svgFlag, activeIds, locale, rtl, null ); return out; }
/** * Render report page. * * @param request * @param reportDocument * @param pageNumber * @param masterPage * @param svgFlag * @param activeIds * @param locale * @param rtl * @deprecated * @return report page content * @throws RemoteException */
Render report page
renderReport
{ "repo_name": "sguan-actuate/birt", "path": "viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/ReportEngineService.java", "license": "epl-1.0", "size": 67902 }
[ "java.io.ByteArrayOutputStream", "java.rmi.RemoteException", "java.util.List", "java.util.Locale", "javax.servlet.http.HttpServletRequest", "org.eclipse.birt.report.engine.api.IReportDocument" ]
import java.io.ByteArrayOutputStream; import java.rmi.RemoteException; import java.util.List; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import org.eclipse.birt.report.engine.api.IReportDocument;
import java.io.*; import java.rmi.*; import java.util.*; import javax.servlet.http.*; import org.eclipse.birt.report.engine.api.*;
[ "java.io", "java.rmi", "java.util", "javax.servlet", "org.eclipse.birt" ]
java.io; java.rmi; java.util; javax.servlet; org.eclipse.birt;
853,361
private DefaultCategoryDataset getDataSet(final List<?> list) { DefaultCategoryDataset result = new DefaultCategoryDataset(); if (list != null) { for (int i = 0; i < list.size(); i++) { Object[] obj = (Object[]) list.get(i); result.setValue((Integer) obj[1], "", (String) obj[0]); } } return result; }
DefaultCategoryDataset function(final List<?> list) { DefaultCategoryDataset result = new DefaultCategoryDataset(); if (list != null) { for (int i = 0; i < list.size(); i++) { Object[] obj = (Object[]) list.get(i); result.setValue((Integer) obj[1], "", (String) obj[0]); } } return result; }
/** * Gets the data set. * * @param list * the list * * @return the data set */
Gets the data set
getDataSet
{ "repo_name": "PDavid/aTunes", "path": "aTunes/src/main/java/net/sourceforge/atunes/kernel/modules/statistics/StatsDialogController.java", "license": "gpl-2.0", "size": 14802 }
[ "java.util.List", "org.jfree.data.category.DefaultCategoryDataset" ]
import java.util.List; import org.jfree.data.category.DefaultCategoryDataset;
import java.util.*; import org.jfree.data.category.*;
[ "java.util", "org.jfree.data" ]
java.util; org.jfree.data;
2,173,616
public void setLabel(MultiLingualText label) { this.label = label; }
void function(MultiLingualText label) { this.label = label; }
/** * Set the label. * * @param label - the label to set */
Set the label
setLabel
{ "repo_name": "selfbus/development-tools-incubation", "path": "sbtools-products-editor/src/main/java/org/selfbus/sbtools/prodedit/model/prodgroup/parameter/ParameterValue.java", "license": "gpl-3.0", "size": 3081 }
[ "org.selfbus.sbtools.prodedit.model.common.MultiLingualText" ]
import org.selfbus.sbtools.prodedit.model.common.MultiLingualText;
import org.selfbus.sbtools.prodedit.model.common.*;
[ "org.selfbus.sbtools" ]
org.selfbus.sbtools;
313,357
public File build() throws IOException { if (entries.isEmpty()) { throw new EmptyZipException(); } String fileName = "import_configuration" + System.currentTimeMillis() + ".zip"; File result = new File(TEMP_DIR.toFile(), fileName); try (ZipOutputStream zip = new ZipOutputStream( Files.newOutputStream(result.toPath(), StandardOpenOption.CREATE_NEW))) { customization.init(entries.values(), this::streamFor); for (Entry<Object, String> entry : entries.entrySet()) { try (InputStream input = toInputStream(entry.getKey())) { addEntry(ExtraZipEntry.of(entry.getValue(), customization.customize(entry.getValue(), input)), zip); } } customization.extraEntries().forEach(entry -> addEntry(entry, zip)); zip.closeEntry(); } return result; }
File function() throws IOException { if (entries.isEmpty()) { throw new EmptyZipException(); } String fileName = STR + System.currentTimeMillis() + ".zip"; File result = new File(TEMP_DIR.toFile(), fileName); try (ZipOutputStream zip = new ZipOutputStream( Files.newOutputStream(result.toPath(), StandardOpenOption.CREATE_NEW))) { customization.init(entries.values(), this::streamFor); for (Entry<Object, String> entry : entries.entrySet()) { try (InputStream input = toInputStream(entry.getKey())) { addEntry(ExtraZipEntry.of(entry.getValue(), customization.customize(entry.getValue(), input)), zip); } } customization.extraEntries().forEach(entry -> addEntry(entry, zip)); zip.closeEntry(); } return result; }
/** * Build a ZIP file containing the added entries. * @return A ZIP file containing the added entries * @throws IOException In case an I/O error occurs */
Build a ZIP file containing the added entries
build
{ "repo_name": "kovaloid/infoarchive-sip-sdk", "path": "yaml/src/main/java/com/opentext/ia/yaml/configuration/zip/ZipBuilder.java", "license": "mpl-2.0", "size": 6835 }
[ "java.io.File", "java.io.IOException", "java.io.InputStream", "java.nio.file.Files", "java.nio.file.StandardOpenOption", "java.util.Map", "java.util.zip.ZipOutputStream" ]
import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.Map; import java.util.zip.ZipOutputStream;
import java.io.*; import java.nio.file.*; import java.util.*; import java.util.zip.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
1,840,067
public Command createIncrDecrCommand(final String key, final byte[] keyBytes, final long delta, long initial, int expTime, CommandType cmdType, boolean noreply);
Command function(final String key, final byte[] keyBytes, final long delta, long initial, int expTime, CommandType cmdType, boolean noreply);
/** * create a incr/decr command * * @param key * @param keyBytes * @param delta * @param initial * @param expTime * @param cmdType * @param noreply * @return */
create a incr/decr command
createIncrDecrCommand
{ "repo_name": "springning/xmemcached", "path": "src/main/java/net/rubyeye/xmemcached/CommandFactory.java", "license": "apache-2.0", "size": 7419 }
[ "net.rubyeye.xmemcached.command.Command", "net.rubyeye.xmemcached.command.CommandType" ]
import net.rubyeye.xmemcached.command.Command; import net.rubyeye.xmemcached.command.CommandType;
import net.rubyeye.xmemcached.command.*;
[ "net.rubyeye.xmemcached" ]
net.rubyeye.xmemcached;
1,546,408
@Test void testReaderWriter() throws IOException { final Path file = Files.createTempFile("test", "dat"); Medias.setResourcesDirectory(file.getParent().toFile().getAbsolutePath()); try { fileData = Medias.get(file.toFile()); testFileWriting(); testFileReading(); } finally { Medias.setLoadFromJar(null); Files.delete(file); } }
void testReaderWriter() throws IOException { final Path file = Files.createTempFile("test", "dat"); Medias.setResourcesDirectory(file.getParent().toFile().getAbsolutePath()); try { fileData = Medias.get(file.toFile()); testFileWriting(); testFileReading(); } finally { Medias.setLoadFromJar(null); Files.delete(file); } }
/** * Test writer and reader * * @throws IOException If error. */
Test writer and reader
testReaderWriter
{ "repo_name": "b3dgs/lionengine", "path": "lionengine-core/src/test/java/com/b3dgs/lionengine/io/FileWritingReadingTest.java", "license": "gpl-3.0", "size": 3788 }
[ "com.b3dgs.lionengine.Medias", "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path" ]
import com.b3dgs.lionengine.Medias; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path;
import com.b3dgs.lionengine.*; import java.io.*; import java.nio.file.*;
[ "com.b3dgs.lionengine", "java.io", "java.nio" ]
com.b3dgs.lionengine; java.io; java.nio;
2,768,924
public static GameModel loadGame(int fileNumber) throws IOException { if (getSaveFiles().contains(fileNumber)) { return new GameModel(fileNumber); } else { return null; } }
static GameModel function(int fileNumber) throws IOException { if (getSaveFiles().contains(fileNumber)) { return new GameModel(fileNumber); } else { return null; } }
/** * Returns a GameModel with the file associated with the given file number * loaded if save file is successfully loaded, or null if this save file * does not exist. * * @param fileNumber the file number to attempt to load * @return a GameModel if the save file is successfully loaded or null if * the file was not * @throws IOException */
Returns a GameModel with the file associated with the given file number loaded if save file is successfully loaded, or null if this save file does not exist
loadGame
{ "repo_name": "swammer5/AdventureMaker", "path": "src/model/GameModel.java", "license": "gpl-3.0", "size": 7232 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,748,363
private ITextEditor getTextEditor() { if (targetEditor instanceof ITextEditor) { return (ITextEditor) targetEditor; } else { throw new RuntimeException("Expecting text editor. Found:"+targetEditor.getClass().getName()); } }
ITextEditor function() { if (targetEditor instanceof ITextEditor) { return (ITextEditor) targetEditor; } else { throw new RuntimeException(STR+targetEditor.getClass().getName()); } }
/** * This function returns the text editor. */
This function returns the text editor
getTextEditor
{ "repo_name": "kolovos/texlipse", "path": "net.sourceforge.texlipse/src/net/sourceforge/texlipse/actions/TexComment.java", "license": "epl-1.0", "size": 2783 }
[ "org.eclipse.ui.texteditor.ITextEditor" ]
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.*;
[ "org.eclipse.ui" ]
org.eclipse.ui;
292,860
@Override public void mapTagToHost(Tag tag, String hostmac, Short vlan, String dpid, String interfaceName) throws TagDoesNotExistException, TagInvalidHostMacException { if (tag == null) throw new TagDoesNotExistException("null tag"); if (hostmac != null && !Ethernet.isMACAddress(hostmac)) { throw new TagInvalidHostMacException(hostmac + " is an invalid mac address"); } String ns = DEFAULT_NAMESPACE; if (!tag.getNamespace().equals("")) { ns = tag.getNamespace(); } if (m_tags.get(ns) == null || !m_tags.get(ns).containsKey(tag.getName())) { throw new TagDoesNotExistException(tag.toString()); } if (hostmac == null && vlan == null && dpid == null && interfaceName == null) return; String blankStr = new String(""); String vlanStr = blankStr; if (vlan != null) { vlanStr = new String(vlan.toString()); } if (dpid == null && interfaceName != null) return; if (hostmac == null) hostmac = blankStr; if (dpid == null) dpid = blankStr; if (interfaceName == null) interfaceName = blankStr; Map<String, Object> rowValues = new HashMap<String, Object>(); String tagid = getTagKey(ns, tag.getName(), tag.getValue()); String id = tagid + Tag.KEY_SEPARATOR + hostmac + Tag.KEY_SEPARATOR + vlanStr + Tag.KEY_SEPARATOR + dpid + Tag.KEY_SEPARATOR + interfaceName; rowValues.put(TAGMAPPING_ID_COLUMN_NAME, id); rowValues.put(TAGMAPPING_TAG_COLUMN_NAME, tagid); rowValues.put(TAGMAPPING_MAC_COLUMN_NAME, hostmac); rowValues.put(TAGMAPPING_VLAN_COLUMN_NAME, vlanStr); rowValues.put(TAGMAPPING_SWITCH_COLUMN_NAME, dpid); rowValues.put(TAGMAPPING_INTERFACE_COLUMN_NAME, interfaceName); storageSource.insertRowAsync(TAGMAPPING_TABLE_NAME, rowValues); }
void function(Tag tag, String hostmac, Short vlan, String dpid, String interfaceName) throws TagDoesNotExistException, TagInvalidHostMacException { if (tag == null) throw new TagDoesNotExistException(STR); if (hostmac != null && !Ethernet.isMACAddress(hostmac)) { throw new TagInvalidHostMacException(hostmac + STR); } String ns = DEFAULT_NAMESPACE; if (!tag.getNamespace().equals(STR"); String vlanStr = blankStr; if (vlan != null) { vlanStr = new String(vlan.toString()); } if (dpid == null && interfaceName != null) return; if (hostmac == null) hostmac = blankStr; if (dpid == null) dpid = blankStr; if (interfaceName == null) interfaceName = blankStr; Map<String, Object> rowValues = new HashMap<String, Object>(); String tagid = getTagKey(ns, tag.getName(), tag.getValue()); String id = tagid + Tag.KEY_SEPARATOR + hostmac + Tag.KEY_SEPARATOR + vlanStr + Tag.KEY_SEPARATOR + dpid + Tag.KEY_SEPARATOR + interfaceName; rowValues.put(TAGMAPPING_ID_COLUMN_NAME, id); rowValues.put(TAGMAPPING_TAG_COLUMN_NAME, tagid); rowValues.put(TAGMAPPING_MAC_COLUMN_NAME, hostmac); rowValues.put(TAGMAPPING_VLAN_COLUMN_NAME, vlanStr); rowValues.put(TAGMAPPING_SWITCH_COLUMN_NAME, dpid); rowValues.put(TAGMAPPING_INTERFACE_COLUMN_NAME, interfaceName); storageSource.insertRowAsync(TAGMAPPING_TABLE_NAME, rowValues); }
/** * Map a tag to a host. The mapping is saved in DB. * @param tag * @param hostmac */
Map a tag to a host. The mapping is saved in DB
mapTagToHost
{ "repo_name": "mandeepdhami/netvirt-ctrl", "path": "sdnplatform/src/main/java/org/sdnplatform/devicemanager/internal/BetterDeviceManagerImpl.java", "license": "epl-1.0", "size": 78077 }
[ "java.util.HashMap", "java.util.Map", "org.sdnplatform.packet.Ethernet", "org.sdnplatform.tagmanager.Tag", "org.sdnplatform.tagmanager.TagDoesNotExistException", "org.sdnplatform.tagmanager.TagInvalidHostMacException" ]
import java.util.HashMap; import java.util.Map; import org.sdnplatform.packet.Ethernet; import org.sdnplatform.tagmanager.Tag; import org.sdnplatform.tagmanager.TagDoesNotExistException; import org.sdnplatform.tagmanager.TagInvalidHostMacException;
import java.util.*; import org.sdnplatform.packet.*; import org.sdnplatform.tagmanager.*;
[ "java.util", "org.sdnplatform.packet", "org.sdnplatform.tagmanager" ]
java.util; org.sdnplatform.packet; org.sdnplatform.tagmanager;
1,370,937
default Consumer<IBaseResource> withBirthdate(String theBirthdate) { return t -> __setPrimitiveChild(getFhirContext(), t, "birthDate", "dateTime", theBirthdate); }
default Consumer<IBaseResource> withBirthdate(String theBirthdate) { return t -> __setPrimitiveChild(getFhirContext(), t, STR, STR, theBirthdate); }
/** * Set Patient.birthdate */
Set Patient.birthdate
withBirthdate
{ "repo_name": "SingingTree/hapi-fhir", "path": "hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java", "license": "apache-2.0", "size": 8445 }
[ "java.util.function.Consumer", "org.hl7.fhir.instance.model.api.IBaseResource" ]
import java.util.function.Consumer; import org.hl7.fhir.instance.model.api.IBaseResource;
import java.util.function.*; import org.hl7.fhir.instance.model.api.*;
[ "java.util", "org.hl7.fhir" ]
java.util; org.hl7.fhir;
1,459,007
@Override @NonTransactional public void populateFinancialSystemDocumentHeadersFromKew(int batchSize, Integer jobRunSize, Set<DocumentStatus> documentStatusesToPopulate) { final long startTime = System.currentTimeMillis(); for (Collection<FinancialSystemDocumentHeader> documentHeaderBatch : getFinancialSystemDocumentHeaderBatchIterable(batchSize, jobRunSize)) { Map<String, FinancialSystemDocumentHeader> documentHeaderMap = convertDocumentHeaderBatchToMap(documentHeaderBatch); handleBatch(documentHeaderMap, documentStatusesToPopulate); } final long endTime = System.currentTimeMillis(); final double runTimeSeconds = (endTime - startTime) / 1000.0; LOG.info("Run time: " + runTimeSeconds); }
void function(int batchSize, Integer jobRunSize, Set<DocumentStatus> documentStatusesToPopulate) { final long startTime = System.currentTimeMillis(); for (Collection<FinancialSystemDocumentHeader> documentHeaderBatch : getFinancialSystemDocumentHeaderBatchIterable(batchSize, jobRunSize)) { Map<String, FinancialSystemDocumentHeader> documentHeaderMap = convertDocumentHeaderBatchToMap(documentHeaderBatch); handleBatch(documentHeaderMap, documentStatusesToPopulate); } final long endTime = System.currentTimeMillis(); final double runTimeSeconds = (endTime - startTime) / 1000.0; LOG.info(STR + runTimeSeconds); }
/** * Populates financial system document header records, at a count of batchSize at a time, until the jobRunSize number of records have been processed, skipping document headers that * are included in documentStatusesToPopulate if the given Set has any members at all * * @see org.kuali.kfs.sys.batch.service.FinancialSystemDocumentHeaderPopulationService#populateFinancialSystemDocumentHeadersFromKew(int, int, Set<DocumentStatus>) */
Populates financial system document header records, at a count of batchSize at a time, until the jobRunSize number of records have been processed, skipping document headers that are included in documentStatusesToPopulate if the given Set has any members at all
populateFinancialSystemDocumentHeadersFromKew
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/sys/batch/service/impl/FinancialSystemDocumentHeaderPopulationServiceImpl.java", "license": "agpl-3.0", "size": 17126 }
[ "java.util.Collection", "java.util.Map", "java.util.Set", "org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader", "org.kuali.rice.kew.api.document.DocumentStatus" ]
import java.util.Collection; import java.util.Map; import java.util.Set; import org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader; import org.kuali.rice.kew.api.document.DocumentStatus;
import java.util.*; import org.kuali.kfs.sys.businessobject.*; import org.kuali.rice.kew.api.document.*;
[ "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.util; org.kuali.kfs; org.kuali.rice;
1,002,316
private ActionForward executePackageAction(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext context = new RequestContext(request); StrutsDelegate strutsDelegate = getStrutsDelegate(); User user = context.getLoggedInUser(); // Load the date selected by the user Date earliest = getStrutsDelegate().readDatePicker((DynaActionForm) formIn, "date", DatePicker.YEAR_RANGE_POSITIVE); // Parse through all of the results DataResult result = (DataResult) getResult(context, true); result.elaborate(); log.debug("Publishing schedule package remove event to message queue."); SsmRemovePackagesEvent event = new SsmRemovePackagesEvent(user.getId(), earliest, result); MessageQueue.publish(event); log.debug("Clearing set."); // Remove the packages from session and the DB SessionSetHelper.obliterate(request, request.getParameter("packagesDecl")); log.debug("Deleting set."); RhnSetManager.deleteByLabel(user.getId(), RhnSetDecl.SSM_REMOVE_PACKAGES_LIST.getLabel()); ActionMessages msgs = new ActionMessages(); // Check to determine to display single or plural confirmation message msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("ssm.package.remove.message.packageremovals")); strutsDelegate.saveMessages(request, msgs); return mapping.findForward("confirm"); }
ActionForward function(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext context = new RequestContext(request); StrutsDelegate strutsDelegate = getStrutsDelegate(); User user = context.getLoggedInUser(); Date earliest = getStrutsDelegate().readDatePicker((DynaActionForm) formIn, "date", DatePicker.YEAR_RANGE_POSITIVE); DataResult result = (DataResult) getResult(context, true); result.elaborate(); log.debug(STR); SsmRemovePackagesEvent event = new SsmRemovePackagesEvent(user.getId(), earliest, result); MessageQueue.publish(event); log.debug(STR); SessionSetHelper.obliterate(request, request.getParameter(STR)); log.debug(STR); RhnSetManager.deleteByLabel(user.getId(), RhnSetDecl.SSM_REMOVE_PACKAGES_LIST.getLabel()); ActionMessages msgs = new ActionMessages(); msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(STR)); strutsDelegate.saveMessages(request, msgs); return mapping.findForward(STR); }
/** * Creates the package removal action. * * @param mapping struts mapping * @param formIn struts form * @param request HTTP request * @param response HTTP response * @return */
Creates the package removal action
executePackageAction
{ "repo_name": "colloquium/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageRemoveAction.java", "license": "gpl-2.0", "size": 7031 }
[ "com.redhat.rhn.common.db.datasource.DataResult", "com.redhat.rhn.common.messaging.MessageQueue", "com.redhat.rhn.common.util.DatePicker", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.events.SsmRemovePackagesEvent", "com.redhat.rhn.frontend.struts.RequestContext", "com.redhat.rhn.frontend.struts.SessionSetHelper", "com.redhat.rhn.frontend.struts.StrutsDelegate", "com.redhat.rhn.manager.rhnset.RhnSetDecl", "com.redhat.rhn.manager.rhnset.RhnSetManager", "java.util.Date", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.apache.struts.action.ActionMessage", "org.apache.struts.action.ActionMessages", "org.apache.struts.action.DynaActionForm" ]
import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.messaging.MessageQueue; import com.redhat.rhn.common.util.DatePicker; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.events.SsmRemovePackagesEvent; import com.redhat.rhn.frontend.struts.RequestContext; import com.redhat.rhn.frontend.struts.SessionSetHelper; import com.redhat.rhn.frontend.struts.StrutsDelegate; import com.redhat.rhn.manager.rhnset.RhnSetDecl; import com.redhat.rhn.manager.rhnset.RhnSetManager; import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.DynaActionForm;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.common.messaging.*; import com.redhat.rhn.common.util.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.events.*; import com.redhat.rhn.frontend.struts.*; import com.redhat.rhn.manager.rhnset.*; import java.util.*; import javax.servlet.http.*; import org.apache.struts.action.*;
[ "com.redhat.rhn", "java.util", "javax.servlet", "org.apache.struts" ]
com.redhat.rhn; java.util; javax.servlet; org.apache.struts;
933,336
@Test public void testWeatherTempHumMinMax2() { String message = " PKT:SID=10;PC=17531;MT=8;MGID=10;MID=2;MD=001FFFC00000;785c34de"; SHCMessage shcMessage = new SHCMessage(message, packet); List<Type> values = shcMessage.getData().getOpenHABTypes(); assertEquals(0, ((DecimalType) values.get(0)).intValue()); assertEquals(32767, ((DecimalType) values.get(1)).intValue()); }
void function() { String message = STR; SHCMessage shcMessage = new SHCMessage(message, packet); List<Type> values = shcMessage.getData().getOpenHABTypes(); assertEquals(0, ((DecimalType) values.get(0)).intValue()); assertEquals(32767, ((DecimalType) values.get(1)).intValue()); }
/** * test data is: weather temperature & humidity: 0 (0x000) temperatur: 32767 * (0x7FFF) */
test data is: weather temperature & humidity: 0 (0x000) temperatur: 32767 (0x7FFF)
testWeatherTempHumMinMax2
{ "repo_name": "sedstef/openhab", "path": "bundles/binding/org.openhab.binding.smarthomatic/src/test/java/org/openhab/binding/smarthomatic/TestSHCMessage.java", "license": "epl-1.0", "size": 24815 }
[ "java.util.List", "org.junit.Assert", "org.openhab.binding.smarthomatic.internal.SHCMessage", "org.openhab.core.library.types.DecimalType", "org.openhab.core.types.Type" ]
import java.util.List; import org.junit.Assert; import org.openhab.binding.smarthomatic.internal.SHCMessage; import org.openhab.core.library.types.DecimalType; import org.openhab.core.types.Type;
import java.util.*; import org.junit.*; import org.openhab.binding.smarthomatic.internal.*; import org.openhab.core.library.types.*; import org.openhab.core.types.*;
[ "java.util", "org.junit", "org.openhab.binding", "org.openhab.core" ]
java.util; org.junit; org.openhab.binding; org.openhab.core;
1,819,919
@Override public void setRule(int idx, ConditionalFormattingRule cfRule) { XSSFConditionalFormattingRule xRule = (XSSFConditionalFormattingRule) cfRule; _cf.getCfRuleArray(idx).set(xRule.getCTCfRule()); }
void function(int idx, ConditionalFormattingRule cfRule) { XSSFConditionalFormattingRule xRule = (XSSFConditionalFormattingRule) cfRule; _cf.getCfRuleArray(idx).set(xRule.getCTCfRule()); }
/** * Replaces an existing Conditional Formatting rule at position idx. * Excel allows to create up to 3 Conditional Formatting rules. * This method can be useful to modify existing Conditional Formatting rules. * * @param idx position of the rule. Should be between 0 and 2. * @param cfRule - Conditional Formatting rule */
Replaces an existing Conditional Formatting rule at position idx. Excel allows to create up to 3 Conditional Formatting rules. This method can be useful to modify existing Conditional Formatting rules
setRule
{ "repo_name": "lvweiwolf/poi-3.16", "path": "src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormatting.java", "license": "apache-2.0", "size": 4534 }
[ "org.apache.poi.ss.usermodel.ConditionalFormattingRule" ]
import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
import org.apache.poi.ss.usermodel.*;
[ "org.apache.poi" ]
org.apache.poi;
2,462,506
private URL getRedirectURL( String hostname, WADORequestObject req ) { StringBuffer sb = new StringBuffer(); sb.append( "/dcm4jboss-wado/wado?requestType=WADO"); Map mapParam = req.getRequestParams(); Iterator iter = mapParam.keySet().iterator(); Object key; while ( iter.hasNext() ) { key = iter.next(); sb.append("&").append(key).append("=").append( ( (String[]) mapParam.get(key))[0] ); } URL url = null; try { int port = new URL( req.getRequestURL() ).getPort(); url = new URL("http",hostname,port, sb.toString() ); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (log.isDebugEnabled() ) log.debug("redirect url:"+url ); return url; }
URL function( String hostname, WADORequestObject req ) { StringBuffer sb = new StringBuffer(); sb.append( STR); Map mapParam = req.getRequestParams(); Iterator iter = mapParam.keySet().iterator(); Object key; while ( iter.hasNext() ) { key = iter.next(); sb.append("&").append(key).append("=").append( ( (String[]) mapParam.get(key))[0] ); } URL url = null; try { int port = new URL( req.getRequestURL() ).getPort(); url = new URL("http",hostname,port, sb.toString() ); } catch (MalformedURLException e) { e.printStackTrace(); } if (log.isDebugEnabled() ) log.debug(STR+url ); return url; }
/** * Returns the WADO URL to remote server which serves the object. * <p> * the remote server have to be a dcm4jboss-wado server on the same port as this WADO server! * * @param hostname * @param req * @return */
Returns the WADO URL to remote server which serves the object. the remote server have to be a dcm4jboss-wado server on the same port as this WADO server
getRedirectURL
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/tags/DCM4JBOSS_2_7_3/dcm4jboss-wado/src/java/org/dcm4chex/wado/mbean/WADOSupport.java", "license": "apache-2.0", "size": 21530 }
[ "java.net.MalformedURLException", "java.util.Iterator", "java.util.Map", "org.dcm4chex.wado.common.WADORequestObject" ]
import java.net.MalformedURLException; import java.util.Iterator; import java.util.Map; import org.dcm4chex.wado.common.WADORequestObject;
import java.net.*; import java.util.*; import org.dcm4chex.wado.common.*;
[ "java.net", "java.util", "org.dcm4chex.wado" ]
java.net; java.util; org.dcm4chex.wado;
1,515,364
public static String getArguments(ILaunchConfiguration configuration, boolean makeArgumentsVariableSubstitution) throws CoreException { String arguments = configuration.getAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, ""); if (makeArgumentsVariableSubstitution) { return VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arguments); } else { return arguments; } }
static String function(ILaunchConfiguration configuration, boolean makeArgumentsVariableSubstitution) throws CoreException { String arguments = configuration.getAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, ""); if (makeArgumentsVariableSubstitution) { return VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arguments); } else { return arguments; } }
/** * Expands and returns the arguments attribute of the given launch * configuration. Returns <code>null</code> if arguments are not specified. * * @param configuration launch configuration * @return an array of resolved arguments, or <code>null</code> if * unspecified * @throws CoreException if unable to retrieve the associated launch * configuration attribute, or if unable to resolve any variables */
Expands and returns the arguments attribute of the given launch configuration. Returns <code>null</code> if arguments are not specified
getArguments
{ "repo_name": "rgom/Pydev", "path": "plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java", "license": "epl-1.0", "size": 44057 }
[ "org.eclipse.core.runtime.CoreException", "org.eclipse.core.variables.VariablesPlugin", "org.eclipse.debug.core.ILaunchConfiguration", "org.python.pydev.debug.core.Constants" ]
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.python.pydev.debug.core.Constants;
import org.eclipse.core.runtime.*; import org.eclipse.core.variables.*; import org.eclipse.debug.core.*; import org.python.pydev.debug.core.*;
[ "org.eclipse.core", "org.eclipse.debug", "org.python.pydev" ]
org.eclipse.core; org.eclipse.debug; org.python.pydev;
593,165
private void buildSources(int sourceIndex) { File file = configuration.getFiles().get(sourceIndex); if (file.getMimeType().equals("text/comma-separated-values")) { source = new CSVSource(file.getReadToLineNo()); } if (file.getPath().endsWith(".zip")) { source = new ZipSourceWrapper(source); } else if (file.getPath().endsWith(".gz")) { source = new GzipSourceWrapper(source); } try { InputStream inputStream = source.buildInputStream(file); source.setFileInputStream(inputStream); } catch (Exception e) { throw new RuntimeException(String.format("Unable to read input file '%1s' because: %2s", file.getPath(), e.getMessage()), e); } }
void function(int sourceIndex) { File file = configuration.getFiles().get(sourceIndex); if (file.getMimeType().equals(STR)) { source = new CSVSource(file.getReadToLineNo()); } if (file.getPath().endsWith(".zip")) { source = new ZipSourceWrapper(source); } else if (file.getPath().endsWith(".gz")) { source = new GzipSourceWrapper(source); } try { InputStream inputStream = source.buildInputStream(file); source.setFileInputStream(inputStream); } catch (Exception e) { throw new RuntimeException(String.format(STR, file.getPath(), e.getMessage()), e); } }
/** * This method inits the source stack including the ZIP and GZIP wrappers. The determination of the required * wrappers is done over the file extension. * * @param sourceIndex */
This method inits the source stack including the ZIP and GZIP wrappers. The determination of the required wrappers is done over the file extension
buildSources
{ "repo_name": "uzh/katts", "path": "src/main/java/ch/uzh/ddis/katts/bolts/source/FileNTupleReader.java", "license": "apache-2.0", "size": 7926 }
[ "ch.uzh.ddis.katts.bolts.source.file.CSVSource", "ch.uzh.ddis.katts.bolts.source.file.GzipSourceWrapper", "ch.uzh.ddis.katts.bolts.source.file.ZipSourceWrapper", "ch.uzh.ddis.katts.query.source.File", "java.io.InputStream" ]
import ch.uzh.ddis.katts.bolts.source.file.CSVSource; import ch.uzh.ddis.katts.bolts.source.file.GzipSourceWrapper; import ch.uzh.ddis.katts.bolts.source.file.ZipSourceWrapper; import ch.uzh.ddis.katts.query.source.File; import java.io.InputStream;
import ch.uzh.ddis.katts.bolts.source.file.*; import ch.uzh.ddis.katts.query.source.*; import java.io.*;
[ "ch.uzh.ddis", "java.io" ]
ch.uzh.ddis; java.io;
1,538,945
boolean isSupported(Topology topology); /** * Submit {@code topology} to this Streams context. * @param topology Topology to be submitted. * @return Future for the submission, see the descriptions for the {@link Type}
boolean isSupported(Topology topology); /** * Submit {@code topology} to this Streams context. * @param topology Topology to be submitted. * @return Future for the submission, see the descriptions for the {@link Type}
/** * Answers if this StreamsContext supports execution of the * {@code topology}. * @see Type#EMBEDDED * @param topology Topology to evaluate. * @return true if this context supports execution of the topology. */
Answers if this StreamsContext supports execution of the topology
isSupported
{ "repo_name": "ddebrunner/streamsx.topology", "path": "java/src/com/ibm/streamsx/topology/context/StreamsContext.java", "license": "apache-2.0", "size": 13888 }
[ "com.ibm.streamsx.topology.Topology", "java.util.concurrent.Future" ]
import com.ibm.streamsx.topology.Topology; import java.util.concurrent.Future;
import com.ibm.streamsx.topology.*; import java.util.concurrent.*;
[ "com.ibm.streamsx", "java.util" ]
com.ibm.streamsx; java.util;
1,269,827
@ParameterizedTest(name = "initialBufferSize = {0}") @MethodSource("data") public void testBelowThresholdGetInputStream(final int initialBufferSize) throws IOException { final DeferredFileOutputStream dfos = new DeferredFileOutputStream(testBytes.length + 42, initialBufferSize, null); dfos.write(testBytes, 0, testBytes.length); dfos.close(); assertTrue(dfos.isInMemory()); try (InputStream is = dfos.toInputStream()) { assertArrayEquals(testBytes, IOUtils.toByteArray(is)); } }
@ParameterizedTest(name = STR) @MethodSource("data") void function(final int initialBufferSize) throws IOException { final DeferredFileOutputStream dfos = new DeferredFileOutputStream(testBytes.length + 42, initialBufferSize, null); dfos.write(testBytes, 0, testBytes.length); dfos.close(); assertTrue(dfos.isInMemory()); try (InputStream is = dfos.toInputStream()) { assertArrayEquals(testBytes, IOUtils.toByteArray(is)); } }
/** * Tests the case where the amount of data falls below the threshold, and is therefore confined to memory. * Testing the getInputStream() method. */
Tests the case where the amount of data falls below the threshold, and is therefore confined to memory. Testing the getInputStream() method
testBelowThresholdGetInputStream
{ "repo_name": "apache/commons-io", "path": "src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java", "license": "apache-2.0", "size": 15535 }
[ "java.io.IOException", "java.io.InputStream", "org.apache.commons.io.IOUtils", "org.junit.jupiter.api.Assertions", "org.junit.jupiter.params.ParameterizedTest", "org.junit.jupiter.params.provider.MethodSource" ]
import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource;
import java.io.*; import org.apache.commons.io.*; import org.junit.jupiter.api.*; import org.junit.jupiter.params.*; import org.junit.jupiter.params.provider.*;
[ "java.io", "org.apache.commons", "org.junit.jupiter" ]
java.io; org.apache.commons; org.junit.jupiter;
2,415,473
public static Collection<RemoteServerConfiguration> getBlockedServers() { return getConfigurations(Permission.blocked); }
static Collection<RemoteServerConfiguration> function() { return getConfigurations(Permission.blocked); }
/** * Returns the list of remote servers that are NOT allowed to connect to/from this * server. * * @return the configuration of the blocked external components. */
Returns the list of remote servers that are NOT allowed to connect to/from this server
getBlockedServers
{ "repo_name": "trimnguye/JavaChatServer", "path": "src/java/org/jivesoftware/openfire/server/RemoteServerManager.java", "license": "apache-2.0", "size": 15773 }
[ "java.util.Collection", "org.jivesoftware.openfire.server.RemoteServerConfiguration" ]
import java.util.Collection; import org.jivesoftware.openfire.server.RemoteServerConfiguration;
import java.util.*; import org.jivesoftware.openfire.server.*;
[ "java.util", "org.jivesoftware.openfire" ]
java.util; org.jivesoftware.openfire;
471,546
public void setSensitivity(Context context, float sensitivity) { mDragHelper.setSensitivity(context, sensitivity); }
void function(Context context, float sensitivity) { mDragHelper.setSensitivity(context, sensitivity); }
/** * Sets the sensitivity of the NavigationLayout. * * @param context The application context. * @param sensitivity value between 0 and 1, the final value for touchSlop = * ViewConfiguration.getScaledTouchSlop * (1 / s); */
Sets the sensitivity of the NavigationLayout
setSensitivity
{ "repo_name": "fuhongliang/yibairun", "path": "yibairun/src/com/yibairun/swipebacklayout/lib/SwipeBackLayout.java", "license": "apache-2.0", "size": 20765 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,399,155
@Test public void testCreateNewUserWithStudent() { final int oldStudentCount = course.getStudents().size(); ParticipationType newType = DataHelper.createParticipationTypeIn(course); User user = DataHelper.createBasicUser(); user.setUserId(null); assertNull(user.getToken()); participantsController.setSelectedUser(user); participantsController.setSelectedParticipationTypeId(newType.getPartTypeId()); participantsController.setSelectedRoleId(Role.STUDENT.getId()); when(userServiceMock.initPasswordReset(eq(user), anyInt())) .thenReturn(new PasswordReset()); participantsController.createNewUser(); assertNotNull(user.getToken()); assertNull(user.getPassword()); verify(courseServiceMock, times(1)).update(course); verify(userServiceMock, times(1)).initPasswordReset(eq(user), anyInt()); final int newStudentsCount = course.getStudents().size(); assertTrue(oldStudentCount < newStudentsCount); Student createdStudent = course.getStudentFromUser(user); assertNotNull(createdStudent); assertEquals(newType, createdStudent.getParticipationType()); }
void function() { final int oldStudentCount = course.getStudents().size(); ParticipationType newType = DataHelper.createParticipationTypeIn(course); User user = DataHelper.createBasicUser(); user.setUserId(null); assertNull(user.getToken()); participantsController.setSelectedUser(user); participantsController.setSelectedParticipationTypeId(newType.getPartTypeId()); participantsController.setSelectedRoleId(Role.STUDENT.getId()); when(userServiceMock.initPasswordReset(eq(user), anyInt())) .thenReturn(new PasswordReset()); participantsController.createNewUser(); assertNotNull(user.getToken()); assertNull(user.getPassword()); verify(courseServiceMock, times(1)).update(course); verify(userServiceMock, times(1)).initPasswordReset(eq(user), anyInt()); final int newStudentsCount = course.getStudents().size(); assertTrue(oldStudentCount < newStudentsCount); Student createdStudent = course.getStudentFromUser(user); assertNotNull(createdStudent); assertEquals(newType, createdStudent.getParticipationType()); }
/** * Tests if a new user gets inserted correctly and a new student object * gets added to the course. */
Tests if a new user gets inserted correctly and a new student object gets added to the course
testCreateNewUserWithStudent
{ "repo_name": "stefanoberdoerfer/exmatrikulator", "path": "src/test/java/de/unibremen/opensores/controller/ParticipantsControllerTest.java", "license": "agpl-3.0", "size": 32777 }
[ "de.unibremen.opensores.model.ParticipationType", "de.unibremen.opensores.model.PasswordReset", "de.unibremen.opensores.model.Role", "de.unibremen.opensores.model.Student", "de.unibremen.opensores.model.User", "de.unibremen.opensores.testutil.DataHelper", "org.junit.Assert", "org.mockito.Matchers", "org.mockito.Mockito" ]
import de.unibremen.opensores.model.ParticipationType; import de.unibremen.opensores.model.PasswordReset; import de.unibremen.opensores.model.Role; import de.unibremen.opensores.model.Student; import de.unibremen.opensores.model.User; import de.unibremen.opensores.testutil.DataHelper; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito;
import de.unibremen.opensores.model.*; import de.unibremen.opensores.testutil.*; import org.junit.*; import org.mockito.*;
[ "de.unibremen.opensores", "org.junit", "org.mockito" ]
de.unibremen.opensores; org.junit; org.mockito;
771,259
@Pure protected Primitives getPrimitiveTypes() { return this.primitives; }
Primitives function() { return this.primitives; }
/** Replies the primitive type tools. * * @return the primitive type tools. */
Replies the primitive type tools
getPrimitiveTypes
{ "repo_name": "jgfoster/sarl", "path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java", "license": "apache-2.0", "size": 10434 }
[ "org.eclipse.xtext.common.types.util.Primitives" ]
import org.eclipse.xtext.common.types.util.Primitives;
import org.eclipse.xtext.common.types.util.*;
[ "org.eclipse.xtext" ]
org.eclipse.xtext;
1,576,592
private static Date parseDate(String stringDate) { DateFormat df = CachingDateFormat.getDateFormat(); df.setLenient(true); Date date; ParsePosition pp = new ParsePosition(0); date = df.parse(stringDate, pp); if ((pp.getIndex() < stringDate.length()) || (date == null)) { date = new Date(); } return date; } public Duration(Date start_in, Date end_in) { boolean positive = true; Date start; Date end; if (end_in.before(start_in)) { start = end_in; end = start_in; positive = false; } else { start = start_in; end = end_in; positive = true; } Calendar cstart = Calendar.getInstance(); cstart.setTime(start); Calendar cend = Calendar.getInstance(); cend.setTime(end); int millis = cend.get(Calendar.MILLISECOND) - cstart.get(Calendar.MILLISECOND); if (millis < 0) { millis += cstart.getActualMaximum(Calendar.MILLISECOND)+1; } cstart.add(Calendar.MILLISECOND, millis); int seconds = cend.get(Calendar.SECOND) - cstart.get(Calendar.SECOND); if (seconds < 0) { seconds += cstart.getActualMaximum(Calendar.SECOND)+1; } cstart.add(Calendar.SECOND, seconds); int minutes = cend.get(Calendar.MINUTE) - cstart.get(Calendar.MINUTE); if (minutes < 0) { minutes += cstart.getActualMaximum(Calendar.MINUTE)+1; } cstart.add(Calendar.MINUTE, minutes); int hours = cend.get(Calendar.HOUR_OF_DAY) - cstart.get(Calendar.HOUR_OF_DAY); if (hours < 0) { hours += cstart.getActualMaximum(Calendar.HOUR_OF_DAY)+1; } cstart.add(Calendar.HOUR_OF_DAY, hours); int days = cend.get(Calendar.DAY_OF_MONTH) - cstart.get(Calendar.DAY_OF_MONTH); if (days < 0) { days += cstart.getActualMaximum(Calendar.DAY_OF_MONTH)+1; } cstart.add(Calendar.DAY_OF_MONTH, days); int months = cend.get(Calendar.MONTH) - cstart.get(Calendar.MONTH); if (months < 0) { months += cstart.getActualMaximum(Calendar.MONTH)+1; } cstart.add(Calendar.MONTH, months); int years = cend.get(Calendar.YEAR) - cstart.get(Calendar.YEAR); //cstart.add(Calendar.YEAR, years); m_positive = positive; m_years = years; m_months = months; m_days = days; m_hours = hours; m_mins = minutes; m_seconds = seconds; m_nanos = millis * 1000000; } public Duration(boolean positive_in, long months_in, long seconds_in, long nanos_in) { boolean positive = positive_in; long months = months_in; long seconds = seconds_in + nanos_in / 1000000000; long nanos = nanos_in % 1000000000; // Fix up seconds and nanos to be of the same sign if ((seconds > 0) && (nanos < 0)) { seconds -= 1; nanos += 1000000000; } else if ((seconds < 0) && (nanos > 0)) { seconds += 1; nanos -= 1000000000; } // seconds and nanos now the same sign - sum to test overall sign if ((months < 0) && (seconds + nanos < 0)) { // switch sign positive = !positive; months = -months; seconds = -seconds; nanos = -nanos; } else if ((months == 0) && (seconds + nanos < 0)) { // switch sign positive = !positive; months = -months; seconds = -seconds; nanos = -nanos; } else if ((months > 0) && (seconds + nanos < 0)) { throw new RuntimeException("Can not convert to period - incompatible signs for year_to_momth and day_to_second elements"); } else if ((months < 0) && (seconds + nanos > 0)) { throw new RuntimeException("Can not convert to period - incompatible signs for year_to_momth and day_to_second elements"); } else { // All +ve } m_positive = positive; m_years = (int) (months / 12); m_months = (int) (months % 12); m_days = (int) (seconds / (3600 * 24)); seconds -= m_days * 3600 * 24; m_hours = (int) (seconds / 3600); seconds -= m_hours * 3600; m_mins = (int) (seconds / 60); seconds -= m_mins * 60; m_seconds = (int) seconds; m_nanos = (int) nanos; } // Duration arithmetic
static Date function(String stringDate) { DateFormat df = CachingDateFormat.getDateFormat(); df.setLenient(true); Date date; ParsePosition pp = new ParsePosition(0); date = df.parse(stringDate, pp); if ((pp.getIndex() < stringDate.length()) (date == null)) { date = new Date(); } return date; } public Duration(Date start_in, Date end_in) { boolean positive = true; Date start; Date end; if (end_in.before(start_in)) { start = end_in; end = start_in; positive = false; } else { start = start_in; end = end_in; positive = true; } Calendar cstart = Calendar.getInstance(); cstart.setTime(start); Calendar cend = Calendar.getInstance(); cend.setTime(end); int millis = cend.get(Calendar.MILLISECOND) - cstart.get(Calendar.MILLISECOND); if (millis < 0) { millis += cstart.getActualMaximum(Calendar.MILLISECOND)+1; } cstart.add(Calendar.MILLISECOND, millis); int seconds = cend.get(Calendar.SECOND) - cstart.get(Calendar.SECOND); if (seconds < 0) { seconds += cstart.getActualMaximum(Calendar.SECOND)+1; } cstart.add(Calendar.SECOND, seconds); int minutes = cend.get(Calendar.MINUTE) - cstart.get(Calendar.MINUTE); if (minutes < 0) { minutes += cstart.getActualMaximum(Calendar.MINUTE)+1; } cstart.add(Calendar.MINUTE, minutes); int hours = cend.get(Calendar.HOUR_OF_DAY) - cstart.get(Calendar.HOUR_OF_DAY); if (hours < 0) { hours += cstart.getActualMaximum(Calendar.HOUR_OF_DAY)+1; } cstart.add(Calendar.HOUR_OF_DAY, hours); int days = cend.get(Calendar.DAY_OF_MONTH) - cstart.get(Calendar.DAY_OF_MONTH); if (days < 0) { days += cstart.getActualMaximum(Calendar.DAY_OF_MONTH)+1; } cstart.add(Calendar.DAY_OF_MONTH, days); int months = cend.get(Calendar.MONTH) - cstart.get(Calendar.MONTH); if (months < 0) { months += cstart.getActualMaximum(Calendar.MONTH)+1; } cstart.add(Calendar.MONTH, months); int years = cend.get(Calendar.YEAR) - cstart.get(Calendar.YEAR); m_positive = positive; m_years = years; m_months = months; m_days = days; m_hours = hours; m_mins = minutes; m_seconds = seconds; m_nanos = millis * 1000000; } public Duration(boolean positive_in, long months_in, long seconds_in, long nanos_in) { boolean positive = positive_in; long months = months_in; long seconds = seconds_in + nanos_in / 1000000000; long nanos = nanos_in % 1000000000; if ((seconds > 0) && (nanos < 0)) { seconds -= 1; nanos += 1000000000; } else if ((seconds < 0) && (nanos > 0)) { seconds += 1; nanos -= 1000000000; } if ((months < 0) && (seconds + nanos < 0)) { positive = !positive; months = -months; seconds = -seconds; nanos = -nanos; } else if ((months == 0) && (seconds + nanos < 0)) { positive = !positive; months = -months; seconds = -seconds; nanos = -nanos; } else if ((months > 0) && (seconds + nanos < 0)) { throw new RuntimeException(STR); } else if ((months < 0) && (seconds + nanos > 0)) { throw new RuntimeException(STR); } else { } m_positive = positive; m_years = (int) (months / 12); m_months = (int) (months % 12); m_days = (int) (seconds / (3600 * 24)); seconds -= m_days * 3600 * 24; m_hours = (int) (seconds / 3600); seconds -= m_hours * 3600; m_mins = (int) (seconds / 60); seconds -= m_mins * 60; m_seconds = (int) seconds; m_nanos = (int) nanos; }
/** * Helper method to parse eaets from strings * @param stringDate String * @return Date */
Helper method to parse eaets from strings
parseDate
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/data-model/source/java/org/alfresco/service/cmr/repository/datatype/Duration.java", "license": "lgpl-3.0", "size": 32645 }
[ "java.text.DateFormat", "java.text.ParsePosition", "java.util.Calendar", "java.util.Date", "org.alfresco.util.CachingDateFormat" ]
import java.text.DateFormat; import java.text.ParsePosition; import java.util.Calendar; import java.util.Date; import org.alfresco.util.CachingDateFormat;
import java.text.*; import java.util.*; import org.alfresco.util.*;
[ "java.text", "java.util", "org.alfresco.util" ]
java.text; java.util; org.alfresco.util;
1,573,126
public void serialize(XmlSerializer serializer) throws IOException { if (mType == TYPE_LABEL || mType == TYPE_IMAGE) { return; } serializer.startTag(null, "field").attribute(null, "name", mName); serializeInner(serializer); serializer.endTag(null, "field"); }
void function(XmlSerializer serializer) throws IOException { if (mType == TYPE_LABEL mType == TYPE_IMAGE) { return; } serializer.startTag(null, "field").attribute(null, "name", mName); serializeInner(serializer); serializer.endTag(null, "field"); }
/** * Writes information about the editable parts of the field as XML. * * @param serializer The XmlSerializer to write to. * * @throws IOException */
Writes information about the editable parts of the field as XML
serialize
{ "repo_name": "rohlfingt/blockly-android", "path": "blocklylib-core/src/main/java/com/google/blockly/model/Field.java", "license": "apache-2.0", "size": 8621 }
[ "java.io.IOException", "org.xmlpull.v1.XmlSerializer" ]
import java.io.IOException; import org.xmlpull.v1.XmlSerializer;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
567,533
public void setCameraTarget(JSONArray args, final CallbackContext callbackContext) throws JSONException { double lat = args.getDouble(0); double lng = args.getDouble(1);
void function(JSONArray args, final CallbackContext callbackContext) throws JSONException { double lat = args.getDouble(0); double lng = args.getDouble(1);
/** * Set center location of the marker * @param args * @param callbackContext * @throws JSONException */
Set center location of the marker
setCameraTarget
{ "repo_name": "vampiremix/CoffeeHub_V2", "path": "plugins/cordova-plugin-googlemaps/src/android/plugin/google/maps/PluginMap.java", "license": "mit", "size": 95257 }
[ "org.apache.cordova.CallbackContext", "org.json.JSONArray", "org.json.JSONException" ]
import org.apache.cordova.CallbackContext; import org.json.JSONArray; import org.json.JSONException;
import org.apache.cordova.*; import org.json.*;
[ "org.apache.cordova", "org.json" ]
org.apache.cordova; org.json;
1,357,914
private CppCompileActionBuilder initializeCompileAction(Artifact sourceArtifact, Label sourceLabel) { CppCompileActionBuilder builder = createCompileActionBuilder(sourceArtifact, sourceLabel); if (nocopts != null) { builder.addNocopts(nocopts); } builder.setExtraSystemIncludePrefixes(additionalIncludes); builder.setFdoBuildStamp(CppHelper.getFdoBuildStamp(cppConfiguration)); builder.setFeatureConfiguration(featureConfiguration); return builder; }
CppCompileActionBuilder function(Artifact sourceArtifact, Label sourceLabel) { CppCompileActionBuilder builder = createCompileActionBuilder(sourceArtifact, sourceLabel); if (nocopts != null) { builder.addNocopts(nocopts); } builder.setExtraSystemIncludePrefixes(additionalIncludes); builder.setFdoBuildStamp(CppHelper.getFdoBuildStamp(cppConfiguration)); builder.setFeatureConfiguration(featureConfiguration); return builder; }
/** * Returns a {@code CppCompileActionBuilder} with the common fields for a C++ compile action * being initialized. */
Returns a CppCompileActionBuilder with the common fields for a C++ compile action being initialized
initializeCompileAction
{ "repo_name": "rohitsaboo/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java", "license": "apache-2.0", "size": 35098 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.cmdline.Label" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.cmdline.*;
[ "com.google.devtools" ]
com.google.devtools;
2,070,506
private void setZivaUserCodeFromResponse(String responseStr) { if (responseStr == null) return; try { JSONObject json = new JSONObject(responseStr); this.setZivaUserCode((String) json .get(ZivaCareConfig.ZIVA_USER_CODE)); } catch (Exception e) { if (isDebugEnabled()) System.out.println("json error: " + e.getMessage()); int index = responseStr.indexOf(ZivaCareConfig.ZIVA_USER_CODE); if (index > -1) { String responseStr1 = responseStr.substring(index + ZivaCareConfig.ZIVA_USER_CODE.length() + 3); responseStr1 = responseStr1.substring(0, responseStr1.indexOf("\"")); this.setZivaUserCode(responseStr1); } } }
void function(String responseStr) { if (responseStr == null) return; try { JSONObject json = new JSONObject(responseStr); this.setZivaUserCode((String) json .get(ZivaCareConfig.ZIVA_USER_CODE)); } catch (Exception e) { if (isDebugEnabled()) System.out.println(STR + e.getMessage()); int index = responseStr.indexOf(ZivaCareConfig.ZIVA_USER_CODE); if (index > -1) { String responseStr1 = responseStr.substring(index + ZivaCareConfig.ZIVA_USER_CODE.length() + 3); responseStr1 = responseStr1.substring(0, responseStr1.indexOf("\"")); this.setZivaUserCode(responseStr1); } } }
/** * Set the zivaUserCode in configuration object and in the cache file from a * Json formated String * * @param responseStr */
Set the zivaUserCode in configuration object and in the cache file from a Json formated String
setZivaUserCodeFromResponse
{ "repo_name": "ZivaCare/zivacare-android-sdk", "path": "sdk/src/main/java/com/zivacare/android/sdk/ZivaCareConfig.java", "license": "mit", "size": 20726 }
[ "org.json.JSONObject" ]
import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
499,955
public void put(Text columnFamily, Text columnQualifier, Value value) { put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value.get()); }
void function(Text columnFamily, Text columnQualifier, Value value) { put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value.get()); }
/** * Puts a modification in this mutation. Column visibility is empty; * timestamp is not set. All parameters are defensively copied. * * @param columnFamily column family * @param columnQualifier column qualifier * @param value cell value */
Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied
put
{ "repo_name": "joshelser/accumulo", "path": "core/src/main/java/org/apache/accumulo/core/data/Mutation.java", "license": "apache-2.0", "size": 30290 }
[ "org.apache.hadoop.io.Text" ]
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,390,934
@Test public void whenDeleteUserThenMapSizeDecrease() { Operation operation = new Operation(); User user1 = new User("Igor", "01 00 000000"); operation.addUser(user1); operation.deleteUser(user1); int result = operation.getInfo().size(); int exist = 0; assertThat(result, is(exist)); }
void function() { Operation operation = new Operation(); User user1 = new User("Igor", STR); operation.addUser(user1); operation.deleteUser(user1); int result = operation.getInfo().size(); int exist = 0; assertThat(result, is(exist)); }
/** * Test Delete user. */
Test Delete user
whenDeleteUserThenMapSizeDecrease
{ "repo_name": "fr3anthe/ifedorenko", "path": "1.3-Collections-Lite/src/test/java/ru/job4j/collections/tasktest/OperationTest.java", "license": "apache-2.0", "size": 4624 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
834,142
synchronized (fProcess) { if (fProcess.isTerminated()) { refresh(); } else { DebugPlugin.getDefault().addDebugEventListener(this); } } }
synchronized (fProcess) { if (fProcess.isTerminated()) { refresh(); } else { DebugPlugin.getDefault().addDebugEventListener(this); } } }
/** * If the process has already terminated, resource refreshing is done * immediately in the current thread. Otherwise, refreshing is done when the * process terminates. */
If the process has already terminated, resource refreshing is done immediately in the current thread. Otherwise, refreshing is done when the process terminates
startBackgroundRefresh
{ "repo_name": "cooked/NDT", "path": "sc.ndt.launching.fast/src/sc/ndt/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java", "license": "gpl-3.0", "size": 2864 }
[ "org.eclipse.debug.core.DebugPlugin" ]
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.*;
[ "org.eclipse.debug" ]
org.eclipse.debug;
1,271,388
public int getNumArcs() { Topology topology = getTopologyOptional(); return topology != null ? topology.getNumArcs() : backup().cellRevision.arcs.size(); }
int function() { Topology topology = getTopologyOptional(); return topology != null ? topology.getNumArcs() : backup().cellRevision.arcs.size(); }
/** * Method to return the number of ArcInst objects in this Cell. * @return the number of ArcInst objects in this Cell. */
Method to return the number of ArcInst objects in this Cell
getNumArcs
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/database/hierarchy/Cell.java", "license": "gpl-3.0", "size": 185659 }
[ "com.sun.electric.database.topology.Topology" ]
import com.sun.electric.database.topology.Topology;
import com.sun.electric.database.topology.*;
[ "com.sun.electric" ]
com.sun.electric;
476,014
public boolean profile_setFBML(CharSequence fbmlMarkup, Integer userId) throws FacebookException, IOException;
boolean function(CharSequence fbmlMarkup, Integer userId) throws FacebookException, IOException;
/** * Sets the FBML for a user's profile, including the content for both the profile box * and the profile actions. * @param userId - the user whose profile FBML to set * @param fbmlMarkup - refer to the FBML documentation for a description of the markup and its role in various contexts * @return a boolean indicating whether the FBML was successfully set */
Sets the FBML for a user's profile, including the content for both the profile box and the profile actions
profile_setFBML
{ "repo_name": "jkinner/ringside", "path": "api/clients/java/com/facebook/api/IFacebookRestClient.java", "license": "lgpl-2.1", "size": 46105 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
141,072
@Type(type = "com.servinglynk.hmis.warehouse.enums.ClientSsnDataQualityEnumType") @Basic( optional = true ) @Column( name = "ssn_data_quality" ) public ClientSsnDataQualityEnum getSsnDataQuality() { return this.ssnDataQuality; }
@Type(type = STR) @Basic( optional = true ) @Column( name = STR ) ClientSsnDataQualityEnum function() { return this.ssnDataQuality; }
/** * Return the value associated with the column: ssnDataQuality. * @return A ClientSsnDataQualityEnum object (this.ssnDataQuality) */
Return the value associated with the column: ssnDataQuality
getSsnDataQuality
{ "repo_name": "servinglynk/hmis-lynk-open-source", "path": "hmis-model-v2015/src/main/java/com/servinglynk/hmis/warehouse/model/v2015/Client.java", "license": "mpl-2.0", "size": 23038 }
[ "com.servinglynk.hmis.warehouse.enums.ClientSsnDataQualityEnum", "javax.persistence.Basic", "javax.persistence.Column", "org.hibernate.annotations.Type" ]
import com.servinglynk.hmis.warehouse.enums.ClientSsnDataQualityEnum; import javax.persistence.Basic; import javax.persistence.Column; import org.hibernate.annotations.Type;
import com.servinglynk.hmis.warehouse.enums.*; import javax.persistence.*; import org.hibernate.annotations.*;
[ "com.servinglynk.hmis", "javax.persistence", "org.hibernate.annotations" ]
com.servinglynk.hmis; javax.persistence; org.hibernate.annotations;
1,844,486
public List<Alarm> getAlarms() { return alarms; }
List<Alarm> function() { return alarms; }
/** * Return an list of configured alarms * * @return */
Return an list of configured alarms
getAlarms
{ "repo_name": "OpenJEVis/JEAlarm", "path": "src/main/java/org/jevis/jealarm/Config.java", "license": "gpl-3.0", "size": 7043 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,543,397
protected List<DeleteOperation> removeUnnecessaryOperations() { List<DeleteOperation> removedDeleteOperations = new ArrayList<>(); for (Iterator<DeleteOperation> deleteIterator = deleteOperations.iterator(); deleteIterator.hasNext(); ) { DeleteOperation deleteOperation = deleteIterator.next(); Class<? extends PersistentObject> deletedPersistentObjectClass = deleteOperation.getPersistentObjectClass(); List<PersistentObject> insertedObjectsOfSameClass = insertedObjects.get(deletedPersistentObjectClass); if (insertedObjectsOfSameClass != null && insertedObjectsOfSameClass.size() > 0) { for (Iterator<PersistentObject> insertIterator = insertedObjectsOfSameClass.iterator(); insertIterator.hasNext(); ) { PersistentObject insertedObject = insertIterator.next(); // if the deleted object is inserted, if (deleteOperation.sameIdentity(insertedObject)) { // remove the insert and the delete, they cancel each other insertIterator.remove(); deleteIterator.remove(); // add removed operations to be able to fire events removedDeleteOperations.add(deleteOperation); } } if (insertedObjects.get(deletedPersistentObjectClass).size() == 0) { insertedObjects.remove(deletedPersistentObjectClass); } } // in any case, remove the deleted object from the cache deleteOperation.clearCache(); } for (Class<? extends PersistentObject> persistentObjectClass : insertedObjects.keySet()) { for (PersistentObject insertedObject : insertedObjects.get(persistentObjectClass)) { cacheRemove(insertedObject.getClass(), insertedObject.getId()); } } return removedDeleteOperations; } // // [Joram] Put this in comments. Had all kinds of errors. // // // protected List<DeleteOperation> optimizeDeleteOperations(List<DeleteOperation> deleteOperations) { // // // No optimization possible for 0 or 1 operations // if (!isOptimizeDeleteOperationsEnabled || deleteOperations.size() <= 1) { // return deleteOperations; // } // // List<DeleteOperation> optimizedDeleteOperations = new ArrayList<DbSqlSession.DeleteOperation>(); // boolean[] checkedIndices = new boolean[deleteOperations.size()]; // for (int i=0; i<deleteOperations.size(); i++) { // // if (checkedIndices[i] == true) { // continue; // } // // DeleteOperation deleteOperation = deleteOperations.get(i); // boolean couldOptimize = false; // if (deleteOperation instanceof CheckedDeleteOperation) { // // PersistentObject persistentObject = ((CheckedDeleteOperation) deleteOperation).getPersistentObject(); // if (persistentObject instanceof BulkDeleteable) { // String bulkDeleteStatement = dbSqlSessionFactory.getBulkDeleteStatement(persistentObject.getClass()); // bulkDeleteStatement = dbSqlSessionFactory.mapStatement(bulkDeleteStatement); // if (bulkDeleteStatement != null) { // BulkCheckedDeleteOperation bulkCheckedDeleteOperation = null; // // // Find all objects of the same type // for (int j=0; j<deleteOperations.size(); j++) { // DeleteOperation otherDeleteOperation = deleteOperations.get(j); // if (j != i && checkedIndices[j] == false && otherDeleteOperation instanceof CheckedDeleteOperation) { // PersistentObject otherPersistentObject = ((CheckedDeleteOperation) otherDeleteOperation).getPersistentObject(); // if (otherPersistentObject.getClass().equals(persistentObject.getClass())) { // if (bulkCheckedDeleteOperation == null) { // bulkCheckedDeleteOperation = new BulkCheckedDeleteOperation(persistentObject.getClass()); // bulkCheckedDeleteOperation.addPersistentObject(persistentObject); // optimizedDeleteOperations.add(bulkCheckedDeleteOperation); // } // couldOptimize = true; // bulkCheckedDeleteOperation.addPersistentObject(otherPersistentObject); // checkedIndices[j] = true; // } else { // // We may only optimize subsequent delete operations of the same type, to prevent messing up // // the order of deletes of related entities which may depend on the referenced entity being deleted before // break; // } // } // // } // } // } // } // // if (!couldOptimize) { // optimizedDeleteOperations.add(deleteOperation); // } // checkedIndices[i]=true; // // } // return optimizedDeleteOperations; // }
List<DeleteOperation> function() { List<DeleteOperation> removedDeleteOperations = new ArrayList<>(); for (Iterator<DeleteOperation> deleteIterator = deleteOperations.iterator(); deleteIterator.hasNext(); ) { DeleteOperation deleteOperation = deleteIterator.next(); Class<? extends PersistentObject> deletedPersistentObjectClass = deleteOperation.getPersistentObjectClass(); List<PersistentObject> insertedObjectsOfSameClass = insertedObjects.get(deletedPersistentObjectClass); if (insertedObjectsOfSameClass != null && insertedObjectsOfSameClass.size() > 0) { for (Iterator<PersistentObject> insertIterator = insertedObjectsOfSameClass.iterator(); insertIterator.hasNext(); ) { PersistentObject insertedObject = insertIterator.next(); if (deleteOperation.sameIdentity(insertedObject)) { insertIterator.remove(); deleteIterator.remove(); removedDeleteOperations.add(deleteOperation); } } if (insertedObjects.get(deletedPersistentObjectClass).size() == 0) { insertedObjects.remove(deletedPersistentObjectClass); } } deleteOperation.clearCache(); } for (Class<? extends PersistentObject> persistentObjectClass : insertedObjects.keySet()) { for (PersistentObject insertedObject : insertedObjects.get(persistentObjectClass)) { cacheRemove(insertedObject.getClass(), insertedObject.getId()); } } return removedDeleteOperations; }
/** * Clears all deleted and inserted objects from the cache, and removes inserts and deletes that cancel each other. */
Clears all deleted and inserted objects from the cache, and removes inserts and deletes that cancel each other
removeUnnecessaryOperations
{ "repo_name": "zwets/flowable-engine", "path": "modules/flowable5-engine/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java", "license": "apache-2.0", "size": 46954 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,474,609
default CompletableFuture<LogicalSlot> allocateBatchSlot( SlotRequestId slotRequestId, ScheduledUnit scheduledUnit, SlotProfile slotProfile) { throw new UnsupportedOperationException("Not properly implemented."); }
default CompletableFuture<LogicalSlot> allocateBatchSlot( SlotRequestId slotRequestId, ScheduledUnit scheduledUnit, SlotProfile slotProfile) { throw new UnsupportedOperationException(STR); }
/** * Allocating batch slot with specific requirement. * * @param slotRequestId identifying the slot request * @param scheduledUnit The task to allocate the slot for * @param slotProfile profile of the requested slot * @return The future of the allocation */
Allocating batch slot with specific requirement
allocateBatchSlot
{ "repo_name": "darionyaphet/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotProvider.java", "license": "apache-2.0", "size": 3808 }
[ "java.util.concurrent.CompletableFuture", "org.apache.flink.runtime.clusterframework.types.SlotProfile", "org.apache.flink.runtime.jobmanager.scheduler.ScheduledUnit", "org.apache.flink.runtime.jobmaster.LogicalSlot", "org.apache.flink.runtime.jobmaster.SlotRequestId" ]
import java.util.concurrent.CompletableFuture; import org.apache.flink.runtime.clusterframework.types.SlotProfile; import org.apache.flink.runtime.jobmanager.scheduler.ScheduledUnit; import org.apache.flink.runtime.jobmaster.LogicalSlot; import org.apache.flink.runtime.jobmaster.SlotRequestId;
import java.util.concurrent.*; import org.apache.flink.runtime.clusterframework.types.*; import org.apache.flink.runtime.jobmanager.scheduler.*; import org.apache.flink.runtime.jobmaster.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
2,181,684
List<QueueInfo> getRootQueueInfos() throws YarnRemoteException;
List<QueueInfo> getRootQueueInfos() throws YarnRemoteException;
/** * <p> * Get information ({@link QueueInfo}) about top level queues. * </p> * * @return a list of queue-information for all the top-level queues * @throws YarnRemoteException */
Get information (<code>QueueInfo</code>) about top level queues.
getRootQueueInfos
{ "repo_name": "moreus/hadoop", "path": "hadoop-0.23.10/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/hadoop/yarn/client/YarnClient.java", "license": "apache-2.0", "size": 7580 }
[ "java.util.List", "org.apache.hadoop.yarn.api.records.QueueInfo", "org.apache.hadoop.yarn.exceptions.YarnRemoteException" ]
import java.util.List; import org.apache.hadoop.yarn.api.records.QueueInfo; import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.exceptions.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
530,549
public String completeIt() { // Re-Check if (!m_justPrepared) { String status = prepareIt(); if (!DocAction.STATUS_InProgress.equals(status)) return status; } m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); if (m_processMsg != null) return DocAction.STATUS_Invalid; // Implicit Approval if (!isApproved()) approveIt(); log.info("completeIt - " + toString()); // Set Payment reconciled MBankStatementLine[] lines = getLines(false); for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; if (line.getC_Payment_ID() != 0) { MPayment payment = new MPayment (getCtx(), line.getC_Payment_ID(), get_TrxName()); payment.setIsReconciled(true); payment.save(get_TrxName()); } } // Update Bank Account MBankAccount ba = getBankAccount(); ba.load(get_TrxName()); //BF 1933645 ba.setCurrentBalance(ba.getCurrentBalance().add(getStatementDifference())); ba.save(get_TrxName()); // User Validation String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); if (valid != null) { m_processMsg = valid; return DocAction.STATUS_Invalid; } // setProcessed(true); setDocAction(DOCACTION_Close); return DocAction.STATUS_Completed; } // completeIt
String function() { if (!m_justPrepared) { String status = prepareIt(); if (!DocAction.STATUS_InProgress.equals(status)) return status; } m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); if (m_processMsg != null) return DocAction.STATUS_Invalid; if (!isApproved()) approveIt(); log.info(STR + toString()); MBankStatementLine[] lines = getLines(false); for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; if (line.getC_Payment_ID() != 0) { MPayment payment = new MPayment (getCtx(), line.getC_Payment_ID(), get_TrxName()); payment.setIsReconciled(true); payment.save(get_TrxName()); } } MBankAccount ba = getBankAccount(); ba.load(get_TrxName()); ba.setCurrentBalance(ba.getCurrentBalance().add(getStatementDifference())); ba.save(get_TrxName()); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); if (valid != null) { m_processMsg = valid; return DocAction.STATUS_Invalid; } setProcessed(true); setDocAction(DOCACTION_Close); return DocAction.STATUS_Completed; }
/** * Complete Document * @return new status (Complete, In Progress, Invalid, Waiting ..) */
Complete Document
completeIt
{ "repo_name": "erpcya/adempierePOS", "path": "base/src/org/compiere/model/MBankStatement.java", "license": "gpl-2.0", "size": 19069 }
[ "org.compiere.process.DocAction" ]
import org.compiere.process.DocAction;
import org.compiere.process.*;
[ "org.compiere.process" ]
org.compiere.process;
646,359
protected InvocationEntity createEntity(URI serviceID) { return new InvocationEntityImpl(serviceID); } // ///////////////////////////////////////////////////////////////////////////// // // // WORKFLOW NOTIFIER // // // // ///////////////////////////////////////////////////////////////////////////// /** * {@inheritDoc}
InvocationEntity function(URI serviceID) { return new InvocationEntityImpl(serviceID); } /** * {@inheritDoc}
/** * this method allows us to override the default timestamp with a user supplied one * * @param msg * a BaseNotificationType * @param entity * an InvocationEntity * */
this method allows us to override the default timestamp with a user supplied one
createEntity
{ "repo_name": "glahiru/airavata", "path": "modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/ProvenanceNotifierImpl.java", "license": "apache-2.0", "size": 34332 }
[ "org.apache.airavata.workflow.tracking.common.InvocationEntity", "org.apache.airavata.workflow.tracking.impl.state.InvocationEntityImpl" ]
import org.apache.airavata.workflow.tracking.common.InvocationEntity; import org.apache.airavata.workflow.tracking.impl.state.InvocationEntityImpl;
import org.apache.airavata.workflow.tracking.common.*; import org.apache.airavata.workflow.tracking.impl.state.*;
[ "org.apache.airavata" ]
org.apache.airavata;
1,002,679
public void fireNotifyChanged(Notification notification) { changeNotifier.fireNotifyChanged(notification); if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } }
void function(Notification notification) { changeNotifier.fireNotifyChanged(notification); if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } }
/** * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This delegates to <code>#changeNotifier</code> and to <code>#parentAdapterFactory</code>.
fireNotifyChanged
{ "repo_name": "janstey/fuse-1", "path": "components/camel-sap/org.fusesource.camel.component.sap.model.edit/src/org/fusesource/camel/component/sap/model/rfc/provider/RfcItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 25729 }
[ "org.eclipse.emf.common.notify.Notification" ]
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
191,876
public Long startDiagnosis(final JobDescription jobDescription) { lastClientException = null; try { return client.startDiagnosis(jobDescription); } catch (Exception e) { handleException("startDiagnosis", MSG_START_DIAGNOSIS, e, HandlerStyle.SHOW, false); } return null; }
Long function(final JobDescription jobDescription) { lastClientException = null; try { return client.startDiagnosis(jobDescription); } catch (Exception e) { handleException(STR, MSG_START_DIAGNOSIS, e, HandlerStyle.SHOW, false); } return null; }
/** * Starts the diagnosis using the given job description. Returns the * retrieved job id or <code>null</code> on failure. * * @param jobDescription * The job description to use. * @return The retrieved job id or <code>null</code> on failure. */
Starts the diagnosis using the given job description. Returns the retrieved job id or <code>null</code> on failure
startDiagnosis
{ "repo_name": "sopeco/DynamicSpotter", "path": "org.spotter.eclipse.ui/src/org/spotter/eclipse/ui/ServiceClientWrapper.java", "license": "apache-2.0", "size": 23011 }
[ "org.spotter.shared.configuration.JobDescription" ]
import org.spotter.shared.configuration.JobDescription;
import org.spotter.shared.configuration.*;
[ "org.spotter.shared" ]
org.spotter.shared;
1,033,758
private void parseConnectorProviderExtension(IExtension extension) { final IConfigurationElement[] configElements = extension.getConfigurationElements(); for (IConfigurationElement elem : configElements) { if (CONNECTOR_TAG_EXTENSION.equals(elem.getName())) { try { final IConnector connector = (IConnector)elem.createExecutableExtension( CONNECTOR_ATTRIBUTE_CLASS); MappingUtils.getConnectorRegistry().register(connector); } catch (CoreException e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e .getMessage(), e)); } } } }
void function(IExtension extension) { final IConfigurationElement[] configElements = extension.getConfigurationElements(); for (IConfigurationElement elem : configElements) { if (CONNECTOR_TAG_EXTENSION.equals(elem.getName())) { try { final IConnector connector = (IConnector)elem.createExecutableExtension( CONNECTOR_ATTRIBUTE_CLASS); MappingUtils.getConnectorRegistry().register(connector); } catch (CoreException e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e .getMessage(), e)); } } } }
/** * Parses a single {@link IConnector} extension contribution. * * @param extension * Parses the given extension and adds its contribution to the registry */
Parses a single <code>IConnector</code> extension contribution
parseConnectorProviderExtension
{ "repo_name": "ModelWriter/Source", "path": "plugins/org.eclipse.mylyn.docs.intent.mapping.ide/src/org/eclipse/mylyn/docs/intent/mapping/ide/IdeMappingRegistryListener.java", "license": "epl-1.0", "size": 18153 }
[ "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IConfigurationElement", "org.eclipse.core.runtime.IExtension", "org.eclipse.core.runtime.IStatus", "org.eclipse.core.runtime.Status", "org.eclipse.mylyn.docs.intent.mapping.MappingUtils", "org.eclipse.mylyn.docs.intent.mapping.connector.IConnector" ]
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.mylyn.docs.intent.mapping.MappingUtils; import org.eclipse.mylyn.docs.intent.mapping.connector.IConnector;
import org.eclipse.core.runtime.*; import org.eclipse.mylyn.docs.intent.mapping.*; import org.eclipse.mylyn.docs.intent.mapping.connector.*;
[ "org.eclipse.core", "org.eclipse.mylyn" ]
org.eclipse.core; org.eclipse.mylyn;
1,540,264
@LogMessage(level = Level.ERROR) @Message(id = 11, value = "No deployment content with hash %s is available in the deployment content repository for deployment %s. Because this Host Controller is booting in ADMIN-ONLY mode, boot will be allowed to proceed to provide administrators an opportunity to correct this problem. If this Host Controller were not in ADMIN-ONLY mode this would be a fatal boot failure.") void reportAdminOnlyMissingDeploymentContent(String contentHash, String deploymentName);
@LogMessage(level = Level.ERROR) @Message(id = 11, value = STR) void reportAdminOnlyMissingDeploymentContent(String contentHash, String deploymentName);
/** * Logs an error message indicating the content for a configured deployment was unavailable at boot but boot * was allowed to proceed because the HC is in admin-only mode. * * @param contentHash the content hash that could not be found. * @param deploymentName the deployment name. */
Logs an error message indicating the content for a configured deployment was unavailable at boot but boot was allowed to proceed because the HC is in admin-only mode
reportAdminOnlyMissingDeploymentContent
{ "repo_name": "JiriOndrusek/wildfly-core", "path": "host-controller/src/main/java/org/jboss/as/domain/controller/logging/DomainControllerLogger.java", "license": "lgpl-2.1", "size": 34701 }
[ "org.jboss.logging.Logger", "org.jboss.logging.annotations.LogMessage", "org.jboss.logging.annotations.Message" ]
import org.jboss.logging.Logger; import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message;
import org.jboss.logging.*; import org.jboss.logging.annotations.*;
[ "org.jboss.logging" ]
org.jboss.logging;
336,499
public List<JobExecutionContext> getRunningJobs();
List<JobExecutionContext> function();
/** * Returns the list of job currently running within the scheduler. * * @return */
Returns the list of job currently running within the scheduler
getRunningJobs
{ "repo_name": "ua-eas/kfs-devops-automation-fork", "path": "kfs-core/src/main/java/org/kuali/kfs/sys/batch/service/SchedulerService.java", "license": "agpl-3.0", "size": 6074 }
[ "java.util.List", "org.quartz.JobExecutionContext" ]
import java.util.List; import org.quartz.JobExecutionContext;
import java.util.*; import org.quartz.*;
[ "java.util", "org.quartz" ]
java.util; org.quartz;
937,211
@Nonnull Context detach(@Nonnull Route.Handler next) throws Exception;
@Nonnull Context detach(@Nonnull Route.Handler next) throws Exception;
/** * Tells context that response will be generated form a different thread. This operation is * similar to {@link #dispatch(Runnable)} except there is no thread dispatching here. * * This operation integrates easily with third-party libraries like rxJava or others. * * @param next Application code. * @return This context. * @throws Exception When detach operation fails. */
Tells context that response will be generated form a different thread. This operation is similar to <code>#dispatch(Runnable)</code> except there is no thread dispatching here. This operation integrates easily with third-party libraries like rxJava or others
detach
{ "repo_name": "jooby-project/jooby", "path": "jooby/src/main/java/io/jooby/Context.java", "license": "apache-2.0", "size": 41138 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,850,269
public static List<Fragment> fragmentize(List<MultipartSequence> sequences, Options o) { List<Fragment> list = new ArrayList<Fragment>(o.fragmentCount); for (MultipartSequence ms : sequences) { list.addAll(fragmentize(ms.sequence, o, ms.offset)); } return list; }
static List<Fragment> function(List<MultipartSequence> sequences, Options o) { List<Fragment> list = new ArrayList<Fragment>(o.fragmentCount); for (MultipartSequence ms : sequences) { list.addAll(fragmentize(ms.sequence, o, ms.offset)); } return list; }
/** * XXX: o.fragmentCount is interpreted *per sequence*, so read coverage * is a function of the sequence length (human genome case: 2GB + 1GB with * same number of reads from each = 1GB part gets denser coverage for same * number of reads) * * @param sequences * @param o * @return */
is a function of the sequence length (human genome case: 2GB + 1GB with same number of reads from each = 1GB part gets denser coverage for same number of reads)
fragmentize
{ "repo_name": "mruffalo/seal", "path": "src/generator/Fragmentizer.java", "license": "gpl-3.0", "size": 11220 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,084,516
public void onDisconnectConferenceParticipant(Uri endpoint) {}
void functionConferenceParticipant(Uri endpoint) {}
/** * Notifies this Connection of a request to disconnect. */
Notifies this Connection of a request to disconnect
onDisconnect
{ "repo_name": "Ant-Droid/android_frameworks_base_OLD", "path": "telecomm/java/android/telecom/Connection.java", "license": "apache-2.0", "size": 73185 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
2,832,792
public synchronized void deleteObserver(Observer observer) { observers.remove(observer); }
synchronized void function(Observer observer) { observers.remove(observer); }
/** * Removes the specified observer from the list of observers. Passing null * won't do anything. * * @param observer the observer to remove. */
Removes the specified observer from the list of observers. Passing null won't do anything
deleteObserver
{ "repo_name": "bhm/Cthulhator", "path": "cthulhator/src/main/java/com/bustiblelemons/cthulhator/system/properties/ObservableCharacterProperty.java", "license": "mit", "size": 3264 }
[ "java.util.Observer" ]
import java.util.Observer;
import java.util.*;
[ "java.util" ]
java.util;
1,677,001
protected boolean shouldCreateWorkUnit(Path dataLocation) { if (null == this.ignoreDataPathIdentifierList || this.ignoreDataPathIdentifierList.size() == 0) { return true; } for (String pathToken : this.ignoreDataPathIdentifierList) { if (dataLocation.toString().toLowerCase().contains(pathToken.toLowerCase())) { return false; } } return true; }
boolean function(Path dataLocation) { if (null == this.ignoreDataPathIdentifierList this.ignoreDataPathIdentifierList.size() == 0) { return true; } for (String pathToken : this.ignoreDataPathIdentifierList) { if (dataLocation.toString().toLowerCase().contains(pathToken.toLowerCase())) { return false; } } return true; }
/*** * Check if path of Hive entity (table / partition) contains location token that should be ignored. If so, ignore * the partition. */
Check if path of Hive entity (table / partition) contains location token that should be ignored. If so, ignore the partition
shouldCreateWorkUnit
{ "repo_name": "jinhyukchang/gobblin", "path": "gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/source/HiveSource.java", "license": "apache-2.0", "size": 22695 }
[ "org.apache.hadoop.fs.Path" ]
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,790,985
public void setPropertyFile(String value) { File f = (new File(value)).getAbsoluteFile(); if (f.isDirectory()) { throw new IllegalArgumentException(LocalizedStrings.AgentImpl_THE_FILE_0_IS_A_DIRECTORY.toLocalizedString(f)); } File parent = f.getParentFile(); if (parent != null) { if (!parent.isDirectory()) { throw new IllegalArgumentException(LocalizedStrings.AgentImpl_THE_DIRECTORY_0_DOES_NOT_EXIST.toLocalizedString(parent)); } } this.propertyFile = f.getPath(); }
void function(String value) { File f = (new File(value)).getAbsoluteFile(); if (f.isDirectory()) { throw new IllegalArgumentException(LocalizedStrings.AgentImpl_THE_FILE_0_IS_A_DIRECTORY.toLocalizedString(f)); } File parent = f.getParentFile(); if (parent != null) { if (!parent.isDirectory()) { throw new IllegalArgumentException(LocalizedStrings.AgentImpl_THE_DIRECTORY_0_DOES_NOT_EXIST.toLocalizedString(parent)); } } this.propertyFile = f.getPath(); }
/** * Sets the agent's property file. * * @param value the name of the file to save the agent properties in. * @throws IllegalArgumentException if the specified file is a directory. * @throws IllegalArgumentException if the specified file's parent is not an existing directory. */
Sets the agent's property file
setPropertyFile
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java", "license": "apache-2.0", "size": 59041 }
[ "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "java.io.File" ]
import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import java.io.File;
import com.gemstone.gemfire.internal.i18n.*; import java.io.*;
[ "com.gemstone.gemfire", "java.io" ]
com.gemstone.gemfire; java.io;
2,877,853
public void setArtifactPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.artifactPaint = paint; notifyListeners(new RendererChangeEvent(this)); }
void function(Paint paint) { if (paint == null) { throw new IllegalArgumentException(STR); } this.artifactPaint = paint; notifyListeners(new RendererChangeEvent(this)); }
/** * Sets the paint used to color the median and average markers and sends * a {@link RendererChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). * * @see #getArtifactPaint() */
Sets the paint used to color the median and average markers and sends a <code>RendererChangeEvent</code> to all registered listeners
setArtifactPaint
{ "repo_name": "opensim-org/opensim-gui", "path": "Gui/opensim/jfreechart/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java", "license": "apache-2.0", "size": 33287 }
[ "java.awt.Paint", "org.jfree.chart.event.RendererChangeEvent" ]
import java.awt.Paint; import org.jfree.chart.event.RendererChangeEvent;
import java.awt.*; import org.jfree.chart.event.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
2,802,514
public OnExceptionDefinition handled(@AsPredicate Expression handled) { setHandledPolicy(ExpressionToPredicateAdapter.toPredicate(handled)); return this; }
OnExceptionDefinition function(@AsPredicate Expression handled) { setHandledPolicy(ExpressionToPredicateAdapter.toPredicate(handled)); return this; }
/** * Sets whether the exchange should be marked as handled or not. * * @param handled expression that determines true or false * @return the builder */
Sets whether the exchange should be marked as handled or not
handled
{ "repo_name": "dmvolod/camel", "path": "camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java", "license": "apache-2.0", "size": 37919 }
[ "org.apache.camel.Expression", "org.apache.camel.spi.AsPredicate", "org.apache.camel.util.ExpressionToPredicateAdapter" ]
import org.apache.camel.Expression; import org.apache.camel.spi.AsPredicate; import org.apache.camel.util.ExpressionToPredicateAdapter;
import org.apache.camel.*; import org.apache.camel.spi.*; import org.apache.camel.util.*;
[ "org.apache.camel" ]
org.apache.camel;
2,081,706