method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
private String getToday() {
return dateFormat.format(Calendar.getInstance().getTime());
} | String function() { return dateFormat.format(Calendar.getInstance().getTime()); } | /**
* Get today's date
* @return formated as yyyy-mm-dd
*/ | Get today's date | getToday | {
"repo_name": "AGES-Initiatives/common-utilities",
"path": "common-utilities/src/main/java/net/ages/alwb/utils/transformer/epub/EpubBuilder.java",
"license": "epl-1.0",
"size": 12745
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 846,234 |
protected void closeLog ()
{
try
{
rdr.close();
}
catch (IOException e)
{
ApplicationLogger.getInstance().logException(e);
}
} | void function () { try { rdr.close(); } catch (IOException e) { ApplicationLogger.getInstance().logException(e); } } | /**
* Closes the log file
*/ | Closes the log file | closeLog | {
"repo_name": "mj21181/ursus-swarm",
"path": "src/main/java/pso/PsoLogParser.java",
"license": "gpl-3.0",
"size": 11370
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,147,634 |
public Color getHighlightInnerColor()
{
return highlightInner;
} | Color function() { return highlightInner; } | /**
* Returns the inner highlight color of the bevel border.
* Will return null if no highlight color was specified
* at instantiation.
*/ | Returns the inner highlight color of the bevel border. Will return null if no highlight color was specified at instantiation | getHighlightInnerColor | {
"repo_name": "vrjuggler/vrjuggler",
"path": "modules/vrjuggler/vrjconfig/customeditors/cave/org/vrjuggler/vrjconfig/customeditors/cave/ComputerScreenBorder.java",
"license": "lgpl-2.1",
"size": 10238
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 653,426 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add(createChildParameter(SetupP2Package.Literals.P2_TASK__REQUIREMENTS, P2Factory.eINSTANCE.createRequirement()));
newChildDescriptors.add(createChildParameter(SetupP2Package.Literals.P2_TASK__REPOSITORIES, P2Factory.eINSTANCE.createRepository()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(SetupP2Package.Literals.P2_TASK__REQUIREMENTS, P2Factory.eINSTANCE.createRequirement())); newChildDescriptors.add(createChildParameter(SetupP2Package.Literals.P2_TASK__REPOSITORIES, P2Factory.eINSTANCE.createRepository())); } | /**
* 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": "peterkir/org.eclipse.oomph",
"path": "plugins/org.eclipse.oomph.setup.p2.edit/src/org/eclipse/oomph/setup/p2/provider/P2TaskItemProvider.java",
"license": "epl-1.0",
"size": 8532
} | [
"java.util.Collection",
"org.eclipse.oomph.p2.P2Factory",
"org.eclipse.oomph.setup.p2.SetupP2Package"
] | import java.util.Collection; import org.eclipse.oomph.p2.P2Factory; import org.eclipse.oomph.setup.p2.SetupP2Package; | import java.util.*; import org.eclipse.oomph.p2.*; import org.eclipse.oomph.setup.p2.*; | [
"java.util",
"org.eclipse.oomph"
] | java.util; org.eclipse.oomph; | 955,557 |
public Iterator<Entry<K, V>> iterator() {
return size == 0 ? new LHMIterator<K, V>(null, null) : new LHMIterator<K, V>(this, buckets);
}
/**
* Get an Iterable containing the same iterator, as is returned by
* iterator(). See: {@link #iterator()} | Iterator<Entry<K, V>> function() { return size == 0 ? new LHMIterator<K, V>(null, null) : new LHMIterator<K, V>(this, buckets); } /** * Get an Iterable containing the same iterator, as is returned by * iterator(). See: {@link #iterator()} | /**
* Get an iterator reflecting this 'stage of resetting'. During iteration,
* entries may get removed or added, values changed. Concurrent modification
* will not let the iteration fail.
* <hr>
* This operation does not use locking.
*
* @return
*/ | Get an iterator reflecting this 'stage of resetting'. During iteration, entries may get removed or added, values changed. Concurrent modification will not let the iteration fail. This operation does not use locking | iterator | {
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/ds/map/HashMapLOW.java",
"license": "gpl-3.0",
"size": 22292
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 615,363 |
private Key getKey(int type,long id){
Key key=new Key();
key.type=type;
key.id=id;
key.checksum=checkKey(key);
return key;
} | Key function(int type,long id){ Key key=new Key(); key.type=type; key.id=id; key.checksum=checkKey(key); return key; } | /** create a new key, with an integer ID.
*
* <P> Keys contain their own checksum instead of using
* the heavy-weight CheckedMessage wrapper.
*/ | create a new key, with an integer ID. Keys contain their own checksum instead of using the heavy-weight CheckedMessage wrapper | getKey | {
"repo_name": "hikelee/projector",
"path": "android/master/src/com/android/launcher3/LauncherBackupHelper.java",
"license": "mit",
"size": 39905
} | [
"com.android.launcher3.backup.BackupProtos"
] | import com.android.launcher3.backup.BackupProtos; | import com.android.launcher3.backup.*; | [
"com.android.launcher3"
] | com.android.launcher3; | 2,313,153 |
public TaskReport[] getReduceTaskReports(JobID jobId) throws IOException {
return jobSubmitClient.getReduceTaskReports(jobId);
} | TaskReport[] function(JobID jobId) throws IOException { return jobSubmitClient.getReduceTaskReports(jobId); } | /**
* Get the information of the current state of the reduce tasks of a job.
*
* @param jobId the job to query.
* @return the list of all of the reduce tips.
* @throws IOException
*/ | Get the information of the current state of the reduce tasks of a job | getReduceTaskReports | {
"repo_name": "yuanke/hadoop-hbase",
"path": "src/mapred/org/apache/hadoop/mapred/JobClient.java",
"license": "apache-2.0",
"size": 61037
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 629,565 |
public List<DimensionalItemObject> getDimensionOrFilterItems( String key )
{
List<DimensionalItemObject> dimensionOptions = getDimensionOptions( key );
return !dimensionOptions.isEmpty() ? dimensionOptions : getFilterOptions( key );
} | List<DimensionalItemObject> function( String key ) { List<DimensionalItemObject> dimensionOptions = getDimensionOptions( key ); return !dimensionOptions.isEmpty() ? dimensionOptions : getFilterOptions( key ); } | /**
* Retrieves the options for the the dimension or filter with the given
* identifier. Returns an empty list if the dimension or filter is not
* present.
*/ | Retrieves the options for the the dimension or filter with the given identifier. Returns an empty list if the dimension or filter is not present | getDimensionOrFilterItems | {
"repo_name": "hispindia/dhis2-Core",
"path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java",
"license": "bsd-3-clause",
"size": 105104
} | [
"java.util.List",
"org.hisp.dhis.common.DimensionalItemObject"
] | import java.util.List; import org.hisp.dhis.common.DimensionalItemObject; | import java.util.*; import org.hisp.dhis.common.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 775,138 |
private static ImageWriter getWriter() throws IIOException {
Iterator<ImageWriter> iter = ImageIO.getImageWritersBySuffix("gif");
if(!iter.hasNext()) {
throw new IIOException("No GIF Image Writers Exist");
} else {
return iter.next();
}
}
| static ImageWriter function() throws IIOException { Iterator<ImageWriter> iter = ImageIO.getImageWritersBySuffix("gif"); if(!iter.hasNext()) { throw new IIOException(STR); } else { return iter.next(); } } | /**
* Returns the first available GIF ImageWriter using
* ImageIO.getImageWritersBySuffix("gif").
*
* @return a GIF ImageWriter object
* @throws IIOException if no GIF image writers are returned
*/ | Returns the first available GIF ImageWriter using ImageIO.getImageWritersBySuffix("gif") | getWriter | {
"repo_name": "WenzheLiu/WorkRecorder",
"path": "src/main/java/org/wenzhe/scrcap/gif/GifSequenceWriter.java",
"license": "apache-2.0",
"size": 6735
} | [
"java.util.Iterator",
"javax.imageio.IIOException",
"javax.imageio.ImageIO",
"javax.imageio.ImageWriter"
] | import java.util.Iterator; import javax.imageio.IIOException; import javax.imageio.ImageIO; import javax.imageio.ImageWriter; | import java.util.*; import javax.imageio.*; | [
"java.util",
"javax.imageio"
] | java.util; javax.imageio; | 2,490,247 |
@Override
public boolean equals(final Object object) {
if(object == this) {
return true;
} else if(!(object instanceof FieldInfo)) {
return false;
} else if(getAccessFlags() != FieldInfo.class.cast(object).getAccessFlags()) {
return false;
} else if(getNameIndex() != FieldInfo.class.cast(object).getNameIndex()) {
return false;
} else if(getDescriptorIndex() != FieldInfo.class.cast(object).getDescriptorIndex()) {
return false;
} else if(!Objects.equals(this.attributeInfos, FieldInfo.class.cast(object).attributeInfos)) {
return false;
} else {
return true;
}
}
| boolean function(final Object object) { if(object == this) { return true; } else if(!(object instanceof FieldInfo)) { return false; } else if(getAccessFlags() != FieldInfo.class.cast(object).getAccessFlags()) { return false; } else if(getNameIndex() != FieldInfo.class.cast(object).getNameIndex()) { return false; } else if(getDescriptorIndex() != FieldInfo.class.cast(object).getDescriptorIndex()) { return false; } else if(!Objects.equals(this.attributeInfos, FieldInfo.class.cast(object).attributeInfos)) { return false; } else { return true; } } | /**
* Compares {@code object} to this {@code FieldInfo} instance for equality.
* <p>
* Returns {@code true} if, and only if, {@code object} is an instance of {@code FieldInfo}, and their respective values are equal, {@code false} otherwise.
*
* @param object the {@code Object} to compare to this {@code FieldInfo} instance for equality
* @return {@code true} if, and only if, {@code object} is an instance of {@code FieldInfo}, and their respective values are equal, {@code false} otherwise
*/ | Compares object to this FieldInfo instance for equality. Returns true if, and only if, object is an instance of FieldInfo, and their respective values are equal, false otherwise | equals | {
"repo_name": "macroing/CEL4J",
"path": "src/main/java/org/macroing/cel4j/java/binary/classfile/FieldInfo.java",
"license": "gpl-3.0",
"size": 38299
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 2,351,548 |
public static synchronized CompareMode getInstance(String name,
int strength, boolean binaryUnsigned) {
if (lastUsed != null) {
if (StringUtils.equals(lastUsed.name, name) &&
lastUsed.strength == strength &&
lastUsed.binaryUnsigned == binaryUnsigned) {
return lastUsed;
}
}
if (name == null || name.equals(OFF)) {
lastUsed = new CompareMode(name, strength, binaryUnsigned);
} else {
boolean useICU4J;
if (name.startsWith(ICU4J)) {
useICU4J = true;
name = name.substring(ICU4J.length());
} else if (name.startsWith(DEFAULT)) {
useICU4J = false;
name = name.substring(DEFAULT.length());
} else {
useICU4J = CAN_USE_ICU4J;
}
if (useICU4J) {
lastUsed = new CompareModeIcu4J(name, strength, binaryUnsigned);
} else {
lastUsed = new CompareModeDefault(name, strength, binaryUnsigned);
}
}
return lastUsed;
} | static synchronized CompareMode function(String name, int strength, boolean binaryUnsigned) { if (lastUsed != null) { if (StringUtils.equals(lastUsed.name, name) && lastUsed.strength == strength && lastUsed.binaryUnsigned == binaryUnsigned) { return lastUsed; } } if (name == null name.equals(OFF)) { lastUsed = new CompareMode(name, strength, binaryUnsigned); } else { boolean useICU4J; if (name.startsWith(ICU4J)) { useICU4J = true; name = name.substring(ICU4J.length()); } else if (name.startsWith(DEFAULT)) { useICU4J = false; name = name.substring(DEFAULT.length()); } else { useICU4J = CAN_USE_ICU4J; } if (useICU4J) { lastUsed = new CompareModeIcu4J(name, strength, binaryUnsigned); } else { lastUsed = new CompareModeDefault(name, strength, binaryUnsigned); } } return lastUsed; } | /**
* Create a new compare mode with the given collator and strength. If
* required, a new CompareMode is created, or if possible the last one is
* returned. A cache is used to speed up comparison when using a collator;
* CollationKey objects are cached.
*
* @param name the collation name or null
* @param strength the collation strength
* @param binaryUnsigned whether to compare binaries as unsigned
* @return the compare mode
*/ | Create a new compare mode with the given collator and strength. If required, a new CompareMode is created, or if possible the last one is returned. A cache is used to speed up comparison when using a collator; CollationKey objects are cached | getInstance | {
"repo_name": "vdr007/ThriftyPaxos",
"path": "src/applications/h2/src/main/org/h2/value/CompareMode.java",
"license": "apache-2.0",
"size": 8753
} | [
"org.h2.util.StringUtils"
] | import org.h2.util.StringUtils; | import org.h2.util.*; | [
"org.h2.util"
] | org.h2.util; | 902,069 |
public static Map<String, Boolean> getAccountControlSettings(int accountControlFlag) {
Map<String, Boolean> settings = new HashMap<String, Boolean>();
for (Map.Entry<String, Integer> element : CONTROL_FLAGS.entrySet()) {
String key = element.getKey();
int flagValue = element.getValue();
settings.put(key, isValueSet(accountControlFlag, flagValue));
}
return settings;
}
| static Map<String, Boolean> function(int accountControlFlag) { Map<String, Boolean> settings = new HashMap<String, Boolean>(); for (Map.Entry<String, Integer> element : CONTROL_FLAGS.entrySet()) { String key = element.getKey(); int flagValue = element.getValue(); settings.put(key, isValueSet(accountControlFlag, flagValue)); } return settings; } | /**
* Finds if each of the control flags have been enabled for a user.
*
* @param accountControlFlag the users account control setting
* @return a <code>java.util.Map</code> with the flag name ->
* <code>java.lang.Boolean</code>
*/ | Finds if each of the control flags have been enabled for a user | getAccountControlSettings | {
"repo_name": "nervepoint/identity4j",
"path": "identity4j-active-directory-jndi/src/main/java/com/identity4j/connector/jndi/activedirectory/UserAccountControl.java",
"license": "lgpl-3.0",
"size": 11786
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,429,878 |
void checkSecurityTeamNotAssigned(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws InternalErrorException, SecurityTeamAlreadyAssignedException; | void checkSecurityTeamNotAssigned(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws InternalErrorException, SecurityTeamAlreadyAssignedException; | /**
* Check if security team is <b>not</b> assigned to facility.
* Throw exception info is.
*
* @param sess
* @param facility
* @param securityTeam
* @throws InternalErrorException
* @throws SecurityTeamAlreadyAssignedException
*/ | Check if security team is not assigned to facility. Throw exception info is | checkSecurityTeamNotAssigned | {
"repo_name": "licehammer/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/FacilitiesManagerImplApi.java",
"license": "bsd-2-clause",
"size": 24484
} | [
"cz.metacentrum.perun.core.api.Facility",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.SecurityTeam",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"cz.metacentrum.perun.core.api.exceptions.SecurityTeamAlreadyAssignedException"
] | import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.SecurityTeam; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.SecurityTeamAlreadyAssignedException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,270,043 |
private HueBindingConfig getConfigForItemName(String itemName) {
for (HueBindingProvider provider : this.providers) {
if (provider.getItemConfig(itemName) != null) {
return provider.getItemConfig(itemName);
}
}
return null;
} | HueBindingConfig function(String itemName) { for (HueBindingProvider provider : this.providers) { if (provider.getItemConfig(itemName) != null) { return provider.getItemConfig(itemName); } } return null; } | /**
* Lookup of the configuration of the named item.
*
* @param itemName
* The name of the item.
* @return The configuration, null otherwise.
*/ | Lookup of the configuration of the named item | getConfigForItemName | {
"repo_name": "xmor/openhab",
"path": "bundles/binding/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/HueBinding.java",
"license": "epl-1.0",
"size": 6573
} | [
"org.openhab.binding.hue.HueBindingProvider"
] | import org.openhab.binding.hue.HueBindingProvider; | import org.openhab.binding.hue.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,732,827 |
public static void saveBitmap(final Bitmap bitmap, final String filename) {
final String root =
Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "tensorflow";
LOGGER.i("Saving %dx%d bitmap to %s.", bitmap.getWidth(), bitmap.getHeight(), root);
final File myDir = new File(root);
if (!myDir.mkdirs()) {
LOGGER.i("Make dir failed");
}
final String fname = filename;
final File file = new File(myDir, fname);
if (file.exists()) {
file.delete();
}
try {
final FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 99, out);
out.flush();
out.close();
} catch (final Exception e) {
LOGGER.e(e, "Exception!");
}
} | static void function(final Bitmap bitmap, final String filename) { final String root = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + STR; LOGGER.i(STR, bitmap.getWidth(), bitmap.getHeight(), root); final File myDir = new File(root); if (!myDir.mkdirs()) { LOGGER.i(STR); } final String fname = filename; final File file = new File(myDir, fname); if (file.exists()) { file.delete(); } try { final FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 99, out); out.flush(); out.close(); } catch (final Exception e) { LOGGER.e(e, STR); } } | /**
* Saves a Bitmap object to disk for analysis.
*
* @param bitmap The bitmap to save.
* @param filename The location to save the bitmap to.
*/ | Saves a Bitmap object to disk for analysis | saveBitmap | {
"repo_name": "Konstie/SightsGuru",
"path": "app/src/main/java/org/tensorflow/demo/env/ImageUtils.java",
"license": "apache-2.0",
"size": 7616
} | [
"android.graphics.Bitmap",
"android.os.Environment",
"java.io.File",
"java.io.FileOutputStream"
] | import android.graphics.Bitmap; import android.os.Environment; import java.io.File; import java.io.FileOutputStream; | import android.graphics.*; import android.os.*; import java.io.*; | [
"android.graphics",
"android.os",
"java.io"
] | android.graphics; android.os; java.io; | 1,150,908 |
public InvocationRouter<InvocationBaratine> buildRouter(WebApp webApp)
{
// find views
InjectorAmp inject = webApp.inject();
buildViews(inject);
ArrayList<RouteMap> mapList = new ArrayList<>();
ServicesAmp manager = webApp.services();
ServiceRefAmp serviceRef = manager.newService(new RouteService()).ref();
while (_routes.size() > 0) {
ArrayList<RouteWebApp> routes = new ArrayList<>(_routes);
_routes.clear();
for (RouteWebApp route : routes) {
mapList.addAll(route.toMap(inject, serviceRef));
}
}
RouteMap []routeArray = new RouteMap[mapList.size()];
mapList.toArray(routeArray);
return new InvocationRouterWebApp(webApp, routeArray);
} | InvocationRouter<InvocationBaratine> function(WebApp webApp) { InjectorAmp inject = webApp.inject(); buildViews(inject); ArrayList<RouteMap> mapList = new ArrayList<>(); ServicesAmp manager = webApp.services(); ServiceRefAmp serviceRef = manager.newService(new RouteService()).ref(); while (_routes.size() > 0) { ArrayList<RouteWebApp> routes = new ArrayList<>(_routes); _routes.clear(); for (RouteWebApp route : routes) { mapList.addAll(route.toMap(inject, serviceRef)); } } RouteMap []routeArray = new RouteMap[mapList.size()]; mapList.toArray(routeArray); return new InvocationRouterWebApp(webApp, routeArray); } | /**
* Builds the web-app's router
*/ | Builds the web-app's router | buildRouter | {
"repo_name": "baratine/baratine",
"path": "web/src/main/java/com/caucho/v5/web/webapp/WebAppBuilder.java",
"license": "gpl-2.0",
"size": 27845
} | [
"com.caucho.v5.amp.ServiceRefAmp",
"com.caucho.v5.amp.ServicesAmp",
"com.caucho.v5.http.dispatch.InvocationRouter",
"com.caucho.v5.inject.InjectorAmp",
"java.util.ArrayList"
] | import com.caucho.v5.amp.ServiceRefAmp; import com.caucho.v5.amp.ServicesAmp; import com.caucho.v5.http.dispatch.InvocationRouter; import com.caucho.v5.inject.InjectorAmp; import java.util.ArrayList; | import com.caucho.v5.amp.*; import com.caucho.v5.http.dispatch.*; import com.caucho.v5.inject.*; import java.util.*; | [
"com.caucho.v5",
"java.util"
] | com.caucho.v5; java.util; | 1,540,338 |
@Override
protected Dialog onCreateDialog(int id) {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getResources().getString(R.string.dialog_building_msg));
mProgressDialog.setIndeterminate(false);
mProgressDialog.setCancelable(false);
return mProgressDialog;
} | Dialog function(int id) { mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage(getResources().getString(R.string.dialog_building_msg)); mProgressDialog.setIndeterminate(false); mProgressDialog.setCancelable(false); return mProgressDialog; } | /***************************
* Functions to create various alert dialogs
***************************/ | Functions to create various alert dialogs | onCreateDialog | {
"repo_name": "tortuca/holoken-dev",
"path": "src/com/tortuca/holoken/MainActivity.java",
"license": "gpl-3.0",
"size": 36629
} | [
"android.app.Dialog",
"android.app.ProgressDialog"
] | import android.app.Dialog; import android.app.ProgressDialog; | import android.app.*; | [
"android.app"
] | android.app; | 631,018 |
List<Worker> getBound(); | List<Worker> getBound(); | /**
* Return the list of {@link Worker Workers} bound to any {@link User}.
*/ | Return the list of <code>Worker Workers</code> bound to any <code>User</code> | getBound | {
"repo_name": "bolobr/IEBT-Libreplan",
"path": "libreplan-business/src/main/java/org/libreplan/business/resources/daos/IWorkerDAO.java",
"license": "agpl-3.0",
"size": 4403
} | [
"java.util.List",
"org.libreplan.business.resources.entities.Worker"
] | import java.util.List; import org.libreplan.business.resources.entities.Worker; | import java.util.*; import org.libreplan.business.resources.entities.*; | [
"java.util",
"org.libreplan.business"
] | java.util; org.libreplan.business; | 2,463,175 |
@Test
public void testGetConnectionType() throws Exception {
createPowerSpy();
ConversionTable conversionTable = PowerMockito
.spy(new ConversionTable());
conversionTable.addEntryConnectionType("LowerNetworkId", "lower");
conversionTable.addEntryConnectionType("UpperNetworkId", "upper");
conversionTable.addEntryConnectionType("LayerizedNetworkId",
"layerized");
PowerMockito.doReturn(conversionTable).when(target, "conversionTable");
String resultLower = Whitebox.invokeMethod(target,
"getConnectionType", "LowerNetworkId");
String resultUpper = Whitebox.invokeMethod(target,
"getConnectionType", "UpperNetworkId");
String resultLayerized = Whitebox.invokeMethod(target,
"getConnectionType", "LayerizedNetworkId");
assertThat(resultLower, is("lower"));
assertThat(resultUpper, is("upper"));
assertThat(resultLayerized, is("layerized"));
} | void function() throws Exception { createPowerSpy(); ConversionTable conversionTable = PowerMockito .spy(new ConversionTable()); conversionTable.addEntryConnectionType(STR, "lower"); conversionTable.addEntryConnectionType(STR, "upper"); conversionTable.addEntryConnectionType(STR, STR); PowerMockito.doReturn(conversionTable).when(target, STR); String resultLower = Whitebox.invokeMethod(target, STR, STR); String resultUpper = Whitebox.invokeMethod(target, STR, STR); String resultLayerized = Whitebox.invokeMethod(target, STR, STR); assertThat(resultLower, is("lower")); assertThat(resultUpper, is("upper")); assertThat(resultLayerized, is(STR)); } | /**
* Test method for {@link org.o3project.odenos.component.linklayerizer.LinkLayerizer#getConnectionType(java.lang.String)}.
* @throws Exception
*/ | Test method for <code>org.o3project.odenos.component.linklayerizer.LinkLayerizer#getConnectionType(java.lang.String)</code> | testGetConnectionType | {
"repo_name": "narry/odenos",
"path": "src/test/java/org/o3project/odenos/component/linklayerizer/LinkLayerizerTest.java",
"license": "apache-2.0",
"size": 127722
} | [
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.mockito.Mockito",
"org.o3project.odenos.core.component.ConversionTable",
"org.powermock.api.mockito.PowerMockito",
"org.powermock.reflect.Whitebox"
] | import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.mockito.Mockito; import org.o3project.odenos.core.component.ConversionTable; import org.powermock.api.mockito.PowerMockito; import org.powermock.reflect.Whitebox; | import org.hamcrest.*; import org.junit.*; import org.mockito.*; import org.o3project.odenos.core.component.*; import org.powermock.api.mockito.*; import org.powermock.reflect.*; | [
"org.hamcrest",
"org.junit",
"org.mockito",
"org.o3project.odenos",
"org.powermock.api",
"org.powermock.reflect"
] | org.hamcrest; org.junit; org.mockito; org.o3project.odenos; org.powermock.api; org.powermock.reflect; | 1,904,177 |
public static long getSmsThreadId(Context context, Uri uri) {
Cursor cursor = SqliteWrapper.query(
context,
context.getContentResolver(),
uri,
SMS_THREAD_ID_PROJECTION,
null,
null,
null);
if (cursor == null) {
return THREAD_NONE;
}
try {
if (cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndex(Sms.THREAD_ID));
} else {
return THREAD_NONE;
}
} finally {
cursor.close();
}
} | static long function(Context context, Uri uri) { Cursor cursor = SqliteWrapper.query( context, context.getContentResolver(), uri, SMS_THREAD_ID_PROJECTION, null, null, null); if (cursor == null) { return THREAD_NONE; } try { if (cursor.moveToFirst()) { return cursor.getLong(cursor.getColumnIndex(Sms.THREAD_ID)); } else { return THREAD_NONE; } } finally { cursor.close(); } } | /**
* Get the thread ID of the SMS message with the given URI
* @param context The context
* @param uri The URI of the SMS message
* @return The thread ID, or THREAD_NONE if the URI contains no entries
*/ | Get the thread ID of the SMS message with the given URI | getSmsThreadId | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java",
"license": "gpl-2.0",
"size": 82502
} | [
"android.content.Context",
"android.database.Cursor",
"android.database.sqlite.SqliteWrapper",
"android.net.Uri",
"android.provider.Telephony"
] | import android.content.Context; import android.database.Cursor; import android.database.sqlite.SqliteWrapper; import android.net.Uri; import android.provider.Telephony; | import android.content.*; import android.database.*; import android.database.sqlite.*; import android.net.*; import android.provider.*; | [
"android.content",
"android.database",
"android.net",
"android.provider"
] | android.content; android.database; android.net; android.provider; | 2,824,403 |
@Nonnull
public WorkbookFunctionsTextRequest expand(@Nonnull final String value) {
addExpandOption(value);
return this;
} | WorkbookFunctionsTextRequest function(@Nonnull final String value) { addExpandOption(value); return this; } | /**
* Sets the expand clause for the request
*
* @param value the expand clause
* @return the updated request
*/ | Sets the expand clause for the request | expand | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/WorkbookFunctionsTextRequest.java",
"license": "mit",
"size": 2956
} | [
"com.microsoft.graph.requests.WorkbookFunctionsTextRequest",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.requests.WorkbookFunctionsTextRequest; import javax.annotation.Nonnull; | import com.microsoft.graph.requests.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 2,418,849 |
public void fillMenu(IMenuManager menuManager) {
update();
menuManager.add(expandAction);
menuManager.add(collapseAction);
menuManager.add(expandAllAction);
menuManager.add(collapseAllAction);
} | void function(IMenuManager menuManager) { update(); menuManager.add(expandAction); menuManager.add(collapseAction); menuManager.add(expandAllAction); menuManager.add(collapseAllAction); } | /**
* Fill a menu with a actions.
*
* @param menuManager
* The menu manager to add to
*/ | Fill a menu with a actions | fillMenu | {
"repo_name": "ben8p/smallEditor",
"path": "src/smalleditor/editors/common/actions/FoldingActionsGroup.java",
"license": "gpl-2.0",
"size": 3193
} | [
"org.eclipse.jface.action.IMenuManager"
] | import org.eclipse.jface.action.IMenuManager; | import org.eclipse.jface.action.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 504,737 |
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((EnumFacing.Axis)state.getValue(AXIS))
{
case X:
return state.withProperty(AXIS, EnumFacing.Axis.Z);
case Z:
return state.withProperty(AXIS, EnumFacing.Axis.X);
default:
return state;
}
default:
return state;
}
} | IBlockState function(IBlockState state, Rotation rot) { switch (rot) { case COUNTERCLOCKWISE_90: case CLOCKWISE_90: switch ((EnumFacing.Axis)state.getValue(AXIS)) { case X: return state.withProperty(AXIS, EnumFacing.Axis.Z); case Z: return state.withProperty(AXIS, EnumFacing.Axis.X); default: return state; } default: return state; } } | /**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/ | Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate | withRotation | {
"repo_name": "MartyParty21/AwakenDreamsClient",
"path": "mcp/src/minecraft/net/minecraft/block/BlockRotatedPillar.java",
"license": "gpl-3.0",
"size": 3438
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.util.EnumFacing",
"net.minecraft.util.Rotation"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.Rotation; | import net.minecraft.block.state.*; import net.minecraft.util.*; | [
"net.minecraft.block",
"net.minecraft.util"
] | net.minecraft.block; net.minecraft.util; | 1,617,219 |
public void setStation(String station) {
//Store entered text in variable
mStation = station.trim();
//Saves variable as SharedPreference
SharedPreferences.Editor editor = mSharedPrefs.edit();
//Set the String value in the preferences editor
editor.putString(STATION, mStation);
//Commit the changes
editor.apply();
} | void function(String station) { mStation = station.trim(); SharedPreferences.Editor editor = mSharedPrefs.edit(); editor.putString(STATION, mStation); editor.apply(); } | /**
* The setStation method saves the station id entered by the user.
* @param station Station ID Number.
*/ | The setStation method saves the station id entered by the user | setStation | {
"repo_name": "lilyheart/HomeMirror",
"path": "app/src/main/java/com/morristaedt/mirror/configuration/ConfigurationSettings.java",
"license": "apache-2.0",
"size": 7296
} | [
"android.content.SharedPreferences"
] | import android.content.SharedPreferences; | import android.content.*; | [
"android.content"
] | android.content; | 678,632 |
public Object getValueInVMOrDiskWithoutFaultIn(Object key) throws EntryNotFoundException {
RegionEntry re = this.entries.getEntry(key);
if (re == null) {
throw new EntryNotFoundException(key.toString());
}
return re.getValueInVMOrDiskWithoutFaultIn(this);
} | Object function(Object key) throws EntryNotFoundException { RegionEntry re = this.entries.getEntry(key); if (re == null) { throw new EntryNotFoundException(key.toString()); } return re.getValueInVMOrDiskWithoutFaultIn(this); } | /**
* Gets the value from VM, if present, otherwise from disk without fault in.
*/ | Gets the value from VM, if present, otherwise from disk without fault in | getValueInVMOrDiskWithoutFaultIn | {
"repo_name": "charliemblack/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java",
"license": "apache-2.0",
"size": 428144
} | [
"org.apache.geode.cache.EntryNotFoundException"
] | import org.apache.geode.cache.EntryNotFoundException; | import org.apache.geode.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,883,680 |
private void delayedSetup() {
final boolean fallbackEnabled = context.getOptions().getOption(ExecConstants.HASHAGG_FALLBACK_ENABLED_KEY).bool_val;
// Set the number of partitions from the configuration (raise to a power of two, if needed)
numPartitions = (int)context.getOptions().getOption(ExecConstants.HASHAGG_NUM_PARTITIONS_VALIDATOR);
if ( numPartitions == 1 && is2ndPhase ) { // 1st phase can still do early return with 1 partition
canSpill = false;
logger.warn("Spilling is disabled due to configuration setting of num_partitions to 1");
}
numPartitions = BaseAllocator.nextPowerOfTwo(numPartitions); // in case not a power of 2
if ( schema == null ) { estValuesBatchSize = estOutgoingAllocSize = estMaxBatchSize = 0; } // incoming was an empty batch
else {
// Estimate the max batch size; should use actual data (e.g. lengths of varchars)
updateEstMaxBatchSize(incoming);
}
// create "reserved memory" and adjust the memory limit down
reserveValueBatchMemory = reserveOutgoingMemory = estValuesBatchSize ;
long newMemoryLimit = allocator.getLimit() - reserveValueBatchMemory - reserveOutgoingMemory ;
long memAvail = newMemoryLimit - allocator.getAllocatedMemory();
if ( memAvail <= 0 ) { throw new OutOfMemoryException("Too little memory available"); }
allocator.setLimit(newMemoryLimit);
if ( !canSpill ) { // single phase, or spill disabled by configuation
numPartitions = 1; // single phase should use only a single partition (to save memory)
} else { // two phase
// Adjust down the number of partitions if needed - when the memory available can not hold as
// many batches (configurable option), plus overhead (e.g. hash table, links, hash values))
while ( numPartitions * ( estMaxBatchSize * minBatchesPerPartition + 2 * 1024 * 1024) > memAvail ) {
numPartitions /= 2;
if ( numPartitions < 2) {
if (is2ndPhase) {
canSpill = false; // 2nd phase needs at least 2 to make progress
if (fallbackEnabled) {
logger.warn("Spilling is disabled - not enough memory available for internal partitioning. Falling back"
+ " to use unbounded memory");
} else {
throw UserException.resourceError()
.message(String.format("Not enough memory for internal partitioning and fallback mechanism for "
+ "HashAgg to use unbounded memory is disabled. Either enable fallback config %s using Alter "
+ "session/system command or increase memory limit for Drillbit",
ExecConstants.HASHAGG_FALLBACK_ENABLED_KEY))
.build(logger);
}
}
break;
}
}
}
logger.debug("{} phase. Number of partitions chosen: {}. {} spill", isTwoPhase?(is2ndPhase?"2nd":"1st"):"Single",
numPartitions, canSpill ? "Can" : "Cannot");
// The following initial safety check should be revisited once we can lower the number of rows in a batch
// In cases of very tight memory -- need at least memory to process one batch, plus overhead (e.g. hash table)
if ( numPartitions == 1 && ! canSpill ) {
// if too little memory - behave like the old code -- practically no memory limit for hash aggregate
// (but 1st phase can still spill, so it will maintain the original memory limit)
allocator.setLimit(AbstractBase.MAX_ALLOCATION); // 10_000_000_000L
}
// Based on the number of partitions: Set the mask and bit count
partitionMask = numPartitions - 1; // e.g. 32 --> 0x1F
bitsInMask = Integer.bitCount(partitionMask); // e.g. 0x1F -> 5
// Create arrays (one entry per partition)
htables = new HashTable[numPartitions] ;
batchHolders = (ArrayList<BatchHolder>[]) new ArrayList<?>[numPartitions] ;
outBatchIndex = new int[numPartitions] ;
writers = new Writer[numPartitions];
spilledBatchesCount = new int[numPartitions];
spillFiles = new String[numPartitions];
spilledPartitionsList = new ArrayList<SpilledPartition>();
plannedBatches = numPartitions; // each partition should allocate its first batch
// initialize every (per partition) entry in the arrays
for (int i = 0; i < numPartitions; i++ ) {
try {
this.htables[i] = baseHashTable.createAndSetupHashTable(groupByOutFieldIds);
} catch (ClassTransformationException e) {
throw UserException.unsupportedError(e)
.message("Code generation error - likely an error in the code.")
.build(logger);
} catch (IOException e) {
throw UserException.resourceError(e)
.message("IO Error while creating a hash table.")
.build(logger);
} catch (SchemaChangeException sce) {
throw new IllegalStateException("Unexpected Schema Change while creating a hash table",sce);
}
this.batchHolders[i] = new ArrayList<BatchHolder>(); // First BatchHolder is created when the first put request is received.
}
// Initialize the value vectors in the generated code (which point to the incoming or outgoing fields)
try { htables[0].updateBatches(); } catch (SchemaChangeException sc) { throw new UnsupportedOperationException(sc); };
}
@Override
public RecordBatch getNewIncoming() { return newIncoming; } | void function() { final boolean fallbackEnabled = context.getOptions().getOption(ExecConstants.HASHAGG_FALLBACK_ENABLED_KEY).bool_val; numPartitions = (int)context.getOptions().getOption(ExecConstants.HASHAGG_NUM_PARTITIONS_VALIDATOR); if ( numPartitions == 1 && is2ndPhase ) { canSpill = false; logger.warn(STR); } numPartitions = BaseAllocator.nextPowerOfTwo(numPartitions); if ( schema == null ) { estValuesBatchSize = estOutgoingAllocSize = estMaxBatchSize = 0; } else { updateEstMaxBatchSize(incoming); } reserveValueBatchMemory = reserveOutgoingMemory = estValuesBatchSize ; long newMemoryLimit = allocator.getLimit() - reserveValueBatchMemory - reserveOutgoingMemory ; long memAvail = newMemoryLimit - allocator.getAllocatedMemory(); if ( memAvail <= 0 ) { throw new OutOfMemoryException(STR); } allocator.setLimit(newMemoryLimit); if ( !canSpill ) { numPartitions = 1; } else { while ( numPartitions * ( estMaxBatchSize * minBatchesPerPartition + 2 * 1024 * 1024) > memAvail ) { numPartitions /= 2; if ( numPartitions < 2) { if (is2ndPhase) { canSpill = false; if (fallbackEnabled) { logger.warn(STR + STR); } else { throw UserException.resourceError() .message(String.format(STR + STR + STR, ExecConstants.HASHAGG_FALLBACK_ENABLED_KEY)) .build(logger); } } break; } } } logger.debug(STR, isTwoPhase?(is2ndPhase?"2nd":"1st"):STR, numPartitions, canSpill ? "Can" : STR); if ( numPartitions == 1 && ! canSpill ) { allocator.setLimit(AbstractBase.MAX_ALLOCATION); } partitionMask = numPartitions - 1; bitsInMask = Integer.bitCount(partitionMask); htables = new HashTable[numPartitions] ; batchHolders = (ArrayList<BatchHolder>[]) new ArrayList<?>[numPartitions] ; outBatchIndex = new int[numPartitions] ; writers = new Writer[numPartitions]; spilledBatchesCount = new int[numPartitions]; spillFiles = new String[numPartitions]; spilledPartitionsList = new ArrayList<SpilledPartition>(); plannedBatches = numPartitions; for (int i = 0; i < numPartitions; i++ ) { try { this.htables[i] = baseHashTable.createAndSetupHashTable(groupByOutFieldIds); } catch (ClassTransformationException e) { throw UserException.unsupportedError(e) .message(STR) .build(logger); } catch (IOException e) { throw UserException.resourceError(e) .message(STR) .build(logger); } catch (SchemaChangeException sce) { throw new IllegalStateException(STR,sce); } this.batchHolders[i] = new ArrayList<BatchHolder>(); } try { htables[0].updateBatches(); } catch (SchemaChangeException sc) { throw new UnsupportedOperationException(sc); }; } public RecordBatch getNewIncoming() { return newIncoming; } | /**
* Delayed setup are the parts from setup() that can only be set after actual data arrives in incoming
* This data is used to compute the number of partitions.
*/ | Delayed setup are the parts from setup() that can only be set after actual data arrives in incoming This data is used to compute the number of partitions | delayedSetup | {
"repo_name": "ppadma/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java",
"license": "apache-2.0",
"size": 69912
} | [
"java.io.IOException",
"java.util.ArrayList",
"org.apache.drill.common.exceptions.UserException",
"org.apache.drill.exec.ExecConstants",
"org.apache.drill.exec.cache.VectorSerializer",
"org.apache.drill.exec.exception.ClassTransformationException",
"org.apache.drill.exec.exception.OutOfMemoryException",
"org.apache.drill.exec.exception.SchemaChangeException",
"org.apache.drill.exec.memory.BaseAllocator",
"org.apache.drill.exec.physical.base.AbstractBase",
"org.apache.drill.exec.physical.impl.common.HashTable",
"org.apache.drill.exec.record.RecordBatch"
] | import java.io.IOException; import java.util.ArrayList; import org.apache.drill.common.exceptions.UserException; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.cache.VectorSerializer; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.OutOfMemoryException; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.BaseAllocator; import org.apache.drill.exec.physical.base.AbstractBase; import org.apache.drill.exec.physical.impl.common.HashTable; import org.apache.drill.exec.record.RecordBatch; | import java.io.*; import java.util.*; import org.apache.drill.common.exceptions.*; import org.apache.drill.exec.*; import org.apache.drill.exec.cache.*; import org.apache.drill.exec.exception.*; import org.apache.drill.exec.memory.*; import org.apache.drill.exec.physical.base.*; import org.apache.drill.exec.physical.impl.common.*; import org.apache.drill.exec.record.*; | [
"java.io",
"java.util",
"org.apache.drill"
] | java.io; java.util; org.apache.drill; | 1,135,071 |
public final void setColumn(int column, double x, double y) {
assert column >= 0 && column < 2 : AssertMessages.outsideRangeInclusiveParameter(0, column, 0, 1);
switch (column) {
case 0:
this.m00 = x;
this.m10 = y;
break;
case 1:
this.m01 = x;
this.m11 = y;
break;
default:
throw new ArrayIndexOutOfBoundsException();
}
this.isIdentity = null;
} | final void function(int column, double x, double y) { assert column >= 0 && column < 2 : AssertMessages.outsideRangeInclusiveParameter(0, column, 0, 1); switch (column) { case 0: this.m00 = x; this.m10 = y; break; case 1: this.m01 = x; this.m11 = y; break; default: throw new ArrayIndexOutOfBoundsException(); } this.isIdentity = null; } | /**
* Sets the specified column of this Matrix2f to the two values provided.
*
* @param column
* the column number to be modified (zero indexed)
* @param x
* the first row element
* @param y
* the second row element
*/ | Sets the specified column of this Matrix2f to the two values provided | setColumn | {
"repo_name": "gallandarakhneorg/afc",
"path": "core/maths/mathgeom/src/main/java/org/arakhne/afc/math/matrix/Matrix2d.java",
"license": "apache-2.0",
"size": 55348
} | [
"org.arakhne.afc.vmutil.asserts.AssertMessages"
] | import org.arakhne.afc.vmutil.asserts.AssertMessages; | import org.arakhne.afc.vmutil.asserts.*; | [
"org.arakhne.afc"
] | org.arakhne.afc; | 19,304 |
public static ISOChronology getInstance(DateTimeZone zone) {
if (zone == null) {
zone = DateTimeZone.getDefault();
}
int index = System.identityHashCode(zone) & (FAST_CACHE_SIZE - 1);
ISOChronology chrono = cFastCache[index];
if (chrono != null && chrono.getZone() == zone) {
return chrono;
}
synchronized (cCache) {
chrono = cCache.get(zone);
if (chrono == null) {
chrono = new ISOChronology(ZonedChronology.getInstance(INSTANCE_UTC, zone));
cCache.put(zone, chrono);
}
}
cFastCache[index] = chrono;
return chrono;
}
// Constructors and instance variables
//-----------------------------------------------------------------------
private ISOChronology(Chronology base) {
super(base, null);
} | static ISOChronology function(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } int index = System.identityHashCode(zone) & (FAST_CACHE_SIZE - 1); ISOChronology chrono = cFastCache[index]; if (chrono != null && chrono.getZone() == zone) { return chrono; } synchronized (cCache) { chrono = cCache.get(zone); if (chrono == null) { chrono = new ISOChronology(ZonedChronology.getInstance(INSTANCE_UTC, zone)); cCache.put(zone, chrono); } } cFastCache[index] = chrono; return chrono; } private ISOChronology(Chronology base) { super(base, null); } | /**
* Gets an instance of the ISOChronology in the given time zone.
*
* @param zone the time zone to get the chronology in, null is default
* @return a chronology in the specified time zone
*/ | Gets an instance of the ISOChronology in the given time zone | getInstance | {
"repo_name": "jorisdgff/Trade-Today",
"path": "Third Party Libraries/joda-time-2.3/src/main/java/org/joda/time/chrono/ISOChronology.java",
"license": "unlicense",
"size": 7845
} | [
"org.joda.time.Chronology",
"org.joda.time.DateTimeZone"
] | import org.joda.time.Chronology; import org.joda.time.DateTimeZone; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,328,170 |
private SharedPreferences GetOtherAppSharedPreferences(String publicAccessName) {
SharedPreferences settings = null;
try {
if (publicAccessName != null) {
settings = context.getSharedPreferences(publicAccessName, Context.MODE_MULTI_PROCESS + Context.MODE_PRIVATE);
} else {
String PREFERENCES_FILE_NAME = "AdaptiveSettings";
settings = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_MULTI_PROCESS + Context.MODE_PRIVATE);
}
} catch (Exception e) {
logger.log(ILoggingLogLevel.Debug, LOG_TAG, "GetOtherAppSharedPreferences: Opening Storage Unit: The storage unit could not be accessed. Unhanlded error. e: " + e.toString());
}
return settings;
}
}
/**
------------------------------------| Engineered with ♥ in Barcelona, Catalonia |-------------------------------------- | SharedPreferences function(String publicAccessName) { SharedPreferences settings = null; try { if (publicAccessName != null) { settings = context.getSharedPreferences(publicAccessName, Context.MODE_MULTI_PROCESS + Context.MODE_PRIVATE); } else { String PREFERENCES_FILE_NAME = STR; settings = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_MULTI_PROCESS + Context.MODE_PRIVATE); } } catch (Exception e) { logger.log(ILoggingLogLevel.Debug, LOG_TAG, STR + e.toString()); } return settings; } } /** ------------------------------------ Engineered with ♥ in Barcelona, Catalonia -------------------------------------- | /**
* Get the SharedPreferences Object
*
* @param publicAccessName name
* @return SharedPreferences desired object
*/ | Get the SharedPreferences Object | GetOtherAppSharedPreferences | {
"repo_name": "AdaptiveMe/adaptive-arp-android",
"path": "adaptive-arp-rt/mobile/src/main/java/me/adaptive/arp/impl/SecurityDelegate.java",
"license": "apache-2.0",
"size": 14939
} | [
"android.content.Context",
"android.content.SharedPreferences",
"me.adaptive.arp.api.ILoggingLogLevel"
] | import android.content.Context; import android.content.SharedPreferences; import me.adaptive.arp.api.ILoggingLogLevel; | import android.content.*; import me.adaptive.arp.api.*; | [
"android.content",
"me.adaptive.arp"
] | android.content; me.adaptive.arp; | 884,357 |
@Test void testTimeExtractThatCannotBePushed() {
final String sql = "SELECT extract(CENTURY from \"timestamp\") from \"foodmart\" where "
+ "\"product_id\" = 1558 group by extract(CENTURY from \"timestamp\")";
final String plan = "PLAN=EnumerableInterpreter\n"
+ " BindableAggregate(group=[{0}])\n"
+ " BindableProject(EXPR$0=[EXTRACT(FLAG(CENTURY), $0)])\n"
+ " DruidQuery(table=[[foodmart, foodmart]], "
+ "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], "
+ "filter=[=(CAST($1):INTEGER, 1558)], projects=[[$0]])\n";
sql(sql).explainContains(plan).queryContains(new DruidChecker("'queryType':'scan'"))
.returnsUnordered("EXPR$0=20");
} | @Test void testTimeExtractThatCannotBePushed() { final String sql = STRtimestamp\STRfoodmart\STR + "\"product_id\STRtimestamp\")"; final String plan = STR + STR + STR + STR + STR + STR; sql(sql).explainContains(plan).queryContains(new DruidChecker(STR)) .returnsUnordered(STR); } | /** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1765">[CALCITE-1765]
* Druid adapter: Gracefully handle granularity that cannot be pushed to
* extraction function</a>. */ | Test case for [CALCITE-1765] Druid adapter: Gracefully handle granularity that cannot be pushed to | testTimeExtractThatCannotBePushed | {
"repo_name": "googleinterns/calcite",
"path": "druid/src/test/java/org/apache/calcite/test/DruidAdapter2IT.java",
"license": "apache-2.0",
"size": 202207
} | [
"org.junit.jupiter.api.Test"
] | import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 33,419 |
public @CheckForNull String checkSanity() {
OUTER: for (int i = 0; i < 5; i++) {
long bitMask = i < 4 ? bits[i] : (long) dayOfWeek;
for (int j = BaseParser.LOWER_BOUNDS[i]; j <= BaseParser.UPPER_BOUNDS[i]; j++) {
if (!checkBits(bitMask, j)) {
// this rank has a sparse entry.
// if we have a sparse rank, one of them better be the left-most.
if (i > 0)
return Messages.CronTab_do_you_really_mean_every_minute_when_you(spec, "H " + spec.substring(spec.indexOf(' ') + 1));
// once we find a sparse rank, upper ranks don't matter
break OUTER;
}
}
}
int daysOfMonth = 0;
for (int i = 1; i < 31; i++) {
if (checkBits(bits[2], i)) {
daysOfMonth++;
}
}
if (daysOfMonth > 5 && daysOfMonth < 28) { // a bit arbitrary
return Messages.CronTab_short_cycles_in_the_day_of_month_field_w();
}
String hashified = hashify(spec);
if (hashified != null) {
return Messages.CronTab_spread_load_evenly_by_using_rather_than_(hashified, spec);
}
return null;
} | @CheckForNull String function() { OUTER: for (int i = 0; i < 5; i++) { long bitMask = i < 4 ? bits[i] : (long) dayOfWeek; for (int j = BaseParser.LOWER_BOUNDS[i]; j <= BaseParser.UPPER_BOUNDS[i]; j++) { if (!checkBits(bitMask, j)) { if (i > 0) return Messages.CronTab_do_you_really_mean_every_minute_when_you(spec, STR + spec.substring(spec.indexOf(' ') + 1)); break OUTER; } } } int daysOfMonth = 0; for (int i = 1; i < 31; i++) { if (checkBits(bits[2], i)) { daysOfMonth++; } } if (daysOfMonth > 5 && daysOfMonth < 28) { return Messages.CronTab_short_cycles_in_the_day_of_month_field_w(); } String hashified = hashify(spec); if (hashified != null) { return Messages.CronTab_spread_load_evenly_by_using_rather_than_(hashified, spec); } return null; } | /**
* Checks if this crontab entry looks reasonable,
* and if not, return an warning message.
*
* <p>
* The point of this method is to catch syntactically correct
* but semantically suspicious combinations, like
* "* 0 * * *"
*/ | Checks if this crontab entry looks reasonable, and if not, return an warning message. The point of this method is to catch syntactically correct but semantically suspicious combinations, like "* 0 * * *" | checkSanity | {
"repo_name": "MarkEWaite/jenkins",
"path": "core/src/main/java/hudson/scheduler/CronTab.java",
"license": "mit",
"size": 21065
} | [
"edu.umd.cs.findbugs.annotations.CheckForNull"
] | import edu.umd.cs.findbugs.annotations.CheckForNull; | import edu.umd.cs.findbugs.annotations.*; | [
"edu.umd.cs"
] | edu.umd.cs; | 2,825,839 |
public ResultMatcher isGatewayTimeout() {
return matcher(HttpStatus.GATEWAY_TIMEOUT);
} | ResultMatcher function() { return matcher(HttpStatus.GATEWAY_TIMEOUT); } | /**
* Assert the response status code is {@code HttpStatus.GATEWAY_TIMEOUT} (504).
*/ | Assert the response status code is HttpStatus.GATEWAY_TIMEOUT (504) | isGatewayTimeout | {
"repo_name": "spring-projects/spring-framework",
"path": "spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java",
"license": "apache-2.0",
"size": 17758
} | [
"org.springframework.http.HttpStatus",
"org.springframework.test.web.servlet.ResultMatcher"
] | import org.springframework.http.HttpStatus; import org.springframework.test.web.servlet.ResultMatcher; | import org.springframework.http.*; import org.springframework.test.web.servlet.*; | [
"org.springframework.http",
"org.springframework.test"
] | org.springframework.http; org.springframework.test; | 1,833,030 |
public char getFIXValue() {
return mFIXValue;
}
private final char mFIXValue;
private static final Map<Character, OrderCapacity> mFIXValueMap;
static {
Map<Character, OrderCapacity> table = new HashMap<Character, OrderCapacity>();
for(OrderCapacity s:values()) {
table.put(s.getFIXValue(),s);
}
mFIXValueMap = Collections.unmodifiableMap(table);
}
| char function() { return mFIXValue; } private final char mFIXValue; private static final Map<Character, OrderCapacity> mFIXValueMap; static { Map<Character, OrderCapacity> table = new HashMap<Character, OrderCapacity>(); for(OrderCapacity s:values()) { table.put(s.getFIXValue(),s); } mFIXValueMap = Collections.unmodifiableMap(table); } | /**
* The FIX char value for this instance.
*
* @return the FIX char value for this instance.
*/ | The FIX char value for this instance | getFIXValue | {
"repo_name": "nagyist/marketcetera",
"path": "trunk/core/src/main/java/org/marketcetera/trade/OrderCapacity.java",
"license": "apache-2.0",
"size": 2169
} | [
"java.util.Collections",
"java.util.HashMap",
"java.util.Map"
] | import java.util.Collections; import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 843,537 |
public MockHttpServletRequest newPOST(final String requestURI, final Response previousResponse) {
MockHttpServletRequest request = new MockHttpServletRequest("POST", requestURI);
request.setSession(previousResponse.session);
return request;
}
| MockHttpServletRequest function(final String requestURI, final Response previousResponse) { MockHttpServletRequest request = new MockHttpServletRequest("POST", requestURI); request.setSession(previousResponse.session); return request; } | /**
* Creates a chained POST request (within a single HttpSession).
*
* @param requestURI
* @param previousResponse
* @return
*/ | Creates a chained POST request (within a single HttpSession) | newPOST | {
"repo_name": "Bhamni/openmrs-core",
"path": "web/src/test/java/org/openmrs/web/test/WebTestHelper.java",
"license": "mpl-2.0",
"size": 5130
} | [
"org.springframework.mock.web.MockHttpServletRequest"
] | import org.springframework.mock.web.MockHttpServletRequest; | import org.springframework.mock.web.*; | [
"org.springframework.mock"
] | org.springframework.mock; | 649,552 |
protected CharsetDecoder getCorrectDecoder(ByteBuffer inBuffer)
{
CharsetDecoder decoder=null;
if(inBuffer.remaining()<=2)
{
decoder = getTextEncodingCharSet().newDecoder();
decoder.reset();
return decoder;
}
if(getTextEncodingCharSet()== Charset.forName("UTF-16"))
{
if(inBuffer.getChar(0)==0xfffe || inBuffer.getChar(0)==0xfeff)
{
//Get the Specified Decoder
decoder = getTextEncodingCharSet().newDecoder();
decoder.reset();
}
else
{
if(inBuffer.get(0)==0)
{
decoder = Charset.forName("UTF-16BE").newDecoder();
decoder.reset();
}
else
{
decoder = Charset.forName("UTF-16LE").newDecoder();
decoder.reset();
}
}
}
else
{
decoder = getTextEncodingCharSet().newDecoder();
decoder.reset();
}
return decoder;
} | CharsetDecoder function(ByteBuffer inBuffer) { CharsetDecoder decoder=null; if(inBuffer.remaining()<=2) { decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); return decoder; } if(getTextEncodingCharSet()== Charset.forName(STR)) { if(inBuffer.getChar(0)==0xfffe inBuffer.getChar(0)==0xfeff) { decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); } else { if(inBuffer.get(0)==0) { decoder = Charset.forName(STR).newDecoder(); decoder.reset(); } else { decoder = Charset.forName(STR).newDecoder(); decoder.reset(); } } } else { decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); } return decoder; } | /**
* If they have specified UTF-16 then decoder works out by looking at BOM
* but if missing we have to make an educated guess otherwise just use
* specified decoder
*
* @param inBuffer
* @return
*/ | If they have specified UTF-16 then decoder works out by looking at BOM but if missing we have to make an educated guess otherwise just use specified decoder | getCorrectDecoder | {
"repo_name": "thawee/musixmate",
"path": "library/jaudiotagger226/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java",
"license": "apache-2.0",
"size": 5546
} | [
"java.nio.ByteBuffer",
"java.nio.charset.Charset",
"java.nio.charset.CharsetDecoder"
] | import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; | import java.nio.*; import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 1,510,328 |
public static byte[] readAll(InputStream inputStream) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int k = 0;
for (; (k = inputStream.read(buffer)) != -1;) {
outputStream.write(buffer, 0, k);
}
return outputStream.toByteArray();
} | static byte[] function(InputStream inputStream) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int k = 0; for (; (k = inputStream.read(buffer)) != -1;) { outputStream.write(buffer, 0, k); } return outputStream.toByteArray(); } | /**
* Reads all contents of the input stream.
*
*/ | Reads all contents of the input stream | readAll | {
"repo_name": "onyxbits/dummydroid",
"path": "src/main/java/com/akdeniz/googleplaycrawler/Utils.java",
"license": "apache-2.0",
"size": 12378
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,904,536 |
public void setAccount(Account account) {
this.account = account;
} | void function(Account account) { this.account = account; } | /**
* Sets the account attribute.
*
* @param account The account to set.
* @deprecated
*/ | Sets the account attribute | setAccount | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/bc/businessobject/BudgetConstructionObjectDump.java",
"license": "apache-2.0",
"size": 10044
} | [
"org.kuali.kfs.coa.businessobject.Account"
] | import org.kuali.kfs.coa.businessobject.Account; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 604,257 |
public NameParser getNameParser (Name name)
{
return _parser;
} | NameParser function (Name name) { return _parser; } | /**
* Return a NameParser for this Context.
*
* @param name a <code>Name</code> value
* @return a <code>NameParser</code> value
*/ | Return a NameParser for this Context | getNameParser | {
"repo_name": "sdw2330976/Research-jetty-9.2.5",
"path": "jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java",
"license": "apache-2.0",
"size": 43667
} | [
"javax.naming.Name",
"javax.naming.NameParser"
] | import javax.naming.Name; import javax.naming.NameParser; | import javax.naming.*; | [
"javax.naming"
] | javax.naming; | 1,111,377 |
void setGenerationStampV1Limit(long stamp) {
Preconditions.checkState(generationStampV1Limit ==
GenerationStamp.GRANDFATHER_GENERATION_STAMP);
generationStampV1Limit = stamp;
} | void setGenerationStampV1Limit(long stamp) { Preconditions.checkState(generationStampV1Limit == GenerationStamp.GRANDFATHER_GENERATION_STAMP); generationStampV1Limit = stamp; } | /**
* Sets the generation stamp that delineates random and sequentially
* allocated block IDs.
* @param stamp
*/ | Sets the generation stamp that delineates random and sequentially allocated block IDs | setGenerationStampV1Limit | {
"repo_name": "songweijia/fffs",
"path": "sources/hadoop-2.4.1-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 292274
} | [
"com.google.common.base.Preconditions",
"org.apache.hadoop.hdfs.server.common.GenerationStamp"
] | import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.server.common.GenerationStamp; | import com.google.common.base.*; import org.apache.hadoop.hdfs.server.common.*; | [
"com.google.common",
"org.apache.hadoop"
] | com.google.common; org.apache.hadoop; | 2,724,480 |
public static VCard makeVcard( long contact_id) {
VCard vcard = new VCard();
try {
vcard.setKind(Kind.individual());
vcard.addLanguage("en-US");
String full_name = NameUtil.getFullName(contact_id);
vcard.setFormattedName(full_name);
{
StructuredName n = new StructuredName();
String prefix = SqlCipher.getKv( contact_id, KvTab.name_prefix);
n.addPrefix(prefix);
String first = SqlCipher.getKv( contact_id, KvTab.name_first);
n.setGiven( first );
String last = SqlCipher.getKv( contact_id, KvTab.name_last);
n.setFamily( last );
String suffix = SqlCipher.getKv( contact_id, KvTab.name_suffix);
n.addSuffix( suffix );
vcard.setStructuredName(n);
// if( prefix.isEmpty() && first.isEmpty() && last.isEmpty() && suffix.isEmpty())//TODO remove
// n.setFamily(full_name);
}
{
JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.address));
for( int i =0; i< itemArray.length(); i++){
JSONObject item = itemArray.getJSONObject(i);
Iterator<?> item_keys = item.keys();
String item_label = (String) item_keys.next();
final String item_value = item.getString(item_label);
Address adr = new Address();
adr.setStreetAddress( item_value);
if( item_label.contentEquals("HOME"))
adr.addType(AddressType.HOME);
else
if( item_label.contentEquals("WORK"))
adr.addType(AddressType.WORK);
vcard.addAddress(adr);
}
}
{
JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.phone));
for( int i =0; i< itemArray.length(); i++){
JSONObject item = itemArray.getJSONObject(i);
Iterator<?> item_keys = item.keys();
String item_label = (String) item_keys.next();
final String item_value = item.getString(item_label);
TelephoneType type = null;
if( item_label.contentEquals("HOME"))
type = TelephoneType.HOME;
else
if( item_label.contentEquals("WORK"))
type = TelephoneType.WORK;
if( type == null)
vcard.addTelephoneNumber(item_value);
else
vcard.addTelephoneNumber(item_value, type);
}
}
{
JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.email));
for( int i =0; i< itemArray.length(); i++){
JSONObject item = itemArray.getJSONObject(i);
Iterator<?> item_keys = item.keys();
String item_label = (String) item_keys.next();
final String item_value = item.getString(item_label);
EmailType type = null;
if( item_label.contentEquals("HOME"))
type = EmailType.HOME;
else
if( item_label.contentEquals("WORK"))
type = EmailType.WORK;
if( type == null)
vcard.addEmail( item_value);
else
vcard.addEmail( item_value, type);
}
}
{
JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.website));
for( int i =0; i< itemArray.length(); i++){
JSONObject item = itemArray.getJSONObject(i);
Iterator<?> item_keys = item.keys();
String item_label = (String) item_keys.next();
final String item_value = item.getString(item_label);
vcard.addUrl( item_value);
}
}
{
String photoStr = SqlCipher.get( contact_id, DTab.photo);
byte[] b = null;
b = Base64.decode( photoStr.getBytes(), Base64.DEFAULT);
Photo photo = new Photo( b, ImageType.PNG );
vcard.addPhoto(photo);
}
{
String noteStr = SqlCipher.getKv( contact_id, KvTab.note);
Note note = vcard.addNote(noteStr); // can contain newlines
note.setLanguage("en-us");
}
{
String organization = SqlCipher.getKv(contact_id, KvTab.organization);
vcard.setOrganization(organization, "");// second parameter is department
}
{
String title = SqlCipher.getKv(contact_id, KvTab.title);
vcard.addTitle(title);
}
//FUTURE export im
//FUTURE export dates
//FUTURE export relation
} catch (JSONException e) {
LogUtil.logException(m_act, LogType.EXPORT_VCF, e);
}
return vcard;
} | static VCard function( long contact_id) { VCard vcard = new VCard(); try { vcard.setKind(Kind.individual()); vcard.addLanguage("en-US"); String full_name = NameUtil.getFullName(contact_id); vcard.setFormattedName(full_name); { StructuredName n = new StructuredName(); String prefix = SqlCipher.getKv( contact_id, KvTab.name_prefix); n.addPrefix(prefix); String first = SqlCipher.getKv( contact_id, KvTab.name_first); n.setGiven( first ); String last = SqlCipher.getKv( contact_id, KvTab.name_last); n.setFamily( last ); String suffix = SqlCipher.getKv( contact_id, KvTab.name_suffix); n.addSuffix( suffix ); vcard.setStructuredName(n); } { JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.address)); for( int i =0; i< itemArray.length(); i++){ JSONObject item = itemArray.getJSONObject(i); Iterator<?> item_keys = item.keys(); String item_label = (String) item_keys.next(); final String item_value = item.getString(item_label); Address adr = new Address(); adr.setStreetAddress( item_value); if( item_label.contentEquals("HOME")) adr.addType(AddressType.HOME); else if( item_label.contentEquals("WORK")) adr.addType(AddressType.WORK); vcard.addAddress(adr); } } { JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.phone)); for( int i =0; i< itemArray.length(); i++){ JSONObject item = itemArray.getJSONObject(i); Iterator<?> item_keys = item.keys(); String item_label = (String) item_keys.next(); final String item_value = item.getString(item_label); TelephoneType type = null; if( item_label.contentEquals("HOME")) type = TelephoneType.HOME; else if( item_label.contentEquals("WORK")) type = TelephoneType.WORK; if( type == null) vcard.addTelephoneNumber(item_value); else vcard.addTelephoneNumber(item_value, type); } } { JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.email)); for( int i =0; i< itemArray.length(); i++){ JSONObject item = itemArray.getJSONObject(i); Iterator<?> item_keys = item.keys(); String item_label = (String) item_keys.next(); final String item_value = item.getString(item_label); EmailType type = null; if( item_label.contentEquals("HOME")) type = EmailType.HOME; else if( item_label.contentEquals("WORK")) type = EmailType.WORK; if( type == null) vcard.addEmail( item_value); else vcard.addEmail( item_value, type); } } { JSONArray itemArray = new JSONArray( SqlCipher.get( contact_id, DTab.website)); for( int i =0; i< itemArray.length(); i++){ JSONObject item = itemArray.getJSONObject(i); Iterator<?> item_keys = item.keys(); String item_label = (String) item_keys.next(); final String item_value = item.getString(item_label); vcard.addUrl( item_value); } } { String photoStr = SqlCipher.get( contact_id, DTab.photo); byte[] b = null; b = Base64.decode( photoStr.getBytes(), Base64.DEFAULT); Photo photo = new Photo( b, ImageType.PNG ); vcard.addPhoto(photo); } { String noteStr = SqlCipher.getKv( contact_id, KvTab.note); Note note = vcard.addNote(noteStr); note.setLanguage("en-us"); } { String organization = SqlCipher.getKv(contact_id, KvTab.organization); vcard.setOrganization(organization, ""); } { String title = SqlCipher.getKv(contact_id, KvTab.title); vcard.addTitle(title); } } catch (JSONException e) { LogUtil.logException(m_act, LogType.EXPORT_VCF, e); } return vcard; } | /**
* Create a single vcard from a contact record
* @param contact_id
* @return appended vcard
*/ | Create a single vcard from a contact record | makeVcard | {
"repo_name": "Nuvolect/SecureSuite-Android",
"path": "SecureSuite/src/main/java/com/nuvolect/securesuite/data/ExportVcf.java",
"license": "gpl-3.0",
"size": 14050
} | [
"android.util.Base64",
"com.nuvolect.securesuite.data.SqlCipher",
"com.nuvolect.securesuite.util.LogUtil",
"java.util.Iterator",
"org.json.JSONArray",
"org.json.JSONException",
"org.json.JSONObject"
] | import android.util.Base64; import com.nuvolect.securesuite.data.SqlCipher; import com.nuvolect.securesuite.util.LogUtil; import java.util.Iterator; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; | import android.util.*; import com.nuvolect.securesuite.data.*; import com.nuvolect.securesuite.util.*; import java.util.*; import org.json.*; | [
"android.util",
"com.nuvolect.securesuite",
"java.util",
"org.json"
] | android.util; com.nuvolect.securesuite; java.util; org.json; | 1,429,746 |
public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out", true);
configuration.save(configurationFile);
}
// Disable Task, if it is running
if (task != null) {
task.cancel();
task = null;
}
}
} | void function() throws IOException { synchronized (optOutLock) { if (!isOptOut()) { configuration.set(STR, true); configuration.save(configurationFile); } if (task != null) { task.cancel(); task = null; } } } | /**
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
*
* @throws java.io.IOException
*/ | Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task | disable | {
"repo_name": "CyberdyneCC/Thermos",
"path": "src/main/java/org/spigotmc/Metrics.java",
"license": "gpl-3.0",
"size": 22796
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 15,405 |
public static void handleInternalError(AuthWebSocket webSocket, Throwable e) {
JsonObject data = new JsonObject();
data.addProperty("code", 500);
data.addProperty("message", "Internal Server Error");
WsPackage.create().resource(Resource.APP).action(Action.ERROR).data(data).send(webSocket);
ErrorHandler.handleLocal(e);
} | static void function(AuthWebSocket webSocket, Throwable e) { JsonObject data = new JsonObject(); data.addProperty("code", 500); data.addProperty(STR, STR); WsPackage.create().resource(Resource.APP).action(Action.ERROR).data(data).send(webSocket); ErrorHandler.handleLocal(e); } | /**
* Handles an internal error by sending a notification to the web socket who triggered the error and also
* handles the error locally.
*
* @param webSocket the web socket who triggered the internal error
* @param e the error
*/ | Handles an internal error by sending a notification to the web socket who triggered the error and also handles the error locally | handleInternalError | {
"repo_name": "VSETH-GECO/BASS",
"path": "src/main/java/ch/ethz/geco/bass/server/util/RequestSender.java",
"license": "mit",
"size": 3240
} | [
"ch.ethz.geco.bass.server.AuthWebSocket",
"ch.ethz.geco.bass.server.Server",
"ch.ethz.geco.bass.util.ErrorHandler",
"com.google.gson.JsonObject"
] | import ch.ethz.geco.bass.server.AuthWebSocket; import ch.ethz.geco.bass.server.Server; import ch.ethz.geco.bass.util.ErrorHandler; import com.google.gson.JsonObject; | import ch.ethz.geco.bass.server.*; import ch.ethz.geco.bass.util.*; import com.google.gson.*; | [
"ch.ethz.geco",
"com.google.gson"
] | ch.ethz.geco; com.google.gson; | 252,248 |
public void stopAgents(List<String> instanceIds); | void function(List<String> instanceIds); | /**
* Sends a stop request to all agents on the specific instanceId.
*
* @param instanceIds
* the instanceIds to stop
*/ | Sends a stop request to all agents on the specific instanceId | stopAgents | {
"repo_name": "kevinmcgoldrick/Tank",
"path": "api/src/main/java/com/intuit/tank/vm/perfManager/AgentChannel.java",
"license": "epl-1.0",
"size": 1786
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 513,099 |
public static Integer ascii(String s) {
if ((s == null) || (s.length() == 0)) {
return null;
}
return ValuePool.getInt(s.charAt(0));
} | static Integer function(String s) { if ((s == null) (s.length() == 0)) { return null; } return ValuePool.getInt(s.charAt(0)); } | /**
* Returns the Unicode code value of the leftmost character of
* <code>s</code> as an <code>int</code>. This is the same as the
* ASCII value if the string contains only ASCII characters.
* @param s the <code>String</code> to evaluate
* @return the integer Unicode value of the
* leftmost character
*/ | Returns the Unicode code value of the leftmost character of <code>s</code> as an <code>int</code>. This is the same as the ASCII value if the string contains only ASCII characters | ascii | {
"repo_name": "chip/rhodes",
"path": "platform/bb/Hsqldb/src/org/hsqldb/Library.java",
"license": "gpl-3.0",
"size": 80182
} | [
"org.hsqldb.store.ValuePool"
] | import org.hsqldb.store.ValuePool; | import org.hsqldb.store.*; | [
"org.hsqldb.store"
] | org.hsqldb.store; | 2,220,016 |
@Override
public void removeView(View child) {
throw new UnsupportedOperationException(
"removeView(View) is not supported in CarouselAdapter");
}
| void function(View child) { throw new UnsupportedOperationException( STR); } | /**
* This method is not supported and throws an UnsupportedOperationException
* when called.
*
* @param child
* Ignored.
*
* @throws UnsupportedOperationException
* Every time this method is invoked.
*/ | This method is not supported and throws an UnsupportedOperationException when called | removeView | {
"repo_name": "Git-tl/appcan-plugin-timemachine-android",
"path": "uexTimeMachine/src/org/zywx/wbpalmstar/plugin/uextimemachine/CarouselAdapter.java",
"license": "lgpl-3.0",
"size": 33927
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 214,296 |
@Nullable
public WorkbookFunctionResult post() throws ClientException {
return send(HttpMethod.POST, body);
} | WorkbookFunctionResult function() throws ClientException { return send(HttpMethod.POST, body); } | /**
* Invokes the method and returns the result
* @return result of the method invocation
* @throws ClientException an exception occurs if there was an error while the request was sent
*/ | Invokes the method and returns the result | post | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/WorkbookFunctionsOct2BinRequest.java",
"license": "mit",
"size": 2983
} | [
"com.microsoft.graph.core.ClientException",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.WorkbookFunctionResult"
] | import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.WorkbookFunctionResult; | import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 1,561,128 |
@Override
public void generateAtom(XmlWriter w,
String elementName) throws IOException {
ArrayList<XmlWriter.Attribute> attrs =
new ArrayList<XmlWriter.Attribute>();
// For v2 and later, optimize out the text attribute since it is implied.
if (Service.getVersion().isCompatible(Service.Versions.V1)) {
attrs.add(new XmlWriter.Attribute("type", "text"));
}
if (lang != null) {
attrs.add(new XmlWriter.Attribute("xml:lang", lang));
}
w.simpleElement(Namespaces.atomNs, elementName, attrs, text);
} | void function(XmlWriter w, String elementName) throws IOException { ArrayList<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (Service.getVersion().isCompatible(Service.Versions.V1)) { attrs.add(new XmlWriter.Attribute("type", "text")); } if (lang != null) { attrs.add(new XmlWriter.Attribute(STR, lang)); } w.simpleElement(Namespaces.atomNs, elementName, attrs, text); } | /**
* Generates XML in the Atom format.
*
* @param w
* output writer
*
* @param elementName
* Atom element name
*
* @throws IOException
*/ | Generates XML in the Atom format | generateAtom | {
"repo_name": "elhoim/gdata-client-java",
"path": "java/src/com/google/gdata/data/PlainTextConstruct.java",
"license": "apache-2.0",
"size": 4403
} | [
"com.google.gdata.client.Service",
"com.google.gdata.util.Namespaces",
"com.google.gdata.util.common.xml.XmlWriter",
"java.io.IOException",
"java.util.ArrayList"
] | import com.google.gdata.client.Service; import com.google.gdata.util.Namespaces; import com.google.gdata.util.common.xml.XmlWriter; import java.io.IOException; import java.util.ArrayList; | import com.google.gdata.client.*; import com.google.gdata.util.*; import com.google.gdata.util.common.xml.*; import java.io.*; import java.util.*; | [
"com.google.gdata",
"java.io",
"java.util"
] | com.google.gdata; java.io; java.util; | 2,530,557 |
public static int intersectPath(PathIterator p, double x, double y, double w, double h) {
int cross = 0;
int count;
double mx, my, cx, cy;
mx = my = cx = cy = 0.0;
double coords[] = new double[6];
double rx1 = x;
double ry1 = y;
double rx2 = x + w;
double ry2 = y + h;
while (!p.isDone()) {
count = 0;
switch (p.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
if (cx != mx || cy != my) {
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
}
mx = cx = coords[0];
my = cy = coords[1];
break;
case PathIterator.SEG_LINETO:
count = intersectLine(cx, cy, cx = coords[0], cy = coords[1], rx1, ry1, rx2, ry2);
break;
case PathIterator.SEG_QUADTO:
count = intersectQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], rx1, ry1, rx2, ry2);
break;
case PathIterator.SEG_CUBICTO:
count = intersectCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], rx1, ry1, rx2, ry2);
break;
case PathIterator.SEG_CLOSE:
if (cy != my || cx != mx) {
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
}
cx = mx;
cy = my;
break;
}
if (count == CROSSING) {
return CROSSING;
}
cross += count;
p.next();
}
if (cy != my) {
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
if (count == CROSSING) {
return CROSSING;
}
cross += count;
}
return cross;
}
| static int function(PathIterator p, double x, double y, double w, double h) { int cross = 0; int count; double mx, my, cx, cy; mx = my = cx = cy = 0.0; double coords[] = new double[6]; double rx1 = x; double ry1 = y; double rx2 = x + w; double ry2 = y + h; while (!p.isDone()) { count = 0; switch (p.currentSegment(coords)) { case PathIterator.SEG_MOVETO: if (cx != mx cy != my) { count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2); } mx = cx = coords[0]; my = cy = coords[1]; break; case PathIterator.SEG_LINETO: count = intersectLine(cx, cy, cx = coords[0], cy = coords[1], rx1, ry1, rx2, ry2); break; case PathIterator.SEG_QUADTO: count = intersectQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], rx1, ry1, rx2, ry2); break; case PathIterator.SEG_CUBICTO: count = intersectCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], rx1, ry1, rx2, ry2); break; case PathIterator.SEG_CLOSE: if (cy != my cx != mx) { count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2); } cx = mx; cy = my; break; } if (count == CROSSING) { return CROSSING; } cross += count; p.next(); } if (cy != my) { count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2); if (count == CROSSING) { return CROSSING; } cross += count; } return cross; } | /**
* Returns how many times rectangle stripe cross path or the are intersect
*/ | Returns how many times rectangle stripe cross path or the are intersect | intersectPath | {
"repo_name": "windwardadmin/android-awt",
"path": "src/main/java/org/apache/harmony/awt/gl/Crossing.java",
"license": "apache-2.0",
"size": 28692
} | [
"net.windward.android.awt.geom.PathIterator"
] | import net.windward.android.awt.geom.PathIterator; | import net.windward.android.awt.geom.*; | [
"net.windward.android"
] | net.windward.android; | 942,857 |
@Test
public void testAcknowledgeAlarm() {
VerificationObject vo = createAckStructure();
Assert.assertTrue(vo.m_nodeId > 0);
Assert.assertTrue(vo.m_alarmId > 0);
Assert.assertTrue(vo.m_eventID > 0);
Assert.assertTrue(vo.m_userNotifId > 0);
OnmsAlarm alarm = m_alarmDao.get(vo.m_alarmId);
OnmsAcknowledgment ack = new OnmsAcknowledgment(m_alarmDao.get(vo.m_alarmId));
m_ackDao.save(ack);
m_ackDao.flush();
m_ackService.processAck(ack);
alarm = m_alarmDao.get(ack.getRefId());
Assert.assertNotNull(alarm.getAlarmAckUser());
Assert.assertEquals("admin", alarm.getAlarmAckUser());
OnmsNotification notif = m_notificationDao.get(vo.m_notifId);
Assert.assertNotNull(notif);
Assert.assertEquals("admin", notif.getAnsweredBy());
Assert.assertTrue(alarm.getAlarmAckTime().before(notif.getRespondTime()));
}
| void function() { VerificationObject vo = createAckStructure(); Assert.assertTrue(vo.m_nodeId > 0); Assert.assertTrue(vo.m_alarmId > 0); Assert.assertTrue(vo.m_eventID > 0); Assert.assertTrue(vo.m_userNotifId > 0); OnmsAlarm alarm = m_alarmDao.get(vo.m_alarmId); OnmsAcknowledgment ack = new OnmsAcknowledgment(m_alarmDao.get(vo.m_alarmId)); m_ackDao.save(ack); m_ackDao.flush(); m_ackService.processAck(ack); alarm = m_alarmDao.get(ack.getRefId()); Assert.assertNotNull(alarm.getAlarmAckUser()); Assert.assertEquals("admin", alarm.getAlarmAckUser()); OnmsNotification notif = m_notificationDao.get(vo.m_notifId); Assert.assertNotNull(notif); Assert.assertEquals("admin", notif.getAnsweredBy()); Assert.assertTrue(alarm.getAlarmAckTime().before(notif.getRespondTime())); } | /**
* This tests the acknowledgment of an alarm and any related notifications.
*/ | This tests the acknowledgment of an alarm and any related notifications | testAcknowledgeAlarm | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-ackd/src/test/java/org/opennms/netmgt/ackd/AckdTest.java",
"license": "gpl-2.0",
"size": 15110
} | [
"junit.framework.Assert",
"org.opennms.netmgt.model.OnmsAcknowledgment",
"org.opennms.netmgt.model.OnmsAlarm",
"org.opennms.netmgt.model.OnmsNotification"
] | import junit.framework.Assert; import org.opennms.netmgt.model.OnmsAcknowledgment; import org.opennms.netmgt.model.OnmsAlarm; import org.opennms.netmgt.model.OnmsNotification; | import junit.framework.*; import org.opennms.netmgt.model.*; | [
"junit.framework",
"org.opennms.netmgt"
] | junit.framework; org.opennms.netmgt; | 1,402,242 |
public BigDecimal[][] getDataRef() {
return data;
}
/***
* Gets the rounding mode for division operations
* The default is {@link java.math.BigDecimal#ROUND_HALF_UP} | BigDecimal[][] function() { return data; } /*** * Gets the rounding mode for division operations * The default is {@link java.math.BigDecimal#ROUND_HALF_UP} | /**
* Returns a reference to the underlying data array.
* <p>
* Does not make a fresh copy of the underlying data.</p>
*
* @return 2-dimensional array of entries
*/ | Returns a reference to the underlying data array. Does not make a fresh copy of the underlying data | getDataRef | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_63/src/main/java/org/apache/commons/math/linear/BigMatrixImpl.java",
"license": "gpl-2.0",
"size": 54472
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,505,816 |
public List<ClientAuthenticationMethod> clientAuthenticationMethod() {
return this.clientAuthenticationMethod;
} | List<ClientAuthenticationMethod> function() { return this.clientAuthenticationMethod; } | /**
* Get method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format.
*
* @return the clientAuthenticationMethod value
*/ | Get method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format | clientAuthenticationMethod | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/apimanagement/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/apimanagement/v2018_06_01_preview/AuthorizationServerContractBaseProperties.java",
"license": "mit",
"size": 12383
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,248,443 |
private void assertTime1970(Time t) {
cal.clear();
cal.setTime(t);
assertEquals(1970, cal.get(Calendar.YEAR));
assertEquals(Calendar.JANUARY, cal.get(Calendar.MONTH));
assertEquals(1, cal.get(Calendar.DATE));
} | void function(Time t) { cal.clear(); cal.setTime(t); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(Calendar.JANUARY, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DATE)); } | /**
* Javadoc for java.sql.Time states the components of
* date for a java.sql.Time value must be set to January 1, 1970.
* Note that the java.sql.Time class does not enforce this,
* it is up to the driver.
* @param t
*/ | Javadoc for java.sql.Time states the components of date for a java.sql.Time value must be set to January 1, 1970. Note that the java.sql.Time class does not enforce this, it is up to the driver | assertTime1970 | {
"repo_name": "lpxz/grail-derby104",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/TimeHandlingTest.java",
"license": "apache-2.0",
"size": 34092
} | [
"java.sql.Time",
"java.util.Calendar"
] | import java.sql.Time; import java.util.Calendar; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 605,359 |
public GeoApiContext setWriteTimeout(long timeout, TimeUnit unit) {
client.setWriteTimeout(timeout, unit);
return this;
} | GeoApiContext function(long timeout, TimeUnit unit) { client.setWriteTimeout(timeout, unit); return this; } | /**
* Sets the default write timeout for new connections. A value of 0 means no timeout.
*/ | Sets the default write timeout for new connections. A value of 0 means no timeout | setWriteTimeout | {
"repo_name": "johnjohndoe/google-maps-services-java",
"path": "src/main/java/com/google/maps/GeoApiContext.java",
"license": "apache-2.0",
"size": 7746
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 251,355 |
public static F.Promise<String> redirectURL(String openID,
String callbackURL,
Map<String, String> axRequired,
Map<String, String> axOptional) {
return redirectURL(openID, callbackURL, axRequired, axOptional, null);
} | static F.Promise<String> function(String openID, String callbackURL, Map<String, String> axRequired, Map<String, String> axOptional) { return redirectURL(openID, callbackURL, axRequired, axOptional, null); } | /**
* Retrieve the URL where the user should be redirected to start the OpenID authentication process
*/ | Retrieve the URL where the user should be redirected to start the OpenID authentication process | redirectURL | {
"repo_name": "michaelahlers/team-awesome-wedding",
"path": "vendor/play-2.2.1/framework/src/play-java/src/main/java/play/libs/OpenID.java",
"license": "mit",
"size": 3580
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,495,426 |
public static <V> SimpleCombineFn<V> of(
SerializableFunction<Iterable<V>, V> combiner) {
return new SimpleCombineFn<>(combiner);
}
protected SimpleCombineFn(SerializableFunction<Iterable<V>, V> combiner) {
super(combiner, IterableCombineFn.DEFAULT_BUFFER_SIZE);
}
}
/////////////////////////////////////////////////////////////////////////////
public static class PerKey<K, InputT, OutputT>
extends PTransform<PCollection<KV<K, InputT>>, PCollection<KV<K, OutputT>>> {
private final GlobalCombineFn<? super InputT, ?, OutputT> fn;
private final DisplayData.ItemSpec<? extends Class<?>> fnDisplayData;
private final boolean fewKeys;
private final List<PCollectionView<?>> sideInputs;
private PerKey(
GlobalCombineFn<? super InputT, ?, OutputT> fn,
DisplayData.ItemSpec<? extends Class<?>> fnDisplayData, boolean fewKeys) {
this.fn = fn;
this.fnDisplayData = fnDisplayData;
this.fewKeys = fewKeys;
this.sideInputs = ImmutableList.of();
}
private PerKey(
GlobalCombineFn<? super InputT, ?, OutputT> fn,
DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
boolean fewKeys, List<PCollectionView<?>> sideInputs) {
this.fn = fn;
this.fnDisplayData = fnDisplayData;
this.fewKeys = fewKeys;
this.sideInputs = sideInputs;
} | static <V> SimpleCombineFn<V> function( SerializableFunction<Iterable<V>, V> combiner) { return new SimpleCombineFn<>(combiner); } protected SimpleCombineFn(SerializableFunction<Iterable<V>, V> combiner) { super(combiner, IterableCombineFn.DEFAULT_BUFFER_SIZE); } } public static class PerKey<K, InputT, OutputT> extends PTransform<PCollection<KV<K, InputT>>, PCollection<KV<K, OutputT>>> { private final GlobalCombineFn<? super InputT, ?, OutputT> fn; private final DisplayData.ItemSpec<? extends Class<?>> fnDisplayData; private final boolean fewKeys; private final List<PCollectionView<?>> sideInputs; private PerKey( GlobalCombineFn<? super InputT, ?, OutputT> fn, DisplayData.ItemSpec<? extends Class<?>> fnDisplayData, boolean fewKeys) { this.fn = fn; this.fnDisplayData = fnDisplayData; this.fewKeys = fewKeys; this.sideInputs = ImmutableList.of(); } private PerKey( GlobalCombineFn<? super InputT, ?, OutputT> fn, DisplayData.ItemSpec<? extends Class<?>> fnDisplayData, boolean fewKeys, List<PCollectionView<?>> sideInputs) { this.fn = fn; this.fnDisplayData = fnDisplayData; this.fewKeys = fewKeys; this.sideInputs = sideInputs; } | /**
* Returns a {@code CombineFn} that uses the given
* {@code SerializableFunction} to combine values.
*/ | Returns a CombineFn that uses the given SerializableFunction to combine values | of | {
"repo_name": "tgroh/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Combine.java",
"license": "apache-2.0",
"size": 81805
} | [
"com.google.common.collect.ImmutableList",
"java.util.List",
"org.apache.beam.sdk.transforms.CombineFnBase",
"org.apache.beam.sdk.transforms.display.DisplayData",
"org.apache.beam.sdk.values.PCollection",
"org.apache.beam.sdk.values.PCollectionView"
] | import com.google.common.collect.ImmutableList; import java.util.List; import org.apache.beam.sdk.transforms.CombineFnBase; import org.apache.beam.sdk.transforms.display.DisplayData; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionView; | import com.google.common.collect.*; import java.util.*; import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.transforms.display.*; import org.apache.beam.sdk.values.*; | [
"com.google.common",
"java.util",
"org.apache.beam"
] | com.google.common; java.util; org.apache.beam; | 510,590 |
@Test
@OperateOnDeployment(AGGREGATE_REALM_SAME_TYPE_NAME)
public void principal_transformedUserIsNotDefinedInAuthorizationRealm_sameTypeRealm(@ArquillianResource URL webAppURL) throws Exception {
principal_transformedUserIsNotDefinedInAuthorizationRealm(webAppURL);
} | @OperateOnDeployment(AGGREGATE_REALM_SAME_TYPE_NAME) void function(@ArquillianResource URL webAppURL) throws Exception { principal_transformedUserIsNotDefinedInAuthorizationRealm(webAppURL); } | /**
* B is not defined in authorization realm, but B is defined in authentication realm.
* User A is authenticated with correct password.
* User with correct password is authenticated but not authorized.
*/ | B is not defined in authorization realm, but B is defined in authentication realm. User A is authenticated with correct password. User with correct password is authenticated but not authorized | principal_transformedUserIsNotDefinedInAuthorizationRealm_sameTypeRealm | {
"repo_name": "jstourac/wildfly",
"path": "testsuite/integration/elytron/src/test/java/org/wildfly/test/integration/elytron/realm/AggregateRealmWithTransformerTestCase.java",
"license": "lgpl-2.1",
"size": 47180
} | [
"org.jboss.arquillian.container.test.api.OperateOnDeployment",
"org.jboss.arquillian.test.api.ArquillianResource"
] | import org.jboss.arquillian.container.test.api.OperateOnDeployment; import org.jboss.arquillian.test.api.ArquillianResource; | import org.jboss.arquillian.container.test.api.*; import org.jboss.arquillian.test.api.*; | [
"org.jboss.arquillian"
] | org.jboss.arquillian; | 2,685,957 |
public java.sql.PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException {
return clientPrepareStatement(sql, resultSetType, resultSetConcurrency, true);
} | java.sql.PreparedStatement function(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return clientPrepareStatement(sql, resultSetType, resultSetConcurrency, true); } | /**
* DOCUMENT ME!
*
* @param sql
* DOCUMENT ME!
* @param resultSetType
* DOCUMENT ME!
* @param resultSetConcurrency
* DOCUMENT ME!
* @return DOCUMENT ME!
* @throws SQLException
* DOCUMENT ME!
*/ | DOCUMENT ME | clientPrepareStatement | {
"repo_name": "mashuai/Open-Source-Research",
"path": "MySQL-JDBC-Driver/src/com/mysql/jdbc/ConnectionImpl.java",
"license": "apache-2.0",
"size": 172162
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 113,631 |
public ServiceResponse<Void> getGlobalAndLocalQueryNull(String localStringPath, String pathItemStringPath, String localStringQuery, String pathItemStringQuery) throws ErrorException, IOException, IllegalArgumentException {
if (localStringPath == null) {
throw new IllegalArgumentException("Parameter localStringPath is required and cannot be null.");
}
if (pathItemStringPath == null) {
throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.");
}
if (this.client.globalStringPath() == null) {
throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.");
}
Call<ResponseBody> call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery());
return getGlobalAndLocalQueryNullDelegate(call.execute());
} | ServiceResponse<Void> function(String localStringPath, String pathItemStringPath, String localStringQuery, String pathItemStringQuery) throws ErrorException, IOException, IllegalArgumentException { if (localStringPath == null) { throw new IllegalArgumentException(STR); } if (pathItemStringPath == null) { throw new IllegalArgumentException(STR); } if (this.client.globalStringPath() == null) { throw new IllegalArgumentException(STR); } Call<ResponseBody> call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getGlobalAndLocalQueryNullDelegate(call.execute()); } | /**
* send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null.
*
* @param localStringPath should contain value 'localStringPath'
* @param pathItemStringPath A string value 'pathItemStringPath' that appears in the path
* @param localStringQuery should contain null value
* @param pathItemStringQuery A string value 'pathItemStringQuery' that appears as a query parameter
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/ | send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null | getGlobalAndLocalQueryNull | {
"repo_name": "yaqiyang/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/implementation/PathItemsImpl.java",
"license": "mit",
"size": 40451
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 2,865,797 |
@Override
public Result clone() {
try {
Result result = (Result) super.clone();
// Clone result rows and files as well...
if ( rows != null ) {
List<RowMetaAndData> clonedRows = new ArrayList<RowMetaAndData>();
for ( int i = 0; i < rows.size(); i++ ) {
clonedRows.add( ( rows.get( i ) ).clone() );
}
result.setRows( clonedRows );
}
if ( resultFiles != null ) {
Map<String, ResultFile> clonedFiles = new ConcurrentHashMap<String, ResultFile>();
Collection<ResultFile> files = resultFiles.values();
for ( ResultFile file : files ) {
clonedFiles.put( file.getFile().toString(), file.clone() );
}
result.setResultFiles( clonedFiles );
}
return result;
} catch ( CloneNotSupportedException e ) {
return null;
}
} | Result function() { try { Result result = (Result) super.clone(); if ( rows != null ) { List<RowMetaAndData> clonedRows = new ArrayList<RowMetaAndData>(); for ( int i = 0; i < rows.size(); i++ ) { clonedRows.add( ( rows.get( i ) ).clone() ); } result.setRows( clonedRows ); } if ( resultFiles != null ) { Map<String, ResultFile> clonedFiles = new ConcurrentHashMap<String, ResultFile>(); Collection<ResultFile> files = resultFiles.values(); for ( ResultFile file : files ) { clonedFiles.put( file.getFile().toString(), file.clone() ); } result.setResultFiles( clonedFiles ); } return result; } catch ( CloneNotSupportedException e ) { return null; } } | /**
* Clones the Result, including rows and files. To perform a clone without rows, use lightClone()
*
* @see java.lang.Object#clone()
* @see Result#lightClone
*
* @return A clone of the Result object
*/ | Clones the Result, including rows and files. To perform a clone without rows, use lightClone() | clone | {
"repo_name": "pavel-sakun/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/Result.java",
"license": "apache-2.0",
"size": 25256
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.Map",
"java.util.concurrent.ConcurrentHashMap"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 642,233 |
public Collection<ExportedConfiguration> getConfigurations() {
return configurations;
} | Collection<ExportedConfiguration> function() { return configurations; } | /**
* Obtain associated host group scoped configurations.
*
* @return collection of host group scoped configurations
*/ | Obtain associated host group scoped configurations | getConfigurations | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java",
"license": "apache-2.0",
"size": 15964
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 77,805 |
public EntityResolver getEntityResolver() {
return null;
} | EntityResolver function() { return null; } | /**
* This class is only used internally so this method should never
* be called.
*/ | This class is only used internally so this method should never be called | getEntityResolver | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xalan/internal/xsltc/trax/StAXStream2SAX.java",
"license": "apache-2.0",
"size": 16296
} | [
"org.xml.sax.EntityResolver"
] | import org.xml.sax.EntityResolver; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 2,791,488 |
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfStringTooLongPrefixLengthIPv4() {
IpPrefix ipPrefix;
ipPrefix = IpPrefix.valueOf("1.2.3.4/33");
} | @Test(expected = IllegalArgumentException.class) void function() { IpPrefix ipPrefix; ipPrefix = IpPrefix.valueOf(STR); } | /**
* Tests invalid valueOf() converter for IPv4 string and
* too long prefix length.
*/ | Tests invalid valueOf() converter for IPv4 string and too long prefix length | testInvalidValueOfStringTooLongPrefixLengthIPv4 | {
"repo_name": "kuangrewawa/onos",
"path": "utils/misc/src/test/java/org/onlab/packet/IpPrefixTest.java",
"license": "apache-2.0",
"size": 40625
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 911,771 |
public static void flushSilently(Flushable flushable) {
try {
if(flushable != null) {
flushable.flush();
}
}
catch(IOException ignore) {
LOG.debugCloseException(ignore);
}
} | static void function(Flushable flushable) { try { if(flushable != null) { flushable.flush(); } } catch(IOException ignore) { LOG.debugCloseException(ignore); } } | /**
* Flushes the given object. The same as calling {@link Flushable#flush()}, but
* errors while flushing are silently ignored.
*/ | Flushes the given object. The same as calling <code>Flushable#flush()</code>, but errors while flushing are silently ignored | flushSilently | {
"repo_name": "subhrajyotim/camunda-bpm-platform",
"path": "engine/src/main/java/org/camunda/bpm/engine/impl/util/IoUtil.java",
"license": "apache-2.0",
"size": 3697
} | [
"java.io.Flushable",
"java.io.IOException"
] | import java.io.Flushable; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,761,928 |
@Generated
@Selector("setMipFilter:")
public native void setMipFilter(@NUInt long value); | @Selector(STR) native void function(@NUInt long value); | /**
* [@property] mipFilter
* <p>
* Filter options for filtering between two mipmap levels.
* <p>
* The default value is MTLSamplerMipFilterNotMipmapped
*/ | [@property] mipFilter Filter options for filtering between two mipmap levels. The default value is MTLSamplerMipFilterNotMipmapped | setMipFilter | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/metal/MTLSamplerDescriptor.java",
"license": "apache-2.0",
"size": 14791
} | [
"org.moe.natj.general.ann.NUInt",
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.general.ann.NUInt; import org.moe.natj.objc.ann.Selector; | import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,896,243 |
public void setBaseVal(float baseVal) throws DOMException {
try {
this.baseVal = baseVal;
valid = true;
changing = true;
element.setAttributeNS(namespaceURI, localName,
String.valueOf(baseVal));
} finally {
changing = false;
}
} | void function(float baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } } | /**
* <b>DOM</b>: Implements {@link SVGAnimatedNumber#setBaseVal(float)}.
*/ | DOM: Implements <code>SVGAnimatedNumber#setBaseVal(float)</code> | setBaseVal | {
"repo_name": "adufilie/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/svg/SVGOMAnimatedNumber.java",
"license": "apache-2.0",
"size": 6292
} | [
"org.w3c.dom.DOMException"
] | import org.w3c.dom.DOMException; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 486,681 |
public void ejbCreate() throws CreateException {
} | void function() throws CreateException { } | /**
* EJB Required method
*/ | EJB Required method | ejbCreate | {
"repo_name": "stephaneperry/Silverpeas-Core",
"path": "ejb-core/pdc/src/main/java/com/silverpeas/pdcSubscription/ejb/PdcSubscriptionBmEJB.java",
"license": "agpl-3.0",
"size": 26945
} | [
"javax.ejb.CreateException"
] | import javax.ejb.CreateException; | import javax.ejb.*; | [
"javax.ejb"
] | javax.ejb; | 654,402 |
public static boolean registerFluid(Fluid fluid)
{
masterFluidReference.put(uniqueName(fluid), fluid);
delegates.put(fluid, new FluidDelegate(fluid, fluid.getName()));
if (fluids.containsKey(fluid.getName()))
{
return false;
}
fluids.put(fluid.getName(), fluid);
maxID++;
fluidIDs.put(fluid, maxID);
fluidNames.put(maxID, fluid.getName());
defaultFluidName.put(fluid.getName(), uniqueName(fluid));
MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID));
return true;
} | static boolean function(Fluid fluid) { masterFluidReference.put(uniqueName(fluid), fluid); delegates.put(fluid, new FluidDelegate(fluid, fluid.getName())); if (fluids.containsKey(fluid.getName())) { return false; } fluids.put(fluid.getName(), fluid); maxID++; fluidIDs.put(fluid, maxID); fluidNames.put(maxID, fluid.getName()); defaultFluidName.put(fluid.getName(), uniqueName(fluid)); MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID)); return true; } | /**
* Register a new Fluid. If a fluid with the same name already exists, registration the alternative fluid is tracked
* in case it is the default in another place
*
* @param fluid
* The fluid to register.
* @return True if the fluid was registered as the current default fluid, false if it was only registered as an alternative
*/ | Register a new Fluid. If a fluid with the same name already exists, registration the alternative fluid is tracked in case it is the default in another place | registerFluid | {
"repo_name": "shadekiller666/MinecraftForge",
"path": "src/main/java/net/minecraftforge/fluids/FluidRegistry.java",
"license": "lgpl-2.1",
"size": 15377
} | [
"net.minecraftforge.common.MinecraftForge"
] | import net.minecraftforge.common.MinecraftForge; | import net.minecraftforge.common.*; | [
"net.minecraftforge.common"
] | net.minecraftforge.common; | 1,493,935 |
protected void engineSetHMACOutputLength(int HMACOutputLength)
throws XMLSignatureException {
throw new XMLSignatureException(
"algorithms.HMACOutputLengthOnlyForHMAC");
} | void function(int HMACOutputLength) throws XMLSignatureException { throw new XMLSignatureException( STR); } | /**
* Method engineSetHMACOutputLength
*
* @param HMACOutputLength
* @throws XMLSignatureException
*/ | Method engineSetHMACOutputLength | engineSetHMACOutputLength | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java",
"license": "apache-2.0",
"size": 12566
} | [
"com.sun.org.apache.xml.internal.security.signature.XMLSignatureException"
] | import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; | import com.sun.org.apache.xml.internal.security.signature.*; | [
"com.sun.org"
] | com.sun.org; | 599,787 |
Observable<ImagePrediction> executeAsync();
}
}
interface PredictionsDetectImageUrlWithNoStoreDefinition extends
PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithProjectId,
PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithPublishedName,
PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithUrl,
PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithExecute {
} | Observable<ImagePrediction> executeAsync(); } } interface PredictionsDetectImageUrlWithNoStoreDefinition extends PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithProjectId, PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithPublishedName, PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithUrl, PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithExecute { } | /**
* Execute the request asynchronously.
*
* @return the observable to the ImagePrediction object
*/ | Execute the request asynchronously | executeAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/Predictions.java",
"license": "mit",
"size": 38351
} | [
"com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction"
] | import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction; | import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,305,338 |
@Test
public void testAuthAndChiperedOkCrossCredential() throws Exception {
KeyStore clientKs = KeyStore.getInstance("PKCS12");
clientKs.load(null, null);
clientKs.setKeyEntry(kpAndCerts[0].cert.getSubjectDN().toString(), kpAndCerts[0].getPrivateKey(),
SslHelpers.DEFAULT_KS_PASSWD.toCharArray(), kpAndCerts[0].getCertAsCertArray());
X509Certificate[] clientTrustedCerts = kpAndCerts[1].getCertAsCertArray();
KeyStore serverKs = KeyStore.getInstance("PKCS12");
serverKs.load(null, null);
serverKs.setKeyEntry(kpAndCerts[1].cert.getSubjectDN().toString(), kpAndCerts[1].getPrivateKey(),
SslHelpers.DEFAULT_KS_PASSWD.toCharArray(), kpAndCerts[1].getCertAsCertArray());
X509Certificate[] serverTrustedCerts = kpAndCerts[0].getCertAsCertArray();
connectAndExchange(SecureMode.AUTH_AND_CIPHERED, clientKs, clientTrustedCerts, serverKs,
serverTrustedCerts);
} | void function() throws Exception { KeyStore clientKs = KeyStore.getInstance(STR); clientKs.load(null, null); clientKs.setKeyEntry(kpAndCerts[0].cert.getSubjectDN().toString(), kpAndCerts[0].getPrivateKey(), SslHelpers.DEFAULT_KS_PASSWD.toCharArray(), kpAndCerts[0].getCertAsCertArray()); X509Certificate[] clientTrustedCerts = kpAndCerts[1].getCertAsCertArray(); KeyStore serverKs = KeyStore.getInstance(STR); serverKs.load(null, null); serverKs.setKeyEntry(kpAndCerts[1].cert.getSubjectDN().toString(), kpAndCerts[1].getPrivateKey(), SslHelpers.DEFAULT_KS_PASSWD.toCharArray(), kpAndCerts[1].getCertAsCertArray()); X509Certificate[] serverTrustedCerts = kpAndCerts[0].getCertAsCertArray(); connectAndExchange(SecureMode.AUTH_AND_CIPHERED, clientKs, clientTrustedCerts, serverKs, serverTrustedCerts); } | /**
* Check that client and server are able to communicate:
* <ul>
* <li>Chipering and authentication</li>
* <li>Client and Server uses cross credential. server has client cert in it's truststore and vice versa</li>
* </ul>
*/ | Check that client and server are able to communicate: Chipering and authentication Client and Server uses cross credential. server has client cert in it's truststore and vice versa | testAuthAndChiperedOkCrossCredential | {
"repo_name": "lpellegr/programming",
"path": "programming-test/src/test/java/functionalTests/ssl/TestPASslSocketFactory.java",
"license": "agpl-3.0",
"size": 11665
} | [
"java.security.KeyStore",
"java.security.cert.X509Certificate",
"org.objectweb.proactive.extensions.ssl.SecureMode",
"org.objectweb.proactive.extensions.ssl.SslHelpers"
] | import java.security.KeyStore; import java.security.cert.X509Certificate; import org.objectweb.proactive.extensions.ssl.SecureMode; import org.objectweb.proactive.extensions.ssl.SslHelpers; | import java.security.*; import java.security.cert.*; import org.objectweb.proactive.extensions.ssl.*; | [
"java.security",
"org.objectweb.proactive"
] | java.security; org.objectweb.proactive; | 2,750,638 |
return new java.awt.Color(c.getRed(), c.getGreen(), c.getBlue());
} | return new java.awt.Color(c.getRed(), c.getGreen(), c.getBlue()); } | /**
* Converts a color from SWT to Swing.
* The argument Color remains owned by the caller.
*/ | Converts a color from SWT to Swing. The argument Color remains owned by the caller | convertColor | {
"repo_name": "FFY00/Helios",
"path": "src/main/java/org/eclipse/albireo/core/ResourceConverter.java",
"license": "apache-2.0",
"size": 2784
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,178,363 |
public static DataElementOperand getOperand( String expression )
throws NumberFormatException
{
Matcher matcher = ExpressionService.OPERAND_PATTERN.matcher( expression );
matcher.find();
String dataElement = StringUtils.trimToNull( matcher.group( 1 ) );
String categoryOptionCombo = StringUtils.trimToNull( matcher.group( 2 ) );
String operandType = categoryOptionCombo != null ? TYPE_VALUE : TYPE_TOTAL;
final DataElementOperand operand = new DataElementOperand( dataElement, categoryOptionCombo );
operand.setOperandType( operandType );
return operand;
}
// -------------------------------------------------------------------------
// Getters & setters
// -------------------------------------------------------------------------
| static DataElementOperand function( String expression ) throws NumberFormatException { Matcher matcher = ExpressionService.OPERAND_PATTERN.matcher( expression ); matcher.find(); String dataElement = StringUtils.trimToNull( matcher.group( 1 ) ); String categoryOptionCombo = StringUtils.trimToNull( matcher.group( 2 ) ); String operandType = categoryOptionCombo != null ? TYPE_VALUE : TYPE_TOTAL; final DataElementOperand operand = new DataElementOperand( dataElement, categoryOptionCombo ); operand.setOperandType( operandType ); return operand; } | /**
* Generates a DataElementOperand based on the given formula. The formula
* needs to be on the form "#{<dataelementid>.<categoryoptioncomboid>}".
*
* @param expression the formula.
* @return a DataElementOperand.
*/ | Generates a DataElementOperand based on the given formula. The formula needs to be on the form "#{.}" | getOperand | {
"repo_name": "uonafya/jphes-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java",
"license": "bsd-3-clause",
"size": 24282
} | [
"java.util.regex.Matcher",
"org.apache.commons.lang3.StringUtils",
"org.hisp.dhis.expression.ExpressionService"
] | import java.util.regex.Matcher; import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.expression.ExpressionService; | import java.util.regex.*; import org.apache.commons.lang3.*; import org.hisp.dhis.expression.*; | [
"java.util",
"org.apache.commons",
"org.hisp.dhis"
] | java.util; org.apache.commons; org.hisp.dhis; | 1,491,253 |
@Override
public AppiumServiceBuilder usingDriverExecutable(File nodeJSExecutable) {
return super.usingDriverExecutable(nodeJSExecutable);
} | AppiumServiceBuilder function(File nodeJSExecutable) { return super.usingDriverExecutable(nodeJSExecutable); } | /**
* Sets which Node.js the builder will use.
*
* @param nodeJSExecutable The executable Node.js to use.
* @return A self reference.
*/ | Sets which Node.js the builder will use | usingDriverExecutable | {
"repo_name": "dolszews/appium-tigerspike",
"path": "src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java",
"license": "apache-2.0",
"size": 17998
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,956,585 |
public boolean requestTblLoadAndWait(Set<TableName> requestedTbls)
throws InternalException {
return requestTblLoadAndWait(requestedTbls, MISSING_TBL_LOAD_WAIT_TIMEOUT_MS);
} | boolean function(Set<TableName> requestedTbls) throws InternalException { return requestTblLoadAndWait(requestedTbls, MISSING_TBL_LOAD_WAIT_TIMEOUT_MS); } | /**
* Overload of requestTblLoadAndWait that uses the default timeout.
*/ | Overload of requestTblLoadAndWait that uses the default timeout | requestTblLoadAndWait | {
"repo_name": "cloudera/recordservice",
"path": "fe/src/main/java/com/cloudera/impala/service/Frontend.java",
"license": "apache-2.0",
"size": 56702
} | [
"com.cloudera.impala.analysis.TableName",
"com.cloudera.impala.common.InternalException",
"java.util.Set"
] | import com.cloudera.impala.analysis.TableName; import com.cloudera.impala.common.InternalException; import java.util.Set; | import com.cloudera.impala.analysis.*; import com.cloudera.impala.common.*; import java.util.*; | [
"com.cloudera.impala",
"java.util"
] | com.cloudera.impala; java.util; | 621,957 |
public void createDocument(Object doc)
{
Assert.notNull(doc, "document cannot be null");
if (documentHelper.getRevision(doc) != null)
{
throw new IllegalStateException("Newly created docs can't have a revision ( is = " +
documentHelper.getRevision(doc) + " )");
}
createOrUpdateDocument(doc);
} | void function(Object doc) { Assert.notNull(doc, STR); if (documentHelper.getRevision(doc) != null) { throw new IllegalStateException(STR + documentHelper.getRevision(doc) + STR); } createOrUpdateDocument(doc); } | /**
* Creates the given document and updates the document's id and revision properties. If the
* document has an id property, a named document will be created, else the id will be generated by the server.
* assigned.
*
* @param doc Document to create.
* @throws IllegalStateException if the document already had a revision set
* @throws UpdateConflictException if there's an update conflict while updating the document
*/ | Creates the given document and updates the document's id and revision properties. If the document has an id property, a named document will be created, else the id will be generated by the server. assigned | createDocument | {
"repo_name": "eclipsesource/jcouchdb",
"path": "src/org/jcouchdb/db/Database.java",
"license": "bsd-3-clause",
"size": 42376
} | [
"org.jcouchdb.util.Assert"
] | import org.jcouchdb.util.Assert; | import org.jcouchdb.util.*; | [
"org.jcouchdb.util"
] | org.jcouchdb.util; | 1,258,790 |
public static Element getElementByAttributeValue(final Node start,
final String tagName, final String attrName, final String attrValue) {
NodeList nl = ((Element) start).getElementsByTagName(tagName);
int l = nl.getLength();
if (l == 0) {
return null;
}
Element e = null;
String compareValue = null;
for (int i = 0; i < l; i++) {
e = (Element) nl.item(i);
if (e.getNodeType() == Node.ELEMENT_NODE) {
compareValue = e.getAttribute(attrName);
if (compareValue.equals(attrValue)) {
return e;
}
}
}
return null;
} | static Element function(final Node start, final String tagName, final String attrName, final String attrValue) { NodeList nl = ((Element) start).getElementsByTagName(tagName); int l = nl.getLength(); if (l == 0) { return null; } Element e = null; String compareValue = null; for (int i = 0; i < l; i++) { e = (Element) nl.item(i); if (e.getNodeType() == Node.ELEMENT_NODE) { compareValue = e.getAttribute(attrName); if (compareValue.equals(attrValue)) { return e; } } } return null; } | /**
* equivalent to the XPath expression './/tagName[@attrName='attrValue']'
*/ | equivalent to the XPath expression './/tagName[@attrName='attrValue']' | getElementByAttributeValue | {
"repo_name": "IHTSDO/OTF-User-Module",
"path": "security/src/main/java/org/ihtsdo/otf/security/xml/base/XMLUtil.java",
"license": "apache-2.0",
"size": 38305
} | [
"org.w3c.dom.Element",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 211,900 |
public static int getIntersectionNumber(Set<Integer> scomm,
Set<Integer> gcomm) {
int num = 0;
if (scomm == null || gcomm == null) {
System.out.println("scomm or gcomm == null");
return num;
}
int scommSize = scomm.size();
int gcommSize = gcomm.size();
Set<Integer> tmp1 = null, tmp2 = null;
if (scommSize < gcommSize) {
tmp1 = scomm;
tmp2 = gcomm;
} else {
tmp1 = gcomm;
tmp2 = scomm;
}
for (int nodeId : tmp1) {
if (tmp2.contains(nodeId)) {
++num;
}
}
return num;
} | static int function(Set<Integer> scomm, Set<Integer> gcomm) { int num = 0; if (scomm == null gcomm == null) { System.out.println(STR); return num; } int scommSize = scomm.size(); int gcommSize = gcomm.size(); Set<Integer> tmp1 = null, tmp2 = null; if (scommSize < gcommSize) { tmp1 = scomm; tmp2 = gcomm; } else { tmp1 = gcomm; tmp2 = scomm; } for (int nodeId : tmp1) { if (tmp2.contains(nodeId)) { ++num; } } return num; } | /**
* Get the intersection of 2 sets
*
* @param scomm
* @param gcomm
* @return
*/ | Get the intersection of 2 sets | getIntersectionNumber | {
"repo_name": "sbarakat/graph-partitioning",
"path": "bin/ComQualityMetric/CommunityQualityUpdated.java",
"license": "mit",
"size": 21861
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,559,065 |
private static int getType(int ch)
{
if (UCharacterUtility.isNonCharacter(ch)) {
// not a character we return a invalid category count
return NON_CHARACTER_;
}
int result = UCharacter.getType(ch);
if (result == UCharacterCategory.SURROGATE) {
if (ch <= UTF16.LEAD_SURROGATE_MAX_VALUE) {
result = LEAD_SURROGATE_;
}
else {
result = TRAIL_SURROGATE_;
}
}
return result;
} | static int function(int ch) { if (UCharacterUtility.isNonCharacter(ch)) { return NON_CHARACTER_; } int result = UCharacter.getType(ch); if (result == UCharacterCategory.SURROGATE) { if (ch <= UTF16.LEAD_SURROGATE_MAX_VALUE) { result = LEAD_SURROGATE_; } else { result = TRAIL_SURROGATE_; } } return result; } | /**
* Gets the character extended type
* @param ch character to be tested
* @return extended type it is associated with
*/ | Gets the character extended type | getType | {
"repo_name": "UweTrottmann/QuickDic-Dictionary",
"path": "jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/impl/UCharacterName.java",
"license": "apache-2.0",
"size": 59040
} | [
"com.ibm.icu.lang.UCharacter",
"com.ibm.icu.lang.UCharacterCategory"
] | import com.ibm.icu.lang.UCharacter; import com.ibm.icu.lang.UCharacterCategory; | import com.ibm.icu.lang.*; | [
"com.ibm.icu"
] | com.ibm.icu; | 2,280,660 |
public static Map<Class, Collection<String>> getFieldMap(Class<? extends GraphDataObject> gdo) {
return getFieldMap(gdo, false);
} | static Map<Class, Collection<String>> function(Class<? extends GraphDataObject> gdo) { return getFieldMap(gdo, false); } | /** Returns a Map of all the possible objects that can be addressed in this domain object graph.
* Unmapped fields will not be included in the output.
* For each object, the Map will contain the Class and the associated Collection of Fields.
* @param gdo the Class for a graph data object.
* @return a Map of all possible objects that can be addressed in this domain object graph.
*/ | Returns a Map of all the possible objects that can be addressed in this domain object graph. Unmapped fields will not be included in the output. For each object, the Map will contain the Class and the associated Collection of Fields | getFieldMap | {
"repo_name": "snavaneethan1/jaffa-framework",
"path": "jaffa-soa/source/java/org/jaffa/soa/dataaccess/MappingFilter.java",
"license": "gpl-3.0",
"size": 27230
} | [
"java.util.Collection",
"java.util.Map",
"org.jaffa.soa.graph.GraphDataObject"
] | import java.util.Collection; import java.util.Map; import org.jaffa.soa.graph.GraphDataObject; | import java.util.*; import org.jaffa.soa.graph.*; | [
"java.util",
"org.jaffa.soa"
] | java.util; org.jaffa.soa; | 1,806,147 |
private void addDifference(LinkedList<ScanInfo> diffRecord,
Stats statsRecord, ScanInfo info) {
statsRecord.missingMetaFile += info.getMetaFile() == null ? 1 : 0;
statsRecord.missingBlockFile += info.getBlockFile() == null ? 1 : 0;
diffRecord.add(info);
} | void function(LinkedList<ScanInfo> diffRecord, Stats statsRecord, ScanInfo info) { statsRecord.missingMetaFile += info.getMetaFile() == null ? 1 : 0; statsRecord.missingBlockFile += info.getBlockFile() == null ? 1 : 0; diffRecord.add(info); } | /**
* Add the ScanInfo object to the list of differences and adjust the stats
* accordingly. This method is called when a block is found on the disk,
* but the in-memory block is missing or does not match the block on the disk.
*
* @param diffRecord the list to which to add the info
* @param statsRecord the stats to update
* @param info the differing info
*/ | Add the ScanInfo object to the list of differences and adjust the stats accordingly. This method is called when a block is found on the disk, but the in-memory block is missing or does not match the block on the disk | addDifference | {
"repo_name": "jaypatil/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java",
"license": "gpl-3.0",
"size": 23661
} | [
"java.util.LinkedList",
"org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi"
] | import java.util.LinkedList; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi; | import java.util.*; import org.apache.hadoop.hdfs.server.datanode.fsdataset.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,218,697 |
DriverManager.registerDriver(new MemDriver());
}
public MemDriver() {
super(0, 1, MEM_DRIVER_PREFIX);
} | DriverManager.registerDriver(new MemDriver()); } public MemDriver() { super(0, 1, MEM_DRIVER_PREFIX); } | /**
* Registers the driver with the JDBC {@link DriverManager}
*
* @throws SQLException
* Thrown if the driver cannot be registered
*/ | Registers the driver with the JDBC <code>DriverManager</code> | register | {
"repo_name": "hdadler/sensetrace-src",
"path": "com.ipv.sensetrace.RDFDatamanager/jena-2.11.0/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java",
"license": "gpl-2.0",
"size": 8040
} | [
"java.sql.DriverManager"
] | import java.sql.DriverManager; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,343,770 |
void dropItem(Vector3 position, BaseItemStack item, int count); | void dropItem(Vector3 position, BaseItemStack item, int count); | /**
* Drop an item at the given position.
*
* @param position the position
* @param item the item to drop
* @param count the number of individual stacks to drop (number of item entities)
*/ | Drop an item at the given position | dropItem | {
"repo_name": "HolodeckOne-Minecraft/WorldEdit",
"path": "worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java",
"license": "gpl-3.0",
"size": 12175
} | [
"com.sk89q.worldedit.blocks.BaseItemStack",
"com.sk89q.worldedit.math.Vector3"
] | import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.math.Vector3; | import com.sk89q.worldedit.blocks.*; import com.sk89q.worldedit.math.*; | [
"com.sk89q.worldedit"
] | com.sk89q.worldedit; | 2,449,472 |
public void getEmpty(String accountName) throws ErrorException, IOException, IllegalArgumentException {
getEmptyWithServiceResponseAsync(accountName).toBlocking().single().getBody();
} | void function(String accountName) throws ErrorException, IOException, IllegalArgumentException { getEmptyWithServiceResponseAsync(accountName).toBlocking().single().getBody(); } | /**
* Get a 200 to test a valid base uri.
*
* @param accountName Account Name
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
*/ | Get a 200 to test a valid base uri | getEmpty | {
"repo_name": "tbombach/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java",
"license": "mit",
"size": 5486
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,856,191 |
private void validateRequest(final RecordedRequest request) {
assertEquals(TEST_URL, request.getPath());
assertEquals(
request.getHeader(AUTHORIZATION),
String.format("%s %s", BEARER, TEST_TOKEN)
);
} | void function(final RecordedRequest request) { assertEquals(TEST_URL, request.getPath()); assertEquals( request.getHeader(AUTHORIZATION), String.format(STR, BEARER, TEST_TOKEN) ); } | /**
* Validates that a request was to our test URL, and that it
* contained the expected authorization header.
*/ | Validates that a request was to our test URL, and that it contained the expected authorization header | validateRequest | {
"repo_name": "jamesonwilliams/medium-sdk-java",
"path": "src/test/java/com/medium/api/dependencies/http/OkayHttpClientTest.java",
"license": "apache-2.0",
"size": 6739
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 592,718 |
@SuppressWarnings("unchecked")
private void assertSearch(final String userName, final Collection<String> roles, final int expectedResultCount)
throws ResponseException {
// input
final MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("q", userName);
if (roles != null) {
final String rolesAsCommaSeparatedString = StringUtils.join(roles, ",");
request.addParameter(UserResource1_8.PARAMETER_ROLES, rolesAsCommaSeparatedString);
}
final RequestContext context = RestUtil.getRequestContext(request, new MockHttpServletResponse());
// search
final SimpleObject simple = getResource().search(context);
final List<SimpleObject> results = (List<SimpleObject>) simple.get("results");
// verify
final String errorMessage = "Number of results does not match for: userName=" + userName + ", roles=" + roles
+ ", Results=" + results;
Assert.assertEquals(errorMessage, expectedResultCount, results.size());
}
/**
* Test searching users by user name.
*
* @see {@link https://issues.openmrs.org/browse/RESTWS-490} | @SuppressWarnings(STR) void function(final String userName, final Collection<String> roles, final int expectedResultCount) throws ResponseException { final MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("q", userName); if (roles != null) { final String rolesAsCommaSeparatedString = StringUtils.join(roles, ","); request.addParameter(UserResource1_8.PARAMETER_ROLES, rolesAsCommaSeparatedString); } final RequestContext context = RestUtil.getRequestContext(request, new MockHttpServletResponse()); final SimpleObject simple = getResource().search(context); final List<SimpleObject> results = (List<SimpleObject>) simple.get(STR); final String errorMessage = STR + userName + STR + roles + STR + results; Assert.assertEquals(errorMessage, expectedResultCount, results.size()); } /** * Test searching users by user name. * * @see {@link https: | /**
* Assert that a search with the given parameters returns an expected number of results.
*
* @param userName The user name to search for.
* @param roles The roles to search for.
* @param expectedResultCount The expected result count for the given search parameters.
* @throws ResponseException
*/ | Assert that a search with the given parameters returns an expected number of results | assertSearch | {
"repo_name": "PawelGutkowski/openmrs-module-webservices.rest",
"path": "omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/UserResource1_9Test.java",
"license": "mpl-2.0",
"size": 7107
} | [
"java.util.Collection",
"java.util.List",
"org.apache.commons.lang.StringUtils",
"org.junit.Assert",
"org.junit.Test",
"org.openmrs.module.webservices.rest.SimpleObject",
"org.openmrs.module.webservices.rest.web.RequestContext",
"org.openmrs.module.webservices.rest.web.RestUtil",
"org.openmrs.module.webservices.rest.web.response.ResponseException",
"org.springframework.mock.web.MockHttpServletRequest",
"org.springframework.mock.web.MockHttpServletResponse"
] | import java.util.Collection; import java.util.List; import org.apache.commons.lang.StringUtils; import org.junit.Assert; import org.junit.Test; import org.openmrs.module.webservices.rest.SimpleObject; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestUtil; import org.openmrs.module.webservices.rest.web.response.ResponseException; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; | import java.util.*; import org.apache.commons.lang.*; import org.junit.*; import org.openmrs.module.webservices.rest.*; import org.openmrs.module.webservices.rest.web.*; import org.openmrs.module.webservices.rest.web.response.*; import org.springframework.mock.web.*; | [
"java.util",
"org.apache.commons",
"org.junit",
"org.openmrs.module",
"org.springframework.mock"
] | java.util; org.apache.commons; org.junit; org.openmrs.module; org.springframework.mock; | 2,019,428 |
private String diff_linesToCharsMunge(String text, List<String> lineArray,
Map<String, Integer> lineHash) {
int lineStart = 0;
int lineEnd = -1;
String line;
StringBuilder chars = new StringBuilder();
// Walk the text, pulling out a substring for each line.
// text.split('\n') would would temporarily double our memory footprint.
// Modifying text would create many large strings to garbage collect.
while (lineEnd < text.length() - 1) {
lineEnd = text.indexOf('\n', lineStart);
if (lineEnd == -1) {
lineEnd = text.length() - 1;
}
line = text.substring(lineStart, lineEnd + 1);
lineStart = lineEnd + 1;
if (lineHash.containsKey(line)) {
chars.append(String.valueOf((char) (int) lineHash.get(line)));
} else {
lineArray.add(line);
lineHash.put(line, lineArray.size() - 1);
chars.append(String.valueOf((char) (lineArray.size() - 1)));
}
}
return chars.toString();
} | String function(String text, List<String> lineArray, Map<String, Integer> lineHash) { int lineStart = 0; int lineEnd = -1; String line; StringBuilder chars = new StringBuilder(); while (lineEnd < text.length() - 1) { lineEnd = text.indexOf('\n', lineStart); if (lineEnd == -1) { lineEnd = text.length() - 1; } line = text.substring(lineStart, lineEnd + 1); lineStart = lineEnd + 1; if (lineHash.containsKey(line)) { chars.append(String.valueOf((char) (int) lineHash.get(line))); } else { lineArray.add(line); lineHash.put(line, lineArray.size() - 1); chars.append(String.valueOf((char) (lineArray.size() - 1))); } } return chars.toString(); } | /**
* Split a text into a list of strings. Reduce the texts to a string of
* hashes where each Unicode character represents one line.
* @param text String to encode.
* @param lineArray List of unique strings.
* @param lineHash Map of strings to indices.
* @return Encoded string.
*/ | Split a text into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line | diff_linesToCharsMunge | {
"repo_name": "makiaea/Anki-Android",
"path": "src/com/ichi2/utils/DiffEngine.java",
"license": "gpl-3.0",
"size": 43347
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,067,865 |
public static String getDebugModes() {
return Arrays.stream(DebugMode.values())
.filter(m -> isInDebugMode(m))
.map(m -> m.toString())
.collect(Collectors.joining(","));
} | static String function() { return Arrays.stream(DebugMode.values()) .filter(m -> isInDebugMode(m)) .map(m -> m.toString()) .collect(Collectors.joining(",")); } | /**
* Gets the debug modes.
*
* @return A string containing the modes as csv.
*/ | Gets the debug modes | getDebugModes | {
"repo_name": "edijman/SOEN_6431_Colonization_Game",
"path": "src/net/sf/freecol/common/debug/FreeColDebugger.java",
"license": "gpl-2.0",
"size": 12071
} | [
"java.util.Arrays",
"java.util.stream.Collectors"
] | import java.util.Arrays; import java.util.stream.Collectors; | import java.util.*; import java.util.stream.*; | [
"java.util"
] | java.util; | 1,449,524 |
public State getTemporaryState() {
return temporaryState;
} | State function() { return temporaryState; } | /**
* Gets get temporary state.
*
* @return the get temporary state
*/ | Gets get temporary state | getTemporaryState | {
"repo_name": "seata/seata",
"path": "saga/seata-saga-engine/src/main/java/io/seata/saga/engine/pcext/StateInstruction.java",
"license": "apache-2.0",
"size": 4622
} | [
"io.seata.saga.statelang.domain.State"
] | import io.seata.saga.statelang.domain.State; | import io.seata.saga.statelang.domain.*; | [
"io.seata.saga"
] | io.seata.saga; | 660,003 |
private void recordDepScope(Node node, NameInformation name) {
Preconditions.checkNotNull(name);
scopes.put(node, name);
}
}
private class HoistVariableAndFunctionDeclarations
extends NodeTraversal.AbstractShallowCallback { | void function(Node node, NameInformation name) { Preconditions.checkNotNull(name); scopes.put(node, name); } } private class HoistVariableAndFunctionDeclarations extends NodeTraversal.AbstractShallowCallback { | /**
* Defines a dependency scope.
*/ | Defines a dependency scope | recordDepScope | {
"repo_name": "selkhateeb/closure-compiler",
"path": "src/com/google/javascript/jscomp/NameAnalyzer.java",
"license": "apache-2.0",
"size": 67568
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,402,331 |
public Point2D.Float parse(String s) {
Point2D.Float result;
String[] parts;
result = null;
if (s.indexOf(SEPARATOR) > 0) {
parts = s.split(SEPARATOR);
if (parts.length == 2) {
if (Utils.isFloat(parts[0]) && Utils.isFloat(parts[1]))
result = new Point2D.Float(Float.parseFloat(parts[0]), Float.parseFloat(parts[1]));
}
}
return result;
} | Point2D.Float function(String s) { Point2D.Float result; String[] parts; result = null; if (s.indexOf(SEPARATOR) > 0) { parts = s.split(SEPARATOR); if (parts.length == 2) { if (Utils.isFloat(parts[0]) && Utils.isFloat(parts[1])) result = new Point2D.Float(Float.parseFloat(parts[0]), Float.parseFloat(parts[1])); } } return result; } | /**
* Parses the string ("x;y").
*
* @param s the string to parse
* @return the generated {@link Point2D.Float} object, null if failed to parse
*/ | Parses the string ("x;y") | parse | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/main/java/adams/core/base/BasePointFloat.java",
"license": "gpl-3.0",
"size": 3672
} | [
"java.awt.geom.Point2D"
] | import java.awt.geom.Point2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,538,724 |
@Generated
@Selector("setFrame:")
public native void setFrame(@ByValue CGRect value); | @Selector(STR) native void function(@ByValue CGRect value); | /**
* animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead.
*/ | animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead | setFrame | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIView.java",
"license": "apache-2.0",
"size": 76797
} | [
"org.moe.natj.general.ann.ByValue",
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.general.ann.ByValue; import org.moe.natj.objc.ann.Selector; | import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,809,132 |
private void updateFunctionNode(JsMessage message, Node functionNode)
throws MalformedException {
checkNode(functionNode, Token.FUNCTION);
Node nameNode = functionNode.getFirstChild();
checkNode(nameNode, Token.NAME);
Node argListNode = nameNode.getNext();
checkNode(argListNode, Token.PARAM_LIST);
Node oldBlockNode = argListNode.getNext();
checkNode(oldBlockNode, Token.BLOCK);
Iterator<CharSequence> iterator = message.parts().iterator();
Node valueNode = iterator.hasNext()
? constructAddOrStringNode(iterator, argListNode)
: IR.string("");
Node newBlockNode = IR.block(IR.returnNode(valueNode));
// TODO(user): checkTreeEqual is overkill. I am in process of rewriting
// these functions.
if (newBlockNode.checkTreeEquals(oldBlockNode) != null) {
newBlockNode.useSourceInfoIfMissingFromForTree(oldBlockNode);
functionNode.replaceChild(oldBlockNode, newBlockNode);
compiler.reportCodeChange();
}
} | void function(JsMessage message, Node functionNode) throws MalformedException { checkNode(functionNode, Token.FUNCTION); Node nameNode = functionNode.getFirstChild(); checkNode(nameNode, Token.NAME); Node argListNode = nameNode.getNext(); checkNode(argListNode, Token.PARAM_LIST); Node oldBlockNode = argListNode.getNext(); checkNode(oldBlockNode, Token.BLOCK); Iterator<CharSequence> iterator = message.parts().iterator(); Node valueNode = iterator.hasNext() ? constructAddOrStringNode(iterator, argListNode) : IR.string(""); Node newBlockNode = IR.block(IR.returnNode(valueNode)); if (newBlockNode.checkTreeEquals(oldBlockNode) != null) { newBlockNode.useSourceInfoIfMissingFromForTree(oldBlockNode); functionNode.replaceChild(oldBlockNode, newBlockNode); compiler.reportCodeChange(); } } | /**
* Updates the descendants of a FUNCTION node to represent a message's value.
* <p>
* The tree looks something like:
* <pre>
* function
* |-- name
* |-- lp
* | |-- name <arg1>
* | -- name <arg2>
* -- block
* |
* --return
* |
* --add
* |-- string foo
* -- name <arg1>
* </pre>
*
* @param message a message
* @param functionNode the message's original FUNCTION value node
*
* @throws MalformedException if the passed node's subtree structure is
* not as expected
*/ | Updates the descendants of a FUNCTION node to represent a message's value. The tree looks something like: <code> function |-- name |-- lp | |-- name | -- name -- block | --return | --add |-- string foo -- name </code> | updateFunctionNode | {
"repo_name": "mbrukman/closure-compiler",
"path": "src/com/google/javascript/jscomp/ReplaceMessages.java",
"license": "apache-2.0",
"size": 12945
} | [
"com.google.javascript.rhino.IR",
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token",
"java.util.Iterator"
] | import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; import java.util.Iterator; | import com.google.javascript.rhino.*; import java.util.*; | [
"com.google.javascript",
"java.util"
] | com.google.javascript; java.util; | 1,928,435 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ApiManagementServiceGetSsoTokenResultInner>> getSsoTokenWithResponseAsync(
String resourceGroupName, String serviceName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.getSsoToken(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<ApiManagementServiceGetSsoTokenResultInner>> function( String resourceGroupName, String serviceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (serviceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .getSsoToken( this.client.getEndpoint(), resourceGroupName, serviceName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); } | /**
* Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the Single-Sign-On token for the API Management Service which is valid for 5 Minutes.
*/ | Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes | getSsoTokenWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/ApiManagementServicesClientImpl.java",
"license": "mit",
"size": 156165
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.apimanagement.fluent.models.ApiManagementServiceGetSsoTokenResultInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.apimanagement.fluent.models.ApiManagementServiceGetSsoTokenResultInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.apimanagement.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 89,515 |
public static JButton newAccuseButton(){
final JButton button = new JButton(" Accuse ");
button.addActionListener(new ActionListener() { | static JButton function(){ final JButton button = new JButton(STR); button.addActionListener(new ActionListener() { | /**
* Method that creates a button containing logic for the accusations - Past being a nice interface, actually does nothing yet as accuse is unimplemented as of yet
* @return Button containing logic for accuse Window
*/ | Method that creates a button containing logic for the accusations - Past being a nice interface, actually does nothing yet as accuse is unimplemented as of yet | newAccuseButton | {
"repo_name": "Sy4z/Cluedo",
"path": "src/ui/BoardFrame.java",
"license": "mit",
"size": 12938
} | [
"java.awt.event.ActionListener",
"javax.swing.JButton"
] | import java.awt.event.ActionListener; import javax.swing.JButton; | import java.awt.event.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,700,763 |
public ApiResponse<Void> retrieveServiceTransactionDocumentWithHttpInfo(String authorization, String transactionType, String documentCode) throws ApiException {
com.squareup.okhttp.Call call = retrieveServiceTransactionDocumentValidateBeforeCall(authorization, transactionType, documentCode, null, null);
return apiClient.execute(call);
} | ApiResponse<Void> function(String authorization, String transactionType, String documentCode) throws ApiException { com.squareup.okhttp.Call call = retrieveServiceTransactionDocumentValidateBeforeCall(authorization, transactionType, documentCode, null, null); return apiClient.execute(call); } | /**
* Retrieve service transactions
* Retrieve a single transaction
* @param authorization Bearer {auth} (required)
* @param transactionType Transaction Type (sale, purchase, receipts or payment) (required)
* @param documentCode Document Code (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ | Retrieve service transactions Retrieve a single transaction | retrieveServiceTransactionDocumentWithHttpInfo | {
"repo_name": "Avalara/avataxbr-clients",
"path": "java-client/src/main/java/io/swagger/client/api/ServiceCalculationsApi.java",
"license": "gpl-3.0",
"size": 60128
} | [
"io.swagger.client.ApiException",
"io.swagger.client.ApiResponse"
] | import io.swagger.client.ApiException; import io.swagger.client.ApiResponse; | import io.swagger.client.*; | [
"io.swagger.client"
] | io.swagger.client; | 2,294,421 |
@Override
public List<BatchClassDynamicPluginConfig> getDynamicPluginPropertiesForBatchClass(String batchClassIdentifier, String pluginName,
PluginProperty pluginProperty) {
DetachedCriteria criteria = criteria();
criteria.createAlias(BATCH_CLASS_PLUGIN, BATCH_CLASS_PLUGIN, JoinFragment.INNER_JOIN);
criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE, BATCH_CLASS_MODULE, JoinFragment.INNER_JOIN);
criteria.createAlias("batchClassPlugin.batchClassModule.batchClass", BATCH_CLASS, JoinFragment.INNER_JOIN);
criteria.createAlias("batchClassPlugin.plugin", "plugin", JoinFragment.INNER_JOIN);
criteria.createAlias("batchClassPlugin.batchClassDynamicPluginConfigs", "batchClassDynamicPluginConfigs",
JoinFragment.INNER_JOIN);
if (pluginProperty != null) {
criteria.add(Restrictions.eq("batchClassDynamicPluginConfigs.name", pluginProperty.getPropertyKey()));
}
criteria.add(Restrictions.eq("plugin.pluginName", pluginName));
criteria.add(Restrictions.eq("batchClass.identifier", batchClassIdentifier));
return find(criteria);
} | List<BatchClassDynamicPluginConfig> function(String batchClassIdentifier, String pluginName, PluginProperty pluginProperty) { DetachedCriteria criteria = criteria(); criteria.createAlias(BATCH_CLASS_PLUGIN, BATCH_CLASS_PLUGIN, JoinFragment.INNER_JOIN); criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE, BATCH_CLASS_MODULE, JoinFragment.INNER_JOIN); criteria.createAlias(STR, BATCH_CLASS, JoinFragment.INNER_JOIN); criteria.createAlias(STR, STR, JoinFragment.INNER_JOIN); criteria.createAlias(STR, STR, JoinFragment.INNER_JOIN); if (pluginProperty != null) { criteria.add(Restrictions.eq(STR, pluginProperty.getPropertyKey())); } criteria.add(Restrictions.eq(STR, pluginName)); criteria.add(Restrictions.eq(STR, batchClassIdentifier)); return find(criteria); } | /**
* To get Dynamic Plugin Properties for Batch Class.
*
* @param batchClassIdentifier String
* @param pluginName String
* @param pluginProperty PluginProperty
* @return List<BatchClassDynamicPluginConfig>
*/ | To get Dynamic Plugin Properties for Batch Class | getDynamicPluginPropertiesForBatchClass | {
"repo_name": "kuzavas/ephesoft",
"path": "dcma-data-access/src/main/java/com/ephesoft/dcma/da/dao/hibernate/BatchClassDynamicPluginConfigDaoImpl.java",
"license": "agpl-3.0",
"size": 7637
} | [
"com.ephesoft.dcma.core.common.PluginProperty",
"com.ephesoft.dcma.da.domain.BatchClassDynamicPluginConfig",
"java.util.List",
"org.hibernate.criterion.DetachedCriteria",
"org.hibernate.criterion.Restrictions",
"org.hibernate.sql.JoinFragment"
] | import com.ephesoft.dcma.core.common.PluginProperty; import com.ephesoft.dcma.da.domain.BatchClassDynamicPluginConfig; import java.util.List; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Restrictions; import org.hibernate.sql.JoinFragment; | import com.ephesoft.dcma.core.common.*; import com.ephesoft.dcma.da.domain.*; import java.util.*; import org.hibernate.criterion.*; import org.hibernate.sql.*; | [
"com.ephesoft.dcma",
"java.util",
"org.hibernate.criterion",
"org.hibernate.sql"
] | com.ephesoft.dcma; java.util; org.hibernate.criterion; org.hibernate.sql; | 1,665,702 |
@Test
public void testRegisterChildDefaultsHandler() {
final DefaultParametersManager manager = EasyMock.createMock(DefaultParametersManager.class);
final DefaultParametersHandler<BuilderParameters> handler = createDefaultsHandlerMock();
manager.registerDefaultsHandler(BuilderParameters.class, handler);
EasyMock.replay(manager, handler);
final CombinedBuilderParametersImpl params = new CombinedBuilderParametersImpl();
params.setChildDefaultParametersManager(manager);
assertSame("Wrong result", params, params.registerChildDefaultsHandler(BuilderParameters.class, handler));
EasyMock.verify(manager);
} | void function() { final DefaultParametersManager manager = EasyMock.createMock(DefaultParametersManager.class); final DefaultParametersHandler<BuilderParameters> handler = createDefaultsHandlerMock(); manager.registerDefaultsHandler(BuilderParameters.class, handler); EasyMock.replay(manager, handler); final CombinedBuilderParametersImpl params = new CombinedBuilderParametersImpl(); params.setChildDefaultParametersManager(manager); assertSame(STR, params, params.registerChildDefaultsHandler(BuilderParameters.class, handler)); EasyMock.verify(manager); } | /**
* Tests whether a defaults handler for a child source can be registered.
*/ | Tests whether a defaults handler for a child source can be registered | testRegisterChildDefaultsHandler | {
"repo_name": "apache/commons-configuration",
"path": "src/test/java/org/apache/commons/configuration2/builder/combined/TestCombinedBuilderParametersImpl.java",
"license": "apache-2.0",
"size": 17832
} | [
"org.apache.commons.configuration2.builder.BuilderParameters",
"org.apache.commons.configuration2.builder.DefaultParametersHandler",
"org.apache.commons.configuration2.builder.DefaultParametersManager",
"org.easymock.EasyMock",
"org.junit.Assert"
] | import org.apache.commons.configuration2.builder.BuilderParameters; import org.apache.commons.configuration2.builder.DefaultParametersHandler; import org.apache.commons.configuration2.builder.DefaultParametersManager; import org.easymock.EasyMock; import org.junit.Assert; | import org.apache.commons.configuration2.builder.*; import org.easymock.*; import org.junit.*; | [
"org.apache.commons",
"org.easymock",
"org.junit"
] | org.apache.commons; org.easymock; org.junit; | 2,497,959 |
static <T> Routed<T> of(Route route, RoutingResult routingResult, T value) {
requireNonNull(route, "route");
requireNonNull(routingResult, "routingResult");
requireNonNull(value, "value");
if (!routingResult.isPresent()) {
throw new IllegalArgumentException("routingResult: " + routingResult + " (must be present)");
}
return new Routed<>(route, routingResult, value);
}
@Nullable
private final Route route;
private final RoutingResult routingResult;
@Nullable
private final T value;
private Routed(@Nullable Route route, RoutingResult routingResult, @Nullable T value) {
assert route != null && value != null ||
route == null && value == null;
this.route = route;
this.routingResult = routingResult;
this.value = value;
} | static <T> Routed<T> of(Route route, RoutingResult routingResult, T value) { requireNonNull(route, "route"); requireNonNull(routingResult, STR); requireNonNull(value, "value"); if (!routingResult.isPresent()) { throw new IllegalArgumentException(STR + routingResult + STR); } return new Routed<>(route, routingResult, value); } private final Route route; private final RoutingResult routingResult; private final T value; private Routed(@Nullable Route route, RoutingResult routingResult, @Nullable T value) { assert route != null && value != null route == null && value == null; this.route = route; this.routingResult = routingResult; this.value = value; } | /**
* Creates a new {@link Routed} with the specified {@link Route}, {@link RoutingResult} and
* {@code value}.
*/ | Creates a new <code>Routed</code> with the specified <code>Route</code>, <code>RoutingResult</code> and value | of | {
"repo_name": "anuraaga/armeria",
"path": "core/src/main/java/com/linecorp/armeria/server/Routed.java",
"license": "apache-2.0",
"size": 3862
} | [
"java.util.Objects",
"javax.annotation.Nullable"
] | import java.util.Objects; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 2,365,255 |
public final HashMap<NodeAddress, LinkedList<NodeAddress>> getResults() {
return results;
} | final HashMap<NodeAddress, LinkedList<NodeAddress>> function() { return results; } | /**
* Gets an HashMap with the already computed path.
*
* @return an hash map with the computed results
*/ | Gets an HashMap with the already computed path | getResults | {
"repo_name": "sdnwiselab/sdn-wise-java",
"path": "ctrl/src/main/java/com/github/sdnwiselab/sdnwise/controller/AbstractController.java",
"license": "gpl-3.0",
"size": 24619
} | [
"com.github.sdnwiselab.sdnwise.util.NodeAddress",
"java.util.HashMap",
"java.util.LinkedList"
] | import com.github.sdnwiselab.sdnwise.util.NodeAddress; import java.util.HashMap; import java.util.LinkedList; | import com.github.sdnwiselab.sdnwise.util.*; import java.util.*; | [
"com.github.sdnwiselab",
"java.util"
] | com.github.sdnwiselab; java.util; | 83,234 |
@Override
public void mousePressed(MouseEvent me) {
if (popupButtonIsActive) {
showPopup();
}
else if ( !popupMenuIsShowing )
{
popupButtonIsActive = true;
}
}
}
| void function(MouseEvent me) { if (popupButtonIsActive) { showPopup(); } else if ( !popupMenuIsShowing ) { popupButtonIsActive = true; } } } | /**
* Catch the down stroke of mouse click to make the popup appear a tiny
* bit earlier.
*/ | Catch the down stroke of mouse click to make the popup appear a tiny bit earlier | mousePressed | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/argouml_critics/argouml-app/src/org/argouml/ui/ZoomSliderButton.java",
"license": "gpl-3.0",
"size": 11802
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,790,901 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.