method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void setControlEncoding(final FileSystemOptions opts, final String encoding) {
setParam(opts, ENCODING, encoding);
} | void function(final FileSystemOptions opts, final String encoding) { setParam(opts, ENCODING, encoding); } | /**
* See {@link org.apache.commons.net.ftp.FTP#setControlEncoding} for details and examples.
*
* @param opts The FileSystemOptions.
* @param encoding the encoding to use
* @since 2.0
*/ | See <code>org.apache.commons.net.ftp.FTP#setControlEncoding</code> for details and examples | setControlEncoding | {
"repo_name": "seeburger-ag/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java",
"license": "apache-2.0",
"size": 17410
} | [
"org.apache.commons.vfs2.FileSystemOptions"
] | import org.apache.commons.vfs2.FileSystemOptions; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
] | org.apache.commons; | 664,142 |
public T caseNamedOperator(NamedOperator object) {
return null;
} | T function(NamedOperator object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Named
* Operator</em>'. <!-- begin-user-doc --> This implementation returns null;
* returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Named
* Operator</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Named Operator'. This implementation returns null; returning a non-null result will terminate the switch. | caseNamedOperator | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/terms/util/TermsSwitch.java",
"license": "epl-1.0",
"size": 21460
} | [
"fr.lip6.move.pnml.pthlpng.terms.NamedOperator"
] | import fr.lip6.move.pnml.pthlpng.terms.NamedOperator; | import fr.lip6.move.pnml.pthlpng.terms.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 2,750,245 |
private void checkComment(DetailAST aAST, TextBlock aComment)
{
final List<JavadocTag> tags = getMethodTags(aComment);
if (hasShortCircuitTag(aAST, tags)) {
return;
}
Iterator<JavadocTag> it = tags.iterator();
if (aAST.getType() != TokenTypes.ANNOTATION_FIELD_DEF) {
// Check for inheritDoc
boolean hasInheritDocTag = false;
while (it.hasNext() && !hasInheritDocTag) {
hasInheritDocTag |= (it.next()).isInheritDocTag();
}
checkParamTags(tags, aAST, !hasInheritDocTag);
checkThrowsTags(tags, getThrows(aAST), !hasInheritDocTag);
if (isFunction(aAST)) {
checkReturnTag(tags, aAST.getLineNo(), !hasInheritDocTag);
}
}
// Dump out all unused tags
it = tags.iterator();
while (it.hasNext()) {
final JavadocTag jt = it.next();
if (!jt.isSeeOrInheritDocTag()) {
log(jt.getLineNo(), "javadoc.unusedTagGeneral");
}
}
} | void function(DetailAST aAST, TextBlock aComment) { final List<JavadocTag> tags = getMethodTags(aComment); if (hasShortCircuitTag(aAST, tags)) { return; } Iterator<JavadocTag> it = tags.iterator(); if (aAST.getType() != TokenTypes.ANNOTATION_FIELD_DEF) { boolean hasInheritDocTag = false; while (it.hasNext() && !hasInheritDocTag) { hasInheritDocTag = (it.next()).isInheritDocTag(); } checkParamTags(tags, aAST, !hasInheritDocTag); checkThrowsTags(tags, getThrows(aAST), !hasInheritDocTag); if (isFunction(aAST)) { checkReturnTag(tags, aAST.getLineNo(), !hasInheritDocTag); } } it = tags.iterator(); while (it.hasNext()) { final JavadocTag jt = it.next(); if (!jt.isSeeOrInheritDocTag()) { log(jt.getLineNo(), STR); } } } | /**
* Checks the Javadoc for a method.
*
* @param aAST the token for the method
* @param aComment the Javadoc comment
*/ | Checks the Javadoc for a method | checkComment | {
"repo_name": "Andrew0701/checkstyle",
"path": "src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java",
"license": "lgpl-2.1",
"size": 34330
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.TextBlock",
"com.puppycrawl.tools.checkstyle.api.TokenTypes",
"java.util.Iterator",
"java.util.List"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.Iterator; import java.util.List; | import com.puppycrawl.tools.checkstyle.api.*; import java.util.*; | [
"com.puppycrawl.tools",
"java.util"
] | com.puppycrawl.tools; java.util; | 2,700,330 |
public static YangCase getYangCaseNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
return new YangJavaCase();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
}
}
} | static YangCase function(GeneratedLanguage targetLanguage) { switch (targetLanguage) { case JAVA_GENERATION: { return new YangJavaCase(); } default: { throw new TranslatorException(STR); } } } | /**
* Returns based on the target language generate the inherited data model node.
*
* @param targetLanguage target language in which YANG mapping needs to be
* generated
* @return the corresponding inherited node based on the target language
*/ | Returns based on the target language generate the inherited data model node | getYangCaseNode | {
"repo_name": "paradisecr/ONOS-OXP",
"path": "utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java",
"license": "apache-2.0",
"size": 15453
} | [
"org.onosproject.yangutils.datamodel.YangCase",
"org.onosproject.yangutils.datamodel.utils.GeneratedLanguage",
"org.onosproject.yangutils.translator.exception.TranslatorException",
"org.onosproject.yangutils.translator.tojava.javamodel.YangJavaCase"
] | import org.onosproject.yangutils.datamodel.YangCase; import org.onosproject.yangutils.datamodel.utils.GeneratedLanguage; import org.onosproject.yangutils.translator.exception.TranslatorException; import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaCase; | import org.onosproject.yangutils.datamodel.*; import org.onosproject.yangutils.datamodel.utils.*; import org.onosproject.yangutils.translator.exception.*; import org.onosproject.yangutils.translator.tojava.javamodel.*; | [
"org.onosproject.yangutils"
] | org.onosproject.yangutils; | 1,754,032 |
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
YamlConfiguration config = SettingsManager.getInstance().getConfig();
var player = e.getPlayer();
MainScoreboardManager manager = MainScoreboardManager.getInstance();
if (!config.getBoolean("scoreboards.main.enable"))
return;
if (config.getStringList("scoreboards.main.worlds.enable").contains(player.getWorld().getName()))
//show scoreboard and other stuff
manager.register(player);
else if (config.getStringList("scoreboards.main.worlds.enable").contains(e.getFrom().getName())) {
//show scoreboard and other stuff
manager.remove(player);
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
}
} | void function(PlayerChangedWorldEvent e) { YamlConfiguration config = SettingsManager.getInstance().getConfig(); var player = e.getPlayer(); MainScoreboardManager manager = MainScoreboardManager.getInstance(); if (!config.getBoolean(STR)) return; if (config.getStringList(STR).contains(player.getWorld().getName())) manager.register(player); else if (config.getStringList(STR).contains(e.getFrom().getName())) { manager.remove(player); player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard()); } } | /**
* Handles the main scoreboard for players switching worlds
*
* @param e an event representing a player who switched between worlds
* @see PlayerChangedWorldEvent
* @since 3.1.1
*/ | Handles the main scoreboard for players switching worlds | onWorldChange | {
"repo_name": "stefvanschie/buildinggame",
"path": "buildinggame/src/main/java/com/gmail/stefvanschiedev/buildinggame/events/scoreboards/MainScoreboardWorldChange.java",
"license": "unlicense",
"size": 1547
} | [
"com.gmail.stefvanschiedev.buildinggame.managers.files.SettingsManager",
"com.gmail.stefvanschiedev.buildinggame.managers.scoreboards.MainScoreboardManager",
"org.bukkit.Bukkit",
"org.bukkit.configuration.file.YamlConfiguration",
"org.bukkit.event.player.PlayerChangedWorldEvent"
] | import com.gmail.stefvanschiedev.buildinggame.managers.files.SettingsManager; import com.gmail.stefvanschiedev.buildinggame.managers.scoreboards.MainScoreboardManager; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.event.player.PlayerChangedWorldEvent; | import com.gmail.stefvanschiedev.buildinggame.managers.files.*; import com.gmail.stefvanschiedev.buildinggame.managers.scoreboards.*; import org.bukkit.*; import org.bukkit.configuration.file.*; import org.bukkit.event.player.*; | [
"com.gmail.stefvanschiedev",
"org.bukkit",
"org.bukkit.configuration",
"org.bukkit.event"
] | com.gmail.stefvanschiedev; org.bukkit; org.bukkit.configuration; org.bukkit.event; | 2,815,837 |
static boolean equalsImpl(Set<?> s, @Nullable Object object){
if (s == object) {
return true;
}
if (object instanceof Set) {
Set<?> o = (Set<?>) object;
try {
return s.size() == o.size() && s.containsAll(o);
} catch (NullPointerException ignored) {
return false;
} catch (ClassCastException ignored) {
return false;
}
}
return false;
} | static boolean equalsImpl(Set<?> s, @Nullable Object object){ if (s == object) { return true; } if (object instanceof Set) { Set<?> o = (Set<?>) object; try { return s.size() == o.size() && s.containsAll(o); } catch (NullPointerException ignored) { return false; } catch (ClassCastException ignored) { return false; } } return false; } | /**
* An implementation for {@link Set#equals(Object)}.
*/ | An implementation for <code>Set#equals(Object)</code> | equalsImpl | {
"repo_name": "hceylan/guava",
"path": "guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Sets.java",
"license": "apache-2.0",
"size": 47528
} | [
"java.util.Set",
"javax.annotation.Nullable"
] | import java.util.Set; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 2,858,836 |
public String getLocalizedName()
{
return I18n.translateToLocal("item.brewingStand.name");
}
| String function() { return I18n.translateToLocal(STR); } | /**
* Gets the localized name of this block. Used for the statistics page.
*/ | Gets the localized name of this block. Used for the statistics page | getLocalizedName | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/block/BlockBrewingStand.java",
"license": "mpl-2.0",
"size": 7509
} | [
"net.minecraft.util.text.translation.I18n"
] | import net.minecraft.util.text.translation.I18n; | import net.minecraft.util.text.translation.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 2,112,877 |
public void updateEscalationOrder(Escalation escalation, List<EscalationAction> actions) {
if (actions.size() != escalation.getActions().size()) {
throw new IllegalArgumentException("Actions size must be the same");
}
for (Iterator<EscalationAction> i = actions.iterator(); i.hasNext();) {
EscalationAction action = i.next();
if (escalation.getAction(action.getAction().getId()) == null) {
throw new IllegalArgumentException("Action id=" + action.getAction().getId() +
" not found");
}
}
escalation.setActionsList(actions);
unscheduleEscalation(escalation);
} | void function(Escalation escalation, List<EscalationAction> actions) { if (actions.size() != escalation.getActions().size()) { throw new IllegalArgumentException(STR); } for (Iterator<EscalationAction> i = actions.iterator(); i.hasNext();) { EscalationAction action = i.next(); if (escalation.getAction(action.getAction().getId()) == null) { throw new IllegalArgumentException(STR + action.getAction().getId() + STR); } } escalation.setActionsList(actions); unscheduleEscalation(escalation); } | /**
* Re-order the actions for an escalation. If there are any states
* associated with the escalation, they will be cleared.
*
* @param actions a list of {@link EscalationAction}s (already contained
* within the escalation) specifying the new order.
*/ | Re-order the actions for an escalation. If there are any states associated with the escalation, they will be cleared | updateEscalationOrder | {
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/escalation/server/session/EscalationManagerImpl.java",
"license": "unlicense",
"size": 31648
} | [
"java.util.Iterator",
"java.util.List"
] | import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,339,378 |
public void afterStateRestored(AffinityTopologyVersion topVer); | void function(AffinityTopologyVersion topVer); | /**
* Initializes local data structures after partitions are restored from persistence.
*
* @param topVer Topology version.
*/ | Initializes local data structures after partitions are restored from persistence | afterStateRestored | {
"repo_name": "voipp/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java",
"license": "apache-2.0",
"size": 14699
} | [
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion"
] | import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; | import org.apache.ignite.internal.processors.affinity.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 968,511 |
@param dir
The location for the new image.
@return
An image suitable for package operations.
*/
public static IPSImage
createImage (File dir) throws java.net.MalformedURLException, java.io.IOException, InterruptedException, Exception
{
IPSImage img = createImage(dir, "default", new URL("http://pkg.sun.com/glassfish/v3prelude/release/"));
img.unsetAuthority("default");
return img;
}
/** Remove the configuration associated with the given authority. Well, actually, it seems not to do a thing... | @param dir The location for the new image. An image suitable for package operations. */ static IPSImage function (File dir) throws java.net.MalformedURLException, java.io.IOException, InterruptedException, Exception { IPSImage img = createImage(dir, STR, new URL("http: img.unsetAuthority(STR); return img; } /** Remove the configuration associated with the given authority. Well, actually, it seems not to do a thing... | /** Create an image without an authority.
@param dir
The location for the new image.
@return
An image suitable for package operations.
*/ | Create an image without an authority | createImage | {
"repo_name": "awilhelm/izpack-with-ips",
"path": "src/lib/com/izforge/izpack/installer/IPSImage.java",
"license": "apache-2.0",
"size": 4151
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,190,064 |
public static UUID getUUIDForCluster(ZKWatcher zkw) throws KeeperException {
String uuid = readClusterIdZNode(zkw);
return uuid == null ? null : UUID.fromString(uuid);
} | static UUID function(ZKWatcher zkw) throws KeeperException { String uuid = readClusterIdZNode(zkw); return uuid == null ? null : UUID.fromString(uuid); } | /**
* Get the UUID for the provided ZK watcher. Doesn't handle any ZK exceptions
* @param zkw watcher connected to an ensemble
* @return the UUID read from zookeeper
* @throws KeeperException if a ZooKeeper operation fails
*/ | Get the UUID for the provided ZK watcher. Doesn't handle any ZK exceptions | getUUIDForCluster | {
"repo_name": "HubSpot/hbase",
"path": "hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKClusterId.java",
"license": "apache-2.0",
"size": 3231
} | [
"java.util.UUID",
"org.apache.zookeeper.KeeperException"
] | import java.util.UUID; import org.apache.zookeeper.KeeperException; | import java.util.*; import org.apache.zookeeper.*; | [
"java.util",
"org.apache.zookeeper"
] | java.util; org.apache.zookeeper; | 2,482,185 |
public double getDistance() {
S2LatLng pokestop = S2LatLng.fromDegrees(getLatitude(), getLongitude());
S2LatLng player = S2LatLng.fromDegrees(api.latitude, api.longitude);
return pokestop.getEarthDistance(player);
} | double function() { S2LatLng pokestop = S2LatLng.fromDegrees(getLatitude(), getLongitude()); S2LatLng player = S2LatLng.fromDegrees(api.latitude, api.longitude); return pokestop.getEarthDistance(player); } | /**
* Returns the distance to a pokestop.
*
* @return the calculated distance
*/ | Returns the distance to a pokestop | getDistance | {
"repo_name": "Grover-c13/PokeGOAPI-Java",
"path": "library/src/main/java/com/pokegoapi/api/map/fort/Fort.java",
"license": "gpl-3.0",
"size": 8938
} | [
"com.pokegoapi.google.common.geometry.S2LatLng"
] | import com.pokegoapi.google.common.geometry.S2LatLng; | import com.pokegoapi.google.common.geometry.*; | [
"com.pokegoapi.google"
] | com.pokegoapi.google; | 649,438 |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity();
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
String predefinedName = getArguments().getString(ARG_NAME);
ArrayAdapter<String> autoCompleteEmailAdapter = new ArrayAdapter<String>
(getActivity(), android.R.layout.simple_spinner_dropdown_item,
ContactHelper.getPossibleUserEmails(getActivity())
);
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity);
alert.setTitle(R.string.edit_key_action_add_identity);
LayoutInflater inflater = activity.getLayoutInflater();
View view = inflater.inflate(R.layout.add_user_id_dialog, null);
alert.setView(view);
mName = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_name);
mEmail = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_address);
mComment = (EditText) view.findViewById(R.id.add_user_id_comment);
mName.setText(predefinedName); | Dialog function(Bundle savedInstanceState) { final Activity activity = getActivity(); mMessenger = getArguments().getParcelable(ARG_MESSENGER); String predefinedName = getArguments().getString(ARG_NAME); ArrayAdapter<String> autoCompleteEmailAdapter = new ArrayAdapter<String> (getActivity(), android.R.layout.simple_spinner_dropdown_item, ContactHelper.getPossibleUserEmails(getActivity()) ); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity); alert.setTitle(R.string.edit_key_action_add_identity); LayoutInflater inflater = activity.getLayoutInflater(); View view = inflater.inflate(R.layout.add_user_id_dialog, null); alert.setView(view); mName = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_name); mEmail = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_address); mComment = (EditText) view.findViewById(R.id.add_user_id_comment); mName.setText(predefinedName); | /**
* Creates dialog
*/ | Creates dialog | onCreateDialog | {
"repo_name": "cketti/open-keychain",
"path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/AddUserIdDialogFragment.java",
"license": "gpl-3.0",
"size": 10140
} | [
"android.app.Activity",
"android.app.Dialog",
"android.os.Bundle",
"android.view.LayoutInflater",
"android.view.View",
"android.widget.ArrayAdapter",
"android.widget.AutoCompleteTextView",
"android.widget.EditText",
"org.sufficientlysecure.keychain.util.ContactHelper"
] | import android.app.Activity; import android.app.Dialog; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.EditText; import org.sufficientlysecure.keychain.util.ContactHelper; | import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import org.sufficientlysecure.keychain.util.*; | [
"android.app",
"android.os",
"android.view",
"android.widget",
"org.sufficientlysecure.keychain"
] | android.app; android.os; android.view; android.widget; org.sufficientlysecure.keychain; | 2,148,668 |
public Organization getOrganization() {
return organization;
} | Organization function() { return organization; } | /**
* Gets the organization attribute.
*
* @return Returns the organization
*/ | Gets the organization attribute | getOrganization | {
"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.Organization"
] | import org.kuali.kfs.coa.businessobject.Organization; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 604,252 |
public CreateNotationalElementCommand getCreateShortcutCommand(View containerView, EObject underlyingModelObject); | CreateNotationalElementCommand function(View containerView, EObject underlyingModelObject); | /**
* Returns the command to create a shortcut in the given containerView for the given underlying model object.
* May return <code>null</code> if the receiver is not applicable for the given underlying model object.
*/ | Returns the command to create a shortcut in the given containerView for the given underlying model object. May return <code>null</code> if the receiver is not applicable for the given underlying model object | getCreateShortcutCommand | {
"repo_name": "mikesligo/visGrid",
"path": "ie.tcd.gmf.visGrid.plugin/src/org/eclipse/gmf/runtime/lite/shortcuts/IShortcutProvider.java",
"license": "gpl-3.0",
"size": 1552
} | [
"org.eclipse.emf.ecore.EObject",
"org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand",
"org.eclipse.gmf.runtime.notation.View"
] | import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand; import org.eclipse.gmf.runtime.notation.View; | import org.eclipse.emf.ecore.*; import org.eclipse.gmf.runtime.lite.commands.*; import org.eclipse.gmf.runtime.notation.*; | [
"org.eclipse.emf",
"org.eclipse.gmf"
] | org.eclipse.emf; org.eclipse.gmf; | 697,358 |
@Deprecated
public static Boolean canCreateTables(Class<?> implementingClass, Configuration conf) {
return org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator.canCreateTables(implementingClass, conf);
} | static Boolean function(Class<?> implementingClass, Configuration conf) { return org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator.canCreateTables(implementingClass, conf); } | /**
* Determines whether tables are permitted to be created as needed.
*
* @param implementingClass
* the class whose name will be used as a prefix for the property configuration key
* @param conf
* the Hadoop configuration object to configure
* @return true if the feature is disabled, false otherwise
* @deprecated since 1.6.0; Configure your job with the appropriate InputFormat or OutputFormat.
* @since 1.5.0
* @see #setCreateTables(Class, Configuration, boolean)
*/ | Determines whether tables are permitted to be created as needed | canCreateTables | {
"repo_name": "dhutchis/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/OutputConfigurator.java",
"license": "apache-2.0",
"size": 8286
} | [
"org.apache.hadoop.conf.Configuration"
] | import org.apache.hadoop.conf.Configuration; | import org.apache.hadoop.conf.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,886,420 |
protected void export( MWProject project, File deploymentFile, String ejbJarXMLDir, boolean failOnError, String url, String driverclass, String user, String password) {
if( project instanceof MWOXProject) {
this.exportOXProject( project, deploymentFile);
}
else if( project instanceof MWEisProject) {
this.exportEisProject( project, deploymentFile, url, driverclass, user, password);
}
else {
this.exportRelationalProject( project, deploymentFile, url, driverclass, user, password);
}
} | void function( MWProject project, File deploymentFile, String ejbJarXMLDir, boolean failOnError, String url, String driverclass, String user, String password) { if( project instanceof MWOXProject) { this.exportOXProject( project, deploymentFile); } else if( project instanceof MWEisProject) { this.exportEisProject( project, deploymentFile, url, driverclass, user, password); } else { this.exportRelationalProject( project, deploymentFile, url, driverclass, user, password); } } | /**
* Generate TopLink deployment descriptor XML or the ejb-jar.xml depending the type of project.
*/ | Generate TopLink deployment descriptor XML or the ejb-jar.xml depending the type of project | export | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "utils/eclipselink.utils.workbench/mappingsplugin/source/org/eclipse/persistence/tools/workbench/ant/ProjectExporter.java",
"license": "epl-1.0",
"size": 7940
} | [
"java.io.File",
"org.eclipse.persistence.tools.workbench.mappingsmodel.project.MWProject",
"org.eclipse.persistence.tools.workbench.mappingsmodel.project.xml.MWEisProject",
"org.eclipse.persistence.tools.workbench.mappingsmodel.project.xml.MWOXProject"
] | import java.io.File; import org.eclipse.persistence.tools.workbench.mappingsmodel.project.MWProject; import org.eclipse.persistence.tools.workbench.mappingsmodel.project.xml.MWEisProject; import org.eclipse.persistence.tools.workbench.mappingsmodel.project.xml.MWOXProject; | import java.io.*; import org.eclipse.persistence.tools.workbench.mappingsmodel.project.*; import org.eclipse.persistence.tools.workbench.mappingsmodel.project.xml.*; | [
"java.io",
"org.eclipse.persistence"
] | java.io; org.eclipse.persistence; | 61,315 |
public Adapter createAnnotationAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link org.yakindu.base.types.Annotation <em>Annotation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.yakindu.base.types.Annotation
* @generated
*/ | Creates a new adapter for an object of class '<code>org.yakindu.base.types.Annotation Annotation</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createAnnotationAdapter | {
"repo_name": "Yakindu/statecharts",
"path": "plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/util/TypesAdapterFactory.java",
"license": "epl-1.0",
"size": 19611
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 357,464 |
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfShortArrayIPv4() {
IpAddress ipAddress;
byte[] value;
value = new byte[] {1, 2, 3};
ipAddress = IpAddress.valueOf(IpAddress.Version.INET, value);
} | @Test(expected = IllegalArgumentException.class) void function() { IpAddress ipAddress; byte[] value; value = new byte[] {1, 2, 3}; ipAddress = IpAddress.valueOf(IpAddress.Version.INET, value); } | /**
* Tests invalid valueOf() converger for an array that is too short for
* IPv4.
*/ | Tests invalid valueOf() converger for an array that is too short for IPv4 | testInvalidValueOfShortArrayIPv4 | {
"repo_name": "kuangrewawa/OnosFw",
"path": "utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java",
"license": "apache-2.0",
"size": 32395
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,413,436 |
public void addProgressListener(ProgressListener listener) {
if (progressListeners == null) {
progressListeners = new LinkedHashSet<ProgressListener>();
}
progressListeners.add(listener);
}
/**
* @deprecated As of 7.0, replaced by
* {@link #addProgressListener(ProgressListener)} | void function(ProgressListener listener) { if (progressListeners == null) { progressListeners = new LinkedHashSet<ProgressListener>(); } progressListeners.add(listener); } /** * @deprecated As of 7.0, replaced by * {@link #addProgressListener(ProgressListener)} | /**
* Adds the upload progress event listener.
*
* @param listener
* the progress listener to be added
*/ | Adds the upload progress event listener | addProgressListener | {
"repo_name": "peterl1084/framework",
"path": "compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java",
"license": "apache-2.0",
"size": 35695
} | [
"java.util.LinkedHashSet"
] | import java.util.LinkedHashSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,366,792 |
@Override
public BeanInfo[] getAdditionalBeanInfo() {
try {
return new BeanInfo[] {
Introspector.getBeanInfo(Schema.class.getSuperclass())
};
} catch(IntrospectionException err) {
throw new AssertionError(err);
}
} | BeanInfo[] function() { try { return new BeanInfo[] { Introspector.getBeanInfo(Schema.class.getSuperclass()) }; } catch(IntrospectionException err) { throw new AssertionError(err); } } | /**
* Include base class.
*/ | Include base class | getAdditionalBeanInfo | {
"repo_name": "aoindustries/aoserv-client",
"path": "src/main/java/com/aoindustries/aoserv/client/postgresql/SchemaBeanInfo.java",
"license": "lgpl-3.0",
"size": 2343
} | [
"java.beans.BeanInfo",
"java.beans.IntrospectionException",
"java.beans.Introspector"
] | import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; | import java.beans.*; | [
"java.beans"
] | java.beans; | 631,316 |
public void setZeppelinhubUrl(String url) {
if (StringUtils.isBlank(url)) {
LOG.warn("Zeppelinhub url is empty, setting up default url {}", DEFAULT_ZEPPELINHUB_URL);
zeppelinhubUrl = DEFAULT_ZEPPELINHUB_URL;
} else {
zeppelinhubUrl = (isZeppelinHubUrlValid(url) ? url : DEFAULT_ZEPPELINHUB_URL);
LOG.info("Setting up Zeppelinhub url to {}", zeppelinhubUrl);
}
} | void function(String url) { if (StringUtils.isBlank(url)) { LOG.warn(STR, DEFAULT_ZEPPELINHUB_URL); zeppelinhubUrl = DEFAULT_ZEPPELINHUB_URL; } else { zeppelinhubUrl = (isZeppelinHubUrlValid(url) ? url : DEFAULT_ZEPPELINHUB_URL); LOG.info(STR, zeppelinhubUrl); } } | /**
* Setter of ZeppelinHub URL, this will be called by Shiro based on zeppelinhubUrl property
* in shiro.ini file.</p>
* It will also perform a check of ZeppelinHub url {@link #isZeppelinHubUrlValid},
* if the url is not valid, the default zeppelinhub url will be used.
*
* @param url
*/ | Setter of ZeppelinHub URL, this will be called by Shiro based on zeppelinhubUrl property in shiro.ini file. It will also perform a check of ZeppelinHub url <code>#isZeppelinHubUrlValid</code>, if the url is not valid, the default zeppelinhub url will be used | setZeppelinhubUrl | {
"repo_name": "anthonycorbacho/incubator-zeppelin",
"path": "zeppelin-server/src/main/java/org/apache/zeppelin/realm/ZeppelinHubRealm.java",
"license": "apache-2.0",
"size": 8713
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,057,914 |
PictureDto createNewPicture() throws CillaServiceException; | PictureDto createNewPicture() throws CillaServiceException; | /**
* Creates a new {@link PictureDto}.
*
* @return {@link PictureDto} that was created
*/ | Creates a new <code>PictureDto</code> | createNewPicture | {
"repo_name": "shred/cilla",
"path": "cilla-ws/src/main/java/org/shredzone/cilla/ws/page/PageWs.java",
"license": "agpl-3.0",
"size": 4820
} | [
"org.shredzone.cilla.ws.exception.CillaServiceException"
] | import org.shredzone.cilla.ws.exception.CillaServiceException; | import org.shredzone.cilla.ws.exception.*; | [
"org.shredzone.cilla"
] | org.shredzone.cilla; | 60,005 |
public String HMAC_SHA256(String toGetHash, String secret)
{
String authKey = "erro ao encriptar";
Base64 base64 = new Base64();
try
{
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(base64.decode(secret), "HmacSHA256"));
authKey = new String(base64.encode(mac.doFinal(toGetHash.getBytes("UTF-8"))));
}
catch (Exception e)
{
System.out.println("Error: " + e.toString());
}
return authKey;
}
//copiado do github do azure
private static final String RFC1123_PATTERN = "EEE, dd MMM yyyy HH:mm:ss z"; | String function(String toGetHash, String secret) { String authKey = STR; Base64 base64 = new Base64(); try { Mac mac = Mac.getInstance(STR); mac.init(new SecretKeySpec(base64.decode(secret), STR)); authKey = new String(base64.encode(mac.doFinal(toGetHash.getBytes("UTF-8")))); } catch (Exception e) { System.out.println(STR + e.toString()); } return authKey; } private static final String RFC1123_PATTERN = STR; | /**
* Gera o hash da string passada como paramentro. Conforme especificado pela MS.
* @param toGetHash String da qual se espera obter o hash.
* @return String contendo o hash gerado.
*/ | Gera o hash da string passada como paramentro. Conforme especificado pela MS | HMAC_SHA256 | {
"repo_name": "viniciusmaboni/azureDownUp",
"path": "src/main/java/inf/ufg/services/AuthorizationAzure.java",
"license": "gpl-2.0",
"size": 8138
} | [
"javax.crypto.Mac",
"javax.crypto.spec.SecretKeySpec",
"org.apache.commons.codec.binary.Base64"
] | import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; | import javax.crypto.*; import javax.crypto.spec.*; import org.apache.commons.codec.binary.*; | [
"javax.crypto",
"org.apache.commons"
] | javax.crypto; org.apache.commons; | 2,191,480 |
public static <T> ValueBuilder faultBodyAs(Class<T> type) {
Expression expression = ExpressionBuilder.faultBodyExpression(type);
return new ValueBuilder(expression);
}
| static <T> ValueBuilder function(Class<T> type) { Expression expression = ExpressionBuilder.faultBodyExpression(type); return new ValueBuilder(expression); } | /**
* Returns a predicate and value builder for the fault message body as a
* specific type
*/ | Returns a predicate and value builder for the fault message body as a specific type | faultBodyAs | {
"repo_name": "everttigchelaar/camel-svn",
"path": "camel-core/src/main/java/org/apache/camel/builder/Builder.java",
"license": "apache-2.0",
"size": 8221
} | [
"org.apache.camel.Expression"
] | import org.apache.camel.Expression; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 426,497 |
public boolean canAcceptChild(Class<? extends ElementBase> childClass) {
if (!canAcceptChild()) {
return false;
}
Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass);
int max = cardinality.getMaxOccurrences();
if (max == 0) {
rejectReason = getDisplayName() + " does not accept " + childClass.getSimpleName() + " as a child.";
} else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) {
rejectReason = getDisplayName() + " cannot accept more than " + max + " of "
+ cardinality.getTargetClass().getSimpleName() + ".";
}
return rejectReason == null;
} | boolean function(Class<? extends ElementBase> childClass) { if (!canAcceptChild()) { return false; } Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass); int max = cardinality.getMaxOccurrences(); if (max == 0) { rejectReason = getDisplayName() + STR + childClass.getSimpleName() + STR; } else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) { rejectReason = getDisplayName() + STR + max + STR + cardinality.getTargetClass().getSimpleName() + "."; } return rejectReason == null; } | /**
* Returns true if this element may accept a child of the specified class. Updates the reject
* reason with the result.
*
* @param childClass Child class to test.
* @return True if this element may accept a child of the specified class.
*/ | Returns true if this element may accept a child of the specified class. Updates the reject reason with the result | canAcceptChild | {
"repo_name": "carewebframework/carewebframework-core",
"path": "org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java",
"license": "apache-2.0",
"size": 32757
} | [
"org.carewebframework.shell.ancillary.RelatedClassMap"
] | import org.carewebframework.shell.ancillary.RelatedClassMap; | import org.carewebframework.shell.ancillary.*; | [
"org.carewebframework.shell"
] | org.carewebframework.shell; | 996,524 |
synchronized long tryRecordSize(AtomicLong totalSize) {
if (recordedSize >= 0) {
return _recordSize(totalSize);
}
return -1;
} | synchronized long tryRecordSize(AtomicLong totalSize) { if (recordedSize >= 0) { return _recordSize(totalSize); } return -1; } | /**
* Attempt to record size if not evicted.
*
* @return -1 if evicted
*/ | Attempt to record size if not evicted | tryRecordSize | {
"repo_name": "milleruntime/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/CachedBlock.java",
"license": "apache-2.0",
"size": 4947
} | [
"java.util.concurrent.atomic.AtomicLong"
] | import java.util.concurrent.atomic.AtomicLong; | import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 458,143 |
public static <D> void iterateDfs(
D rootData, NodeDataAdapter<D> dataAdapter, Visitor<D> callback) {
LinkedList<D> nodes = new LinkedList<>();
nodes.add(rootData);
// Iterative DFS.
while (!nodes.isEmpty()) {
D parentNodeData = nodes.pop();
boolean willVisitChildren = false;
List<D> children = dataAdapter.getChildren(parentNodeData);
for (int i = 0, n = children.size(); i < n; i++) {
D child = children.get(i);
if (callback.shouldVisit(child)) {
// Add a filtered child to the stack of the nodes to visit.
nodes.add(child);
willVisitChildren = true;
}
}
callback.visit(parentNodeData, willVisitChildren);
}
} | static <D> void function( D rootData, NodeDataAdapter<D> dataAdapter, Visitor<D> callback) { LinkedList<D> nodes = new LinkedList<>(); nodes.add(rootData); while (!nodes.isEmpty()) { D parentNodeData = nodes.pop(); boolean willVisitChildren = false; List<D> children = dataAdapter.getChildren(parentNodeData); for (int i = 0, n = children.size(); i < n; i++) { D child = children.get(i); if (callback.shouldVisit(child)) { nodes.add(child); willVisitChildren = true; } } callback.visit(parentNodeData, willVisitChildren); } } | /**
* Recursively iterates children of a given root node using DFS.
*
* @param rootData root node to start the iteration from
* @param dataAdapter data adapter to get the children of a node
* @param callback iteration callback
*/ | Recursively iterates children of a given root node using DFS | iterateDfs | {
"repo_name": "Patricol/che",
"path": "ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/tree/Tree.java",
"license": "epl-1.0",
"size": 57928
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 725,987 |
String original() throws IOException; | String original() throws IOException; | /**
* Get the original yaml.
*
* @return the string representation of the original yaml
* @throws Exception if unable to obtain the original
*/ | Get the original yaml | original | {
"repo_name": "dstl/baleen",
"path": "baleen-core/src/main/java/uk/gov/dstl/baleen/core/utils/yaml/Yaml.java",
"license": "apache-2.0",
"size": 984
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,699,315 |
protected void pop(View view) {
ImageButton b = (ImageButton)view;
setBalloonPosition(b);
if (score == 0) {
// First click, start a new timer
startTimer();
}
score++;
((TextView) findViewById(R.id.textView_clickcount)).setText("Level " + (currentLevel+1) + " Pops: " + score + "/" + GameActivity.SCORE_BY_LEVEL[currentLevel]);
}
| void function(View view) { ImageButton b = (ImageButton)view; setBalloonPosition(b); if (score == 0) { startTimer(); } score++; ((TextView) findViewById(R.id.textView_clickcount)).setText(STR + (currentLevel+1) + STR + score + "/" + GameActivity.SCORE_BY_LEVEL[currentLevel]); } | /**
* Response to popping a balloon, updates score and attached text view.
* @param view - The view this method was called from
*/ | Response to popping a balloon, updates score and attached text view | pop | {
"repo_name": "abnegate/android-pop",
"path": "src/jakebarnby/pop/GameActivity.java",
"license": "gpl-2.0",
"size": 10506
} | [
"android.view.View",
"android.widget.ImageButton",
"android.widget.TextView"
] | import android.view.View; import android.widget.ImageButton; import android.widget.TextView; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 355,485 |
@Test
public void testZipArchiveFile() throws Exception {
System.out.println("zipArchiveFile");
File file = null;
String ext = "";
String basedir = "";
ZipUtils instance = new ZipUtils();
File expResult = null;
File result = instance.zipArchiveFile(file, ext, basedir);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
} | void function() throws Exception { System.out.println(STR); File file = null; String ext = STRSTRThe test case is a prototype."); } | /**
* Test of zipArchiveFile method, of class ZipUtils.
*/ | Test of zipArchiveFile method, of class ZipUtils | testZipArchiveFile | {
"repo_name": "vrezin/bookcase",
"path": "src/test/java/com/hc/bookcase/book/utils/ZipUtilsTest.java",
"license": "gpl-3.0",
"size": 3214
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 615,369 |
public static long getLastMoviesWatchedAt(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.getLong(KEY_LAST_MOVIES_WATCHED_AT, 0);
} | static long function(Context context) { return PreferenceManager.getDefaultSharedPreferences(context) .getLong(KEY_LAST_MOVIES_WATCHED_AT, 0); } | /**
* The last time movie watched flags have changed or 0 if no value exists.
*/ | The last time movie watched flags have changed or 0 if no value exists | getLastMoviesWatchedAt | {
"repo_name": "epiphany27/SeriesGuide",
"path": "SeriesGuide/src/main/java/com/battlelancer/seriesguide/settings/TraktSettings.java",
"license": "apache-2.0",
"size": 7665
} | [
"android.content.Context",
"android.preference.PreferenceManager"
] | import android.content.Context; import android.preference.PreferenceManager; | import android.content.*; import android.preference.*; | [
"android.content",
"android.preference"
] | android.content; android.preference; | 2,362,203 |
@SideOnly(Side.CLIENT)
public static int rgb(int rIn, int gIn, int bIn)
{
int lvt_3_1_ = (rIn << 8) + gIn;
lvt_3_1_ = (lvt_3_1_ << 8) + bIn;
return lvt_3_1_;
} | @SideOnly(Side.CLIENT) static int function(int rIn, int gIn, int bIn) { int lvt_3_1_ = (rIn << 8) + gIn; lvt_3_1_ = (lvt_3_1_ << 8) + bIn; return lvt_3_1_; } | /**
* Makes a single int color with the given red, green, and blue values.
*/ | Makes a single int color with the given red, green, and blue values | rgb | {
"repo_name": "SuperUnitato/UnLonely",
"path": "build/tmp/recompileMc/sources/net/minecraft/util/math/MathHelper.java",
"license": "lgpl-2.1",
"size": 17560
} | [
"net.minecraftforge.fml.relauncher.Side",
"net.minecraftforge.fml.relauncher.SideOnly"
] | import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; | import net.minecraftforge.fml.relauncher.*; | [
"net.minecraftforge.fml"
] | net.minecraftforge.fml; | 2,653,201 |
public static ChunkCoordinates mirrorCellTo(ChunkCoordinates piecePos, int cellSize,
CellIndexDirection cellIndexDirection) {
if (cellIndexDirection == CellIndexDirection.NorthWestCorner) {
return new ChunkCoordinates(piecePos.posX, piecePos.posY, piecePos.posZ);
} else if (cellIndexDirection == CellIndexDirection.SouthWestCorner) {
return new ChunkCoordinates(piecePos.posX, piecePos.posY, cellSize - 1 - piecePos.posZ);
} else if (cellIndexDirection == CellIndexDirection.NorthEastCorner) {
return new ChunkCoordinates(cellSize - 1 - piecePos.posX, piecePos.posY, piecePos.posZ);
} else if (cellIndexDirection == CellIndexDirection.SouthEastCorner) {
return new ChunkCoordinates(cellSize - 1 - piecePos.posX, piecePos.posY, cellSize - 1 - piecePos.posZ);
}
return piecePos;
} | static ChunkCoordinates function(ChunkCoordinates piecePos, int cellSize, CellIndexDirection cellIndexDirection) { if (cellIndexDirection == CellIndexDirection.NorthWestCorner) { return new ChunkCoordinates(piecePos.posX, piecePos.posY, piecePos.posZ); } else if (cellIndexDirection == CellIndexDirection.SouthWestCorner) { return new ChunkCoordinates(piecePos.posX, piecePos.posY, cellSize - 1 - piecePos.posZ); } else if (cellIndexDirection == CellIndexDirection.NorthEastCorner) { return new ChunkCoordinates(cellSize - 1 - piecePos.posX, piecePos.posY, piecePos.posZ); } else if (cellIndexDirection == CellIndexDirection.SouthEastCorner) { return new ChunkCoordinates(cellSize - 1 - piecePos.posX, piecePos.posY, cellSize - 1 - piecePos.posZ); } return piecePos; } | /**
* Similar to {@link CellHelper#rotateCellTo} but instead of rotating it mirrors along the X and Z axes.
*
* NorthWest represents the base configuration which is unaltered.
*
* SouthWest maintains X axis (WEST) but inverted the Z axis for south.
*
*
* @param piecePos
* @param cellSize
* @param cellIndexDirection
* @return
*/ | Similar to <code>CellHelper#rotateCellTo</code> but instead of rotating it mirrors along the X and Z axes. NorthWest represents the base configuration which is unaltered. SouthWest maintains X axis (WEST) but inverted the Z axis for south | mirrorCellTo | {
"repo_name": "soultek101/projectzulu1.7.10",
"path": "src/main/java/com/stek101/projectzulu/common/world2/CellHelper.java",
"license": "lgpl-2.1",
"size": 3587
} | [
"com.stek101.projectzulu.common.world.CellIndexDirection",
"net.minecraft.util.ChunkCoordinates"
] | import com.stek101.projectzulu.common.world.CellIndexDirection; import net.minecraft.util.ChunkCoordinates; | import com.stek101.projectzulu.common.world.*; import net.minecraft.util.*; | [
"com.stek101.projectzulu",
"net.minecraft.util"
] | com.stek101.projectzulu; net.minecraft.util; | 1,025,128 |
public PlatformTargetProxy cache(@Nullable String name) throws IgniteCheckedException; | PlatformTargetProxy function(@Nullable String name) throws IgniteCheckedException; | /**
* Get cache.
*
* @param name Cache name.
* @return Cache.
* @throws IgniteCheckedException If failed.
*/ | Get cache | cache | {
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java",
"license": "apache-2.0",
"size": 8308
} | [
"org.apache.ignite.IgniteCheckedException",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.IgniteCheckedException; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 2,124,621 |
public CounterLocalService getCounterLocalService() {
return counterLocalService;
} | CounterLocalService function() { return counterLocalService; } | /**
* Returns the counter local service.
*
* @return the counter local service
*/ | Returns the counter local service | getCounterLocalService | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/base/assessment_lang_lkpLocalServiceBaseImpl.java",
"license": "gpl-2.0",
"size": 175931
} | [
"com.liferay.counter.service.CounterLocalService"
] | import com.liferay.counter.service.CounterLocalService; | import com.liferay.counter.service.*; | [
"com.liferay.counter"
] | com.liferay.counter; | 2,349,525 |
public TimeSeries getSeries(Comparable key) {
TimeSeries result = null;
Iterator iterator = this.data.iterator();
while (iterator.hasNext()) {
TimeSeries series = (TimeSeries) iterator.next();
Comparable k = series.getKey();
if (k != null && k.equals(key)) {
result = series;
}
}
return result;
}
| TimeSeries function(Comparable key) { TimeSeries result = null; Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TimeSeries series = (TimeSeries) iterator.next(); Comparable k = series.getKey(); if (k != null && k.equals(key)) { result = series; } } return result; } | /**
* Returns the series with the specified key, or {@code null} if
* there is no such series.
*
* @param key the series key ({@code null} permitted).
*
* @return The series with the given key.
*/ | Returns the series with the specified key, or null if there is no such series | getSeries | {
"repo_name": "GitoMat/jfreechart",
"path": "src/main/java/org/jfree/data/time/TimeSeriesCollection.java",
"license": "lgpl-2.1",
"size": 29048
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,110,631 |
public void testNoOrThrottleDecidersRemainsInUnassigned() {
RoutingAllocation allocation = onePrimaryOnNode1And1Replica(
randomBoolean() ? noAllocationDeciders() : throttleAllocationDeciders()
);
testAllocator.addData(node1, "MATCH", new StoreFileMetadata("file1", 10, "MATCH_CHECKSUM", MIN_SUPPORTED_LUCENE_VERSION))
.addData(node2, "MATCH", new StoreFileMetadata("file1", 10, "MATCH_CHECKSUM", MIN_SUPPORTED_LUCENE_VERSION));
allocateAllUnassigned(allocation);
assertThat(allocation.routingNodes().unassigned().ignored().size(), equalTo(1));
assertThat(allocation.routingNodes().unassigned().ignored().get(0).shardId(), equalTo(shardId));
} | void function() { RoutingAllocation allocation = onePrimaryOnNode1And1Replica( randomBoolean() ? noAllocationDeciders() : throttleAllocationDeciders() ); testAllocator.addData(node1, "MATCH", new StoreFileMetadata("file1", 10, STR, MIN_SUPPORTED_LUCENE_VERSION)) .addData(node2, "MATCH", new StoreFileMetadata("file1", 10, STR, MIN_SUPPORTED_LUCENE_VERSION)); allocateAllUnassigned(allocation); assertThat(allocation.routingNodes().unassigned().ignored().size(), equalTo(1)); assertThat(allocation.routingNodes().unassigned().ignored().get(0).shardId(), equalTo(shardId)); } | /**
* When there is no decision or throttle decision across all nodes for the shard, make sure the shard
* moves to the ignore unassigned list.
*/ | When there is no decision or throttle decision across all nodes for the shard, make sure the shard moves to the ignore unassigned list | testNoOrThrottleDecidersRemainsInUnassigned | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/test/java/org/elasticsearch/gateway/ReplicaShardAllocatorTests.java",
"license": "apache-2.0",
"size": 37508
} | [
"org.elasticsearch.cluster.routing.allocation.RoutingAllocation",
"org.elasticsearch.index.store.StoreFileMetadata",
"org.hamcrest.Matchers"
] | import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.index.store.StoreFileMetadata; import org.hamcrest.Matchers; | import org.elasticsearch.cluster.routing.allocation.*; import org.elasticsearch.index.store.*; import org.hamcrest.*; | [
"org.elasticsearch.cluster",
"org.elasticsearch.index",
"org.hamcrest"
] | org.elasticsearch.cluster; org.elasticsearch.index; org.hamcrest; | 1,022,347 |
public RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ) throws KettleStepException {
clearStepFieldsCachce();
setRepositoryOnMappingSteps();
return getStepFields( stepMeta, null, monitor );
} | RowMetaInterface function( StepMeta stepMeta, ProgressMonitorListener monitor ) throws KettleStepException { clearStepFieldsCachce(); setRepositoryOnMappingSteps(); return getStepFields( stepMeta, null, monitor ); } | /**
* Returns the fields that are emitted by a certain step.
*
* @param stepMeta
* The step to be queried.
* @param monitor
* The progress monitor for progress dialog. (null if not used!)
* @return A row containing the fields emitted.
* @throws KettleStepException
* the kettle step exception
*/ | Returns the fields that are emitted by a certain step | getStepFields | {
"repo_name": "TatsianaKasiankova/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 220790
} | [
"org.pentaho.di.core.ProgressMonitorListener",
"org.pentaho.di.core.exception.KettleStepException",
"org.pentaho.di.core.row.RowMetaInterface",
"org.pentaho.di.trans.step.StepMeta"
] | import org.pentaho.di.core.ProgressMonitorListener; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.step.StepMeta; | import org.pentaho.di.core.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; import org.pentaho.di.trans.step.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,295,931 |
public String toString() {
StringBuffer out = new StringBuffer();
out.append( "TextBytesAtom:\n");
out.append( HexDump.dump(_text, 0, 0) );
return out.toString();
} | String function() { StringBuffer out = new StringBuffer(); out.append( STR); out.append( HexDump.dump(_text, 0, 0) ); return out.toString(); } | /**
* dump debug info; use getText() to return a string
* representation of the atom
*/ | dump debug info; use getText() to return a string representation of the atom | toString | {
"repo_name": "tobyclemson/msci-project",
"path": "vendor/poi-3.6/src/scratchpad/src/org/apache/poi/hslf/record/TextBytesAtom.java",
"license": "mit",
"size": 3252
} | [
"org.apache.poi.util.HexDump"
] | import org.apache.poi.util.HexDump; | import org.apache.poi.util.*; | [
"org.apache.poi"
] | org.apache.poi; | 1,491,409 |
@Test (expected = AllocationConfigurationException.class)
public void testReservableCannotBeCombinedWithDynamicUserQueue()
throws Exception {
Configuration conf = new Configuration();
conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
out.println("<?xml version=\"1.0\"?>");
out.println("<allocations>");
out.println("<queue name=\"notboth\" type=\"parent\" >");
out.println("<reservation>");
out.println("</reservation>");
out.println("</queue>");
out.println("</allocations>");
out.close();
AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
allocLoader.init(conf);
ReloadListener confHolder = new ReloadListener();
allocLoader.setReloadListener(confHolder);
allocLoader.reloadAllocations();
}
private class ReloadListener implements AllocationFileLoaderService.Listener {
public AllocationConfiguration allocConf; | @Test (expected = AllocationConfigurationException.class) void function() throws Exception { Configuration conf = new Configuration(); conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE); PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE)); out.println(STR1.0\"?>"); out.println(STR); out.println(STRnotboth\STRparent\STR); out.println(STR); out.println(STR); out.println(STR); out.println(STR); out.close(); AllocationFileLoaderService allocLoader = new AllocationFileLoaderService(); allocLoader.init(conf); ReloadListener confHolder = new ReloadListener(); allocLoader.setReloadListener(confHolder); allocLoader.reloadAllocations(); } private class ReloadListener implements AllocationFileLoaderService.Listener { public AllocationConfiguration allocConf; | /**
* Verify that you can't have dynamic user queue and reservable queue on
* the same queue
*/ | Verify that you can't have dynamic user queue and reservable queue on the same queue | testReservableCannotBeCombinedWithDynamicUserQueue | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestAllocationFileLoaderService.java",
"license": "apache-2.0",
"size": 39882
} | [
"java.io.FileWriter",
"java.io.PrintWriter",
"org.apache.hadoop.conf.Configuration",
"org.junit.Test"
] | import java.io.FileWriter; import java.io.PrintWriter; import org.apache.hadoop.conf.Configuration; import org.junit.Test; | import java.io.*; import org.apache.hadoop.conf.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
] | java.io; org.apache.hadoop; org.junit; | 2,433,031 |
void resetScore(Player player); | void resetScore(Player player); | /**
* Resets the score of a player underneath their name.<br>
* The player score objective must be created first.
*
* @param player The player.
*/ | Resets the score of a player underneath their name. The player score objective must be created first | resetScore | {
"repo_name": "UltimateGames/UltimateGames",
"path": "api/src/main/java/me/ampayne2/ultimategames/api/arenas/scoreboards/Scoreboard.java",
"license": "lgpl-3.0",
"size": 6084
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 2,722,372 |
public final void show(@Nullable final CharSequence text) {
show(text, getDuration(), this);
} | final void function(@Nullable final CharSequence text) { show(text, getDuration(), this); } | /**
* Show the toast for a short period of time.
*
* @param text The text.
*/ | Show the toast for a short period of time | show | {
"repo_name": "Blankj/AndroidUtilCode",
"path": "lib/utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java",
"license": "apache-2.0",
"size": 30424
} | [
"androidx.annotation.Nullable"
] | import androidx.annotation.Nullable; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 148,477 |
protected static void printHelp(String key) {
System.out.print(BundleHandler.getString(serverBundleHandle, key));
} | static void function(String key) { System.out.print(BundleHandler.getString(serverBundleHandle, key)); } | /**
* Prints message for the specified key, without any special
* formatting. The message content comes from the server
* resource bundle and thus may localized according to the default
* JVM locale.<p>
*
* Uses System.out directly instead of Trace.printSystemOut() so it
* always prints, regardless of Trace settings.
*
* @param key for message
*/ | Prints message for the specified key, without any special formatting. The message content comes from the server resource bundle and thus may localized according to the default JVM locale. Uses System.out directly instead of Trace.printSystemOut() so it always prints, regardless of Trace settings | printHelp | {
"repo_name": "proudh0n/emergencymasta",
"path": "hsqldb/src/org/hsqldb/Server.java",
"license": "gpl-2.0",
"size": 70376
} | [
"org.hsqldb.resources.BundleHandler"
] | import org.hsqldb.resources.BundleHandler; | import org.hsqldb.resources.*; | [
"org.hsqldb.resources"
] | org.hsqldb.resources; | 1,402,185 |
public static String replaceMacro(String s, Map<String,String> properties) {
return replaceMacro(s,new VariableResolver.ByMap<String>(properties));
} | static String function(String s, Map<String,String> properties) { return replaceMacro(s,new VariableResolver.ByMap<String>(properties)); } | /**
* Replaces the occurrence of '$key' by <tt>properties.get('key')</tt>.
*
* <p>
* Unlike shell, undefined variables are left as-is (this behavior is the same as Ant.)
*
*/ | Replaces the occurrence of '$key' by properties.get('key'). Unlike shell, undefined variables are left as-is (this behavior is the same as Ant.) | replaceMacro | {
"repo_name": "stefanbrausch/hudson-main",
"path": "core/src/main/java/hudson/Util.java",
"license": "mit",
"size": 42243
} | [
"hudson.util.VariableResolver",
"java.util.Map"
] | import hudson.util.VariableResolver; import java.util.Map; | import hudson.util.*; import java.util.*; | [
"hudson.util",
"java.util"
] | hudson.util; java.util; | 2,593,427 |
private boolean overwriteFilterIfExist(BlockBasedTableConfig blockBasedTableConfig) {
Filter filter = null;
try {
filter = getFilterFromBlockBasedTableConfig(blockBasedTableConfig);
} catch (NoSuchFieldException | IllegalAccessException e) {
LOG.warn(
"Reflection exception occurred when getting filter from BlockBasedTableConfig, disable partition index filters!");
return false;
}
if (filter != null) {
// TODO Can get filter's config in the future RocksDB version, and build new filter use
// existing config.
BloomFilter newFilter = new BloomFilter(10, false);
LOG.info(
"Existing filter has been overwritten to full filters since partitioned index filters is enabled.");
blockBasedTableConfig.setFilter(newFilter);
handlesToClose.add(newFilter);
}
return true;
} | boolean function(BlockBasedTableConfig blockBasedTableConfig) { Filter filter = null; try { filter = getFilterFromBlockBasedTableConfig(blockBasedTableConfig); } catch (NoSuchFieldException IllegalAccessException e) { LOG.warn( STR); return false; } if (filter != null) { BloomFilter newFilter = new BloomFilter(10, false); LOG.info( STR); blockBasedTableConfig.setFilter(newFilter); handlesToClose.add(newFilter); } return true; } | /**
* Overwrite configured {@link Filter} if enable partitioned filter. Partitioned filter only
* worked in full bloom filter, not blocked based.
*/ | Overwrite configured <code>Filter</code> if enable partitioned filter. Partitioned filter only worked in full bloom filter, not blocked based | overwriteFilterIfExist | {
"repo_name": "StephanEwen/incubator-flink",
"path": "flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainer.java",
"license": "apache-2.0",
"size": 10159
} | [
"org.rocksdb.BlockBasedTableConfig",
"org.rocksdb.BloomFilter",
"org.rocksdb.Filter"
] | import org.rocksdb.BlockBasedTableConfig; import org.rocksdb.BloomFilter; import org.rocksdb.Filter; | import org.rocksdb.*; | [
"org.rocksdb"
] | org.rocksdb; | 119,467 |
private String getRequestURL(HttpServletRequest request) {
StringBuffer target = request.getRequestURL();
Enumeration<?> parms = request.getParameterNames();
if (parms.hasMoreElements())
target.append("?");
while (parms.hasMoreElements()) {
String object = (String) parms.nextElement();
if (((String) object).equals("index"))
continue;
target.append(object).append("=").append(request.getParameter(object));
if (parms.hasMoreElements())
target.append("&");
}
return target.toString();
} | String function(HttpServletRequest request) { StringBuffer target = request.getRequestURL(); Enumeration<?> parms = request.getParameterNames(); if (parms.hasMoreElements()) target.append("?"); while (parms.hasMoreElements()) { String object = (String) parms.nextElement(); if (((String) object).equals("index")) continue; target.append(object).append("=").append(request.getParameter(object)); if (parms.hasMoreElements()) target.append("&"); } return target.toString(); } | /**
* Gets the request url.
*
* @param request the request
* @return the request url
*/ | Gets the request url | getRequestURL | {
"repo_name": "freeacs/web",
"path": "src/com/owera/xaps/web/app/security/LoginServlet.java",
"license": "mit",
"size": 17054
} | [
"java.util.Enumeration",
"javax.servlet.http.HttpServletRequest"
] | import java.util.Enumeration; import javax.servlet.http.HttpServletRequest; | import java.util.*; import javax.servlet.http.*; | [
"java.util",
"javax.servlet"
] | java.util; javax.servlet; | 2,572,389 |
public Map<String, CourseDetailsBundle> getCourseSummariesForInstructors(List<InstructorAttributes> instructorList) {
Assumption.assertNotNull(instructorList);
return coursesLogic.getCourseSummariesForInstructor(instructorList);
} | Map<String, CourseDetailsBundle> function(List<InstructorAttributes> instructorList) { Assumption.assertNotNull(instructorList); return coursesLogic.getCourseSummariesForInstructor(instructorList); } | /**
* Preconditions: <br>
* * All parameters are non-null.
* @return A less detailed version of courses for the specified instructor attributes.
* Returns an empty list if none found.
*/ | Preconditions: All parameters are non-null | getCourseSummariesForInstructors | {
"repo_name": "thenaesh/teammates",
"path": "src/main/java/teammates/logic/api/Logic.java",
"license": "gpl-2.0",
"size": 87996
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 602,692 |
public static Document createHtmlDocument()
{
return mxDomUtils.createHtmlDocument();
} | static Document function() { return mxDomUtils.createHtmlDocument(); } | /**
* Returns a document with a HTML node containing a HEAD and BODY node.
* @deprecated Use <code>mxDomUtils.createHtmlDocument</code> (Jan 2012)
*/ | Returns a document with a HTML node containing a HEAD and BODY node | createHtmlDocument | {
"repo_name": "3w3rt0n/AmeacasInternas",
"path": "src/com/mxgraph/util/mxUtils.java",
"license": "apache-2.0",
"size": 67056
} | [
"org.w3c.dom.Document"
] | import org.w3c.dom.Document; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,632,708 |
@Override public void exitRow(@NotNull SaltParser.RowContext ctx) { } | @Override public void exitRow(@NotNull SaltParser.RowContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterRow | {
"repo_name": "mar9000/salt9000",
"path": "src/org/mar9000/salt/grammar/SaltBaseListener.java",
"license": "lgpl-3.0",
"size": 7385
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,441,780 |
public LabelEntity populateRemainingLabelEntityContent(LabelEntity labelEntity) {
labelEntity.setUri(generateResourceUri("labels", labelEntity.getId()));
return labelEntity;
}
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}")
@ApiOperation(
value = "Gets a label",
response = LabelEntity.class,
authorizations = {
@Authorization(value = "Read - /labels/{uuid}")
}
)
@ApiResponses(
value = {
@ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
@ApiResponse(code = 401, message = "Client could not be authenticated."),
@ApiResponse(code = 403, message = "Client is not authorized to make this request."),
@ApiResponse(code = 404, message = "The specified resource could not be found."),
@ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
} | LabelEntity function(LabelEntity labelEntity) { labelEntity.setUri(generateResourceUri(STR, labelEntity.getId())); return labelEntity; } @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") @ApiOperation( value = STR, response = LabelEntity.class, authorizations = { @Authorization(value = STR) } ) @ApiResponses( value = { @ApiResponse(code = 400, message = STR), @ApiResponse(code = 401, message = STR), @ApiResponse(code = 403, message = STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 409, message = STR) } | /**
* Populates the uri for the specified labels.
*
* @param labelEntity label
* @return entities
*/ | Populates the uri for the specified labels | populateRemainingLabelEntityContent | {
"repo_name": "mcgilman/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java",
"license": "apache-2.0",
"size": 13688
} | [
"io.swagger.annotations.ApiOperation",
"io.swagger.annotations.ApiResponse",
"io.swagger.annotations.ApiResponses",
"io.swagger.annotations.Authorization",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"org.apache.nifi.web.api.entity.LabelEntity"
] | import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.Authorization; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.apache.nifi.web.api.entity.LabelEntity; | import io.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.nifi.web.api.entity.*; | [
"io.swagger.annotations",
"javax.ws",
"org.apache.nifi"
] | io.swagger.annotations; javax.ws; org.apache.nifi; | 561,079 |
public void setPoint2(Point newPoint){
p2 = newPoint;
} | void function(Point newPoint){ p2 = newPoint; } | /**
* Sets 2nd reference point
*
* @param newPoint
*/ | Sets 2nd reference point | setPoint2 | {
"repo_name": "MagnificentFour/wtf_art",
"path": "processing_test/src/processing_test/CloneTool.java",
"license": "mit",
"size": 1028
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 78,598 |
public void backward() throws CandybeanException {
logger.info("Navigating the interface backward.");
this.wd.navigate().back();
} | void function() throws CandybeanException { logger.info(STR); this.wd.navigate().back(); } | /**
* Navigates the interface backward. If backward is undefined, it does nothing.
*/ | Navigates the interface backward. If backward is undefined, it does nothing | backward | {
"repo_name": "sugarcrm/candybean",
"path": "src/main/java/com/sugarcrm/candybean/automation/webdriver/WebDriverInterface.java",
"license": "agpl-3.0",
"size": 21122
} | [
"com.sugarcrm.candybean.exceptions.CandybeanException"
] | import com.sugarcrm.candybean.exceptions.CandybeanException; | import com.sugarcrm.candybean.exceptions.*; | [
"com.sugarcrm.candybean"
] | com.sugarcrm.candybean; | 2,865,091 |
public static Number intdiv(Number left, Number right) {
return NumberMath.intdiv(left, right);
} | static Number function(Number left, Number right) { return NumberMath.intdiv(left, right); } | /**
* Integer Divide two Numbers.
*
* @param left a Number
* @param right another Number
* @return a Number (an Integer) resulting from the integer division operation
* @since 1.0
*/ | Integer Divide two Numbers | intdiv | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"org.codehaus.groovy.runtime.typehandling.NumberMath"
] | import org.codehaus.groovy.runtime.typehandling.NumberMath; | import org.codehaus.groovy.runtime.typehandling.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 1,565,713 |
boolean isAdministrator()
{
return MetadataViewerAgent.isAdministrator();
} | boolean isAdministrator() { return MetadataViewerAgent.isAdministrator(); } | /**
* Returns <code>true</code> if the user currently logged in, is a leader
* of the selected group, <code>false</code> otherwise.
*
* @return
*/ | Returns <code>true</code> if the user currently logged in, is a leader of the selected group, <code>false</code> otherwise | isAdministrator | {
"repo_name": "stelfrich/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorModel.java",
"license": "gpl-2.0",
"size": 125983
} | [
"org.openmicroscopy.shoola.agents.metadata.MetadataViewerAgent"
] | import org.openmicroscopy.shoola.agents.metadata.MetadataViewerAgent; | import org.openmicroscopy.shoola.agents.metadata.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 770,917 |
public Optional<String> getPrecompiledHeaderLanguage() {
return precompiledHeaderLanguage;
} | Optional<String> function() { return precompiledHeaderLanguage; } | /**
* "Language" type to pass to the compiler in order to generate a precompiled header.
*
* Will be {@code absent} for source types which do not support precompiled headers.
*/ | "Language" type to pass to the compiler in order to generate a precompiled header. Will be absent for source types which do not support precompiled headers | getPrecompiledHeaderLanguage | {
"repo_name": "bocon13/buck",
"path": "src/com/facebook/buck/cxx/AbstractCxxSource.java",
"license": "apache-2.0",
"size": 4110
} | [
"com.google.common.base.Optional"
] | import com.google.common.base.Optional; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,846,017 |
public void writeShort(short p_72668_1_) throws IOException
{
this.output.writeShort(Short.reverseBytes(p_72668_1_));
} | void function(short p_72668_1_) throws IOException { this.output.writeShort(Short.reverseBytes(p_72668_1_)); } | /**
* Writes the given short to the output stream
*/ | Writes the given short to the output stream | writeShort | {
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/network/rcon/RConOutputStream.java",
"license": "gpl-3.0",
"size": 1715
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,703,754 |
public void add(final Vector2D[] bLoop) throws MathIllegalArgumentException {
add(new NestedLoops(bLoop, tolerance));
} | void function(final Vector2D[] bLoop) throws MathIllegalArgumentException { add(new NestedLoops(bLoop, tolerance)); } | /** Add a loop in a tree.
* @param bLoop boundary loop (will be reversed in place if needed)
* @exception MathIllegalArgumentException if an outline has crossing
* boundary loops or open boundary loops
*/ | Add a loop in a tree | add | {
"repo_name": "happyjack27/autoredistrict",
"path": "src/org/apache/commons/math3/geometry/euclidean/twod/NestedLoops.java",
"license": "gpl-3.0",
"size": 7722
} | [
"org.apache.commons.math3.exception.MathIllegalArgumentException"
] | import org.apache.commons.math3.exception.MathIllegalArgumentException; | import org.apache.commons.math3.exception.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,204,605 |
private void synchronizeWithPreference(ITextEditor editor) {
if (editor == null)
return;
boolean showSegments= fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS);
setChecked(showSegments);
if (editor.showsHighlightRangeOnly() != showSegments) {
IRegion remembered= editor.getHighlightRange();
editor.resetHighlightRange();
editor.showHighlightRangeOnly(showSegments);
if (remembered != null)
editor.setHighlightRange(remembered.getOffset(), remembered.getLength(), true);
}
} | void function(ITextEditor editor) { if (editor == null) return; boolean showSegments= fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS); setChecked(showSegments); if (editor.showsHighlightRangeOnly() != showSegments) { IRegion remembered= editor.getHighlightRange(); editor.resetHighlightRange(); editor.showHighlightRangeOnly(showSegments); if (remembered != null) editor.setHighlightRange(remembered.getOffset(), remembered.getLength(), true); } } | /**
* Synchronizes the appearance of the editor with what the preference store tells him.
*
* @param editor the text editor
*/ | Synchronizes the appearance of the editor with what the preference store tells him | synchronizeWithPreference | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/javaeditor/TogglePresentationAction.java",
"license": "epl-1.0",
"size": 4805
} | [
"org.eclipse.jface.text.IRegion",
"org.eclipse.ui.texteditor.ITextEditor",
"org.eclipse.wst.jsdt.ui.PreferenceConstants"
] | import org.eclipse.jface.text.IRegion; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.wst.jsdt.ui.PreferenceConstants; | import org.eclipse.jface.text.*; import org.eclipse.ui.texteditor.*; import org.eclipse.wst.jsdt.ui.*; | [
"org.eclipse.jface",
"org.eclipse.ui",
"org.eclipse.wst"
] | org.eclipse.jface; org.eclipse.ui; org.eclipse.wst; | 662,509 |
public ArgArray printer(ArgArray argArray) {
OPERATIONS operation = OPERATIONS.INSTANCE;
String attributeName = null;
Tuple printerTuple = null;
Integer attr_int = null;
PrintParameterList ppl = new PrintParameterList();
while (argArray.hasDashCommand()) {
String dashCommand = argArray.parseDashCommand();
switch (dashCommand) {
case "-to":
setDataDestfromArgArray(argArray);
break;
case "-get":
operation = OPERATIONS.GET;
attributeName = "ATTR_" + argArray.nextMaybeQuotationTuplePopString().toUpperCase().trim();
break;
case "-getfloat":
operation = OPERATIONS.GETFLOAT;
attr_int = argArray.nextIntMaybeQuotationTuplePopString();
break;
case "-getint":
operation = OPERATIONS.GETINT;
attr_int = argArray.nextIntMaybeQuotationTuplePopString();
break;
case "-getstring":
operation = OPERATIONS.GETSTRING;
attr_int = argArray.nextIntMaybeQuotationTuplePopString();
break;
case "-new":
case "-instance":
operation = OPERATIONS.INSTANCE;
break;
case "-wtrjob":
operation = OPERATIONS.WTRJOB;
break;
case "-set":
operation = OPERATIONS.SET;
attributeName = argArray.nextMaybeQuotationTuplePopString();
switch (attributeName) {
case "CHANGES":
ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString());
break;
case "DRWRSEP":
ppl.setParameter(attribToInt(attributeName), argArray.nextIntMaybeQuotationTuplePopString());
break;
case "FILESEP":
ppl.setParameter(attribToInt(attributeName), argArray.nextIntMaybeQuotationTuplePopString());
break;
case "FORMTYPE":
ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString());
break;
case "OUTPUT_QUEUE":
ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString());
break;
case "DESCRIPTION":
ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString());
break;
default:
getLogger().log(Level.SEVERE, "Unknown attribute {0} in {1}", new Object[]{attributeName, getNameAndDescription()});
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case "-as400":
setAs400(getAS400Tuple(argArray.next()));
break;
case "--":
case "-printer":
printerTuple = argArray.nextTupleOrPop();
break;
default:
unknownDashCommand(dashCommand);
}
}
if (havingUnknownDashCommand() || getCommandResult() == COMMANDRESULT.FAILURE) {
setCommandResult(COMMANDRESULT.FAILURE);
} else {
Printer printer = null;
String printerName = null;
if (printerTuple != null) {
Object o = printerTuple.getValue();
if (o instanceof Printer) {
printer = Printer.class.cast(o);
} else {
getLogger().log(Level.SEVERE, "Tuple value is not a Printer object in {0}", getNameAndDescription());
setCommandResult(COMMANDRESULT.FAILURE);
}
} else if (argArray.size() < 1) {
logArgArrayTooShortError(argArray);
setCommandResult(COMMANDRESULT.FAILURE);
} else {
printerName = argArray.nextMaybeQuotationTuplePopString();
}
if (printer == null && getAs400() == null) {
try {
if (argArray.size() < 3) {
logArgArrayTooShortError(argArray);
setCommandResult(COMMANDRESULT.FAILURE);
} else {
setAs400FromArgs(argArray);
}
} catch (PropertyVetoException ex) {
getLogger().log(Level.SEVERE, "Couldn't instance AS400 in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
}
if (printer == null && getAs400() != null) {
printer = new Printer(getAs400(), printerName);
}
if (printer != null) {
switch (operation) {
case INSTANCE:
try {
put(printer);
} catch (SQLException | IOException | AS400SecurityException | ErrorCompletingRequestException | InterruptedException | ObjectDoesNotExistException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Exception putting Printer object in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case GET:
Object attrValue = Utils.attrNameToValue(printer, attributeName, this);
if (attrValue != null) {
try {
put(attrValue);
} catch (AS400SecurityException | SQLException | ObjectDoesNotExistException | IOException | InterruptedException | RequestNotSupportedException | ErrorCompletingRequestException ex) {
getLogger().log(Level.SEVERE, "Error putting attribute in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
}
break;
case GETFLOAT:
try {
put(printer.getFloatAttribute(attr_int));
} catch (SQLException | IOException | AS400SecurityException | ErrorCompletingRequestException | InterruptedException | ObjectDoesNotExistException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Exception getting float attribute of " + printer + inNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case GETINT:
try {
put(printer.getIntegerAttribute(attr_int));
} catch (SQLException | IOException | AS400SecurityException | ErrorCompletingRequestException | InterruptedException | ObjectDoesNotExistException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Exception getting integer attribute of " + printer + inNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case GETSTRING:
try {
put(printer.getStringAttribute(attr_int));
} catch (SQLException | IOException | AS400SecurityException | ErrorCompletingRequestException | InterruptedException | ObjectDoesNotExistException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Exception getting string attribute of " + printer + inNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case SET:
try {
printer.setAttributes(ppl);
} catch (AS400SecurityException | IOException | InterruptedException | ErrorCompletingRequestException ex) {
getLogger().log(Level.SEVERE, "Error setting printer attribute in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
break;
case WTRJOB:
Job pJob = null;
try {
pJob = new Job(printer.getSystem(), printer.getStringAttribute(Printer.ATTR_WTRJOBNAME), printer.getStringAttribute(PrintObject.ATTR_WTRJOBUSER), printer.getStringAttribute(PrintObject.ATTR_WTRJOBNUM));
} catch (AS400SecurityException | ErrorCompletingRequestException | IOException | InterruptedException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Error getting printer job in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
if (getCommandResult() != COMMANDRESULT.FAILURE) {
try {
put(pJob);
} catch (SQLException | IOException | AS400SecurityException | ErrorCompletingRequestException | InterruptedException | ObjectDoesNotExistException | RequestNotSupportedException ex) {
getLogger().log(Level.SEVERE, "Error putting printer job in " + getNameAndDescription(), ex);
setCommandResult(COMMANDRESULT.FAILURE);
}
}
break;
case NOOP:
break;
}
}
}
return argArray;
} | ArgArray function(ArgArray argArray) { OPERATIONS operation = OPERATIONS.INSTANCE; String attributeName = null; Tuple printerTuple = null; Integer attr_int = null; PrintParameterList ppl = new PrintParameterList(); while (argArray.hasDashCommand()) { String dashCommand = argArray.parseDashCommand(); switch (dashCommand) { case "-to": setDataDestfromArgArray(argArray); break; case "-get": operation = OPERATIONS.GET; attributeName = "ATTR_" + argArray.nextMaybeQuotationTuplePopString().toUpperCase().trim(); break; case STR: operation = OPERATIONS.GETFLOAT; attr_int = argArray.nextIntMaybeQuotationTuplePopString(); break; case STR: operation = OPERATIONS.GETINT; attr_int = argArray.nextIntMaybeQuotationTuplePopString(); break; case STR: operation = OPERATIONS.GETSTRING; attr_int = argArray.nextIntMaybeQuotationTuplePopString(); break; case "-new": case STR: operation = OPERATIONS.INSTANCE; break; case STR: operation = OPERATIONS.WTRJOB; break; case "-set": operation = OPERATIONS.SET; attributeName = argArray.nextMaybeQuotationTuplePopString(); switch (attributeName) { case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString()); break; case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextIntMaybeQuotationTuplePopString()); break; case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextIntMaybeQuotationTuplePopString()); break; case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString()); break; case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString()); break; case STR: ppl.setParameter(attribToInt(attributeName), argArray.nextMaybeQuotationTuplePopString()); break; default: getLogger().log(Level.SEVERE, STR, new Object[]{attributeName, getNameAndDescription()}); setCommandResult(COMMANDRESULT.FAILURE); } break; case STR: setAs400(getAS400Tuple(argArray.next())); break; case "--": case STR: printerTuple = argArray.nextTupleOrPop(); break; default: unknownDashCommand(dashCommand); } } if (havingUnknownDashCommand() getCommandResult() == COMMANDRESULT.FAILURE) { setCommandResult(COMMANDRESULT.FAILURE); } else { Printer printer = null; String printerName = null; if (printerTuple != null) { Object o = printerTuple.getValue(); if (o instanceof Printer) { printer = Printer.class.cast(o); } else { getLogger().log(Level.SEVERE, STR, getNameAndDescription()); setCommandResult(COMMANDRESULT.FAILURE); } } else if (argArray.size() < 1) { logArgArrayTooShortError(argArray); setCommandResult(COMMANDRESULT.FAILURE); } else { printerName = argArray.nextMaybeQuotationTuplePopString(); } if (printer == null && getAs400() == null) { try { if (argArray.size() < 3) { logArgArrayTooShortError(argArray); setCommandResult(COMMANDRESULT.FAILURE); } else { setAs400FromArgs(argArray); } } catch (PropertyVetoException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } } if (printer == null && getAs400() != null) { printer = new Printer(getAs400(), printerName); } if (printer != null) { switch (operation) { case INSTANCE: try { put(printer); } catch (SQLException IOException AS400SecurityException ErrorCompletingRequestException InterruptedException ObjectDoesNotExistException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } break; case GET: Object attrValue = Utils.attrNameToValue(printer, attributeName, this); if (attrValue != null) { try { put(attrValue); } catch (AS400SecurityException SQLException ObjectDoesNotExistException IOException InterruptedException RequestNotSupportedException ErrorCompletingRequestException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } } break; case GETFLOAT: try { put(printer.getFloatAttribute(attr_int)); } catch (SQLException IOException AS400SecurityException ErrorCompletingRequestException InterruptedException ObjectDoesNotExistException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + printer + inNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } break; case GETINT: try { put(printer.getIntegerAttribute(attr_int)); } catch (SQLException IOException AS400SecurityException ErrorCompletingRequestException InterruptedException ObjectDoesNotExistException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + printer + inNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } break; case GETSTRING: try { put(printer.getStringAttribute(attr_int)); } catch (SQLException IOException AS400SecurityException ErrorCompletingRequestException InterruptedException ObjectDoesNotExistException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + printer + inNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } break; case SET: try { printer.setAttributes(ppl); } catch (AS400SecurityException IOException InterruptedException ErrorCompletingRequestException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } break; case WTRJOB: Job pJob = null; try { pJob = new Job(printer.getSystem(), printer.getStringAttribute(Printer.ATTR_WTRJOBNAME), printer.getStringAttribute(PrintObject.ATTR_WTRJOBUSER), printer.getStringAttribute(PrintObject.ATTR_WTRJOBNUM)); } catch (AS400SecurityException ErrorCompletingRequestException IOException InterruptedException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } if (getCommandResult() != COMMANDRESULT.FAILURE) { try { put(pJob); } catch (SQLException IOException AS400SecurityException ErrorCompletingRequestException InterruptedException ObjectDoesNotExistException RequestNotSupportedException ex) { getLogger().log(Level.SEVERE, STR + getNameAndDescription(), ex); setCommandResult(COMMANDRESULT.FAILURE); } } break; case NOOP: break; } } } return argArray; } | /**
* Get and set printer attributes
*
* @param argArray arguments in interpreter buffer
* @return what's left of arguments
*/ | Get and set printer attributes | printer | {
"repo_name": "jwoehr/Ubloid",
"path": "AndroidStudioProject/ubloid/app/src/main/java/ublu/command/CmdPrinter.java",
"license": "bsd-2-clause",
"size": 15019
} | [
"com.ibm.as400.access.AS400SecurityException",
"com.ibm.as400.access.ErrorCompletingRequestException",
"com.ibm.as400.access.Job",
"com.ibm.as400.access.ObjectDoesNotExistException",
"com.ibm.as400.access.PrintObject",
"com.ibm.as400.access.PrintParameterList",
"com.ibm.as400.access.Printer",
"com.ibm... | import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.ErrorCompletingRequestException; import com.ibm.as400.access.Job; import com.ibm.as400.access.ObjectDoesNotExistException; import com.ibm.as400.access.PrintObject; import com.ibm.as400.access.PrintParameterList; import com.ibm.as400.access.Printer; import com.ibm.as400.access.RequestNotSupportedException; import com.ibm.as400.jtopenstubs.javabeans.PropertyVetoException; import java.io.IOException; import java.sql.SQLException; import java.util.logging.Level; | import com.ibm.as400.access.*; import com.ibm.as400.jtopenstubs.javabeans.*; import java.io.*; import java.sql.*; import java.util.logging.*; | [
"com.ibm.as400",
"java.io",
"java.sql",
"java.util"
] | com.ibm.as400; java.io; java.sql; java.util; | 49,534 |
public static CertStore getInstance(String type, CertStoreParameters params,
Provider provider)
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
{
if (provider == null)
throw new IllegalArgumentException("null provider");
try
{
return new CertStore((CertStoreSpi) Engine.getInstance(CERT_STORE,
type, provider, new Object[] { params }), provider, type, params);
}
catch (ClassCastException cce)
{
throw new NoSuchAlgorithmException(type);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
Throwable cause = ite.getCause();
if (cause instanceof InvalidAlgorithmParameterException)
throw (InvalidAlgorithmParameterException) cause;
else
throw new NoSuchAlgorithmException(type);
}
}
// Instance methods.
// ------------------------------------------------------------------------ | static CertStore function(String type, CertStoreParameters params, Provider provider) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException { if (provider == null) throw new IllegalArgumentException(STR); try { return new CertStore((CertStoreSpi) Engine.getInstance(CERT_STORE, type, provider, new Object[] { params }), provider, type, params); } catch (ClassCastException cce) { throw new NoSuchAlgorithmException(type); } catch (java.lang.reflect.InvocationTargetException ite) { Throwable cause = ite.getCause(); if (cause instanceof InvalidAlgorithmParameterException) throw (InvalidAlgorithmParameterException) cause; else throw new NoSuchAlgorithmException(type); } } | /**
* Get an instance of the given certificate store from the given
* provider.
*
* @param type The type of CertStore to create.
* @param params The parameters to initialize this cert store with.
* @param provider The provider from which to get the implementation.
* @return The new instance.
* @throws InvalidAlgorithmParameterException If the instance rejects
* the specified parameters.
* @throws NoSuchAlgorithmException If the specified provider does not
* implement the specified CertStore.
* @throws IllegalArgumentException If <i>provider</i> is null.
*/ | Get an instance of the given certificate store from the given provider | getInstance | {
"repo_name": "unofficial-opensource-apple/gcc_40",
"path": "libjava/java/security/cert/CertStore.java",
"license": "gpl-2.0",
"size": 9851
} | [
"gnu.java.security.Engine",
"java.security.InvalidAlgorithmParameterException",
"java.security.NoSuchAlgorithmException",
"java.security.Provider"
] | import gnu.java.security.Engine; import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import java.security.Provider; | import gnu.java.security.*; import java.security.*; | [
"gnu.java.security",
"java.security"
] | gnu.java.security; java.security; | 2,300,623 |
public static int readVarInt(ByteBuf buf) throws IOException {
int out = 0;
int bytes = 0;
byte in;
while (true) {
in = buf.readByte();
out |= (in & 0x7F) << (bytes++ * 7);
if (bytes > 5) {
throw new IOException("Attempt to read int bigger than allowed for a varint!");
}
if ((in & 0x80) != 0x80) {
break;
}
}
return out;
} | static int function(ByteBuf buf) throws IOException { int out = 0; int bytes = 0; byte in; while (true) { in = buf.readByte(); out = (in & 0x7F) << (bytes++ * 7); if (bytes > 5) { throw new IOException(STR); } if ((in & 0x80) != 0x80) { break; } } return out; } | /**
* Reads an integer written into the byte buffer as one of various bit sizes.
*
* @param buf The byte buffer to read from
* @return The read integer
* @throws java.io.IOException If the reading fails
*/ | Reads an integer written into the byte buffer as one of various bit sizes | readVarInt | {
"repo_name": "flow/network",
"path": "src/main/java/com/flowpowered/network/util/ByteBufUtils.java",
"license": "mit",
"size": 5205
} | [
"io.netty.buffer.ByteBuf",
"java.io.IOException"
] | import io.netty.buffer.ByteBuf; import java.io.IOException; | import io.netty.buffer.*; import java.io.*; | [
"io.netty.buffer",
"java.io"
] | io.netty.buffer; java.io; | 2,626,921 |
private void updateDatabase(List<MonETSNotification> notifications) {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
try {
Dao<MonETSNotification, ?> dao = databaseHelper.getDao(MonETSNotification.class);
for (MonETSNotification monETSNotification : notifications) {
dao.createOrUpdate(monETSNotification);
}
listener.onRequestSuccess(notifications);
} catch (SQLException e) {
e.printStackTrace();
}
}
private static class AsyncUpdateMonETSToken extends AsyncTask<Void, Void, String> {
private WeakReference<Context> asyncContext;
private NotificationManager notificationManager;
private AsyncUpdateMonETSToken(Context context, NotificationManager manager) {
asyncContext = new WeakReference<>(context);
notificationManager = manager;
} | void function(List<MonETSNotification> notifications) { DatabaseHelper databaseHelper = new DatabaseHelper(context); try { Dao<MonETSNotification, ?> dao = databaseHelper.getDao(MonETSNotification.class); for (MonETSNotification monETSNotification : notifications) { dao.createOrUpdate(monETSNotification); } listener.onRequestSuccess(notifications); } catch (SQLException e) { e.printStackTrace(); } } private static class AsyncUpdateMonETSToken extends AsyncTask<Void, Void, String> { private WeakReference<Context> asyncContext; private NotificationManager notificationManager; private AsyncUpdateMonETSToken(Context context, NotificationManager manager) { asyncContext = new WeakReference<>(context); notificationManager = manager; } | /**
* Updates the database with a given list of notifications
*
* @param notifications the list of notifications that have been fetched from MonÉTS's API
*/ | Updates the database with a given list of notifications | updateDatabase | {
"repo_name": "ApplETS/ETSMobile-Android2",
"path": "app/src/main/java/ca/etsmtl/applets/etsmobile/util/NotificationManager.java",
"license": "apache-2.0",
"size": 5487
} | [
"android.content.Context",
"android.os.AsyncTask",
"ca.etsmtl.applets.etsmobile.db.DatabaseHelper",
"ca.etsmtl.applets.etsmobile.model.MonETSNotification",
"com.j256.ormlite.dao.Dao",
"java.lang.ref.WeakReference",
"java.sql.SQLException",
"java.util.List"
] | import android.content.Context; import android.os.AsyncTask; import ca.etsmtl.applets.etsmobile.db.DatabaseHelper; import ca.etsmtl.applets.etsmobile.model.MonETSNotification; import com.j256.ormlite.dao.Dao; import java.lang.ref.WeakReference; import java.sql.SQLException; import java.util.List; | import android.content.*; import android.os.*; import ca.etsmtl.applets.etsmobile.db.*; import ca.etsmtl.applets.etsmobile.model.*; import com.j256.ormlite.dao.*; import java.lang.ref.*; import java.sql.*; import java.util.*; | [
"android.content",
"android.os",
"ca.etsmtl.applets",
"com.j256.ormlite",
"java.lang",
"java.sql",
"java.util"
] | android.content; android.os; ca.etsmtl.applets; com.j256.ormlite; java.lang; java.sql; java.util; | 680,437 |
AsyncIterator<String> listScopes(); | AsyncIterator<String> listScopes(); | /**
* Gets an async iterator on scopes.
*
* @return An AsyncIterator which can be used to iterate over all scopes.
*/ | Gets an async iterator on scopes | listScopes | {
"repo_name": "pravega/pravega",
"path": "client/src/main/java/io/pravega/client/control/impl/Controller.java",
"license": "apache-2.0",
"size": 24873
} | [
"io.pravega.common.util.AsyncIterator"
] | import io.pravega.common.util.AsyncIterator; | import io.pravega.common.util.*; | [
"io.pravega.common"
] | io.pravega.common; | 2,033,212 |
public VoltXMLElement getXMLForTable(String tableName) throws HSQLParseException {
VoltXMLElement xml = emptySchema.duplicate();
// search all the tables XXX probably could do this non-linearly,
// but i don't know about case-insensitivity yet
HashMappedList hsqlTables = getHSQLTables();
for (int i = 0; i < hsqlTables.size(); i++) {
Table table = (Table) hsqlTables.get(i);
String candidateTableName = table.getName().name;
// found the table of interest
if (candidateTableName.equalsIgnoreCase(tableName)) {
VoltXMLElement vxmle = table.voltGetTableXML(sessionProxy);
assert(vxmle != null);
xml.children.add(vxmle);
return xml;
}
}
return null;
} | VoltXMLElement function(String tableName) throws HSQLParseException { VoltXMLElement xml = emptySchema.duplicate(); HashMappedList hsqlTables = getHSQLTables(); for (int i = 0; i < hsqlTables.size(); i++) { Table table = (Table) hsqlTables.get(i); String candidateTableName = table.getName().name; if (candidateTableName.equalsIgnoreCase(tableName)) { VoltXMLElement vxmle = table.voltGetTableXML(sessionProxy); assert(vxmle != null); xml.children.add(vxmle); return xml; } } return null; } | /**
* Get an serialized XML representation of the a particular table.
*/ | Get an serialized XML representation of the a particular table | getXMLForTable | {
"repo_name": "kumarrus/voltdb",
"path": "src/hsqldb19b3/org/hsqldb_voltpatches/HSQLInterface.java",
"license": "agpl-3.0",
"size": 21928
} | [
"org.hsqldb_voltpatches.lib.HashMappedList"
] | import org.hsqldb_voltpatches.lib.HashMappedList; | import org.hsqldb_voltpatches.lib.*; | [
"org.hsqldb_voltpatches.lib"
] | org.hsqldb_voltpatches.lib; | 354,677 |
private static boolean is64BitJVM() {
String arch = System.getProperty("os.arch");
return Arrays.asList(ARCH64).contains(arch);
} | static boolean function() { String arch = System.getProperty(STR); return Arrays.asList(ARCH64).contains(arch); } | /**
* Is the JVM architecture 64 bit?
*
* @return
*/ | Is the JVM architecture 64 bit | is64BitJVM | {
"repo_name": "kefir-/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/corecomponents/MediaViewVideoPanel.java",
"license": "apache-2.0",
"size": 3701
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 521,702 |
public static int getVanillaDmgValue(ItemStack itemStack)
{
int color = getColor(itemStack);
for (int idx = 0; idx < ItemDye.DYE_COLORS.length; ++idx)
{
if (color == ItemDye.DYE_COLORS[idx])
{
return 15 - idx;
}
}
return 15;
} | static int function(ItemStack itemStack) { int color = getColor(itemStack); for (int idx = 0; idx < ItemDye.DYE_COLORS.length; ++idx) { if (color == ItemDye.DYE_COLORS[idx]) { return 15 - idx; } } return 15; } | /**
* Returns vanilla dye metadata value for OreDictionary dye ItemStack.
*
* @param itemStack
* @return
*/ | Returns vanilla dye metadata value for OreDictionary dye ItemStack | getVanillaDmgValue | {
"repo_name": "burpingdog1/carpentersblocks",
"path": "src/main/java/com/carpentersblocks/util/handler/DyeHandler.java",
"license": "lgpl-2.1",
"size": 3005
} | [
"net.minecraft.item.ItemDye",
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,464,181 |
protected void introspectSpecializes(Annotated annotated)
{
if (! annotated.isAnnotationPresent(Specializes.class))
return;
Type baseType = annotated.getBaseType();
if (! (baseType instanceof Class<?>)) {
throw new ConfigException(L.l("{0}: invalid @Specializes bean because '{1}' is not a class.",
getTargetName(), baseType));
}
Class<?> baseClass = (Class<?>) baseType;
Class<?> parentClass = baseClass.getSuperclass();
if (baseClass.getSuperclass() == null ||
baseClass.getSuperclass().equals(Object.class)) {
throw new ConfigException(L.l("{0}: invalid @Specializes bean because the superclass '{1}' is not a managed bean.",
getTargetName(), baseClass.getSuperclass()));
}
if ((annotated.isAnnotationPresent(Stateless.class)
!= parentClass.isAnnotationPresent(Stateless.class))) {
throw new ConfigException(L.l("{0}: invalid @Specializes bean because the bean is a @Stateless bean but its parent is not.",
getTargetName()));
}
if ((annotated.isAnnotationPresent(Stateful.class)
!= parentClass.isAnnotationPresent(Stateful.class))) {
throw new ConfigException(L.l("{0}: invalid @Specializes bean because the bean is a @Stateful bean but its parent is not.",
getTargetName()));
}
if ((annotated.isAnnotationPresent(Singleton.class)
!= parentClass.isAnnotationPresent(Singleton.class))) {
throw new ConfigException(L.l("{0}: invalid @Specializes bean because the bean is a @Singleton bean but its parent is not.",
getTargetName()));
}
} | void function(Annotated annotated) { if (! annotated.isAnnotationPresent(Specializes.class)) return; Type baseType = annotated.getBaseType(); if (! (baseType instanceof Class<?>)) { throw new ConfigException(L.l(STR, getTargetName(), baseType)); } Class<?> baseClass = (Class<?>) baseType; Class<?> parentClass = baseClass.getSuperclass(); if (baseClass.getSuperclass() == null baseClass.getSuperclass().equals(Object.class)) { throw new ConfigException(L.l(STR, getTargetName(), baseClass.getSuperclass())); } if ((annotated.isAnnotationPresent(Stateless.class) != parentClass.isAnnotationPresent(Stateless.class))) { throw new ConfigException(L.l(STR, getTargetName())); } if ((annotated.isAnnotationPresent(Stateful.class) != parentClass.isAnnotationPresent(Stateful.class))) { throw new ConfigException(L.l(STR, getTargetName())); } if ((annotated.isAnnotationPresent(Singleton.class) != parentClass.isAnnotationPresent(Singleton.class))) { throw new ConfigException(L.l(STR, getTargetName())); } } | /**
* Adds the stereotypes from the bean's annotations
*/ | Adds the stereotypes from the bean's annotations | introspectSpecializes | {
"repo_name": "dlitz/resin",
"path": "modules/kernel/src/com/caucho/config/inject/AbstractIntrospectedBean.java",
"license": "gpl-2.0",
"size": 17702
} | [
"com.caucho.config.ConfigException",
"java.lang.reflect.Type",
"javax.ejb.Singleton",
"javax.ejb.Stateful",
"javax.ejb.Stateless",
"javax.enterprise.inject.Specializes",
"javax.enterprise.inject.spi.Annotated"
] | import com.caucho.config.ConfigException; import java.lang.reflect.Type; import javax.ejb.Singleton; import javax.ejb.Stateful; import javax.ejb.Stateless; import javax.enterprise.inject.Specializes; import javax.enterprise.inject.spi.Annotated; | import com.caucho.config.*; import java.lang.reflect.*; import javax.ejb.*; import javax.enterprise.inject.*; import javax.enterprise.inject.spi.*; | [
"com.caucho.config",
"java.lang",
"javax.ejb",
"javax.enterprise"
] | com.caucho.config; java.lang; javax.ejb; javax.enterprise; | 451,558 |
public synchronized long getLogSize() {
long logSize = SIZE_UNDEFINED;
if (logRecordStore != null) {
try {
int numRecords = logRecordStore.getNumRecords();
if (numRecords != 0) {
logSize = logRecordStore.getSize();
} else if (numRecords == 0) {
logSize = 0;
}
} catch (RecordStoreNotOpenException e) {
System.err.println("RecordStore was not open " + e);
}
}
return logSize;
}
| synchronized long function() { long logSize = SIZE_UNDEFINED; if (logRecordStore != null) { try { int numRecords = logRecordStore.getNumRecords(); if (numRecords != 0) { logSize = logRecordStore.getSize(); } else if (numRecords == 0) { logSize = 0; } } catch (RecordStoreNotOpenException e) { System.err.println(STR + e); } } return logSize; } | /**
* Get the size of the log.
*
* @return the size of the log.
*/ | Get the size of the log | getLogSize | {
"repo_name": "yuuhhe/microlog",
"path": "net/sf/microlog/midp/appender/RecordStoreAppender.java",
"license": "apache-2.0",
"size": 11955
} | [
"javax.microedition.rms.RecordStoreNotOpenException"
] | import javax.microedition.rms.RecordStoreNotOpenException; | import javax.microedition.rms.*; | [
"javax.microedition"
] | javax.microedition; | 615,564 |
private AstNode nameOrLabel()
throws IOException
{
if (currentToken != Token.NAME) throw codeBug();
int pos = ts.tokenBeg;
// set check for label and call down to primaryExpr
currentFlaggedToken |= TI_CHECK_LABEL;
AstNode expr = expr();
if (expr.getType() != Token.LABEL) {
AstNode n = new ExpressionStatement(expr, !insideFunction());
n.lineno = expr.lineno;
return n;
}
LabeledStatement bundle = new LabeledStatement(pos);
recordLabel((Label)expr, bundle);
bundle.setLineno(ts.lineno);
// look for more labels
AstNode stmt = null;
while (peekToken() == Token.NAME) {
currentFlaggedToken |= TI_CHECK_LABEL;
expr = expr();
if (expr.getType() != Token.LABEL) {
stmt = new ExpressionStatement(expr, !insideFunction());
autoInsertSemicolon(stmt);
break;
}
recordLabel((Label)expr, bundle);
}
// no more labels; now parse the labeled statement
try {
currentLabel = bundle;
if (stmt == null) {
stmt = statementHelper();
}
} finally {
currentLabel = null;
// remove the labels for this statement from the global set
for (Label lb : bundle.getLabels()) {
labelSet.remove(lb.getName());
}
}
// If stmt has parent assigned its position already is relative
// (See bug #710225)
bundle.setLength(stmt.getParent() == null
? getNodeEnd(stmt) - pos
: getNodeEnd(stmt));
bundle.setStatement(stmt);
return bundle;
} | AstNode function() throws IOException { if (currentToken != Token.NAME) throw codeBug(); int pos = ts.tokenBeg; currentFlaggedToken = TI_CHECK_LABEL; AstNode expr = expr(); if (expr.getType() != Token.LABEL) { AstNode n = new ExpressionStatement(expr, !insideFunction()); n.lineno = expr.lineno; return n; } LabeledStatement bundle = new LabeledStatement(pos); recordLabel((Label)expr, bundle); bundle.setLineno(ts.lineno); AstNode stmt = null; while (peekToken() == Token.NAME) { currentFlaggedToken = TI_CHECK_LABEL; expr = expr(); if (expr.getType() != Token.LABEL) { stmt = new ExpressionStatement(expr, !insideFunction()); autoInsertSemicolon(stmt); break; } recordLabel((Label)expr, bundle); } try { currentLabel = bundle; if (stmt == null) { stmt = statementHelper(); } } finally { currentLabel = null; for (Label lb : bundle.getLabels()) { labelSet.remove(lb.getName()); } } bundle.setLength(stmt.getParent() == null ? getNodeEnd(stmt) - pos : getNodeEnd(stmt)); bundle.setStatement(stmt); return bundle; } | /**
* Found a name in a statement context. If it's a label, we gather
* up any following labels and the next non-label statement into a
* {@link LabeledStatement} "bundle" and return that. Otherwise we parse
* an expression and return it wrapped in an {@link ExpressionStatement}.
*/ | Found a name in a statement context. If it's a label, we gather up any following labels and the next non-label statement into a <code>LabeledStatement</code> "bundle" and return that. Otherwise we parse an expression and return it wrapped in an <code>ExpressionStatement</code> | nameOrLabel | {
"repo_name": "Pilarbrist/rhino",
"path": "src/org/mozilla/javascript/Parser.java",
"license": "mpl-2.0",
"size": 146072
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 615,418 |
public ArrayList<Fact> createFacts (MAcctSchema as)
{
ArrayList<Fact> facts = new ArrayList<Fact>();
// Nothing to do
if (getM_Product_ID() == 0 // no Product
|| getQty().signum() == 0
|| m_receiptLine.getMovementQty().signum() == 0) // Qty = 0
{
log.fine("No Product/Qty - M_Product_ID=" + getM_Product_ID()
+ ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty());
return facts;
}
// MMatchInv matchInv = (MMatchInv)getPO();
// create Fact Header
Fact fact = new Fact(this, as, Fact.POST_Actual);
setC_Currency_ID (as.getC_Currency_ID());
boolean isInterOrg = isInterOrg(as);
// NotInvoicedReceipt DR
// From Receipt
BigDecimal multiplier = getQty()
.divide(m_receiptLine.getMovementQty(), 12, BigDecimal.ROUND_HALF_UP)
.abs();
FactLine dr = fact.createLine (null,
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
as.getC_Currency_ID(), Env.ONE, null); // updated below
if (dr == null)
{
p_Error = "No Product Costs";
return null;
}
dr.setQty(getQty());
// dr.setM_Locator_ID(m_receiptLine.getM_Locator_ID());
// MInOut receipt = m_receiptLine.getParent();
// dr.setLocationFromBPartner(receipt.getC_BPartner_Location_ID(), true); // from Loc
// dr.setLocationFromLocator(m_receiptLine.getM_Locator_ID(), false); // to Loc
BigDecimal temp = dr.getAcctBalance();
// Set AmtAcctCr/Dr from Receipt (sets also Project)
if (!dr.updateReverseLine (MInOut.Table_ID, // Amt updated
m_receiptLine.getM_InOut_ID(), m_receiptLine.getM_InOutLine_ID(),
multiplier))
{
p_Error = "Mat.Receipt not posted yet";
return null;
}
log.fine("CR - Amt(" + temp + "->" + dr.getAcctBalance()
+ ") - " + dr.toString());
// InventoryClearing CR
// From Invoice
MAccount expense = m_pc.getAccount(ProductCost.ACCTTYPE_P_InventoryClearing, as);
if (m_pc.isService())
expense = m_pc.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
multiplier = getQty()
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP)
.abs();
if (multiplier.compareTo(Env.ONE) != 0)
LineNetAmt = LineNetAmt.multiply(multiplier);
if (m_pc.isService())
LineNetAmt = dr.getAcctBalance(); // book out exact receipt amt
FactLine cr = null;
if (as.isAccrual())
{
cr = fact.createLine (null, expense,
as.getC_Currency_ID(), null, LineNetAmt); // updated below
if (cr == null)
{
log.fine("Line Net Amt=0 - M_Product_ID=" + getM_Product_ID()
+ ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty());
// Invoice Price Variance
BigDecimal ipv = dr.getSourceBalance().negate();
if (ipv.signum() != 0)
{
MInvoice m_invoice = m_invoiceLine.getParent();
int C_Currency_ID = m_invoice.getC_Currency_ID();
FactLine pv = fact.createLine(null,
m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
C_Currency_ID, ipv);
pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
pv.setUser1_ID(m_invoiceLine.getUser1_ID());
pv.setUser2_ID(m_invoiceLine.getUser2_ID());
}
log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance());
facts.add(fact);
return facts;
}
cr.setQty(getQty().negate());
temp = cr.getAcctBalance();
// Set AmtAcctCr/Dr from Invoice (sets also Project)
if (as.isAccrual() && !cr.updateReverseLine (MInvoice.Table_ID, // Amt updated
m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), multiplier))
{
p_Error = "Invoice not posted yet";
return null;
}
log.fine("DR - Amt(" + temp + "->" + cr.getAcctBalance()
+ ") - " + cr.toString());
}
else // Cash Acct
{
MInvoice invoice = m_invoiceLine.getParent();
if (as.getC_Currency_ID() != invoice.getC_Currency_ID())
LineNetAmt = MConversionRate.convert(getCtx(), LineNetAmt,
invoice.getC_Currency_ID(), as.getC_Currency_ID(),
invoice.getDateAcct(), invoice.getC_ConversionType_ID(),
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
cr = fact.createLine (null, expense,
as.getC_Currency_ID(), null, LineNetAmt);
cr.setQty(getQty().multiply(multiplier).negate());
}
cr.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
cr.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
cr.setC_Project_ID(m_invoiceLine.getC_Project_ID());
cr.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
cr.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
cr.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
cr.setUser1_ID(m_invoiceLine.getUser1_ID());
cr.setUser2_ID(m_invoiceLine.getUser2_ID());
//AZ Goodwill
//Desc: Source Not Balanced problem because Currency is Difference - PO=CNY but AP=USD
//see also Fact.java: checking for isMultiCurrency()
if (dr.getC_Currency_ID() != cr.getC_Currency_ID())
setIsMultiCurrency(true);
//end AZ
// Avoid usage of clearing accounts
// If both accounts Not Invoiced Receipts and Inventory Clearing are equal
// then remove the posting
MAccount acct_db = dr.getAccount(); // not_invoiced_receipts
MAccount acct_cr = cr.getAccount(); // inventory_clearing
if ((!as.isPostIfClearingEqual()) && acct_db.equals(acct_cr) && (!isInterOrg)) {
BigDecimal debit = dr.getAmtSourceDr();
BigDecimal credit = cr.getAmtSourceCr();
if (debit.compareTo(credit) == 0) {
fact.remove(dr);
fact.remove(cr);
}
}
// End Avoid usage of clearing accounts
// Invoice Price Variance difference
BigDecimal ipv = cr.getAcctBalance().add(dr.getAcctBalance()).negate();
if (ipv.signum() != 0)
{
FactLine pv = fact.createLine(null,
m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
as.getC_Currency_ID(), ipv);
pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
pv.setUser1_ID(m_invoiceLine.getUser1_ID());
pv.setUser2_ID(m_invoiceLine.getUser2_ID());
}
log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance());
// Elaine 2008/6/20
// Update Costing
updateProductInfo(as.getC_AcctSchema_ID(),
MAcctSchema.COSTINGMETHOD_StandardCosting.equals(as.getCostingMethod()));
//
facts.add(fact);
if (as.isAccrual() && as.isCreatePOCommitment())
{
fact = Doc_Order.getCommitmentRelease(as, this,
getQty(), m_invoiceLine.getC_InvoiceLine_ID(), Env.ONE);
if (fact == null)
return null;
facts.add(fact);
} // Commitment
return facts;
} // createFact
| ArrayList<Fact> function (MAcctSchema as) { ArrayList<Fact> facts = new ArrayList<Fact>(); if (getM_Product_ID() == 0 getQty().signum() == 0 m_receiptLine.getMovementQty().signum() == 0) { log.fine(STR + getM_Product_ID() + ",Qty=" + getQty() + STR + m_receiptLine.getMovementQty()); return facts; } Fact fact = new Fact(this, as, Fact.POST_Actual); setC_Currency_ID (as.getC_Currency_ID()); boolean isInterOrg = isInterOrg(as); BigDecimal multiplier = getQty() .divide(m_receiptLine.getMovementQty(), 12, BigDecimal.ROUND_HALF_UP) .abs(); FactLine dr = fact.createLine (null, getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as), as.getC_Currency_ID(), Env.ONE, null); if (dr == null) { p_Error = STR; return null; } dr.setQty(getQty()); BigDecimal temp = dr.getAcctBalance(); if (!dr.updateReverseLine (MInOut.Table_ID, m_receiptLine.getM_InOut_ID(), m_receiptLine.getM_InOutLine_ID(), multiplier)) { p_Error = STR; return null; } log.fine(STR + temp + "->" + dr.getAcctBalance() + STR + dr.toString()); MAccount expense = m_pc.getAccount(ProductCost.ACCTTYPE_P_InventoryClearing, as); if (m_pc.isService()) expense = m_pc.getAccount(ProductCost.ACCTTYPE_P_Expense, as); BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt(); multiplier = getQty() .divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP) .abs(); if (multiplier.compareTo(Env.ONE) != 0) LineNetAmt = LineNetAmt.multiply(multiplier); if (m_pc.isService()) LineNetAmt = dr.getAcctBalance(); FactLine cr = null; if (as.isAccrual()) { cr = fact.createLine (null, expense, as.getC_Currency_ID(), null, LineNetAmt); if (cr == null) { log.fine(STR + getM_Product_ID() + ",Qty=" + getQty() + STR + m_receiptLine.getMovementQty()); BigDecimal ipv = dr.getSourceBalance().negate(); if (ipv.signum() != 0) { MInvoice m_invoice = m_invoiceLine.getParent(); int C_Currency_ID = m_invoice.getC_Currency_ID(); FactLine pv = fact.createLine(null, m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), C_Currency_ID, ipv); pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID()); pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID()); pv.setC_Project_ID(m_invoiceLine.getC_Project_ID()); pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID()); pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID()); pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID()); pv.setUser1_ID(m_invoiceLine.getUser1_ID()); pv.setUser2_ID(m_invoiceLine.getUser2_ID()); } log.fine("IPV=" + ipv + STR + fact.getSourceBalance()); facts.add(fact); return facts; } cr.setQty(getQty().negate()); temp = cr.getAcctBalance(); if (as.isAccrual() && !cr.updateReverseLine (MInvoice.Table_ID, m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), multiplier)) { p_Error = STR; return null; } log.fine(STR + temp + "->" + cr.getAcctBalance() + STR + cr.toString()); } else { MInvoice invoice = m_invoiceLine.getParent(); if (as.getC_Currency_ID() != invoice.getC_Currency_ID()) LineNetAmt = MConversionRate.convert(getCtx(), LineNetAmt, invoice.getC_Currency_ID(), as.getC_Currency_ID(), invoice.getDateAcct(), invoice.getC_ConversionType_ID(), invoice.getAD_Client_ID(), invoice.getAD_Org_ID()); cr = fact.createLine (null, expense, as.getC_Currency_ID(), null, LineNetAmt); cr.setQty(getQty().multiply(multiplier).negate()); } cr.setC_Activity_ID(m_invoiceLine.getC_Activity_ID()); cr.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID()); cr.setC_Project_ID(m_invoiceLine.getC_Project_ID()); cr.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID()); cr.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID()); cr.setC_UOM_ID(m_invoiceLine.getC_UOM_ID()); cr.setUser1_ID(m_invoiceLine.getUser1_ID()); cr.setUser2_ID(m_invoiceLine.getUser2_ID()); if (dr.getC_Currency_ID() != cr.getC_Currency_ID()) setIsMultiCurrency(true); MAccount acct_db = dr.getAccount(); MAccount acct_cr = cr.getAccount(); if ((!as.isPostIfClearingEqual()) && acct_db.equals(acct_cr) && (!isInterOrg)) { BigDecimal debit = dr.getAmtSourceDr(); BigDecimal credit = cr.getAmtSourceCr(); if (debit.compareTo(credit) == 0) { fact.remove(dr); fact.remove(cr); } } BigDecimal ipv = cr.getAcctBalance().add(dr.getAcctBalance()).negate(); if (ipv.signum() != 0) { FactLine pv = fact.createLine(null, m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), as.getC_Currency_ID(), ipv); pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID()); pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID()); pv.setC_Project_ID(m_invoiceLine.getC_Project_ID()); pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID()); pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID()); pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID()); pv.setUser1_ID(m_invoiceLine.getUser1_ID()); pv.setUser2_ID(m_invoiceLine.getUser2_ID()); } log.fine("IPV=" + ipv + STR + fact.getSourceBalance()); updateProductInfo(as.getC_AcctSchema_ID(), MAcctSchema.COSTINGMETHOD_StandardCosting.equals(as.getCostingMethod())); facts.add(fact); if (as.isAccrual() && as.isCreatePOCommitment()) { fact = Doc_Order.getCommitmentRelease(as, this, getQty(), m_invoiceLine.getC_InvoiceLine_ID(), Env.ONE); if (fact == null) return null; facts.add(fact); } return facts; } | /**
* Create Facts (the accounting logic) for
* MXI.
* (single line)
* <pre>
* NotInvoicedReceipts DR (Receipt Org)
* InventoryClearing CR
* InvoicePV DR CR (difference)
* Commitment
* Expense CR
* Offset DR
* </pre>
* @param as accounting schema
* @return Fact
*/ | Create Facts (the accounting logic) for MXI. (single line) <code> NotInvoicedReceipts DR (Receipt Org) InventoryClearing CR InvoicePV DR CR (difference) Commitment Expense CR Offset DR </code> | createFacts | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/acct/Doc_MatchInv.java",
"license": "gpl-2.0",
"size": 17393
} | [
"java.math.BigDecimal",
"java.util.ArrayList",
"org.compiere.model.MAccount",
"org.compiere.model.MAcctSchema",
"org.compiere.model.MConversionRate",
"org.compiere.model.MInOut",
"org.compiere.model.MInvoice",
"org.compiere.model.ProductCost",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import java.util.ArrayList; import org.compiere.model.MAccount; import org.compiere.model.MAcctSchema; import org.compiere.model.MConversionRate; import org.compiere.model.MInOut; import org.compiere.model.MInvoice; import org.compiere.model.ProductCost; import org.compiere.util.Env; | import java.math.*; import java.util.*; import org.compiere.model.*; import org.compiere.util.*; | [
"java.math",
"java.util",
"org.compiere.model",
"org.compiere.util"
] | java.math; java.util; org.compiere.model; org.compiere.util; | 2,654,690 |
void willDeleteJob(Object job, AuthContext authContext); | void willDeleteJob(Object job, AuthContext authContext); | /**
* The indicated job will be deleted
*
* @param job
* @param authContext
*/ | The indicated job will be deleted | willDeleteJob | {
"repo_name": "rundeck/rundeck",
"path": "core/src/main/java/org/rundeck/app/components/jobs/JobDefinitionComponent.java",
"license": "apache-2.0",
"size": 4989
} | [
"com.dtolabs.rundeck.core.authorization.AuthContext"
] | import com.dtolabs.rundeck.core.authorization.AuthContext; | import com.dtolabs.rundeck.core.authorization.*; | [
"com.dtolabs.rundeck"
] | com.dtolabs.rundeck; | 4,017 |
public String member_name()
throws InvalidValue
{
if (array.length == 1)
throw new InvalidValue(NOAM);
try
{
Any da = discriminator.to_any();
// Get the discriminator variant.
for (int i = 0; i < final_type.member_count(); i++)
{
if (final_type.member_label(i).equal(da))
return final_type.member_name(i);
}
throw new InvalidValue(NOAM);
}
catch (Exception e)
{
InvalidValue t = new InvalidValue("Err");
t.initCause(e);
throw t;
}
} | String function() throws InvalidValue { if (array.length == 1) throw new InvalidValue(NOAM); try { Any da = discriminator.to_any(); for (int i = 0; i < final_type.member_count(); i++) { if (final_type.member_label(i).equal(da)) return final_type.member_name(i); } throw new InvalidValue(NOAM); } catch (Exception e) { InvalidValue t = new InvalidValue("Err"); t.initCause(e); throw t; } } | /**
* Get the name of the current variant of the union.
*/ | Get the name of the current variant of the union | member_name | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/gnu/CORBA/DynAn/gnuDynUnion.java",
"license": "gpl-2.0",
"size": 11224
} | [
"org.omg.CORBA",
"org.omg.DynamicAny"
] | import org.omg.CORBA; import org.omg.DynamicAny; | import org.omg.*; | [
"org.omg"
] | org.omg; | 2,616,298 |
private void initScheduledTasks() {
if (clientConfig.shouldFetchRegistry()) {
// registry cache refresh timer
int registryFetchIntervalSeconds = clientConfig.getRegistryFetchIntervalSeconds();
int expBackOffBound = clientConfig.getCacheRefreshExecutorExponentialBackOffBound();
scheduler.schedule(
new TimedSupervisorTask(
"cacheRefresh",
scheduler,
cacheRefreshExecutor,
registryFetchIntervalSeconds,
TimeUnit.SECONDS,
expBackOffBound,
new CacheRefreshThread()
),
registryFetchIntervalSeconds, TimeUnit.SECONDS);
}
if (shouldRegister(instanceInfo)) {
int renewalIntervalInSecs = instanceInfo.getLeaseInfo().getRenewalIntervalInSecs();
int expBackOffBound = clientConfig.getHeartbeatExecutorExponentialBackOffBound();
logger.info("Starting heartbeat executor: " + "renew interval is: " + renewalIntervalInSecs);
// Heartbeat timer
scheduler.schedule(
new TimedSupervisorTask(
"heartbeat",
scheduler,
heartbeatExecutor,
renewalIntervalInSecs,
TimeUnit.SECONDS,
expBackOffBound,
new HeartbeatThread()
),
renewalIntervalInSecs, TimeUnit.SECONDS);
// InstanceInfo replicator
instanceInfoReplicator = new InstanceInfoReplicator(
this,
instanceInfo,
clientConfig.getInstanceInfoReplicationIntervalSeconds(),
2); // burstSize | void function() { if (clientConfig.shouldFetchRegistry()) { int registryFetchIntervalSeconds = clientConfig.getRegistryFetchIntervalSeconds(); int expBackOffBound = clientConfig.getCacheRefreshExecutorExponentialBackOffBound(); scheduler.schedule( new TimedSupervisorTask( STR, scheduler, cacheRefreshExecutor, registryFetchIntervalSeconds, TimeUnit.SECONDS, expBackOffBound, new CacheRefreshThread() ), registryFetchIntervalSeconds, TimeUnit.SECONDS); } if (shouldRegister(instanceInfo)) { int renewalIntervalInSecs = instanceInfo.getLeaseInfo().getRenewalIntervalInSecs(); int expBackOffBound = clientConfig.getHeartbeatExecutorExponentialBackOffBound(); logger.info(STR + STR + renewalIntervalInSecs); scheduler.schedule( new TimedSupervisorTask( STR, scheduler, heartbeatExecutor, renewalIntervalInSecs, TimeUnit.SECONDS, expBackOffBound, new HeartbeatThread() ), renewalIntervalInSecs, TimeUnit.SECONDS); instanceInfoReplicator = new InstanceInfoReplicator( this, instanceInfo, clientConfig.getInstanceInfoReplicationIntervalSeconds(), 2); | /**
* Initializes all scheduled tasks.
*/ | Initializes all scheduled tasks | initScheduledTasks | {
"repo_name": "ccortezb/eureka",
"path": "eureka-client/src/main/java/com/netflix/discovery/DiscoveryClient.java",
"license": "apache-2.0",
"size": 89455
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 63,006 |
public void doReadBenchmark() throws Exception {
final int n = 5;
final int m = 100000000;
StringBuilder valueSB = new StringBuilder();
for (int i = 0; i < 100; i++) {
valueSB.append((byte)(Math.random() * 10));
}
StringBuilder rowSB = new StringBuilder();
for (int i = 0; i < 50; i++) {
rowSB.append((byte)(Math.random() * 10));
}
KeyValue [] kvs = genKVs(Bytes.toBytes(rowSB.toString()), family,
Bytes.toBytes(valueSB.toString()), 1, n);
Arrays.sort(kvs, CellComparator.COMPARATOR);
ByteBuffer loadValueBuffer = ByteBuffer.allocate(1024);
Result r = Result.create(kvs);
byte[][] qfs = new byte[n][Bytes.SIZEOF_INT];
for (int i = 0; i < n; ++i) {
System.arraycopy(qfs[i], 0, Bytes.toBytes(i), 0, Bytes.SIZEOF_INT);
}
// warm up
for (int k = 0; k < 100000; k++) {
for (int i = 0; i < n; ++i) {
r.getValue(family, qfs[i]);
loadValueBuffer.clear();
r.loadValue(family, qfs[i], loadValueBuffer);
loadValueBuffer.flip();
}
}
System.gc();
long start = System.nanoTime();
for (int k = 0; k < m; k++) {
for (int i = 0; i < n; ++i) {
loadValueBuffer.clear();
r.loadValue(family, qfs[i], loadValueBuffer);
loadValueBuffer.flip();
}
}
long stop = System.nanoTime();
System.out.println("loadValue(): " + (stop - start));
System.gc();
start = System.nanoTime();
for (int k = 0; k < m; k++) {
for (int i = 0; i < n; i++) {
r.getValue(family, qfs[i]);
}
}
stop = System.nanoTime();
System.out.println("getValue(): " + (stop - start));
} | void function() throws Exception { final int n = 5; final int m = 100000000; StringBuilder valueSB = new StringBuilder(); for (int i = 0; i < 100; i++) { valueSB.append((byte)(Math.random() * 10)); } StringBuilder rowSB = new StringBuilder(); for (int i = 0; i < 50; i++) { rowSB.append((byte)(Math.random() * 10)); } KeyValue [] kvs = genKVs(Bytes.toBytes(rowSB.toString()), family, Bytes.toBytes(valueSB.toString()), 1, n); Arrays.sort(kvs, CellComparator.COMPARATOR); ByteBuffer loadValueBuffer = ByteBuffer.allocate(1024); Result r = Result.create(kvs); byte[][] qfs = new byte[n][Bytes.SIZEOF_INT]; for (int i = 0; i < n; ++i) { System.arraycopy(qfs[i], 0, Bytes.toBytes(i), 0, Bytes.SIZEOF_INT); } for (int k = 0; k < 100000; k++) { for (int i = 0; i < n; ++i) { r.getValue(family, qfs[i]); loadValueBuffer.clear(); r.loadValue(family, qfs[i], loadValueBuffer); loadValueBuffer.flip(); } } System.gc(); long start = System.nanoTime(); for (int k = 0; k < m; k++) { for (int i = 0; i < n; ++i) { loadValueBuffer.clear(); r.loadValue(family, qfs[i], loadValueBuffer); loadValueBuffer.flip(); } } long stop = System.nanoTime(); System.out.println(STR + (stop - start)); System.gc(); start = System.nanoTime(); for (int k = 0; k < m; k++) { for (int i = 0; i < n; i++) { r.getValue(family, qfs[i]); } } stop = System.nanoTime(); System.out.println(STR + (stop - start)); } | /**
* Microbenchmark that compares {@link Result#getValue} and {@link Result#loadValue} performance.
*
* @throws Exception
*/ | Microbenchmark that compares <code>Result#getValue</code> and <code>Result#loadValue</code> performance | doReadBenchmark | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java",
"license": "apache-2.0",
"size": 10674
} | [
"java.nio.ByteBuffer",
"java.util.Arrays",
"org.apache.hadoop.hbase.CellComparator",
"org.apache.hadoop.hbase.KeyValue",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.nio.ByteBuffer; import java.util.Arrays; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.util.Bytes; | import java.nio.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; | [
"java.nio",
"java.util",
"org.apache.hadoop"
] | java.nio; java.util; org.apache.hadoop; | 648,396 |
public void addLog(final ProcessInfoLog logEntry)
{
if (logEntry == null)
{
return;
}
final List<ProcessInfoLog> logs;
if (this.logs == null)
{
logs = this.logs = new ArrayList<>();
}
else
{
logs = this.logs;
}
logs.add(logEntry);
} | void function(final ProcessInfoLog logEntry) { if (logEntry == null) { return; } final List<ProcessInfoLog> logs; if (this.logs == null) { logs = this.logs = new ArrayList<>(); } else { logs = this.logs; } logs.add(logEntry); } | /**
* Add to Log
*
* @param logEntry log entry
*/ | Add to Log | addLog | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java/de/metas/process/ProcessExecutionResult.java",
"license": "gpl-2.0",
"size": 16866
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 556,621 |
public static Reader getReaderForConfigFile(String configFile) throws FileNotFoundException {
Reader retval = null;
try {
retval = new InputStreamReader(getInputStreamForConfigFile(configFile), "UTF-8");
} catch (UnsupportedEncodingException e) {
fail("Your JVM doesn't support UTF-8 encoding, which is pretty much impossible.");
}
return retval;
} | static Reader function(String configFile) throws FileNotFoundException { Reader retval = null; try { retval = new InputStreamReader(getInputStreamForConfigFile(configFile), "UTF-8"); } catch (UnsupportedEncodingException e) { fail(STR); } return retval; } | /**
* Use getInputStreamForConfigFile instead.
*
* @param configFile a {@link java.lang.String} object.
* @return a {@link java.io.Reader} object.
* @throws java.io.FileNotFoundException if any.
*/ | Use getInputStreamForConfigFile instead | getReaderForConfigFile | {
"repo_name": "tdefilip/opennms",
"path": "core/test-api/lib/src/main/java/org/opennms/core/test/ConfigurationTestUtils.java",
"license": "agpl-3.0",
"size": 15713
} | [
"java.io.FileNotFoundException",
"java.io.InputStreamReader",
"java.io.Reader",
"java.io.UnsupportedEncodingException"
] | import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 1,471,633 |
public void testContextSafety () throws Exception
{
Vector v = new Vector();
v.addElement( new String("vector hello 1") );
v.addElement( new String("vector hello 2") );
v.addElement( new String("vector hello 3") );
String strArray[] = new String[3];
strArray[0] = "array hello 1";
strArray[1] = "array hello 2";
strArray[2] = "array hello 3";
VelocityContext context = new VelocityContext();
assureResultsDirectoryExists(RESULT_DIR);
Template template = RuntimeSingleton.getTemplate( getFileName(null, "context_safety", TMPL_FILE_EXT));
FileOutputStream fos1 = new FileOutputStream ( getFileName( RESULT_DIR, "context_safety1", RESULT_FILE_EXT));
FileOutputStream fos2 = new FileOutputStream ( getFileName( RESULT_DIR, "context_safety2", RESULT_FILE_EXT));
Writer writer1 = new BufferedWriter(new OutputStreamWriter(fos1));
Writer writer2 = new BufferedWriter(new OutputStreamWriter(fos2));
context.put("vector", v);
template.merge(context, writer1);
writer1.flush();
writer1.close();
context.put("vector", strArray);
template.merge(context, writer2);
writer2.flush();
writer2.close();
if (!isMatch(RESULT_DIR,COMPARE_DIR,"context_safety1", RESULT_FILE_EXT,CMP_FILE_EXT) ||
!isMatch(RESULT_DIR,COMPARE_DIR,"context_safety2", RESULT_FILE_EXT,CMP_FILE_EXT))
{
fail("Output incorrect.");
}
} | void function () throws Exception { Vector v = new Vector(); v.addElement( new String(STR) ); v.addElement( new String(STR) ); v.addElement( new String(STR) ); String strArray[] = new String[3]; strArray[0] = STR; strArray[1] = STR; strArray[2] = STR; VelocityContext context = new VelocityContext(); assureResultsDirectoryExists(RESULT_DIR); Template template = RuntimeSingleton.getTemplate( getFileName(null, STR, TMPL_FILE_EXT)); FileOutputStream fos1 = new FileOutputStream ( getFileName( RESULT_DIR, STR, RESULT_FILE_EXT)); FileOutputStream fos2 = new FileOutputStream ( getFileName( RESULT_DIR, STR, RESULT_FILE_EXT)); Writer writer1 = new BufferedWriter(new OutputStreamWriter(fos1)); Writer writer2 = new BufferedWriter(new OutputStreamWriter(fos2)); context.put(STR, v); template.merge(context, writer1); writer1.flush(); writer1.close(); context.put(STR, strArray); template.merge(context, writer2); writer2.flush(); writer2.close(); if (!isMatch(RESULT_DIR,COMPARE_DIR,STR, RESULT_FILE_EXT,CMP_FILE_EXT) !isMatch(RESULT_DIR,COMPARE_DIR,STR, RESULT_FILE_EXT,CMP_FILE_EXT)) { fail(STR); } } | /**
* Runs the test.
*/ | Runs the test | testContextSafety | {
"repo_name": "fbrier/velocity",
"path": "src/test/java/org/apache/velocity/test/ContextSafetyTestCase.java",
"license": "apache-2.0",
"size": 4328
} | [
"java.io.BufferedWriter",
"java.io.FileOutputStream",
"java.io.OutputStreamWriter",
"java.io.Writer",
"java.util.Vector",
"org.apache.velocity.Template",
"org.apache.velocity.VelocityContext",
"org.apache.velocity.runtime.RuntimeSingleton"
] | import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.Vector; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.runtime.RuntimeSingleton; | import java.io.*; import java.util.*; import org.apache.velocity.*; import org.apache.velocity.runtime.*; | [
"java.io",
"java.util",
"org.apache.velocity"
] | java.io; java.util; org.apache.velocity; | 1,942,609 |
public void setUnderlying(ExternalIdBean underlying) {
this._underlying = underlying;
} | void function(ExternalIdBean underlying) { this._underlying = underlying; } | /**
* Sets the underlying.
* @param underlying the new value of the property
*/ | Sets the underlying | setUnderlying | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/future/FutureSecurityBean.java",
"license": "apache-2.0",
"size": 24798
} | [
"com.opengamma.masterdb.security.hibernate.ExternalIdBean"
] | import com.opengamma.masterdb.security.hibernate.ExternalIdBean; | import com.opengamma.masterdb.security.hibernate.*; | [
"com.opengamma.masterdb"
] | com.opengamma.masterdb; | 1,611,849 |
public Set<String> ids() {
return this.ids;
} | Set<String> function() { return this.ids; } | /**
* Returns the ids for the query.
*/ | Returns the ids for the query | ids | {
"repo_name": "yanjunh/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java",
"license": "apache-2.0",
"size": 6291
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 6,792 |
private Boolean saveAllTracks() {
Cursor cursor = null;
try {
cursor = myTracksProviderUtils.getTrackCursor(null, null, TracksColumns._ID);
if (cursor == null) {
return false;
}
totalCount = cursor.getCount();
for (int i = 0; i < totalCount; i++) {
if (isCancelled()) {
return false;
}
cursor.moveToPosition(i);
Track track = myTracksProviderUtils.createTrack(cursor);
if (track != null && saveTracks(new Track[] { track })) {
successCount++;
}
publishProgress(i + 1, totalCount);
}
return true;
} finally {
if (cursor != null) {
cursor.close();
}
}
} | Boolean function() { Cursor cursor = null; try { cursor = myTracksProviderUtils.getTrackCursor(null, null, TracksColumns._ID); if (cursor == null) { return false; } totalCount = cursor.getCount(); for (int i = 0; i < totalCount; i++) { if (isCancelled()) { return false; } cursor.moveToPosition(i); Track track = myTracksProviderUtils.createTrack(cursor); if (track != null && saveTracks(new Track[] { track })) { successCount++; } publishProgress(i + 1, totalCount); } return true; } finally { if (cursor != null) { cursor.close(); } } } | /**
* Saves all the tracks.
*/ | Saves all the tracks | saveAllTracks | {
"repo_name": "AdaDeb/septracks",
"path": "MyTracks/src/com/google/android/apps/mytracks/io/file/SaveAsyncTask.java",
"license": "gpl-2.0",
"size": 7588
} | [
"android.database.Cursor",
"com.google.android.apps.mytracks.content.Track",
"com.google.android.apps.mytracks.content.TracksColumns"
] | import android.database.Cursor; import com.google.android.apps.mytracks.content.Track; import com.google.android.apps.mytracks.content.TracksColumns; | import android.database.*; import com.google.android.apps.mytracks.content.*; | [
"android.database",
"com.google.android"
] | android.database; com.google.android; | 1,271,321 |
public java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> getSubterm_finiteIntRanges_LessThanHLAPI(){
java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.finiteIntRanges.impl.LessThanImpl.class)){
retour.add(new fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI(
(fr.lip6.move.pnml.hlpn.finiteIntRanges.LessThan)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.finiteIntRanges.impl.LessThanImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.hlpn.finiteIntRanges.LessThan)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_finiteIntRanges_LessThanHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/SubstringHLAPI.java",
"license": "epl-1.0",
"size": 111893
} | [
"fr.lip6.move.pnml.hlpn.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 1,719,561 |
public static InconsistentAmazonS3Client castFrom(AmazonS3 c) throws
Exception {
InconsistentAmazonS3Client ic = null;
if (c instanceof InconsistentAmazonS3Client) {
ic = (InconsistentAmazonS3Client) c;
}
Preconditions.checkNotNull(ic, "Not an instance of " +
"InconsistentAmazonS3Client");
return ic;
} | static InconsistentAmazonS3Client function(AmazonS3 c) throws Exception { InconsistentAmazonS3Client ic = null; if (c instanceof InconsistentAmazonS3Client) { ic = (InconsistentAmazonS3Client) c; } Preconditions.checkNotNull(ic, STR + STR); return ic; } | /**
* Convenience function for test code to cast from supertype.
* @param c supertype to cast from
* @return subtype, not null
* @throws Exception on error
*/ | Convenience function for test code to cast from supertype | castFrom | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/InconsistentAmazonS3Client.java",
"license": "apache-2.0",
"size": 24051
} | [
"com.amazonaws.services.s3.AmazonS3",
"com.google.common.base.Preconditions"
] | import com.amazonaws.services.s3.AmazonS3; import com.google.common.base.Preconditions; | import com.amazonaws.services.s3.*; import com.google.common.base.*; | [
"com.amazonaws.services",
"com.google.common"
] | com.amazonaws.services; com.google.common; | 243,719 |
private static void processIndexes(QueryEntity qryEntity, QueryTypeDescriptorImpl d) throws IgniteCheckedException {
if (!F.isEmpty(qryEntity.getIndexes())) {
for (QueryIndex idx : qryEntity.getIndexes())
processIndex(idx, d);
}
} | static void function(QueryEntity qryEntity, QueryTypeDescriptorImpl d) throws IgniteCheckedException { if (!F.isEmpty(qryEntity.getIndexes())) { for (QueryIndex idx : qryEntity.getIndexes()) processIndex(idx, d); } } | /**
* Processes indexes based on query entity.
*
* @param qryEntity Query entity to process.
* @param d Type descriptor to populate.
* @throws IgniteCheckedException If failed to build index information.
*/ | Processes indexes based on query entity | processIndexes | {
"repo_name": "vladisav/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java",
"license": "apache-2.0",
"size": 49135
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.cache.QueryEntity",
"org.apache.ignite.cache.QueryIndex",
"org.apache.ignite.internal.util.typedef.F"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.internal.util.typedef.F; | import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.util.typedef.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,098,821 |
// -------------------------------------------------------------------------
@Override
protected void doRun() {
final String fileName = getCommandLine().getOptionValue(FILE_NAME_OPT);
final String dataProvider = getCommandLine().hasOption(TIME_SERIES_DATAPROVIDER_OPT) ? getCommandLine().getOptionValue(TIME_SERIES_DATAPROVIDER_OPT)
: DEFAULT_DATA_PROVIDER;
final String dataField = getCommandLine().getOptionValue(TIME_SERIES_DATAFIELD_OPT);
final HistoricalTimeSeriesLoader loader = getToolContext().getHistoricalTimeSeriesLoader();
try {
final File file = new File(fileName);
if (file.exists()) {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
final Set<ExternalId> ids = new LinkedHashSet<>();
while ((line = reader.readLine()) != null) {
if (line.contains("~")) {
ids.add(ExternalId.parse(line.trim()));
} else {
if (getCommandLine().hasOption(TIME_SERIES_IDSCHEME_OPT)) {
ids.add(ExternalId.of(getCommandLine().getOptionValue(TIME_SERIES_IDSCHEME_OPT), line.trim()));
} else {
LOGGER.error("Time series id {} does not have a scheme, and ID scheme option not set, so cannot be loaded, skipping.", line);
}
}
}
final HistoricalTimeSeriesLoaderRequest req = HistoricalTimeSeriesLoaderRequest.create(ids, dataProvider, dataField, null, null);
loader.loadTimeSeries(req);
}
} else {
LOGGER.error("File {} does not exist", fileName);
}
} catch (final Exception e) {
}
} | void function() { final String fileName = getCommandLine().getOptionValue(FILE_NAME_OPT); final String dataProvider = getCommandLine().hasOption(TIME_SERIES_DATAPROVIDER_OPT) ? getCommandLine().getOptionValue(TIME_SERIES_DATAPROVIDER_OPT) : DEFAULT_DATA_PROVIDER; final String dataField = getCommandLine().getOptionValue(TIME_SERIES_DATAFIELD_OPT); final HistoricalTimeSeriesLoader loader = getToolContext().getHistoricalTimeSeriesLoader(); try { final File file = new File(fileName); if (file.exists()) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line; final Set<ExternalId> ids = new LinkedHashSet<>(); while ((line = reader.readLine()) != null) { if (line.contains("~")) { ids.add(ExternalId.parse(line.trim())); } else { if (getCommandLine().hasOption(TIME_SERIES_IDSCHEME_OPT)) { ids.add(ExternalId.of(getCommandLine().getOptionValue(TIME_SERIES_IDSCHEME_OPT), line.trim())); } else { LOGGER.error(STR, line); } } } final HistoricalTimeSeriesLoaderRequest req = HistoricalTimeSeriesLoaderRequest.create(ids, dataProvider, dataField, null, null); loader.loadTimeSeries(req); } } else { LOGGER.error(STR, fileName); } } catch (final Exception e) { } } | /**
* Loads the test portfolio into the position master.
*/ | Loads the test portfolio into the position master | doRun | {
"repo_name": "McLeodMoores/starling",
"path": "projects/integration/src/main/java/com/opengamma/integration/tool/hts/HistoricalTimeSeriesLoaderTool.java",
"license": "apache-2.0",
"size": 5670
} | [
"com.opengamma.id.ExternalId",
"com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoader",
"com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoaderRequest",
"java.io.BufferedReader",
"java.io.File",
"java.io.FileReader",
"java.util.LinkedHashSet",
"java.util.Set"
] | import com.opengamma.id.ExternalId; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoader; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoaderRequest; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.LinkedHashSet; import java.util.Set; | import com.opengamma.id.*; import com.opengamma.master.historicaltimeseries.*; import java.io.*; import java.util.*; | [
"com.opengamma.id",
"com.opengamma.master",
"java.io",
"java.util"
] | com.opengamma.id; com.opengamma.master; java.io; java.util; | 1,885,721 |
public void uploadData(int id, String fileName) throws Exception {
String statusCode;
String message = "UPLOAD " + fileName + " " + InetAddress.getLocalHost().getHostAddress() + " Padding";
sendDataToServer(message, serverIPs[id], serverPortNumbers[id]); // Send message upload to the appropriate server.
message = receiveDataFromServer();
Scanner scan = new Scanner(message);
statusCode = scan.next();
// If the server returned the HTTP status code 200 OK, then the file was successfully added to the DHT.
if (statusCode.equals("200")) {
System.out.println("FROM SERVER -> File Added To DHT");
}
}
| void function(int id, String fileName) throws Exception { String statusCode; String message = STR + fileName + " " + InetAddress.getLocalHost().getHostAddress() + STR; sendDataToServer(message, serverIPs[id], serverPortNumbers[id]); message = receiveDataFromServer(); Scanner scan = new Scanner(message); statusCode = scan.next(); if (statusCode.equals("200")) { System.out.println(STR); } } | /**
* Upload data from client to server.
* @param id ID number of the server in which to upload data.
* @param fileName Name of the file to uplaod.
* @throws Exception
*/ | Upload data from client to server | uploadData | {
"repo_name": "nsalerni/P2P-Photo-Sharing-Service",
"path": "src/PeerClient.java",
"license": "gpl-3.0",
"size": 15636
} | [
"java.net.InetAddress",
"java.util.Scanner"
] | import java.net.InetAddress; import java.util.Scanner; | import java.net.*; import java.util.*; | [
"java.net",
"java.util"
] | java.net; java.util; | 2,470,718 |
@Nonnull
public List<Product> readProductsByName(@Nonnull String searchName); | List<Product> function(@Nonnull String searchName); | /**
* Find all {@code Product} instances whose name starts with
* or is equal to the passed in search parameter
*
* @param searchName the partial or whole name to match
* @return the list of product instances that were search hits
*/ | Find all Product instances whose name starts with or is equal to the passed in search parameter | readProductsByName | {
"repo_name": "passion1014/metaworks_framework",
"path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/catalog/dao/ProductDao.java",
"license": "apache-2.0",
"size": 12036
} | [
"java.util.List",
"javax.annotation.Nonnull",
"org.broadleafcommerce.core.catalog.domain.Product"
] | import java.util.List; import javax.annotation.Nonnull; import org.broadleafcommerce.core.catalog.domain.Product; | import java.util.*; import javax.annotation.*; import org.broadleafcommerce.core.catalog.domain.*; | [
"java.util",
"javax.annotation",
"org.broadleafcommerce.core"
] | java.util; javax.annotation; org.broadleafcommerce.core; | 2,606,428 |
public void testLogin_01() throws Exception {
TestConfig.addInstalledSufficient("TestLoginModule_Success");
LoginContext lc = new LoginContext(CONFIG_NAME);
lc.login();
Subject subj0 = lc.getSubject();
assertNotNull(subj0);
lc.logout();
//
lc.login();
Subject subj1 = lc.getSubject();
assertSame(subj0, subj1);
// additional cleanup to make it PerfTests compatible
clear();
} | void function() throws Exception { TestConfig.addInstalledSufficient(STR); LoginContext lc = new LoginContext(CONFIG_NAME); lc.login(); Subject subj0 = lc.getSubject(); assertNotNull(subj0); lc.logout(); Subject subj1 = lc.getSubject(); assertSame(subj0, subj1); clear(); } | /**
* Tests LoginContext.login()<br>
* If no Subject provided, then new Subject created and this subject is
* used for all subsequent operations.
*/ | Tests LoginContext.login() If no Subject provided, then new Subject created and this subject is used for all subsequent operations | testLogin_01 | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "external/apache-harmony/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/LoginContext1Test.java",
"license": "gpl-2.0",
"size": 75897
} | [
"javax.security.auth.Subject",
"javax.security.auth.login.LoginContext"
] | import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; | import javax.security.auth.*; import javax.security.auth.login.*; | [
"javax.security"
] | javax.security; | 100,742 |
@Override
public void endFunction(final Context context, final BugList bugs) {
//empty body for Adapter
} | void function(final Context context, final BugList bugs) { } | /**
* Default implementation does nothing
*/ | Default implementation does nothing | endFunction | {
"repo_name": "TheRealAgentK/CFLint",
"path": "src/main/java/com/cflint/plugins/CFLintScannerAdapter.java",
"license": "bsd-3-clause",
"size": 6235
} | [
"com.cflint.BugList"
] | import com.cflint.BugList; | import com.cflint.*; | [
"com.cflint"
] | com.cflint; | 191,559 |
static String replaceParameters(String format, String[] params) throws BadFormatString {
Matcher match = parameterPattern.matcher(format);
int start = 0;
StringBuilder result = new StringBuilder();
while (start < format.length() && match.find(start)) {
result.append(match.group(1));
String paramNum = match.group(3);
if (paramNum != null) {
try {
int num = Integer.parseInt(paramNum);
if (num < 0 || num > params.length) {
throw new BadFormatString(String.format(
"index %d from %s is outside of the valid range 0 to %d",
num,
format,
(params.length - 1)));
}
result.append(params[num]);
} catch (NumberFormatException nfe) {
throw new BadFormatString("bad format in username mapping in " + paramNum, nfe);
}
}
start = match.end();
}
return result.toString();
} | static String replaceParameters(String format, String[] params) throws BadFormatString { Matcher match = parameterPattern.matcher(format); int start = 0; StringBuilder result = new StringBuilder(); while (start < format.length() && match.find(start)) { result.append(match.group(1)); String paramNum = match.group(3); if (paramNum != null) { try { int num = Integer.parseInt(paramNum); if (num < 0 num > params.length) { throw new BadFormatString(String.format( STR, num, format, (params.length - 1))); } result.append(params[num]); } catch (NumberFormatException nfe) { throw new BadFormatString(STR + paramNum, nfe); } } start = match.end(); } return result.toString(); } | /**
* Replace the numbered parameters of the form $n where n is from 1 to
* the length of params. Normal text is copied directly and $n is replaced
* by the corresponding parameter.
* @param format the string to replace parameters again
* @param params the list of parameters
* @return the generated string with the parameter references replaced.
* @throws BadFormatString
*/ | Replace the numbered parameters of the form $n where n is from 1 to the length of params. Normal text is copied directly and $n is replaced by the corresponding parameter | replaceParameters | {
"repo_name": "maoling/zookeeper",
"path": "zookeeper-server/src/main/java/org/apache/zookeeper/server/auth/KerberosName.java",
"license": "apache-2.0",
"size": 14328
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,500,834 |
Map<String, Parameter> getEffectiveParameterUpdates(Map<String, Parameter> parameterUpdates, List<ParameterContext> inheritedParameterContexts); | Map<String, Parameter> getEffectiveParameterUpdates(Map<String, Parameter> parameterUpdates, List<ParameterContext> inheritedParameterContexts); | /**
* Returns the resulting map of effective parameter updates if the given parameter updates and inherited parameter contexts were to be applied.
* This allows potential changes to be detected before actually applying the parameter updates.
* @param parameterUpdates A map from parameter name to updated parameter (null if removal is desired)
* @param inheritedParameterContexts An ordered list of parameter contexts to inherit from
* @return The effective map of parameter updates that would result if these changes were applied. This includes only parameters that would
* be effectively updated or removed, and is mapped by parameter name
*/ | Returns the resulting map of effective parameter updates if the given parameter updates and inherited parameter contexts were to be applied. This allows potential changes to be detected before actually applying the parameter updates | getEffectiveParameterUpdates | {
"repo_name": "MikeThomsen/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/parameter/ParameterContext.java",
"license": "apache-2.0",
"size": 9272
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 383,005 |
private boolean saveConfiguration() {
// remember the settings
SharedPreferences.Editor editor = settings.edit();
editor.putString("git_remote_server", ((EditText) findViewById(R.id.server_url)).getText().toString());
editor.putString("git_remote_location", ((EditText) findViewById(R.id.server_path)).getText().toString());
editor.putString("git_remote_username", ((EditText) findViewById(R.id.server_user)).getText().toString());
editor.putString("git_remote_protocol", protocol);
editor.putString("git_remote_auth", connectionMode);
editor.putString("git_remote_port", ((EditText) findViewById(R.id.server_port)).getText().toString());
editor.putString("git_remote_uri", ((EditText) findViewById(R.id.clone_uri)).getText().toString());
// 'save' hostname variable for use by addRemote() either here or later
// in syncRepository()
hostname = ((EditText) findViewById(R.id.clone_uri)).getText().toString();
port = ((EditText) findViewById(R.id.server_port)).getText().toString();
// don't ask the user, take off the protocol that he puts in
hostname = hostname.replaceFirst("^.+://", "");
((TextView) findViewById(R.id.clone_uri)).setText(hostname);
if (!protocol.equals("ssh://")) {
hostname = protocol + hostname;
} else {
// if the port is explicitly given, jgit requires the ssh://
if (!port.isEmpty() && !port.equals("22"))
hostname = protocol + hostname;
// did he forget the username?
if (!hostname.matches("^.+@.+")) {
new AlertDialog.Builder(this).
setMessage(activity.getResources().getString(R.string.forget_username_dialog_text)).
setPositiveButton(activity.getResources().getString(R.string.dialog_oops), null).
show();
return false;
}
}
if (PasswordRepository.isInitialized()) {
// don't just use the clone_uri text, need to use hostname which has
// had the proper protocol prepended
PasswordRepository.addRemote("origin", hostname, true);
}
editor.apply();
return true;
} | boolean function() { SharedPreferences.Editor editor = settings.edit(); editor.putString(STR, ((EditText) findViewById(R.id.server_url)).getText().toString()); editor.putString(STR, ((EditText) findViewById(R.id.server_path)).getText().toString()); editor.putString(STR, ((EditText) findViewById(R.id.server_user)).getText().toString()); editor.putString(STR, protocol); editor.putString(STR, connectionMode); editor.putString(STR, ((EditText) findViewById(R.id.server_port)).getText().toString()); editor.putString(STR, ((EditText) findViewById(R.id.clone_uri)).getText().toString()); hostname = ((EditText) findViewById(R.id.clone_uri)).getText().toString(); port = ((EditText) findViewById(R.id.server_port)).getText().toString(); hostname = hostname.replaceFirst(STRssh: hostname = protocol + hostname; } else { if (!port.isEmpty() && !port.equals("22")) hostname = protocol + hostname; if (!hostname.matches(STR)) { new AlertDialog.Builder(this). setMessage(activity.getResources().getString(R.string.forget_username_dialog_text)). setPositiveButton(activity.getResources().getString(R.string.dialog_oops), null). show(); return false; } } if (PasswordRepository.isInitialized()) { PasswordRepository.addRemote(STR, hostname, true); } editor.apply(); return true; } | /**
* Saves the configuration found in the form
*/ | Saves the configuration found in the form | saveConfiguration | {
"repo_name": "svetlemodry/Android-Password-Store",
"path": "app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java",
"license": "gpl-3.0",
"size": 27636
} | [
"android.content.SharedPreferences",
"android.support.v7.app.AlertDialog",
"android.widget.EditText",
"com.zeapo.pwdstore.utils.PasswordRepository"
] | import android.content.SharedPreferences; import android.support.v7.app.AlertDialog; import android.widget.EditText; import com.zeapo.pwdstore.utils.PasswordRepository; | import android.content.*; import android.support.v7.app.*; import android.widget.*; import com.zeapo.pwdstore.utils.*; | [
"android.content",
"android.support",
"android.widget",
"com.zeapo.pwdstore"
] | android.content; android.support; android.widget; com.zeapo.pwdstore; | 2,177,833 |
public void setUnits(ArrayList<String> units) {
this.units = units;
} | void function(ArrayList<String> units) { this.units = units; } | /**
* Set the units array
*
* @param units
* An arrayList<string> of units in the same order as the
* valuePaths
*/ | Set the units array | setUnits | {
"repo_name": "swandroid/SwanMonitor",
"path": "app/src/main/java/interdroid/swan/swanmonitor/SensorObject.java",
"license": "gpl-2.0",
"size": 9001
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,162,348 |
@Override
public void createBpmaiJsonToJbptUnit(boolean strictness) throws IllegalTypeException {
register(new BpmaiJsonToDiagramUnit());
register(new ErrorCorrectorUnit());
register(new DiagramToJbptUnit(strictness));
}
| void function(boolean strictness) throws IllegalTypeException { register(new BpmaiJsonToDiagramUnit()); register(new ErrorCorrectorUnit()); register(new DiagramToJbptUnit(strictness)); } | /**
* injects an error correction unit into the bpmai to jbpt unit chain
*/ | injects an error correction unit into the bpmai to jbpt unit chain | createBpmaiJsonToJbptUnit | {
"repo_name": "tobiashoppe/promnicat",
"path": "src/de/uni_potsdam/hpi/bpt/promnicat/correctionModule/CorrectionUnitChainBuilder.java",
"license": "gpl-3.0",
"size": 3864
} | [
"de.uni_potsdam.hpi.bpt.promnicat.correctionModule.utilityUnits.ErrorCorrectorUnit",
"de.uni_potsdam.hpi.bpt.promnicat.util.IllegalTypeException",
"de.uni_potsdam.hpi.bpt.promnicat.utilityUnits.transformer.BpmaiJsonToDiagramUnit",
"de.uni_potsdam.hpi.bpt.promnicat.utilityUnits.transformer.DiagramToJbptUnit"
] | import de.uni_potsdam.hpi.bpt.promnicat.correctionModule.utilityUnits.ErrorCorrectorUnit; import de.uni_potsdam.hpi.bpt.promnicat.util.IllegalTypeException; import de.uni_potsdam.hpi.bpt.promnicat.utilityUnits.transformer.BpmaiJsonToDiagramUnit; import de.uni_potsdam.hpi.bpt.promnicat.utilityUnits.transformer.DiagramToJbptUnit; | import de.uni_potsdam.hpi.bpt.promnicat.*; import de.uni_potsdam.hpi.bpt.promnicat.util.*; | [
"de.uni_potsdam.hpi"
] | de.uni_potsdam.hpi; | 1,669,400 |
public ServiceFuture<Contacts> setCertificateContactsAsync(String vaultBaseUrl, Contacts contacts, final ServiceCallback<Contacts> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts), serviceCallback);
} | ServiceFuture<Contacts> function(String vaultBaseUrl, Contacts contacts, final ServiceCallback<Contacts> serviceCallback) { return ServiceFuture.fromResponse(setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts), serviceCallback); } | /**
* Sets the certificate contacts for the specified key vault.
* Sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param contacts The contacts for the key vault certificate.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Sets the certificate contacts for the specified key vault. Sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission | setCertificateContactsAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java",
"license": "mit",
"size": 884227
} | [
"com.microsoft.azure.keyvault.models.Contacts",
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.azure.keyvault.models.Contacts; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.azure.keyvault.models.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,553,081 |
void removeFromInvalidates(final DatanodeInfo datanode) {
if (!namesystem.isPopulatingReplQueues()) {
return;
}
invalidateBlocks.remove(datanode);
} | void removeFromInvalidates(final DatanodeInfo datanode) { if (!namesystem.isPopulatingReplQueues()) { return; } invalidateBlocks.remove(datanode); } | /**
* Remove all block invalidation tasks under this datanode UUID;
* used when a datanode registers with a new UUID and the old one
* is wiped.
*/ | Remove all block invalidation tasks under this datanode UUID; used when a datanode registers with a new UUID and the old one is wiped | removeFromInvalidates | {
"repo_name": "Wajihulhassan/Hadoop-2.7.0",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java",
"license": "apache-2.0",
"size": 146618
} | [
"org.apache.hadoop.hdfs.protocol.DatanodeInfo"
] | import org.apache.hadoop.hdfs.protocol.DatanodeInfo; | import org.apache.hadoop.hdfs.protocol.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 384,536 |
public String getFailureReport()
{
String result = null;
if (LOGGER.isDebugEnabled())
{
Collection<CapabilityReport> capabilities = RMMethodSecurityInterceptor.CAPABILITIES.get().values();
if (!capabilities.isEmpty())
{
StringBuffer buffer = new StringBuffer("\n");
for (CapabilityReport capability : capabilities)
{
buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n");
if (!capability.conditions.isEmpty())
{
for (Map.Entry<String, Boolean> entry : capability.conditions.entrySet())
{
buffer.append(" - ").append(entry.getKey()).append(" (");
if (entry.getValue())
{
buffer.append("passed");
}
else
{
buffer.append("failed");
}
buffer.append(")\n");
}
}
}
result = buffer.toString();
}
}
return result;
}
| String function() { String result = null; if (LOGGER.isDebugEnabled()) { Collection<CapabilityReport> capabilities = RMMethodSecurityInterceptor.CAPABILITIES.get().values(); if (!capabilities.isEmpty()) { StringBuffer buffer = new StringBuffer("\n"); for (CapabilityReport capability : capabilities) { buffer.append(" ").append(capability.name).append(STR).append(capability.status).append(")\n"); if (!capability.conditions.isEmpty()) { for (Map.Entry<String, Boolean> entry : capability.conditions.entrySet()) { buffer.append(STR).append(entry.getKey()).append(STR); if (entry.getValue()) { buffer.append(STR); } else { buffer.append(STR); } buffer.append(")\n"); } } } result = buffer.toString(); } } return result; } | /**
* Gets the failure report for the currently recorded capabilities.
*
* @return {@link String} capability error report
*/ | Gets the failure report for the currently recorded capabilities | getFailureReport | {
"repo_name": "dnacreative/records-management",
"path": "rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java",
"license": "lgpl-3.0",
"size": 11139
} | [
"java.util.Collection",
"java.util.Map"
] | import java.util.Collection; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 266,439 |
@Test
public void testDecodeSyncInfoValueControlRefreshPresentNoCookieNoRefreshDone() throws Exception
{
ByteBuffer bb = ByteBuffer.allocate( 0x02 );
bb.put( new byte[]
{
( byte ) 0xA2, 0x00 // syncInfoValue ::= CHOICE {
} );
bb.flip();
SyncInfoValue decorator = new SyncInfoValueDecorator( codec );
decorator.setType( SynchronizationInfoEnum.REFRESH_PRESENT );
SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );
assertEquals( SynchronizationInfoEnum.REFRESH_PRESENT, syncInfoValue.getType() );
assertEquals( "", Strings.utf8ToString( syncInfoValue.getCookie() ) );
assertTrue( syncInfoValue.isRefreshDone() );
// Check the encoding
try
{
ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
.allocate( ( ( SyncInfoValueDecorator ) syncInfoValue ).computeLength() ) );
assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
}
catch ( EncoderException ee )
{
fail();
}
} | void function() throws Exception { ByteBuffer bb = ByteBuffer.allocate( 0x02 ); bb.put( new byte[] { ( byte ) 0xA2, 0x00 } ); bb.flip(); SyncInfoValue decorator = new SyncInfoValueDecorator( codec ); decorator.setType( SynchronizationInfoEnum.REFRESH_PRESENT ); SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() ); assertEquals( SynchronizationInfoEnum.REFRESH_PRESENT, syncInfoValue.getType() ); assertEquals( "", Strings.utf8ToString( syncInfoValue.getCookie() ) ); assertTrue( syncInfoValue.isRefreshDone() ); try { ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer .allocate( ( ( SyncInfoValueDecorator ) syncInfoValue ).computeLength() ) ); assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) ); } catch ( EncoderException ee ) { fail(); } } | /**
* Test the decoding of a SyncInfoValue control, refreshPresent choice,
* no cookie, no refreshDone
*/ | Test the decoding of a SyncInfoValue control, refreshPresent choice, no cookie, no refreshDone | testDecodeSyncInfoValueControlRefreshPresentNoCookieNoRefreshDone | {
"repo_name": "darranl/directory-shared",
"path": "ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueControlTest.java",
"license": "apache-2.0",
"size": 54422
} | [
"java.nio.ByteBuffer",
"org.apache.directory.api.asn1.EncoderException",
"org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncInfoValue",
"org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SynchronizationInfoEnum",
"org.apache.directory.api.ldap.extras.controls.syncre... | import java.nio.ByteBuffer; import org.apache.directory.api.asn1.EncoderException; import org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncInfoValue; import org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SynchronizationInfoEnum; import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueDecorator; import org.apache.directory.api.util.Strings; import org.junit.Assert; | import java.nio.*; import org.apache.directory.api.asn1.*; import org.apache.directory.api.ldap.extras.controls.syncrepl.*; import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.*; import org.apache.directory.api.util.*; import org.junit.*; | [
"java.nio",
"org.apache.directory",
"org.junit"
] | java.nio; org.apache.directory; org.junit; | 1,167,951 |
public static int getFirefoxVersion(WebDriver driver) {
// extract browser string
Pattern browserPattern = Pattern.compile("Firefox/\\d+.");
Matcher browserMatcher = browserPattern.matcher(getUserAgent(driver));
if (!browserMatcher.find()) {
return 0;
}
String browserStr = browserMatcher.group();
// extract version string
Pattern versionPattern = Pattern.compile("\\d+");
Matcher versionMatcher = versionPattern.matcher(browserStr);
if (!versionMatcher.find()) {
return 0;
}
return Integer.parseInt(versionMatcher.group());
} | static int function(WebDriver driver) { Pattern browserPattern = Pattern.compile(STR); Matcher browserMatcher = browserPattern.matcher(getUserAgent(driver)); if (!browserMatcher.find()) { return 0; } String browserStr = browserMatcher.group(); Pattern versionPattern = Pattern.compile("\\d+"); Matcher versionMatcher = versionPattern.matcher(browserStr); if (!versionMatcher.find()) { return 0; } return Integer.parseInt(versionMatcher.group()); } | /**
* Finds the Firefox version of the given webdriver and returns it as an integer.
* For instance, '14.0.1' will translate to 14.
*
* @param driver The driver to find the version for.
* @return The found version, or 0 if no version could be found.
*/ | Finds the Firefox version of the given webdriver and returns it as an integer. For instance, '14.0.1' will translate to 14 | getFirefoxVersion | {
"repo_name": "actmd/selenium",
"path": "java/client/test/org/openqa/selenium/testing/TestUtilities.java",
"license": "apache-2.0",
"size": 7082
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.openqa.selenium.WebDriver"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; import org.openqa.selenium.WebDriver; | import java.util.regex.*; import org.openqa.selenium.*; | [
"java.util",
"org.openqa.selenium"
] | java.util; org.openqa.selenium; | 844,797 |
public List<InstanceViewStatus> statuses() {
return this.statuses;
} | List<InstanceViewStatus> function() { return this.statuses; } | /**
* Get the statuses value.
*
* @return the statuses value
*/ | Get the statuses value | statuses | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/compute/mgmt-v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskInstanceView.java",
"license": "mit",
"size": 2374
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,172,603 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.