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
void sortNodes(int type) { boolean b = type == Browser.SORT_NODES_BY_DATE; sorter.setByDate(b); sorter.setAscending(!b); DefaultTreeModel dtm = (DefaultTreeModel) treeDisplay.getModel(); TreeImageDisplay root = (TreeImageDisplay) dtm.getRoot(); int n = root.getChildCount(); TreeImageDisplay node; List children; Iterator j; List all; switch (model.getBrowserType()) { case Browser.IMAGES_EXPLORER: case Browser.FILES_EXPLORER: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); j = children.iterator(); TreeImageDisplay child; while (j.hasNext()) { child = (TreeImageDisplay) j.next(); if (child instanceof TreeImageTimeSet || child instanceof TreeFileSet) sortNode((TreeImageSet) child); } } break; case Browser.ADMIN_EXPLORER: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); node.removeAllChildren(); dtm.reload(node); if (!children.isEmpty()) { if (node.getUserObject() instanceof GroupData) { all = prepareSortedList(sorter.sort(children)); buildTreeNode(node, all, dtm); } else { buildTreeNode(node, sorter.sort(children), dtm); } } else buildEmptyNode(node); j = nodesToReset.iterator(); while (j.hasNext()) { setExpandedParent((TreeImageDisplay) j.next(), true); } } break; default: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); node.removeAllChildren(); dtm.reload(node); if (!children.isEmpty()) { if (node.getUserObject() instanceof ExperimenterData) { List<Object> sets = new ArrayList<Object>(); List<Object> toSort = new ArrayList<Object>(); Iterator k = children.iterator(); while (k.hasNext()) { Object object = (Object) k.next(); if (object instanceof TreeFileSet) { sets.add((TreeFileSet) object); } else toSort.add(object); } sets.addAll(sorter.sort(toSort)); Collections.reverse(sets); all = prepareSortedList(sets); buildTreeNode(node, all, dtm); } else { buildTreeNode(node, sorter.sort(children), dtm); } } else buildEmptyNode(node); j = nodesToReset.iterator(); while (j.hasNext()) { setExpandedParent((TreeImageDisplay) j.next(), true); } } } }
void sortNodes(int type) { boolean b = type == Browser.SORT_NODES_BY_DATE; sorter.setByDate(b); sorter.setAscending(!b); DefaultTreeModel dtm = (DefaultTreeModel) treeDisplay.getModel(); TreeImageDisplay root = (TreeImageDisplay) dtm.getRoot(); int n = root.getChildCount(); TreeImageDisplay node; List children; Iterator j; List all; switch (model.getBrowserType()) { case Browser.IMAGES_EXPLORER: case Browser.FILES_EXPLORER: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); j = children.iterator(); TreeImageDisplay child; while (j.hasNext()) { child = (TreeImageDisplay) j.next(); if (child instanceof TreeImageTimeSet child instanceof TreeFileSet) sortNode((TreeImageSet) child); } } break; case Browser.ADMIN_EXPLORER: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); node.removeAllChildren(); dtm.reload(node); if (!children.isEmpty()) { if (node.getUserObject() instanceof GroupData) { all = prepareSortedList(sorter.sort(children)); buildTreeNode(node, all, dtm); } else { buildTreeNode(node, sorter.sort(children), dtm); } } else buildEmptyNode(node); j = nodesToReset.iterator(); while (j.hasNext()) { setExpandedParent((TreeImageDisplay) j.next(), true); } } break; default: for (int i = 0; i < n; i++) { node = (TreeImageDisplay) root.getChildAt(i); children = node.getChildrenDisplay(); node.removeAllChildren(); dtm.reload(node); if (!children.isEmpty()) { if (node.getUserObject() instanceof ExperimenterData) { List<Object> sets = new ArrayList<Object>(); List<Object> toSort = new ArrayList<Object>(); Iterator k = children.iterator(); while (k.hasNext()) { Object object = (Object) k.next(); if (object instanceof TreeFileSet) { sets.add((TreeFileSet) object); } else toSort.add(object); } sets.addAll(sorter.sort(toSort)); Collections.reverse(sets); all = prepareSortedList(sets); buildTreeNode(node, all, dtm); } else { buildTreeNode(node, sorter.sort(children), dtm); } } else buildEmptyNode(node); j = nodesToReset.iterator(); while (j.hasNext()) { setExpandedParent((TreeImageDisplay) j.next(), true); } } } }
/** * Sorts the nodes in the tree view according to the specified index. * * @param type One out of the following constants: * {@link Browser#SORT_NODES_BY_DATE} or * {@link Browser#SORT_NODES_BY_NAME}. */
Sorts the nodes in the tree view according to the specified index
sortNodes
{ "repo_name": "simleo/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserUI.java", "license": "gpl-2.0", "size": 83096 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Iterator", "java.util.List", "javax.swing.tree.DefaultTreeModel", "org.openmicroscopy.shoola.agents.util.browser.TreeFileSet", "org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay", "org.openmicroscopy.shoola.agents.util.browser.TreeImageSet", "org.openmicroscopy.shoola.agents.util.browser.TreeImageTimeSet" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import javax.swing.tree.DefaultTreeModel; import org.openmicroscopy.shoola.agents.util.browser.TreeFileSet; import org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay; import org.openmicroscopy.shoola.agents.util.browser.TreeImageSet; import org.openmicroscopy.shoola.agents.util.browser.TreeImageTimeSet;
import java.util.*; import javax.swing.tree.*; import org.openmicroscopy.shoola.agents.util.browser.*;
[ "java.util", "javax.swing", "org.openmicroscopy.shoola" ]
java.util; javax.swing; org.openmicroscopy.shoola;
216,573
public static void sendPlayerSubSkillList(@NotNull Player player, @NotNull List<Component> subSkillComponents) { final Audience audience = mcMMO.getAudiences().player(player); //@ Signs, done for style Component space = Component.space(); TextComponent atSignComponent = Component.text(LocaleLoader.getString("JSON.Hover.AtSymbolSkills")); //Only send 3 sub-skills per line Component[][] splitSubSkills = TextUtils.splitComponentsIntoGroups(subSkillComponents, 3); ArrayList<Component> individualLinesToSend = new ArrayList<>(); //Create each line for (Component[] componentArray : splitSubSkills) { individualLinesToSend.add(TextUtils.fromArray(componentArray, atSignComponent, space)); } //Send each group for(Component curLine : individualLinesToSend) { audience.sendMessage(Identity.nil(), curLine); } }
static void function(@NotNull Player player, @NotNull List<Component> subSkillComponents) { final Audience audience = mcMMO.getAudiences().player(player); Component space = Component.space(); TextComponent atSignComponent = Component.text(LocaleLoader.getString(STR)); Component[][] splitSubSkills = TextUtils.splitComponentsIntoGroups(subSkillComponents, 3); ArrayList<Component> individualLinesToSend = new ArrayList<>(); for (Component[] componentArray : splitSubSkills) { individualLinesToSend.add(TextUtils.fromArray(componentArray, atSignComponent, space)); } for(Component curLine : individualLinesToSend) { audience.sendMessage(Identity.nil(), curLine); } }
/** * Sends a player a bunch of text components that represent a list of sub-skills * Styling and formatting is applied before sending the messages * * @param player target player * @param subSkillComponents the text components representing the sub-skills by name */
Sends a player a bunch of text components that represent a list of sub-skills Styling and formatting is applied before sending the messages
sendPlayerSubSkillList
{ "repo_name": "mcMMO-Dev/mcMMO", "path": "src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java", "license": "gpl-3.0", "size": 25775 }
[ "com.gmail.nossr50.locale.LocaleLoader", "java.util.ArrayList", "java.util.List", "net.kyori.adventure.audience.Audience", "net.kyori.adventure.identity.Identity", "net.kyori.adventure.text.Component", "net.kyori.adventure.text.TextComponent", "org.bukkit.entity.Player", "org.jetbrains.annotations.NotNull" ]
import com.gmail.nossr50.locale.LocaleLoader; import java.util.ArrayList; import java.util.List; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull;
import com.gmail.nossr50.locale.*; import java.util.*; import net.kyori.adventure.audience.*; import net.kyori.adventure.identity.*; import net.kyori.adventure.text.*; import org.bukkit.entity.*; import org.jetbrains.annotations.*;
[ "com.gmail.nossr50", "java.util", "net.kyori.adventure", "org.bukkit.entity", "org.jetbrains.annotations" ]
com.gmail.nossr50; java.util; net.kyori.adventure; org.bukkit.entity; org.jetbrains.annotations;
259,546
public ContentManager getContentManager(Node n) { Node b = getXblBoundElement(n); if (b != null) { Element s = getXblShadowTree(b); if (s != null) { ContentManager cm; Document doc = b.getOwnerDocument(); if (doc != document) { DefaultXBLManager xm = (DefaultXBLManager) ((AbstractDocument) doc).getXBLManager(); cm = (ContentManager) xm.contentManagers.get(s); } else { cm = (ContentManager) contentManagers.get(s); } return cm; } } return null; }
ContentManager function(Node n) { Node b = getXblBoundElement(n); if (b != null) { Element s = getXblShadowTree(b); if (s != null) { ContentManager cm; Document doc = b.getOwnerDocument(); if (doc != document) { DefaultXBLManager xm = (DefaultXBLManager) ((AbstractDocument) doc).getXBLManager(); cm = (ContentManager) xm.contentManagers.get(s); } else { cm = (ContentManager) contentManagers.get(s); } return cm; } } return null; }
/** * Returns the ContentManager that handles the shadow tree the given * node resides in. */
Returns the ContentManager that handles the shadow tree the given node resides in
getContentManager
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/svg12/DefaultXBLManager.java", "license": "apache-2.0", "size": 70751 }
[ "org.apache.flex.forks.batik.dom.AbstractDocument", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import org.apache.flex.forks.batik.dom.AbstractDocument; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node;
import org.apache.flex.forks.batik.dom.*; import org.w3c.dom.*;
[ "org.apache.flex", "org.w3c.dom" ]
org.apache.flex; org.w3c.dom;
1,321,949
private void loadAntlib(ClassLoader classLoader, URL url) { try { Antlib antlib = Antlib.createAntlib(getProject(), url, getURI()); antlib.setClassLoader(classLoader); antlib.setURI(getURI()); antlib.execute(); } catch (BuildException ex) { throw ProjectHelper.addLocationToBuildException( ex, getLocation()); } }
void function(ClassLoader classLoader, URL url) { try { Antlib antlib = Antlib.createAntlib(getProject(), url, getURI()); antlib.setClassLoader(classLoader); antlib.setURI(getURI()); antlib.execute(); } catch (BuildException ex) { throw ProjectHelper.addLocationToBuildException( ex, getLocation()); } }
/** * Load an antlib from a URL. * * @param classLoader the classloader to use. * @param url the url to load the definitions from. */
Load an antlib from a URL
loadAntlib
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/taskdefs/Definer.java", "license": "mit", "size": 20332 }
[ "org.apache.tools.ant.BuildException", "org.apache.tools.ant.ProjectHelper" ]
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.*;
[ "org.apache.tools" ]
org.apache.tools;
1,740,686
public static List<LaxValidationCase> getRegisteredLaxValidationCases() { return LAX_VALIDATION_CASES; }
static List<LaxValidationCase> function() { return LAX_VALIDATION_CASES; }
/** * Returns the list of currently registered {@link LaxValidationCase}s * @return a List&lt;LaxValidationCase&gt; containing the currently registered {@link LaxValidationCase}s */
Returns the list of currently registered <code>LaxValidationCase</code>s
getRegisteredLaxValidationCases
{ "repo_name": "EHJ-52n/OX-Framework", "path": "52n-oxf-xmlbeans/src/main/java/org/n52/oxf/xmlbeans/parser/XMLBeansParser.java", "license": "gpl-2.0", "size": 18458 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,777,006
private static void setupMenuForHitTarget(final @NonNull Dialog dialog, final @NonNull NavigationView navigationView, final @NonNull IWebView.Callback callback, final @NonNull IWebView.HitTarget hitTarget) { navigationView.inflateMenu(R.menu.menu_browser_context); navigationView.getMenu().findItem(R.id.menu_new_tab).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_link_share).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_link_copy).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_image_share).setVisible(hitTarget.isImage); navigationView.getMenu().findItem(R.id.menu_image_copy).setVisible(hitTarget.isImage); navigationView.getMenu().findItem(R.id.menu_image_save).setVisible( hitTarget.isImage && UrlUtils.isHttpOrHttps(hitTarget.imageURL));
static void function(final @NonNull Dialog dialog, final @NonNull NavigationView navigationView, final @NonNull IWebView.Callback callback, final @NonNull IWebView.HitTarget hitTarget) { navigationView.inflateMenu(R.menu.menu_browser_context); navigationView.getMenu().findItem(R.id.menu_new_tab).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_link_share).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_link_copy).setVisible(hitTarget.isLink); navigationView.getMenu().findItem(R.id.menu_image_share).setVisible(hitTarget.isImage); navigationView.getMenu().findItem(R.id.menu_image_copy).setVisible(hitTarget.isImage); navigationView.getMenu().findItem(R.id.menu_image_save).setVisible( hitTarget.isImage && UrlUtils.isHttpOrHttps(hitTarget.imageURL));
/** * Set up the correct menu contents. Note: this method can only be called once the Dialog * has already been created - we need the dialog in order to be able to dismiss it in the * menu callbacks. */
Set up the correct menu contents. Note: this method can only be called once the Dialog has already been created - we need the dialog in order to be able to dismiss it in the menu callbacks
setupMenuForHitTarget
{ "repo_name": "Achintya999/focus-android", "path": "app/src/main/java/org/mozilla/focus/menu/WebContextMenu.java", "license": "mpl-2.0", "size": 8252 }
[ "android.app.Dialog", "android.support.annotation.NonNull", "android.support.design.widget.NavigationView", "org.mozilla.focus.utils.UrlUtils", "org.mozilla.focus.web.IWebView" ]
import android.app.Dialog; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import org.mozilla.focus.utils.UrlUtils; import org.mozilla.focus.web.IWebView;
import android.app.*; import android.support.annotation.*; import android.support.design.widget.*; import org.mozilla.focus.utils.*; import org.mozilla.focus.web.*;
[ "android.app", "android.support", "org.mozilla.focus" ]
android.app; android.support; org.mozilla.focus;
2,178,893
public D subsetFromRange(int lower, int upper) { List<E> data = getData(); // new ArrayList from subset b/c we don't want to return a DataSet // backed by a list that is itself backed by the full data list here. ArrayList<E> subset = new ArrayList<E> (data.subList(lower, upper)); return spawnSubset(new ArrayList<E>(subset), getLabels(), getFeatValues()); }
D function(int lower, int upper) { List<E> data = getData(); ArrayList<E> subset = new ArrayList<E> (data.subList(lower, upper)); return spawnSubset(new ArrayList<E>(subset), getLabels(), getFeatValues()); }
/** * Returns a subset DataSet with data in range [lower, upper). * @param lower - int, the lower bound, inclusive, of subset range * @param upper - int, the upper bound, exclusive, of subset range */
Returns a subset DataSet with data in range [lower, upper)
subsetFromRange
{ "repo_name": "mxdubois/decision-tree-java", "path": "src/com/michaelxdubois/decisiontree/DataSet.java", "license": "mit", "size": 12383 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
374,369
public boolean isLocked() { return SharedPreferencesHelper.isPasswordSet(getActivity()) & mLocked; }
boolean function() { return SharedPreferencesHelper.isPasswordSet(getActivity()) & mLocked; }
/** * task.locked & mLocked */
task.locked & mLocked
isLocked
{ "repo_name": "Team-Rocket2410/NotePad", "path": "app/src/main/java/com/nononsenseapps/notepad/ui/editor/TaskDetailFragment.java", "license": "gpl-3.0", "size": 29216 }
[ "com.nononsenseapps.notepad.util.SharedPreferencesHelper" ]
import com.nononsenseapps.notepad.util.SharedPreferencesHelper;
import com.nononsenseapps.notepad.util.*;
[ "com.nononsenseapps.notepad" ]
com.nononsenseapps.notepad;
1,199,984
List<IComment> getComments();
List<IComment> getComments();
/** * Function which forwards the comment getter to the appropriate function of the contained * object. * * @return The list of comments currently associated to the object contained. */
Function which forwards the comment getter to the appropriate function of the contained object
getComments
{ "repo_name": "aeppert/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CommentManager.java", "license": "apache-2.0", "size": 127063 }
[ "com.google.security.zynamics.binnavi.Gui", "java.util.List" ]
import com.google.security.zynamics.binnavi.Gui; import java.util.List;
import com.google.security.zynamics.binnavi.*; import java.util.*;
[ "com.google.security", "java.util" ]
com.google.security; java.util;
2,333,573
public Builder setExecutionInfo(Map<String, String> executionInfo) { spawnActionBuilder.setExecutionInfo(executionInfo); return this; }
Builder function(Map<String, String> executionInfo) { spawnActionBuilder.setExecutionInfo(executionInfo); return this; }
/** * Sets the map of execution info for expanded actions. */
Sets the map of execution info for expanded actions
setExecutionInfo
{ "repo_name": "perezd/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java", "license": "apache-2.0", "size": 16504 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,382,202
public int getNextEventOffset() throws IOException { int currentEventOffset = getCurrentEventOffset(); int currentPosition = in.position(); if (-1 == currentEventOffset) { // Current position is an invalid data or in the file end, currentPkt = getNextPkt(currentPosition); if (null == currentPkt) { // It's in the file end return -1; } else { return currentPkt.pktPosition + PKT_HEADER_SIZE; // It's an invalid data, so we need to use the next // packet } } int currentPktPos = currentPkt.pktPosition; PacketHeader packetHeader = currentPkt.pktHeader; int eventSize = packetHeader.eventSize; int nextPktPos = currentPktPos + (packetHeader.eventNumber * packetHeader.eventSize) + PKT_HEADER_SIZE; // It means it's on the event offset right now, so the next event of this position is itself // We can return the currentEventOffset directly, no matter it is in the middle events or the last event if (currentPosition == currentEventOffset) { return currentEventOffset; } // The current position is in the last event of the current packet and not the event header, so the next event // will be in the next packet. // We should update the currentPktPos first. if ((currentPosition + eventSize) >= nextPktPos) { currentPkt = getNextPkt(nextPktPos); if (null == currentPkt) { // It's in the file end return -1; } else { return currentPkt.pktPosition + PKT_HEADER_SIZE; // Use the next packet } } // Now we get the correct currentPktPos and the current position is in the header. if (((currentPosition - currentPktPos) <= PKT_HEADER_SIZE) && ((currentPosition - currentPktPos) >= 0)) { // offset return currentPktPos + PKT_HEADER_SIZE; } return currentEventOffset + eventSize; } // getNextEventOffset
int function() throws IOException { int currentEventOffset = getCurrentEventOffset(); int currentPosition = in.position(); if (-1 == currentEventOffset) { currentPkt = getNextPkt(currentPosition); if (null == currentPkt) { return -1; } else { return currentPkt.pktPosition + PKT_HEADER_SIZE; } } int currentPktPos = currentPkt.pktPosition; PacketHeader packetHeader = currentPkt.pktHeader; int eventSize = packetHeader.eventSize; int nextPktPos = currentPktPos + (packetHeader.eventNumber * packetHeader.eventSize) + PKT_HEADER_SIZE; if (currentPosition == currentEventOffset) { return currentEventOffset; } if ((currentPosition + eventSize) >= nextPktPos) { currentPkt = getNextPkt(nextPktPos); if (null == currentPkt) { return -1; } else { return currentPkt.pktPosition + PKT_HEADER_SIZE; } } if (((currentPosition - currentPktPos) <= PKT_HEADER_SIZE) && ((currentPosition - currentPktPos) >= 0)) { return currentPktPos + PKT_HEADER_SIZE; } return currentEventOffset + eventSize; }
/** * Get the next event offset of the current position * * @return the next event offset of the current position * @throws IOException */
Get the next event offset of the current position
getNextEventOffset
{ "repo_name": "viktorbahr/jaer", "path": "src/net/sf/jaer/eventio/Jaer3BufferParser.java", "license": "lgpl-2.1", "size": 50314 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,689,106
List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException;
List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException;
/** * Get the named Related Entity for the GenericValue from the persistent * store across another Relation. Helps to get related Values in a * multi-to-multi relationship. NOTE 20080502: 3 references * * @param relationNameOne * String containing the relation name which is the combination * of relation.title and relation.rel-entity-name as specified in * the entity XML definition file, for first relation * @param relationNameTwo * String containing the relation name for second relation * @param value * GenericValue instance containing the entity * @param orderBy * The fields of the named entity to order the query by; may be * null; optionally add a " ASC" for ascending or " DESC" for * descending * @return List of GenericValue instances as specified in the relation * definition */
Get the named Related Entity for the GenericValue from the persistent store across another Relation. Helps to get related Values in a multi-to-multi relationship. NOTE 20080502: 3 references
getMultiRelation
{ "repo_name": "ofbizfriends/vogue", "path": "framework/entity/src/org/ofbiz/entity/Delegator.java", "license": "apache-2.0", "size": 59465 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
343,379
static String getClassLoaderName() throws NamingException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Object obj = null; do { obj = clObjectBindings.get(cl); if (obj != null) { return obj.toString(); } } while ((cl = cl.getParent()) != null); throw new NamingException (sm.getString("contextBindings.noContextBoundToCL")); }
static String getClassLoaderName() throws NamingException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Object obj = null; do { obj = clObjectBindings.get(cl); if (obj != null) { return obj.toString(); } } while ((cl = cl.getParent()) != null); throw new NamingException (sm.getString(STR)); }
/** * Retrieves the name of the object bound to the naming context that is also * bound to the thread context class loader. */
Retrieves the name of the object bound to the naming context that is also bound to the thread context class loader
getClassLoaderName
{ "repo_name": "IAMTJW/Tomcat-8.5.20", "path": "tomcat-8.5.20/java/org/apache/naming/ContextBindings.java", "license": "apache-2.0", "size": 10262 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
908,662
public void checkToPayMonthlyPremium(long time) { if (!this.attributes.containsKey(Person.LAST_MONTH_PAID)) { this.attributes.put(Person.LAST_MONTH_PAID, 0); } int currentMonth = Utilities.getMonth(time); int lastMonthPaid = (int) this.attributes.get(Person.LAST_MONTH_PAID); if (currentMonth > lastMonthPaid || (currentMonth == 1 && lastMonthPaid == 12)) { // TODO - Check that they can still afford the premium due to any newly incurred health costs. // Pay the payer. Plan plan = this.coverage.getPlanAtTime(time); plan.totalExpenses += (plan.payer.payMonthlyPremium()); // Pay secondary insurance, if applicable plan.totalExpenses += (plan.secondaryPayer.payMonthlyPremium()); // Update the last monthly premium paid. this.attributes.put(Person.LAST_MONTH_PAID, currentMonth); // Check if person has gone in debt. If yes, then they receive no insurance. this.stillHasIncome(time); } }
void function(long time) { if (!this.attributes.containsKey(Person.LAST_MONTH_PAID)) { this.attributes.put(Person.LAST_MONTH_PAID, 0); } int currentMonth = Utilities.getMonth(time); int lastMonthPaid = (int) this.attributes.get(Person.LAST_MONTH_PAID); if (currentMonth > lastMonthPaid (currentMonth == 1 && lastMonthPaid == 12)) { Plan plan = this.coverage.getPlanAtTime(time); plan.totalExpenses += (plan.payer.payMonthlyPremium()); plan.totalExpenses += (plan.secondaryPayer.payMonthlyPremium()); this.attributes.put(Person.LAST_MONTH_PAID, currentMonth); this.stillHasIncome(time); } }
/** * Checks if the person has paid their monthly premium. If not, the person pays * the premium to their current payer. * * @param time the time that the person checks to pay premium. */
Checks if the person has paid their monthly premium. If not, the person pays the premium to their current payer
checkToPayMonthlyPremium
{ "repo_name": "synthetichealth/synthea", "path": "src/main/java/org/mitre/synthea/world/agents/Person.java", "license": "apache-2.0", "size": 27270 }
[ "org.mitre.synthea.helpers.Utilities", "org.mitre.synthea.world.concepts.CoverageRecord" ]
import org.mitre.synthea.helpers.Utilities; import org.mitre.synthea.world.concepts.CoverageRecord;
import org.mitre.synthea.helpers.*; import org.mitre.synthea.world.concepts.*;
[ "org.mitre.synthea" ]
org.mitre.synthea;
1,947,658
public ServiceFuture<PrivateLinkServiceInner> getByResourceGroupAsync(String resourceGroupName, String serviceName, String expand, final ServiceCallback<PrivateLinkServiceInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName, expand), serviceCallback); }
ServiceFuture<PrivateLinkServiceInner> function(String resourceGroupName, String serviceName, String expand, final ServiceCallback<PrivateLinkServiceInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName, expand), serviceCallback); }
/** * Gets the specified private link service by resource group. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the private link service. * @param expand Expands referenced resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets the specified private link service by resource group
getByResourceGroupAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/PrivateLinkServicesInner.java", "license": "mit", "size": 134452 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,556,056
public static void setValue(Object instance, String className, PackageType packageType, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { setValue(instance, packageType.getClass(className), declared, fieldName, value); }
static void function(Object instance, String className, PackageType packageType, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { setValue(instance, packageType.getClass(className), declared, fieldName, value); }
/** * Sets the value of a field of a desired class of an object * * @param instance Target object * @param className Name of the desired target class * @param packageType Package where the desired target class is located * @param declared Whether the desired field is declared or not * @param fieldName Name of the desired field * @param value New value * @throws IllegalArgumentException If the type of the value does not match the type of the desired field * @throws IllegalAccessException If the desired field cannot be accessed * @throws NoSuchFieldException If the desired field of the desired class cannot be found * @throws SecurityException If the desired field cannot be made accessible * @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found * @see #setValue(Object, Class, boolean, String, Object) */
Sets the value of a field of a desired class of an object
setValue
{ "repo_name": "NavidK0/PSCiv", "path": "src/main/java/com/lastabyss/psciv/util/ParticleEffect.java", "license": "mit", "size": 96450 }
[ "com.lastabyss.psciv.util.ReflectionUtils" ]
import com.lastabyss.psciv.util.ReflectionUtils;
import com.lastabyss.psciv.util.*;
[ "com.lastabyss.psciv" ]
com.lastabyss.psciv;
2,105,533
@Indexable(type = IndexableType.REINDEX) public Category addCategory(Category category) throws SystemException { category.setNew(true); return categoryPersistence.update(category, false); }
@Indexable(type = IndexableType.REINDEX) Category function(Category category) throws SystemException { category.setNew(true); return categoryPersistence.update(category, false); }
/** * Adds the category to the database. Also notifies the appropriate model listeners. * * @param category the category * @return the category that was added * @throws SystemException if a system exception occurred */
Adds the category to the database. Also notifies the appropriate model listeners
addCategory
{ "repo_name": "fraunhoferfokus/govapps", "path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/base/CategoryLocalServiceBaseImpl.java", "license": "bsd-3-clause", "size": 42077 }
[ "com.liferay.portal.kernel.exception.SystemException", "com.liferay.portal.kernel.search.Indexable", "com.liferay.portal.kernel.search.IndexableType", "de.fraunhofer.fokus.movepla.model.Category" ]
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.search.Indexable; import com.liferay.portal.kernel.search.IndexableType; import de.fraunhofer.fokus.movepla.model.Category;
import com.liferay.portal.kernel.exception.*; import com.liferay.portal.kernel.search.*; import de.fraunhofer.fokus.movepla.model.*;
[ "com.liferay.portal", "de.fraunhofer.fokus" ]
com.liferay.portal; de.fraunhofer.fokus;
2,022,459
@DesugarSupportedApi public static void setAll(int[] array, IntUnaryOperator generator) { Objects.requireNonNull(generator); for (int i = 0; i < array.length; i++) array[i] = generator.applyAsInt(i); }
static void function(int[] array, IntUnaryOperator generator) { Objects.requireNonNull(generator); for (int i = 0; i < array.length; i++) array[i] = generator.applyAsInt(i); }
/** * Set all elements of the specified array, using the provided * generator function to compute each element. * * <p>If the generator function throws an exception, it is relayed to * the caller and the array is left in an indeterminate state. * * @apiNote * Setting a subrange of an array, using a generator function to compute * each element, can be written as follows: * <pre>{@code * IntStream.range(startInclusive, endExclusive) * .forEach(i -> array[i] = generator.applyAsInt(i)); * }</pre> * * @param array array to be initialized * @param generator a function accepting an index and producing the desired * value for that position * @throws NullPointerException if the generator is null * @since 1.8 */
Set all elements of the specified array, using the provided generator function to compute each element. If the generator function throws an exception, it is relayed to the caller and the array is left in an indeterminate state
setAll
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/java.base/share/classes/java/util/Arrays.java", "license": "gpl-2.0", "size": 403169 }
[ "java.util.function.IntUnaryOperator" ]
import java.util.function.IntUnaryOperator;
import java.util.function.*;
[ "java.util" ]
java.util;
18,868
public static Vector2D findStartPos(Field f) { Point start = new Point(rand.nextInt(f.getTilesX()), rand.nextInt(f.getTilesY())); Tile[][] tiles = f.getTiles(); while(tiles[start.x][start.y].getValue() == 1) start = new Point(rand.nextInt(f.getTilesX()), rand.nextInt(f.getTilesY())); return f.getWorldPos(start); }
static Vector2D function(Field f) { Point start = new Point(rand.nextInt(f.getTilesX()), rand.nextInt(f.getTilesY())); Tile[][] tiles = f.getTiles(); while(tiles[start.x][start.y].getValue() == 1) start = new Point(rand.nextInt(f.getTilesX()), rand.nextInt(f.getTilesY())); return f.getWorldPos(start); }
/** * Finds valid start position for the Unit * @param f Used field * @return Valid position */
Finds valid start position for the Unit
findStartPos
{ "repo_name": "Henning1/Battlepath", "path": "src/main/Battlepath.java", "license": "gpl-3.0", "size": 4543 }
[ "java.awt.Point" ]
import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,123,929
public void getIncrementalSurrogateKeyFromDictionary(List<byte[]> byteValuesOfFilterMembers, List<Integer> surrogates) { List<Integer> sortedSurrogates = sortOrderReference.get(); int low = 0; for (byte[] byteValueOfFilterMember : byteValuesOfFilterMembers) { String filterKey = new String(byteValueOfFilterMember, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)); if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(filterKey)) { surrogates.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY); continue; } int high = sortedSurrogates.size() - 1; while (low <= high) { int mid = (low + high) >>> 1; int surrogateKey = sortedSurrogates.get(mid); byte[] dictionaryValue = getDictionaryBytesFromSurrogate(surrogateKey); int cmp = -1; //fortify fix if (null == dictionaryValue) { cmp = -1; } else if (this.getDataType() != DataType.STRING) { cmp = compareFilterKeyWithDictionaryKey( new String(dictionaryValue, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)), filterKey, this.getDataType()); } else { cmp = ByteUtil.UnsafeComparer.INSTANCE.compareTo(dictionaryValue, byteValueOfFilterMember); } if (cmp < 0) { low = mid + 1; } else if (cmp > 0) { high = mid - 1; } else { surrogates.add(surrogateKey); low = mid; break; } } } //Default value has to be added if (surrogates.isEmpty()) { surrogates.add(0); } }
void function(List<byte[]> byteValuesOfFilterMembers, List<Integer> surrogates) { List<Integer> sortedSurrogates = sortOrderReference.get(); int low = 0; for (byte[] byteValueOfFilterMember : byteValuesOfFilterMembers) { String filterKey = new String(byteValueOfFilterMember, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)); if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(filterKey)) { surrogates.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY); continue; } int high = sortedSurrogates.size() - 1; while (low <= high) { int mid = (low + high) >>> 1; int surrogateKey = sortedSurrogates.get(mid); byte[] dictionaryValue = getDictionaryBytesFromSurrogate(surrogateKey); int cmp = -1; if (null == dictionaryValue) { cmp = -1; } else if (this.getDataType() != DataType.STRING) { cmp = compareFilterKeyWithDictionaryKey( new String(dictionaryValue, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)), filterKey, this.getDataType()); } else { cmp = ByteUtil.UnsafeComparer.INSTANCE.compareTo(dictionaryValue, byteValueOfFilterMember); } if (cmp < 0) { low = mid + 1; } else if (cmp > 0) { high = mid - 1; } else { surrogates.add(surrogateKey); low = mid; break; } } } if (surrogates.isEmpty()) { surrogates.add(0); } }
/** * This method will apply binary search logic to find the surrogate key for the * given value * * @param byteValuesOfFilterMembers to be searched * @param surrogates * @return */
This method will apply binary search logic to find the surrogate key for the given value
getIncrementalSurrogateKeyFromDictionary
{ "repo_name": "shivangi1015/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfo.java", "license": "apache-2.0", "size": 12407 }
[ "java.nio.charset.Charset", "java.util.List", "org.apache.carbondata.core.constants.CarbonCommonConstants", "org.apache.carbondata.core.metadata.datatype.DataType", "org.apache.carbondata.core.util.ByteUtil" ]
import java.nio.charset.Charset; import java.util.List; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.metadata.datatype.DataType; import org.apache.carbondata.core.util.ByteUtil;
import java.nio.charset.*; import java.util.*; import org.apache.carbondata.core.constants.*; import org.apache.carbondata.core.metadata.datatype.*; import org.apache.carbondata.core.util.*;
[ "java.nio", "java.util", "org.apache.carbondata" ]
java.nio; java.util; org.apache.carbondata;
2,403,556
public static void quickSort(byte[] array, int start, int end, ByteComparator comp) { if (array == null) { throw new NullPointerException(); } checkBounds(array.length, start, end); quickSort0(start, end, array, comp); }
static void function(byte[] array, int start, int end, ByteComparator comp) { if (array == null) { throw new NullPointerException(); } checkBounds(array.length, start, end); quickSort0(start, end, array, comp); }
/** * Sorts the specified range in the array in a specified order. * * @param array * the {@code byte} array to be sorted. * @param start * the start index to sort. * @param end * the last + 1 index to sort. * @param comp * the comparison that determines the sort. * @throws IllegalArgumentException * if {@code start > end}. * @throws ArrayIndexOutOfBoundsException * if {@code start < 0} or {@code end > array.length}. */
Sorts the specified range in the array in a specified order
quickSort
{ "repo_name": "genericDataCompany/hsandbox", "path": "common/mahout-distribution-0.7-hadoop1/math/src/main/java/org/apache/mahout/math/Sorting.java", "license": "apache-2.0", "size": 80868 }
[ "org.apache.mahout.math.function.ByteComparator" ]
import org.apache.mahout.math.function.ByteComparator;
import org.apache.mahout.math.function.*;
[ "org.apache.mahout" ]
org.apache.mahout;
667,571
public void updateMeetingProbFor(Integer index) { Map.Entry<Integer, Double> smallestEntry = null; double smallestValue = Double.MAX_VALUE; this.lastUpdateTime = SimClock.getTime(); if (probs.size() == 0) { // first entry probs.put(index, 1.0); return; } double newValue = getProbFor(index) + alpha; probs.put(index, newValue); for (Map.Entry<Integer, Double> entry : probs.entrySet()) { entry.setValue(entry.getValue() / (1+alpha)); if (entry.getValue() < smallestValue) { smallestEntry = entry; smallestValue = entry.getValue(); } } if (probs.size() >= maxSetSize) { if (DEBUG) core.Debug.p("Probsize: " + probs.size() + " dropping " + probs.remove(smallestEntry.getKey())); } }
void function(Integer index) { Map.Entry<Integer, Double> smallestEntry = null; double smallestValue = Double.MAX_VALUE; this.lastUpdateTime = SimClock.getTime(); if (probs.size() == 0) { probs.put(index, 1.0); return; } double newValue = getProbFor(index) + alpha; probs.put(index, newValue); for (Map.Entry<Integer, Double> entry : probs.entrySet()) { entry.setValue(entry.getValue() / (1+alpha)); if (entry.getValue() < smallestValue) { smallestEntry = entry; smallestValue = entry.getValue(); } } if (probs.size() >= maxSetSize) { if (DEBUG) core.Debug.p(STR + probs.size() + STR + probs.remove(smallestEntry.getKey())); } }
/** * Updates meeting probability for the given node index. * <PRE> P(b) = P(b)_old + alpha * Normalize{P}</PRE> * I.e., The probability of the given node index is increased by one and * then all the probabilities are normalized so that their sum equals to 1. * @param index The node index to update the probability for */
Updates meeting probability for the given node index. P(b) = P(b)_old + alpha Normalize{P} I.e., The probability of the given node index is increased by one and then all the probabilities are normalized so that their sum equals to 1
updateMeetingProbFor
{ "repo_name": "akeranen/the-one", "path": "src/routing/maxprop/MeetingProbabilitySet.java", "license": "gpl-3.0", "size": 4923 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,206,930
@SuppressWarnings("unchecked") public boolean process() { // get the next record to process final StampedRecord record = partitionGroup.nextRecord(recordInfo); // if there is no record to process, return immediately if (record == null) { return false; } try { // process the record by passing to the source node of the topology final ProcessorNode currNode = recordInfo.node(); final TopicPartition partition = recordInfo.partition(); log.trace("Start processing one record [{}]", record); updateProcessorContext(record, currNode); currNode.process(record.key(), record.value()); log.trace("Completed processing one record [{}]", record); // update the consumed offset map after processing is done consumedOffsets.put(partition, record.offset()); commitOffsetNeeded = true; // after processing this record, if its partition queue's buffered size has been // decreased to the threshold, we can then resume the consumption on this partition if (recordInfo.queue().size() == maxBufferedSize) { consumer.resume(singleton(partition)); } } catch (final ProducerFencedException fatal) { throw new TaskMigratedException(this, fatal); } catch (final KafkaException e) { throw new StreamsException(format("Exception caught in process. taskId=%s, processor=%s, topic=%s, partition=%d, offset=%d", id(), processorContext.currentNode().name(), record.topic(), record.partition(), record.offset() ), e); } finally { processorContext.setCurrentNode(null); } return true; }
@SuppressWarnings(STR) boolean function() { final StampedRecord record = partitionGroup.nextRecord(recordInfo); if (record == null) { return false; } try { final ProcessorNode currNode = recordInfo.node(); final TopicPartition partition = recordInfo.partition(); log.trace(STR, record); updateProcessorContext(record, currNode); currNode.process(record.key(), record.value()); log.trace(STR, record); consumedOffsets.put(partition, record.offset()); commitOffsetNeeded = true; if (recordInfo.queue().size() == maxBufferedSize) { consumer.resume(singleton(partition)); } } catch (final ProducerFencedException fatal) { throw new TaskMigratedException(this, fatal); } catch (final KafkaException e) { throw new StreamsException(format(STR, id(), processorContext.currentNode().name(), record.topic(), record.partition(), record.offset() ), e); } finally { processorContext.setCurrentNode(null); } return true; }
/** * Process one record. * * @return true if this method processes a record, false if it does not process a record. * @throws TaskMigratedException if the task producer got fenced (EOS only) */
Process one record
process
{ "repo_name": "MyPureCloud/kafka", "path": "streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java", "license": "apache-2.0", "size": 27485 }
[ "org.apache.kafka.common.KafkaException", "org.apache.kafka.common.TopicPartition", "org.apache.kafka.common.errors.ProducerFencedException", "org.apache.kafka.streams.errors.StreamsException", "org.apache.kafka.streams.errors.TaskMigratedException" ]
import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.errors.ProducerFencedException; import org.apache.kafka.streams.errors.StreamsException; import org.apache.kafka.streams.errors.TaskMigratedException;
import org.apache.kafka.common.*; import org.apache.kafka.common.errors.*; import org.apache.kafka.streams.errors.*;
[ "org.apache.kafka" ]
org.apache.kafka;
2,335,943
public void createSequences() throws EclipseLinkException { createOrReplaceSequences(true); }
void function() throws EclipseLinkException { createOrReplaceSequences(true); }
/** * Create all the receiver's sequences on the database for all of the loaded * descriptors. */
Create all the receiver's sequences on the database for all of the loaded descriptors
createSequences
{ "repo_name": "jGauravGupta/jpamodeler", "path": "relation-mapper/src/main/java/org/eclipse/persistence/tools/schemaframework/JPAMSchemaManager.java", "license": "apache-2.0", "size": 56653 }
[ "org.eclipse.persistence.exceptions.EclipseLinkException" ]
import org.eclipse.persistence.exceptions.EclipseLinkException;
import org.eclipse.persistence.exceptions.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
2,814,505
@Override public void scan(JarScanType scanType, ServletContext context, JarScannerCallback callback) { if (log.isTraceEnabled()) { log.trace(sm.getString("jarScan.webinflibStart")); } Set<URL> processedURLs = new HashSet<>(); // Scan WEB-INF/lib Set<String> dirList = context.getResourcePaths(Constants.WEB_INF_LIB); if (dirList != null) { Iterator<String> it = dirList.iterator(); while (it.hasNext()) { String path = it.next(); if (path.endsWith(Constants.JAR_EXT) && getJarScanFilter().check(scanType, path.substring(path.lastIndexOf('/')+1))) { // Need to scan this JAR if (log.isDebugEnabled()) { log.debug(sm.getString("jarScan.webinflibJarScan", path)); } URL url = null; try { url = context.getResource(path); processedURLs.add(url); process(scanType, callback, url, path, true, null); } catch (IOException e) { log.warn(sm.getString("jarScan.webinflibFail", url), e); } } else { if (log.isTraceEnabled()) { log.trace(sm.getString("jarScan.webinflibJarNoScan", path)); } } } } // Scan WEB-INF/classes try { URL webInfURL = context.getResource(Constants.WEB_INF_CLASSES); if (webInfURL != null) { // WEB-INF/classes will also be included in the URLs returned // by the web application class loader so ensure the class path // scanning below does not re-scan this location. processedURLs.add(webInfURL); if (isScanAllDirectories()) { URL url = context.getResource(Constants.WEB_INF_CLASSES + "/META-INF"); if (url != null) { try { callback.scanWebInfClasses(); } catch (IOException e) { log.warn(sm.getString("jarScan.webinfclassesFail"), e); } } } } } catch (MalformedURLException e) { // Ignore. Won't happen. URLs are of the correct form. } // Scan the classpath if (isScanClassPath()) { if (log.isTraceEnabled()) { log.trace(sm.getString("jarScan.classloaderStart")); } ClassLoader stopLoader = null; if (!isScanBootstrapClassPath()) { // Stop when we reach the bootstrap class loader stopLoader = ClassLoader.getSystemClassLoader().getParent(); } ClassLoader classLoader = context.getClassLoader(); // JARs are treated as application provided until the common class // loader is reached. boolean isWebapp = true; while (classLoader != null && classLoader != stopLoader) { if (classLoader instanceof URLClassLoader) { if (isWebapp) { isWebapp = isWebappClassLoader(classLoader); } // Use a Deque so URLs can be removed as they are processed // and new URLs can be added as they are discovered during // processing. Deque<URL> classPathUrlsToProcess = new LinkedList<>(); classPathUrlsToProcess.addAll( Arrays.asList(((URLClassLoader) classLoader).getURLs())); while (!classPathUrlsToProcess.isEmpty()) { URL url = classPathUrlsToProcess.pop(); if (processedURLs.contains(url)) { // Skip this URL it has already been processed continue; } // TODO: Java 9 support. Details are TBD. It will depend // on the extent to which Java 8 supports the // Java 9 file formats since this code MUST run on // Java 8. ClassPathEntry cpe = new ClassPathEntry(url); // JARs are scanned unless the filter says not to. // Directories are scanned for pluggability scans or // if scanAllDirectories is enabled unless the // filter says not to. if ((cpe.isJar() || scanType == JarScanType.PLUGGABILITY || isScanAllDirectories()) && getJarScanFilter().check(scanType, cpe.getName())) { if (log.isDebugEnabled()) { log.debug(sm.getString("jarScan.classloaderJarScan", url)); } try { processedURLs.add(url); process(scanType, callback, url, null, isWebapp, classPathUrlsToProcess); } catch (IOException ioe) { log.warn(sm.getString("jarScan.classloaderFail", url), ioe); } } else { // JAR / directory has been skipped if (log.isTraceEnabled()) { log.trace(sm.getString("jarScan.classloaderJarNoScan", url)); } } } } classLoader = classLoader.getParent(); } } }
void function(JarScanType scanType, ServletContext context, JarScannerCallback callback) { if (log.isTraceEnabled()) { log.trace(sm.getString(STR)); } Set<URL> processedURLs = new HashSet<>(); Set<String> dirList = context.getResourcePaths(Constants.WEB_INF_LIB); if (dirList != null) { Iterator<String> it = dirList.iterator(); while (it.hasNext()) { String path = it.next(); if (path.endsWith(Constants.JAR_EXT) && getJarScanFilter().check(scanType, path.substring(path.lastIndexOf('/')+1))) { if (log.isDebugEnabled()) { log.debug(sm.getString(STR, path)); } URL url = null; try { url = context.getResource(path); processedURLs.add(url); process(scanType, callback, url, path, true, null); } catch (IOException e) { log.warn(sm.getString(STR, url), e); } } else { if (log.isTraceEnabled()) { log.trace(sm.getString(STR, path)); } } } } try { URL webInfURL = context.getResource(Constants.WEB_INF_CLASSES); if (webInfURL != null) { processedURLs.add(webInfURL); if (isScanAllDirectories()) { URL url = context.getResource(Constants.WEB_INF_CLASSES + STR); if (url != null) { try { callback.scanWebInfClasses(); } catch (IOException e) { log.warn(sm.getString(STR), e); } } } } } catch (MalformedURLException e) { } if (isScanClassPath()) { if (log.isTraceEnabled()) { log.trace(sm.getString(STR)); } ClassLoader stopLoader = null; if (!isScanBootstrapClassPath()) { stopLoader = ClassLoader.getSystemClassLoader().getParent(); } ClassLoader classLoader = context.getClassLoader(); boolean isWebapp = true; while (classLoader != null && classLoader != stopLoader) { if (classLoader instanceof URLClassLoader) { if (isWebapp) { isWebapp = isWebappClassLoader(classLoader); } Deque<URL> classPathUrlsToProcess = new LinkedList<>(); classPathUrlsToProcess.addAll( Arrays.asList(((URLClassLoader) classLoader).getURLs())); while (!classPathUrlsToProcess.isEmpty()) { URL url = classPathUrlsToProcess.pop(); if (processedURLs.contains(url)) { continue; } ClassPathEntry cpe = new ClassPathEntry(url); if ((cpe.isJar() scanType == JarScanType.PLUGGABILITY isScanAllDirectories()) && getJarScanFilter().check(scanType, cpe.getName())) { if (log.isDebugEnabled()) { log.debug(sm.getString(STR, url)); } try { processedURLs.add(url); process(scanType, callback, url, null, isWebapp, classPathUrlsToProcess); } catch (IOException ioe) { log.warn(sm.getString(STR, url), ioe); } } else { if (log.isTraceEnabled()) { log.trace(sm.getString(STR, url)); } } } } classLoader = classLoader.getParent(); } } }
/** * Scan the provided ServletContext and class loader for JAR files. Each JAR * file found will be passed to the callback handler to be processed. * * @param scanType The type of JAR scan to perform. This is passed to * the filter which uses it to determine how to * filter the results * @param context The ServletContext - used to locate and access * WEB-INF/lib * @param callback The handler to process any JARs found */
Scan the provided ServletContext and class loader for JAR files. Each JAR file found will be passed to the callback handler to be processed
scan
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/tomcat/util/scan/StandardJarScanner.java", "license": "apache-2.0", "size": 18087 }
[ "java.io.IOException", "java.net.MalformedURLException", "java.net.URLClassLoader", "java.util.Arrays", "java.util.Deque", "java.util.HashSet", "java.util.Iterator", "java.util.LinkedList", "java.util.Set", "javax.servlet.ServletContext", "org.apache.tomcat.JarScanType", "org.apache.tomcat.JarScannerCallback" ]
import java.io.IOException; import java.net.MalformedURLException; import java.net.URLClassLoader; import java.util.Arrays; import java.util.Deque; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Set; import javax.servlet.ServletContext; import org.apache.tomcat.JarScanType; import org.apache.tomcat.JarScannerCallback;
import java.io.*; import java.net.*; import java.util.*; import javax.servlet.*; import org.apache.tomcat.*;
[ "java.io", "java.net", "java.util", "javax.servlet", "org.apache.tomcat" ]
java.io; java.net; java.util; javax.servlet; org.apache.tomcat;
1,874,493
public void popValues(List values) { right = (Node)values.remove(0); left = (Node)values.remove(0); } }
void function(List values) { right = (Node)values.remove(0); left = (Node)values.remove(0); } }
/** * Lets the node pop its own branch nodes off the front of the * specified list. The default pulls two. */
Lets the node pop its own branch nodes off the front of the specified list. The default pulls two
popValues
{ "repo_name": "whitingjr/JbossWeb_7_2_0", "path": "src/main/java/org/apache/catalina/ssi/ExpressionParseTree.java", "license": "apache-2.0", "size": 11747 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,877,914
public PointSensitivities presentValueSensitivity(FraTrade trade, RatesProvider provider) { return productPricer.presentValueSensitivity(trade.getProduct(), provider); }
PointSensitivities function(FraTrade trade, RatesProvider provider) { return productPricer.presentValueSensitivity(trade.getProduct(), provider); }
/** * Calculates the present value sensitivity of the FRA trade. * <p> * The present value sensitivity of the trade is the sensitivity of the present value to * the underlying curves. * * @param trade the trade to price * @param provider the rates provider * @return the point sensitivity of the present value */
Calculates the present value sensitivity of the FRA trade. The present value sensitivity of the trade is the sensitivity of the present value to the underlying curves
presentValueSensitivity
{ "repo_name": "nssales/Strata", "path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/rate/fra/DiscountingFraTradePricer.java", "license": "apache-2.0", "size": 4132 }
[ "com.opengamma.strata.finance.rate.fra.FraTrade", "com.opengamma.strata.market.sensitivity.PointSensitivities", "com.opengamma.strata.pricer.rate.RatesProvider" ]
import com.opengamma.strata.finance.rate.fra.FraTrade; import com.opengamma.strata.market.sensitivity.PointSensitivities; import com.opengamma.strata.pricer.rate.RatesProvider;
import com.opengamma.strata.finance.rate.fra.*; import com.opengamma.strata.market.sensitivity.*; import com.opengamma.strata.pricer.rate.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
1,214,605
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) { if (v instanceof ViewGroup) { final ViewGroup group = (ViewGroup) v; final int scrollX = v.getScrollX(); final int scrollY = v.getScrollY(); final int count = group.getChildCount(); // Count backwards - let topmost views consume scroll distance first. for (int i = count - 1; i >= 0; i--) { // TODO: Add versioned support here for transformed views. // This will not work for transformed views in Honeycomb+ final View child = group.getChildAt(i); if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() && y + scrollY >= child.getTop() && y + scrollY < child.getBottom() && canScroll(child, true, dx, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) { return true; } } } return checkV && ViewCompat.canScrollHorizontally(v, -dx); }
boolean function(View v, boolean checkV, int dx, int x, int y) { if (v instanceof ViewGroup) { final ViewGroup group = (ViewGroup) v; final int scrollX = v.getScrollX(); final int scrollY = v.getScrollY(); final int count = group.getChildCount(); for (int i = count - 1; i >= 0; i--) { final View child = group.getChildAt(i); if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() && y + scrollY >= child.getTop() && y + scrollY < child.getBottom() && canScroll(child, true, dx, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) { return true; } } } return checkV && ViewCompat.canScrollHorizontally(v, -dx); }
/** * Tests scrollability within child views of v given a delta of dx. * * @param v View to test for horizontal scrollability * @param checkV Whether the view v passed should itself be checked for scrollability (true), * or just its children (false). * @param dx Delta scrolled in pixels * @param x X coordinate of the active touch point * @param y Y coordinate of the active touch point * @return true if child views of v can be scrolled by delta of dx. */
Tests scrollability within child views of v given a delta of dx
canScroll
{ "repo_name": "ligl/SlidingMenu", "path": "src/com/slidingmenu/lib/CustomViewAbove.java", "license": "apache-2.0", "size": 51911 }
[ "android.support.v4.view.ViewCompat", "android.view.View", "android.view.ViewGroup" ]
import android.support.v4.view.ViewCompat; import android.view.View; import android.view.ViewGroup;
import android.support.v4.view.*; import android.view.*;
[ "android.support", "android.view" ]
android.support; android.view;
2,466,864
StringBuilder builder = new StringBuilder(); vertexIdMap = Maps .newHashMapWithExpectedSize(graphTransaction.getVertices().size()); // GRAPH HEAD writeGraphHead(builder, graphId); graphId++; // VERTICES writeVertices(builder, graphTransaction.getVertices()); // EDGES writeEdges(builder, graphTransaction.getEdges()); return builder.toString().trim(); }
StringBuilder builder = new StringBuilder(); vertexIdMap = Maps .newHashMapWithExpectedSize(graphTransaction.getVertices().size()); writeGraphHead(builder, graphId); graphId++; writeVertices(builder, graphTransaction.getVertices()); writeEdges(builder, graphTransaction.getEdges()); return builder.toString().trim(); }
/** * Creates a TLF string representation of a given graph transaction, which * has the following format: * <p> * t # 0 * v 0 label * v 1 label * v 2 label * e 0 1 edgeLabel * e 1 2 edgeLabel * e 2 1 edgeLabel * </p> * * @param graphTransaction graph transaction * @return TLF string representation */
Creates a TLF string representation of a given graph transaction, which has the following format: t # 0 v 0 label v 1 label v 2 label e 0 1 edgeLabel e 1 2 edgeLabel e 2 1 edgeLabel
format
{ "repo_name": "Venom590/gradoop", "path": "gradoop-flink/src/main/java/org/gradoop/flink/io/impl/tlf/functions/TLFFileFormat.java", "license": "gpl-3.0", "size": 4642 }
[ "com.google.common.collect.Maps" ]
import com.google.common.collect.Maps;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,280,248
public InputSource loadSource(String href, String context, XSLTC xsltc);
InputSource function(String href, String context, XSLTC xsltc);
/** * This interface is used to plug external document loaders into XSLTC * (used with the <xsl:include> and <xsl:import> elements. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */
This interface is used to plug external document loaders into XSLTC (used with the and elements
loadSource
{ "repo_name": "haikuowuya/android_system_code", "path": "src/com/sun/org/apache/xalan/internal/xsltc/compiler/SourceLoader.java", "license": "apache-2.0", "size": 1479 }
[ "org.xml.sax.InputSource" ]
import org.xml.sax.InputSource;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
329,889
public int getAccessibleChildrenCount(JComponent a) { int returnValue = uis.elementAt(0).getAccessibleChildrenCount(a); for (int i = 1; i < uis.size(); i++) { uis.elementAt(i).getAccessibleChildrenCount(a); } return returnValue; }
int function(JComponent a) { int returnValue = uis.elementAt(0).getAccessibleChildrenCount(a); for (int i = 1; i < uis.size(); i++) { uis.elementAt(i).getAccessibleChildrenCount(a); } return returnValue; }
/** * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */
Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object
getAccessibleChildrenCount
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/plaf/multi/MultiSeparatorUI.java", "license": "apache-2.0", "size": 7308 }
[ "javax.swing.JComponent" ]
import javax.swing.JComponent;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,298,528
public void addInformation(ItemStack safariNetStack, EntityPlayer player, List<String> infoList, boolean advancedTooltips);
void function(ItemStack safariNetStack, EntityPlayer player, List<String> infoList, boolean advancedTooltips);
/** * Called to add information regarding a mob contained in a SafariNet. * * @param safariNetStack * The Safari Net that is requesting information. * @param player * The player holding the Safari Net. * @param infoList * The current list of information strings. Add yours to this. * @param advancedTooltips * True if the advanced tooltips option is on. */
Called to add information regarding a mob contained in a SafariNet
addInformation
{ "repo_name": "mcNETDev/DaWik", "path": "src/api/powercrystals/minefactoryreloaded/api/ISafariNetHandler.java", "license": "gpl-2.0", "size": 975 }
[ "java.util.List", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.item.ItemStack" ]
import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack;
import java.util.*; import net.minecraft.entity.player.*; import net.minecraft.item.*;
[ "java.util", "net.minecraft.entity", "net.minecraft.item" ]
java.util; net.minecraft.entity; net.minecraft.item;
2,853,605
EAttribute getMarketStatementLineItem_CurrentQuantity();
EAttribute getMarketStatementLineItem_CurrentQuantity();
/** * Returns the meta object for the attribute '{@link CIM.IEC61970.Informative.MarketOperations.MarketStatementLineItem#getCurrentQuantity <em>Current Quantity</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Current Quantity</em>'. * @see CIM.IEC61970.Informative.MarketOperations.MarketStatementLineItem#getCurrentQuantity() * @see #getMarketStatementLineItem() * @generated */
Returns the meta object for the attribute '<code>CIM.IEC61970.Informative.MarketOperations.MarketStatementLineItem#getCurrentQuantity Current Quantity</code>'.
getMarketStatementLineItem_CurrentQuantity
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Informative/MarketOperations/MarketOperationsPackage.java", "license": "mit", "size": 688294 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,431,890
public boolean intersects(Rectangle2D r) { return path.intersects(r); }
boolean function(Rectangle2D r) { return path.intersects(r); }
/** * Delegates to the enclosed <code>GeneralPath</code>. */
Delegates to the enclosed <code>GeneralPath</code>
intersects
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java", "license": "apache-2.0", "size": 24105 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,410,489
protected Request newRequest() { return new MockWebRequest(Url.parse("/")); }
Request function() { return new MockWebRequest(Url.parse("/")); }
/** * Create a new request, by default a {@link MockWebRequest}. */
Create a new request, by default a <code>MockWebRequest</code>
newRequest
{ "repo_name": "mosoft521/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java", "license": "apache-2.0", "size": 12270 }
[ "org.apache.wicket.mock.MockWebRequest", "org.apache.wicket.request.Request", "org.apache.wicket.request.Url" ]
import org.apache.wicket.mock.MockWebRequest; import org.apache.wicket.request.Request; import org.apache.wicket.request.Url;
import org.apache.wicket.mock.*; import org.apache.wicket.request.*;
[ "org.apache.wicket" ]
org.apache.wicket;
216,995
public ListCommentResult listComment(long fileId) throws YfyException { String[] param = { String.valueOf(fileId) }; return listComment(param); }
ListCommentResult function(long fileId) throws YfyException { String[] param = { String.valueOf(fileId) }; return listComment(param); }
/** * List file's all comments' information * * @param fileId File id in fangcloud * @return All file's comments' information * @throws YfyException */
List file's all comments' information
listComment
{ "repo_name": "yifangyun/fangcloud-java-sdk", "path": "src/main/java/com/fangcloud/sdk/api/file/YfyFileRequest.java", "license": "mit", "size": 27933 }
[ "com.fangcloud.sdk.api.comment.ListCommentResult", "com.fangcloud.sdk.exception.YfyException" ]
import com.fangcloud.sdk.api.comment.ListCommentResult; import com.fangcloud.sdk.exception.YfyException;
import com.fangcloud.sdk.api.comment.*; import com.fangcloud.sdk.exception.*;
[ "com.fangcloud.sdk" ]
com.fangcloud.sdk;
1,387,487
public DsnFile.ReadResult import_design(java.io.InputStream p_design, board.BoardObservers p_observers, datastructures.IdNoGenerator p_item_id_no_generator, TestLevel p_test_level) { if (p_design == null) { return DsnFile.ReadResult.ERROR; } DsnFile.ReadResult read_result; try { read_result = DsnFile.read(p_design, this, p_observers, p_item_id_no_generator, p_test_level); } catch (Exception e) { read_result = DsnFile.ReadResult.ERROR; } if (read_result == DsnFile.ReadResult.OK) { this.board.reduce_nets_of_route_items(); this.set_layer(0); for (int i = 0; i < board.get_layer_count(); ++i) { if (!settings.autoroute_settings.get_layer_active(i)) { graphics_context.set_layer_visibility(i, 0); } } } try { p_design.close(); } catch (java.io.IOException e) { read_result = DsnFile.ReadResult.ERROR; } return read_result; }
DsnFile.ReadResult function(java.io.InputStream p_design, board.BoardObservers p_observers, datastructures.IdNoGenerator p_item_id_no_generator, TestLevel p_test_level) { if (p_design == null) { return DsnFile.ReadResult.ERROR; } DsnFile.ReadResult read_result; try { read_result = DsnFile.read(p_design, this, p_observers, p_item_id_no_generator, p_test_level); } catch (Exception e) { read_result = DsnFile.ReadResult.ERROR; } if (read_result == DsnFile.ReadResult.OK) { this.board.reduce_nets_of_route_items(); this.set_layer(0); for (int i = 0; i < board.get_layer_count(); ++i) { if (!settings.autoroute_settings.get_layer_active(i)) { graphics_context.set_layer_visibility(i, 0); } } } try { p_design.close(); } catch (java.io.IOException e) { read_result = DsnFile.ReadResult.ERROR; } return read_result; }
/** * Imports a board design from a Specctra dsn-file. * The parameters p_item_observers and p_item_id_no_generator are used, * in case the board is embedded into a host system. * Returns false, if the dsn-file is currupted. * * @param p_design a java$io$InputStream object. * @param p_observers a {@link board.BoardObservers} object. * @param p_item_id_no_generator a {@link datastructures.IdNoGenerator} object. * @param p_test_level a {@link board.TestLevel} object. * @return a {@link designformats.specctra.DsnFile.ReadResult} object. */
Imports a board design from a Specctra dsn-file. The parameters p_item_observers and p_item_id_no_generator are used, in case the board is embedded into a host system. Returns false, if the dsn-file is currupted
import_design
{ "repo_name": "nick-less/freerouting", "path": "src/main/java/interactive/BoardHandling.java", "license": "gpl-3.0", "size": 62043 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,783,008
public Object evaluate(final Reader scriptReader, final String description) throws IOException {
Object function(final Reader scriptReader, final String description) throws IOException {
/** * This method evaluates a piece of ECMAScript. * @param scriptReader a <code>java.io.Reader</code> on the piece of script * @param description description which can be later used (e.g., for error * messages). * @return if no exception is thrown during the call, should return the * value of the last expression evaluated in the script. */
This method evaluates a piece of ECMAScript
evaluate
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/script/rhino/RhinoInterpreter.java", "license": "apache-2.0", "size": 19723 }
[ "java.io.IOException", "java.io.Reader" ]
import java.io.IOException; import java.io.Reader;
import java.io.*;
[ "java.io" ]
java.io;
216,110
Map<String, Object> executeScript(WalEvent event);
Map<String, Object> executeScript(WalEvent event);
/** * Execute the script supplied when the river was activated * @param event The WAL Event * @return The Context Object supplied to the script, unwrapped after execution */
Execute the script supplied when the river was activated
executeScript
{ "repo_name": "arangodb/elasticsearch-river-arangodb", "path": "src/main/java/org/elasticsearch/river/arangodb/es/script/UserScript.java", "license": "apache-2.0", "size": 395 }
[ "java.util.Map", "net.swisstech.arangodb.model.wal.WalEvent" ]
import java.util.Map; import net.swisstech.arangodb.model.wal.WalEvent;
import java.util.*; import net.swisstech.arangodb.model.wal.*;
[ "java.util", "net.swisstech.arangodb" ]
java.util; net.swisstech.arangodb;
1,150,883
@Test public void testGetOriginalValue() { //Original value is not initialized. Default value will be used instead. Shouldn't be null DescribableList originalValue = property.getOriginalValue(); assertNotNull(originalValue); //Value was set, so return it without modification assertTrue(originalValue == property.getOriginalValue()); }
void function() { DescribableList originalValue = property.getOriginalValue(); assertNotNull(originalValue); assertTrue(originalValue == property.getOriginalValue()); }
/** * Verify {@link org.eclipse.hudson.model.project.property.CopyOnWriteListProjectProperty#getOriginalValue()} method. */
Verify <code>org.eclipse.hudson.model.project.property.CopyOnWriteListProjectProperty#getOriginalValue()</code> method
testGetOriginalValue
{ "repo_name": "eclipse/hudson.core", "path": "hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java", "license": "apache-2.0", "size": 6170 }
[ "hudson.util.DescribableList", "junit.framework.Assert" ]
import hudson.util.DescribableList; import junit.framework.Assert;
import hudson.util.*; import junit.framework.*;
[ "hudson.util", "junit.framework" ]
hudson.util; junit.framework;
2,874,419
public List<String> getCompeticionesSeleccionadas();
List<String> function();
/**Devuelve la lista con el nombre de las competiciones seleccionadas de la primera lista * * @return List<String> */
Devuelve la lista con el nombre de las competiciones seleccionadas de la primera lista
getCompeticionesSeleccionadas
{ "repo_name": "juanmfh/gestor-deportivo", "path": "src/vista/interfaces/VistaUsuarios.java", "license": "gpl-3.0", "size": 4168 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,785,288
@Override public String getName() { return NbBundle.getMessage(this.getClass(), "AddImageWizardChooseDataSourceVisual.getName.text"); }
String function() { return NbBundle.getMessage(this.getClass(), STR); }
/** * Returns the name of the this panel. This name will be shown on the left * panel of the "Add Image" wizard panel. * * @return name the name of this panel */
Returns the name of the this panel. This name will be shown on the left panel of the "Add Image" wizard panel
getName
{ "repo_name": "maxrp/autopsy", "path": "Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourceVisual.java", "license": "apache-2.0", "size": 14411 }
[ "org.openide.util.NbBundle" ]
import org.openide.util.NbBundle;
import org.openide.util.*;
[ "org.openide.util" ]
org.openide.util;
2,067,887
public Observable<ServiceResponse<List<AlertRuleResourceInner>>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<List<AlertRuleResourceInner>>> function(String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * List the alert rules within a resource group. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List&lt;AlertRuleResourceInner&gt; object */
List the alert rules within a resource group
listByResourceGroupWithServiceResponseAsync
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-insights/src/main/java/com/microsoft/azure/management/gallery/implementation/AlertRulesInner.java", "license": "mit", "size": 28641 }
[ "com.microsoft.rest.ServiceResponse", "java.util.List" ]
import com.microsoft.rest.ServiceResponse; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
882,203
if (extract() == null || extract().getId() <= 0 || extract().getHost() == null || extract().getHost().getId() <= 0) { return false; } if (webServer != null) { webServer.stop(); } webServer = WebServer.start(getExtractor(), (sa != null ? sa : SignatureAlgorithm.getDefault())); return true; }
if (extract() == null extract().getId() <= 0 extract().getHost() == null extract().getHost().getId() <= 0) { return false; } if (webServer != null) { webServer.stop(); } webServer = WebServer.start(getExtractor(), (sa != null ? sa : SignatureAlgorithm.getDefault())); return true; }
/** * Starts a {@linkplain WebServer}. If it has already been started it will * be stopped and restarted * * @param sa * the {@linkplain SignatureAlgorithm} to use when the * {@linkplain X509Certificate} needs to be created/signed * @return true when started */
Starts a WebServer. If it has already been started it will be stopped and restarted
start
{ "repo_name": "stephenfvdm/ugate", "path": "src/main/java/org/ugate/service/WebService.java", "license": "apache-2.0", "size": 1722 }
[ "org.ugate.service.web.SignatureAlgorithm", "org.ugate.service.web.WebServer" ]
import org.ugate.service.web.SignatureAlgorithm; import org.ugate.service.web.WebServer;
import org.ugate.service.web.*;
[ "org.ugate.service" ]
org.ugate.service;
1,615,036
public TaskStackBuilder addNextIntent(Intent nextIntent) { mIntents.add(nextIntent); return this; }
TaskStackBuilder function(Intent nextIntent) { mIntents.add(nextIntent); return this; }
/** * Add a new Intent to the task stack. The most recently added Intent will invoke * the Activity at the top of the final task stack. * * @param nextIntent Intent for the next Activity in the synthesized task stack * @return This TaskStackBuilder for method chaining */
Add a new Intent to the task stack. The most recently added Intent will invoke the Activity at the top of the final task stack
addNextIntent
{ "repo_name": "takuji31/android-app-base", "path": "libs-src/support/android/support/v4/app/TaskStackBuilder.java", "license": "apache-2.0", "size": 14019 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
569,499
public int queryNumFileChunks(long fileID) throws KeywordSearchModuleException, NoOpenCoreException { currentCoreLock.readLock().lock(); try { if (null == currentCollection) { throw new NoOpenCoreException(); } try { return currentCollection.queryNumFileChunks(fileID); } catch (Exception ex) { // intentional "catch all" as Solr is known to throw all kinds of Runtime exceptions throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.queryNumFileChunks.exception.msg"), ex); } } finally { currentCoreLock.readLock().unlock(); } }
int function(long fileID) throws KeywordSearchModuleException, NoOpenCoreException { currentCoreLock.readLock().lock(); try { if (null == currentCollection) { throw new NoOpenCoreException(); } try { return currentCollection.queryNumFileChunks(fileID); } catch (Exception ex) { throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), STR), ex); } } finally { currentCoreLock.readLock().unlock(); } }
/** * Execute query that gets number of indexed file chunks for a file * * @param fileID file id of the original file broken into chunks and indexed * * @return int representing number of indexed file chunks, 0 if there is no * chunks * * @throws KeywordSearchModuleException * @throws NoOpenCoreException */
Execute query that gets number of indexed file chunks for a file
queryNumFileChunks
{ "repo_name": "eugene7646/autopsy", "path": "KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java", "license": "apache-2.0", "size": 101731 }
[ "org.openide.util.NbBundle" ]
import org.openide.util.NbBundle;
import org.openide.util.*;
[ "org.openide.util" ]
org.openide.util;
1,547
public int refreshNodes() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy: proxies) { proxy.getProxy().refreshNodes(); System.out.println("Refresh nodes successful for " + proxy.getAddress()); } } else { dfs.refreshNodes(); System.out.println("Refresh nodes successful"); } exitCode = 0; return exitCode; }
int function() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy: proxies) { proxy.getProxy().refreshNodes(); System.out.println(STR + proxy.getAddress()); } } else { dfs.refreshNodes(); System.out.println(STR); } exitCode = 0; return exitCode; }
/** * Command to ask the namenode to reread the hosts and excluded hosts * file. * Usage: java DFSAdmin -refreshNodes * @exception IOException */
Command to ask the namenode to reread the hosts and excluded hosts file. Usage: java DFSAdmin -refreshNodes
refreshNodes
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java", "license": "mit", "size": 70322 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hdfs.DistributedFileSystem", "org.apache.hadoop.hdfs.HAUtil", "org.apache.hadoop.hdfs.NameNodeProxies", "org.apache.hadoop.hdfs.protocol.ClientProtocol" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.HAUtil; import org.apache.hadoop.hdfs.NameNodeProxies; import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
672,243
@IgniteSpiConfiguration(optional = true) public void setPath(String path) { this.path = path; }
@IgniteSpiConfiguration(optional = true) void function(String path) { this.path = path; }
/** * Sets path. * * @param path Shared path. */
Sets path
setPath
{ "repo_name": "leveyj/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java", "license": "apache-2.0", "size": 10539 }
[ "org.apache.ignite.spi.IgniteSpiConfiguration" ]
import org.apache.ignite.spi.IgniteSpiConfiguration;
import org.apache.ignite.spi.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,804,928
@PUT("/detach") @Detach(Serialize.class) void detachSerializer(@Entity User user); static final class UninstantiableSerializer extends AbstractSerializer<String, String> { public UninstantiableSerializer(String illegalParam) { //illegal parameterized constructor super(String.class); }
@PUT(STR) @Detach(Serialize.class) void detachSerializer(@Entity User user); static final class UninstantiableSerializer extends AbstractSerializer<String, String> { public UninstantiableSerializer(String illegalParam) { super(String.class); }
/** * <p>Sends a request which detaches the inherited serializer defined on the endpoint.</p> * * @param user * the model which should not be processed by a serializer * * @since 1.3.0 */
Sends a request which detaches the inherited serializer defined on the endpoint
detachSerializer
{ "repo_name": "sahan/ZombieLink", "path": "zombielink/src/test/java/com/lonepulse/zombielink/processor/SerializerEndpoint.java", "license": "apache-2.0", "size": 5217 }
[ "com.lonepulse.zombielink.annotation.Detach", "com.lonepulse.zombielink.annotation.Entity", "com.lonepulse.zombielink.annotation.Serialize", "com.lonepulse.zombielink.model.User", "com.lonepulse.zombielink.request.AbstractSerializer" ]
import com.lonepulse.zombielink.annotation.Detach; import com.lonepulse.zombielink.annotation.Entity; import com.lonepulse.zombielink.annotation.Serialize; import com.lonepulse.zombielink.model.User; import com.lonepulse.zombielink.request.AbstractSerializer;
import com.lonepulse.zombielink.annotation.*; import com.lonepulse.zombielink.model.*; import com.lonepulse.zombielink.request.*;
[ "com.lonepulse.zombielink" ]
com.lonepulse.zombielink;
1,382,275
public void setDisplayFormatters(Object displayFormatters) { if (displayFormatters instanceof List) { for (Object formatterItem : ((List<?>)displayFormatters)) { if (formatterItem instanceof CmsJspContentAccessValueWrapper) { addFormatter((CmsJspContentAccessValueWrapper)formatterItem); } } } else if (displayFormatters instanceof CmsJspContentAccessValueWrapper) { addFormatter((CmsJspContentAccessValueWrapper)displayFormatters); } else if (displayFormatters instanceof String) { String[] temp = ((String)displayFormatters).split(CmsXmlDisplayFormatterValue.SEPARATOR); if (temp.length == 2) { addDisplayFormatter(temp[0], temp[1]); } } }
void function(Object displayFormatters) { if (displayFormatters instanceof List) { for (Object formatterItem : ((List<?>)displayFormatters)) { if (formatterItem instanceof CmsJspContentAccessValueWrapper) { addFormatter((CmsJspContentAccessValueWrapper)formatterItem); } } } else if (displayFormatters instanceof CmsJspContentAccessValueWrapper) { addFormatter((CmsJspContentAccessValueWrapper)displayFormatters); } else if (displayFormatters instanceof String) { String[] temp = ((String)displayFormatters).split(CmsXmlDisplayFormatterValue.SEPARATOR); if (temp.length == 2) { addDisplayFormatter(temp[0], temp[1]); } } }
/** * Sets the items.<p> * * @param displayFormatters the items to set */
Sets the items
setDisplayFormatters
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/jsp/CmsJspTagDisplay.java", "license": "lgpl-2.1", "size": 20056 }
[ "java.util.List", "org.opencms.jsp.util.CmsJspContentAccessValueWrapper", "org.opencms.xml.types.CmsXmlDisplayFormatterValue" ]
import java.util.List; import org.opencms.jsp.util.CmsJspContentAccessValueWrapper; import org.opencms.xml.types.CmsXmlDisplayFormatterValue;
import java.util.*; import org.opencms.jsp.util.*; import org.opencms.xml.types.*;
[ "java.util", "org.opencms.jsp", "org.opencms.xml" ]
java.util; org.opencms.jsp; org.opencms.xml;
1,074,521
protected final HBox createHeader() { final HBox header = new HBox(); header.getStyleClass().addAll(StyleClass.HEADER, StyleClass.TOOLBAR, StyleClass.ALIGN_CENTER_LEFT); return header; }
final HBox function() { final HBox header = new HBox(); header.getStyleClass().addAll(StyleClass.HEADER, StyleClass.TOOLBAR, StyleClass.ALIGN_CENTER_LEFT); return header; }
/** * Creates the header. * * @return the header. */
Creates the header
createHeader
{ "repo_name": "Haixing-Hu/iLibrary", "path": "src/main/java/com/github/haixing_hu/ilibrary/gui/BasicPanel.java", "license": "gpl-2.0", "size": 3319 }
[ "com.github.haixing_hu.ilibrary.StyleClass" ]
import com.github.haixing_hu.ilibrary.StyleClass;
import com.github.haixing_hu.ilibrary.*;
[ "com.github.haixing_hu" ]
com.github.haixing_hu;
133,054
private static Map<String, AttributeValue> buildTableAttributeValuesMap(final AuditActionContext record) { val values = new HashMap<String, AttributeValue>(); values.put(ColumnNames.PRINCIPAL.getColumnName(), AttributeValue.builder().s(record.getPrincipal()).build()); values.put(ColumnNames.CLIENT_IP_ADDRESS.getColumnName(), AttributeValue.builder().s(record.getClientIpAddress()).build()); values.put(ColumnNames.SERVER_IP_ADDRESS.getColumnName(), AttributeValue.builder().s(record.getServerIpAddress()).build()); values.put(ColumnNames.RESOURCE_OPERATED_UPON.getColumnName(), AttributeValue.builder().s(record.getResourceOperatedUpon()).build()); values.put(ColumnNames.APPLICATION_CODE.getColumnName(), AttributeValue.builder().s(record.getApplicationCode()).build()); values.put(ColumnNames.ACTION_PERFORMED.getColumnName(), AttributeValue.builder().s(record.getActionPerformed()).build()); val time = record.getWhenActionWasPerformed().getTime(); values.put(ColumnNames.WHEN_ACTION_PERFORMED.getColumnName(), AttributeValue.builder().s(String.valueOf(time)).build()); LOGGER.debug("Created attribute values [{}] based on [{}]", values, record); return values; }
static Map<String, AttributeValue> function(final AuditActionContext record) { val values = new HashMap<String, AttributeValue>(); values.put(ColumnNames.PRINCIPAL.getColumnName(), AttributeValue.builder().s(record.getPrincipal()).build()); values.put(ColumnNames.CLIENT_IP_ADDRESS.getColumnName(), AttributeValue.builder().s(record.getClientIpAddress()).build()); values.put(ColumnNames.SERVER_IP_ADDRESS.getColumnName(), AttributeValue.builder().s(record.getServerIpAddress()).build()); values.put(ColumnNames.RESOURCE_OPERATED_UPON.getColumnName(), AttributeValue.builder().s(record.getResourceOperatedUpon()).build()); values.put(ColumnNames.APPLICATION_CODE.getColumnName(), AttributeValue.builder().s(record.getApplicationCode()).build()); values.put(ColumnNames.ACTION_PERFORMED.getColumnName(), AttributeValue.builder().s(record.getActionPerformed()).build()); val time = record.getWhenActionWasPerformed().getTime(); values.put(ColumnNames.WHEN_ACTION_PERFORMED.getColumnName(), AttributeValue.builder().s(String.valueOf(time)).build()); LOGGER.debug(STR, values, record); return values; }
/** * Build table attribute values map. * * @param record the record * @return the map */
Build table attribute values map
buildTableAttributeValuesMap
{ "repo_name": "pdrados/cas", "path": "support/cas-server-support-audit-dynamodb/src/main/java/org/apereo/cas/audit/DynamoDbAuditTrailManagerFacilitator.java", "license": "apache-2.0", "size": 9735 }
[ "java.util.HashMap", "java.util.Map", "org.apereo.inspektr.audit.AuditActionContext", "software.amazon.awssdk.services.dynamodb.model.AttributeValue" ]
import java.util.HashMap; import java.util.Map; import org.apereo.inspektr.audit.AuditActionContext; import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.util.*; import org.apereo.inspektr.audit.*; import software.amazon.awssdk.services.dynamodb.model.*;
[ "java.util", "org.apereo.inspektr", "software.amazon.awssdk" ]
java.util; org.apereo.inspektr; software.amazon.awssdk;
69,880
JSONObject get(final String id) throws RepositoryException;
JSONObject get(final String id) throws RepositoryException;
/** * Gets a json object by the specified id. * * @param id the specified id * @return a json object, returns {@code null} if not found * @throws RepositoryException repository exception */
Gets a json object by the specified id
get
{ "repo_name": "b3log/latke", "path": "latke-core/src/main/java/org/b3log/latke/repository/Repository.java", "license": "apache-2.0", "size": 9170 }
[ "org.json.JSONObject" ]
import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
576,640
public static TargetUserEvent createTargetUserEvent(User targetUser) { Map<String, Object> values = Maps.newHashMap(); values.put("targetUser", targetUser); return SpongeEventFactoryUtils.createEventImpl(TargetUserEvent.class, values); }
static TargetUserEvent function(User targetUser) { Map<String, Object> values = Maps.newHashMap(); values.put(STR, targetUser); return SpongeEventFactoryUtils.createEventImpl(TargetUserEvent.class, values); }
/** * AUTOMATICALLY GENERATED, DO NOT EDIT. * Creates a new instance of * {@link org.spongepowered.api.event.user.TargetUserEvent}. * * @param targetUser The target user * @return A new target user event */
AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.user.TargetUserEvent</code>
createTargetUserEvent
{ "repo_name": "jamierocks/SpongeAPI", "path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java", "license": "mit", "size": 196993 }
[ "com.google.common.collect.Maps", "java.util.Map", "org.spongepowered.api.entity.living.player.User", "org.spongepowered.api.event.user.TargetUserEvent" ]
import com.google.common.collect.Maps; import java.util.Map; import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.user.TargetUserEvent;
import com.google.common.collect.*; import java.util.*; import org.spongepowered.api.entity.living.player.*; import org.spongepowered.api.event.user.*;
[ "com.google.common", "java.util", "org.spongepowered.api" ]
com.google.common; java.util; org.spongepowered.api;
2,173,316
private Set<Provider> getDisplayEncounterProviders(Map<EncounterRole, Set<Provider>> encounterProviders) { String encounterRoles = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GP_DASHBOARD_PROVIDER_DISPLAY_ENCOUNTER_ROLES, null); if (StringUtils.isEmpty(encounterRoles)) { //we do not filter if user has not yet set the global property. LinkedHashSet<Provider> allProviders = new LinkedHashSet<Provider>(); for (Set<Provider> providers : encounterProviders.values()) { allProviders.addAll(providers); } return allProviders; } return filterProviders(encounterProviders, trimStringArray(encounterRoles.split(","))); }
Set<Provider> function(Map<EncounterRole, Set<Provider>> encounterProviders) { String encounterRoles = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GP_DASHBOARD_PROVIDER_DISPLAY_ENCOUNTER_ROLES, null); if (StringUtils.isEmpty(encounterRoles)) { LinkedHashSet<Provider> allProviders = new LinkedHashSet<Provider>(); for (Set<Provider> providers : encounterProviders.values()) { allProviders.addAll(providers); } return allProviders; } return filterProviders(encounterProviders, trimStringArray(encounterRoles.split(","))); }
/** * Filters a list of encounter providers according to the global property * which determines providers in which encounter roles to display. * * @param eps the encounter providers to filter. * @return the filtered encounter providers. */
Filters a list of encounter providers according to the global property which determines providers in which encounter roles to display
getDisplayEncounterProviders
{ "repo_name": "sintjuri/openmrs-core", "path": "web/src/main/java/org/openmrs/web/taglib/FormatTag.java", "license": "mpl-2.0", "size": 25406 }
[ "java.util.LinkedHashSet", "java.util.Map", "java.util.Set", "org.apache.commons.lang.StringUtils", "org.openmrs.EncounterRole", "org.openmrs.Provider", "org.openmrs.api.context.Context", "org.openmrs.util.OpenmrsConstants" ]
import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.openmrs.EncounterRole; import org.openmrs.Provider; import org.openmrs.api.context.Context; import org.openmrs.util.OpenmrsConstants;
import java.util.*; import org.apache.commons.lang.*; import org.openmrs.*; import org.openmrs.api.context.*; import org.openmrs.util.*;
[ "java.util", "org.apache.commons", "org.openmrs", "org.openmrs.api", "org.openmrs.util" ]
java.util; org.apache.commons; org.openmrs; org.openmrs.api; org.openmrs.util;
427,290
public static boolean hasField(Object obj, String fieldName){ try { field(obj, fieldName); return true; }catch (IgniteException e){ return false; } }
static boolean function(Object obj, String fieldName){ try { field(obj, fieldName); return true; }catch (IgniteException e){ return false; } }
/** * Check that field exist. * * @param obj Object. * @param fieldName Field name. * @return Boolean flag. */
Check that field exist
hasField
{ "repo_name": "mcherkasov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 316648 }
[ "org.apache.ignite.IgniteException" ]
import org.apache.ignite.IgniteException;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,321,816
@Override public StringBuffer format(final Date date, final StringBuffer buf) { return printer.format(date, buf); }
StringBuffer function(final Date date, final StringBuffer buf) { return printer.format(date, buf); }
/** * <p>Formats a {@code Date} object into the * supplied {@code StringBuffer} using a {@code GregorianCalendar}.</p> * * @param date the date to format * @param buf the buffer to format into * @return the specified string buffer */
Formats a Date object into the supplied StringBuffer using a GregorianCalendar
format
{ "repo_name": "cjug/jigsaw-commons-lang3", "path": "common-lang-jigsaw/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java", "license": "apache-2.0", "size": 22278 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,581,285
public ArrayList<JavaField> getFieldList() { lazyLoad(); return _fields; }
ArrayList<JavaField> function() { lazyLoad(); return _fields; }
/** * Returns the fields. */
Returns the fields
getFieldList
{ "repo_name": "CleverCloud/Quercus", "path": "resin/src/main/java/com/caucho/bytecode/JavaClass.java", "license": "gpl-2.0", "size": 16398 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
755,291
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.save: save(); return true; case android.R.id.home: finish(); break; } return super.onOptionsItemSelected(item); }
boolean function(MenuItem item) { switch (item.getItemId()) { case R.id.save: save(); return true; case android.R.id.home: finish(); break; } return super.onOptionsItemSelected(item); }
/** * On menu item selected */
On menu item selected
onOptionsItemSelected
{ "repo_name": "mbullington/dialogue", "path": "yaaic/src/main/java/mbullington/dialogue/activity/AddServerActivity.java", "license": "gpl-2.0", "size": 17548 }
[ "android.view.MenuItem" ]
import android.view.MenuItem;
import android.view.*;
[ "android.view" ]
android.view;
933,277
protected final void enableTranspile() { checkState(this.setUpRan, "Attempted to configure before running setUp()."); transpileEnabled = true; }
final void function() { checkState(this.setUpRan, STR); transpileEnabled = true; }
/** * Perform AST transpilation before running the test pass. */
Perform AST transpilation before running the test pass
enableTranspile
{ "repo_name": "MatrixFrog/closure-compiler", "path": "test/com/google/javascript/jscomp/CompilerTestCase.java", "license": "apache-2.0", "size": 77821 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
727,344
public void removeLocalNodeMasterListener(LocalNodeMasterListener listener) { localNodeMasterListeners.remove(listener); }
void function(LocalNodeMasterListener listener) { localNodeMasterListeners.remove(listener); }
/** * Remove the given listener for on/off local master events */
Remove the given listener for on/off local master events
removeLocalNodeMasterListener
{ "repo_name": "winstonewert/elasticsearch", "path": "core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java", "license": "apache-2.0", "size": 54627 }
[ "org.elasticsearch.cluster.LocalNodeMasterListener" ]
import org.elasticsearch.cluster.LocalNodeMasterListener;
import org.elasticsearch.cluster.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
2,800,914
public PlaylistControl getPlaylistControl() { return this; }
PlaylistControl function() { return this; }
/**************** * Playlist Control * ****************/
Playlist Control
getPlaylistControl
{ "repo_name": "david-fenton/Connect-SDK-Cordova-Plugin", "path": "Connect-SDK-Android/core/src/com/connectsdk/service/sessions/WebOSWebAppSession.java", "license": "apache-2.0", "size": 37067 }
[ "com.connectsdk.service.capability.PlaylistControl" ]
import com.connectsdk.service.capability.PlaylistControl;
import com.connectsdk.service.capability.*;
[ "com.connectsdk.service" ]
com.connectsdk.service;
929,143
public JButton createButton(String uiKey, Icon icon) { JButton b = new JButton(icon); b.setName(uiKey); setMnemonic(b, uiKey); setToolTip(b, uiKey); return b; }
JButton function(String uiKey, Icon icon) { JButton b = new JButton(icon); b.setName(uiKey); setMnemonic(b, uiKey); setToolTip(b, uiKey); return b; }
/** * Create a button containing an Icon. * @param uiKey the base name of the resource to be used * @param icon the icon to appear in the button * @return the button that was created */
Create a button containing an Icon
createButton
{ "repo_name": "Distrotech/icedtea6-1.12", "path": "src/jtreg/com/sun/javatest/tool/UIFactory.java", "license": "gpl-2.0", "size": 117735 }
[ "javax.swing.Icon", "javax.swing.JButton" ]
import javax.swing.Icon; import javax.swing.JButton;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
931,071
@Name("avformat_alloc_context") protected native long avformat_alloc_context$2(); public void avformat_free_context(Pointer<AVFormatContext > s) { avformat_free_context(Pointer.getPeer(s)); }
@Name(STR) native long avformat_alloc_context$2(); public void function(Pointer<AVFormatContext > s) { avformat_free_context(Pointer.getPeer(s)); }
/** * Free an AVFormatContext and all its streams.<br> * @param s context to free<br> * Original signature : <code>void avformat_free_context(AVFormatContext*)</code><br> * <i>native declaration : ffmpeg_build/include/libavformat/avformat.h:527</i> */
Free an AVFormatContext and all its streams
avformat_free_context
{ "repo_name": "mutars/java_libav", "path": "wrapper/src/main/java/com/mutar/libav/bridge/avformat/AvformatLibrary.java", "license": "gpl-2.0", "size": 136321 }
[ "org.bridj.Pointer", "org.bridj.ann.Name" ]
import org.bridj.Pointer; import org.bridj.ann.Name;
import org.bridj.*; import org.bridj.ann.*;
[ "org.bridj", "org.bridj.ann" ]
org.bridj; org.bridj.ann;
1,917,312
@ThreadConfined(type = ThreadConfined.ThreadType.AWT) private String getStringForColumn(BlackboardArtifact artifact, BlackboardAttribute bba, int columnIndex) throws TskCoreException { if (columnIndex == 0 && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) { return TimeZoneUtils.getFormattedTime(bba.getValueLong()); } else if (columnIndex == 1) { if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD || artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE) { if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) { return Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(bba.getValueLong()).getName(); } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) { return FilenameUtils.getName(bba.getDisplayString()); } } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID()) { return bba.getDisplayString(); } } else if (columnIndex == 2 && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) { return Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(bba.getValueLong()).getMIMEType(); } return null; }
@ThreadConfined(type = ThreadConfined.ThreadType.AWT) String function(BlackboardArtifact artifact, BlackboardAttribute bba, int columnIndex) throws TskCoreException { if (columnIndex == 0 && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) { return TimeZoneUtils.getFormattedTime(bba.getValueLong()); } else if (columnIndex == 1) { if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE) { if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) { return Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(bba.getValueLong()).getName(); } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) { return FilenameUtils.getName(bba.getDisplayString()); } } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID()) { return bba.getDisplayString(); } } else if (columnIndex == 2 && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) { return Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(bba.getValueLong()).getMIMEType(); } return null; }
/** * Get the appropriate String for the specified column from the * BlackboardAttribute. * * @param artifact The artifact. * @param bba The BlackboardAttribute which may contain a value. * @param columnIndex The column the value will be displayed in. * * @return The value from the specified attribute which should be * displayed in the specified column, null if the specified * attribute does not contain a value for that column. * * @throws TskCoreException When unable to get abstract files based on * the TSK_PATH_ID. */
Get the appropriate String for the specified column from the BlackboardAttribute
getStringForColumn
{ "repo_name": "sleuthkit/autopsy", "path": "Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java", "license": "apache-2.0", "size": 17943 }
[ "org.apache.commons.io.FilenameUtils", "org.sleuthkit.autopsy.casemodule.Case", "org.sleuthkit.autopsy.coreutils.ThreadConfined", "org.sleuthkit.autopsy.coreutils.TimeZoneUtils", "org.sleuthkit.datamodel.BlackboardArtifact", "org.sleuthkit.datamodel.BlackboardAttribute", "org.sleuthkit.datamodel.TskCoreException" ]
import org.apache.commons.io.FilenameUtils; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.coreutils.TimeZoneUtils; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException;
import org.apache.commons.io.*; import org.sleuthkit.autopsy.casemodule.*; import org.sleuthkit.autopsy.coreutils.*; import org.sleuthkit.datamodel.*;
[ "org.apache.commons", "org.sleuthkit.autopsy", "org.sleuthkit.datamodel" ]
org.apache.commons; org.sleuthkit.autopsy; org.sleuthkit.datamodel;
725,662
@Programmatic @MemberOrder(sequence = "3") public List<Correo> listarMensajesPersistidos( final CorreoEmpresa correoEmpresa) { final List<Correo> listaCorreosPersistidos = this.container .allMatches(new QueryDefault<Correo>(Correo.class, "buscarCorreo")); if (listaCorreosPersistidos.isEmpty()) { this.container .warnUser("No hay Correos Electronicos guardados en el sistema."); } return listaCorreosPersistidos; }
@MemberOrder(sequence = "3") List<Correo> function( final CorreoEmpresa correoEmpresa) { final List<Correo> listaCorreosPersistidos = this.container .allMatches(new QueryDefault<Correo>(Correo.class, STR)); if (listaCorreosPersistidos.isEmpty()) { this.container .warnUser(STR); } return listaCorreosPersistidos; }
/** * Retorna los emails guardados por el usuario registrado. * * @return List<Correo> */
Retorna los emails guardados por el usuario registrado
listarMensajesPersistidos
{ "repo_name": "ProyectoTypes/inventariohardware", "path": "dom/src/main/java/servicio/email/EmailRepositorio.java", "license": "gpl-2.0", "size": 15633 }
[ "java.util.List", "org.apache.isis.applib.annotation.MemberOrder", "org.apache.isis.applib.query.QueryDefault" ]
import java.util.List; import org.apache.isis.applib.annotation.MemberOrder; import org.apache.isis.applib.query.QueryDefault;
import java.util.*; import org.apache.isis.applib.annotation.*; import org.apache.isis.applib.query.*;
[ "java.util", "org.apache.isis" ]
java.util; org.apache.isis;
1,385,778
void retrieveStore(String sellerId, Handler<AsyncResult<Store>> resultHandler);
void retrieveStore(String sellerId, Handler<AsyncResult<Store>> resultHandler);
/** * Retrieve an online store by seller id. * * @param sellerId seller id, refers to an independent online store * @param resultHandler async result handler */
Retrieve an online store by seller id
retrieveStore
{ "repo_name": "sczyh30/vertx-blueprint-microservice", "path": "store-microservice/src/main/java/io/vertx/blueprint/microservice/store/StoreCRUDService.java", "license": "apache-2.0", "size": 1440 }
[ "io.vertx.core.AsyncResult", "io.vertx.core.Handler" ]
import io.vertx.core.AsyncResult; import io.vertx.core.Handler;
import io.vertx.core.*;
[ "io.vertx.core" ]
io.vertx.core;
2,323,490
public void sendLocalConsoleOutput2Main(Vector<String> lines2transfer) throws ServiceException { if (myLogger.isLoggable(Logger.CONFIG)) { myLogger.log(Logger.CONFIG, "Send console output to main slice!"); } String sliceName = null; try { DebugServiceSlice slice = (DebugServiceSlice) this.getSlice(BaseService.MAIN_SLICE); if (slice!=null) { sliceName = slice.getNode().getName(); if (myLogger.isLoggable(Logger.FINER)) { myLogger.log(Logger.FINER, "Try to send console output to " + sliceName); } slice.sendLocalConsoleOutput2Main(localSlice.getNode().getName(), lines2transfer); } } catch(Throwable t) { // NOTE that slices are always retrieved from the main and not from the cache --> No need to retry in case of failure myLogger.log(Logger.WARNING, "Error while trying to send console output to " + sliceName, t); } } // -------------------------------------------------------------- // ---- Inner-Class 'ServiceComponent' ---- Start --------------- // -------------------------------------------------------------- private class ServiceComponent implements Service.Slice { private static final long serialVersionUID = 1776886375724997808L;
void function(Vector<String> lines2transfer) throws ServiceException { if (myLogger.isLoggable(Logger.CONFIG)) { myLogger.log(Logger.CONFIG, STR); } String sliceName = null; try { DebugServiceSlice slice = (DebugServiceSlice) this.getSlice(BaseService.MAIN_SLICE); if (slice!=null) { sliceName = slice.getNode().getName(); if (myLogger.isLoggable(Logger.FINER)) { myLogger.log(Logger.FINER, STR + sliceName); } slice.sendLocalConsoleOutput2Main(localSlice.getNode().getName(), lines2transfer); } } catch(Throwable t) { myLogger.log(Logger.WARNING, STR + sliceName, t); } } private class ServiceComponent implements Service.Slice { private static final long serialVersionUID = 1776886375724997808L;
/** * Sends local console output to the MainContainer. * * @param lines2transfer the lines2transfer * @throws ServiceException the service exception */
Sends local console output to the MainContainer
sendLocalConsoleOutput2Main
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/logging/DebugService.java", "license": "lgpl-2.1", "size": 16272 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
434,891
public TaskHubLicenseDetails updateTaskHubLicenseDetails( final TaskHubLicenseDetails taskHubLicenseDetails, final String hubName) { final UUID locationId = UUID.fromString("f9f0f436-b8a1-4475-9041-1ccdbf8f0128"); //$NON-NLS-1$ final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$ final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put("hubName", hubName); //$NON-NLS-1$ final VssRestRequest httpRequest = super.createRequest(HttpMethod.PUT, locationId, routeValues, apiVersion, taskHubLicenseDetails, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, TaskHubLicenseDetails.class); }
TaskHubLicenseDetails function( final TaskHubLicenseDetails taskHubLicenseDetails, final String hubName) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, hubName); final VssRestRequest httpRequest = super.createRequest(HttpMethod.PUT, locationId, routeValues, apiVersion, taskHubLicenseDetails, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, TaskHubLicenseDetails.class); }
/** * [Preview API 3.1-preview.1] * * @param taskHubLicenseDetails * * @param hubName * * @return TaskHubLicenseDetails */
[Preview API 3.1-preview.1]
updateTaskHubLicenseDetails
{ "repo_name": "Microsoft/vso-httpclient-java", "path": "Rest/alm-distributedtask-client/src/main/generated/com/microsoft/alm/teamfoundation/distributedtask/webapi/TaskAgentHttpClientBase.java", "license": "mit", "size": 129237 }
[ "com.microsoft.alm.client.HttpMethod", "com.microsoft.alm.client.VssMediaTypes", "com.microsoft.alm.client.VssRestRequest", "com.microsoft.alm.teamfoundation.distributedtask.webapi.TaskHubLicenseDetails", "com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion", "java.util.HashMap", "java.util.Map", "java.util.UUID" ]
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.distributedtask.webapi.TaskHubLicenseDetails; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID;
import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.distributedtask.webapi.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
[ "com.microsoft.alm", "java.util" ]
com.microsoft.alm; java.util;
588
@Test public void longShortParityExplicit() { final MultipleCurrencyAmount pvLong = METHOD_HW.presentValue(SWAPTION_LONG_PAYER, HW_MULTICURVES); final MultipleCurrencyAmount pvShort = METHOD_HW.presentValue(SWAPTION_SHORT_PAYER, HW_MULTICURVES); assertEquals("Swaption physical - Hull-White - present value - long/short parity", pvLong.getAmount(EUR), -pvShort.getAmount(EUR), TOLERANCE_PV); }
void function() { final MultipleCurrencyAmount pvLong = METHOD_HW.presentValue(SWAPTION_LONG_PAYER, HW_MULTICURVES); final MultipleCurrencyAmount pvShort = METHOD_HW.presentValue(SWAPTION_SHORT_PAYER, HW_MULTICURVES); assertEquals(STR, pvLong.getAmount(EUR), -pvShort.getAmount(EUR), TOLERANCE_PV); }
/** * Tests long/short parity. */
Tests long/short parity
longShortParityExplicit
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/test/java/com/opengamma/analytics/financial/interestrate/swaption/provider/SwaptionPhysicalFixedIborHullWhiteMethodTest.java", "license": "apache-2.0", "size": 37667 }
[ "com.opengamma.util.money.MultipleCurrencyAmount", "org.testng.AssertJUnit" ]
import com.opengamma.util.money.MultipleCurrencyAmount; import org.testng.AssertJUnit;
import com.opengamma.util.money.*; import org.testng.*;
[ "com.opengamma.util", "org.testng" ]
com.opengamma.util; org.testng;
2,485,650
private static Tie lookupTie (Remote target) { Tie result = (Tie)exportedServants.get(target); if (result == null && target instanceof Tie) { if (exportedServants.contains(target)) { result = (Tie)target; } } return result; }
static Tie function (Remote target) { Tie result = (Tie)exportedServants.get(target); if (result == null && target instanceof Tie) { if (exportedServants.contains(target)) { result = (Tie)target; } } return result; }
/** * An unsynchronized version of getTie() for internal use. */
An unsynchronized version of getTie() for internal use
lookupTie
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java", "license": "gpl-2.0", "size": 29510 }
[ "java.rmi.Remote", "javax.rmi.CORBA" ]
import java.rmi.Remote; import javax.rmi.CORBA;
import java.rmi.*; import javax.rmi.*;
[ "java.rmi", "javax.rmi" ]
java.rmi; javax.rmi;
1,117,326
public ServiceFuture<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath, final ServiceCallback<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> serviceCallback) { return ServiceFuture.fromResponse(beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath), serviceCallback); }
ServiceFuture<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> function(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath, final ServiceCallback<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> serviceCallback) { return ServiceFuture.fromResponse(beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath), serviceCallback); }
/** * Gets the route table summary associated with the express route cross connection in a resource group. * * @param resourceGroupName The name of the resource group. * @param crossConnectionName The name of the ExpressRouteCrossConnection. * @param peeringName The name of the peering. * @param devicePath The path of the device. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets the route table summary associated with the express route cross connection in a resource group
beginListRoutesTableSummaryAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/ExpressRouteCrossConnectionsInner.java", "license": "mit", "size": 100923 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,386,840
public void checkServletType () throws UnavailableException { if (_class==null || !javax.servlet.Servlet.class.isAssignableFrom(_class)) { throw new UnavailableException("Servlet "+_class+" is not a javax.servlet.Servlet"); } }
void function () throws UnavailableException { if (_class==null !javax.servlet.Servlet.class.isAssignableFrom(_class)) { throw new UnavailableException(STR+_class+STR); } }
/** * Check to ensure class of servlet is acceptable. * @throws UnavailableException */
Check to ensure class of servlet is acceptable
checkServletType
{ "repo_name": "wang88/jetty", "path": "jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java", "license": "apache-2.0", "size": 23659 }
[ "javax.servlet.Servlet", "javax.servlet.UnavailableException" ]
import javax.servlet.Servlet; import javax.servlet.UnavailableException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,741,581
protected Credential configureKeyEncryptionCredential(final String peerEntityId, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final SamlRegisteredService service, final BasicEncryptionConfiguration encryptionConfiguration) throws Exception { val mdCredentialResolver = new SamlIdPMetadataCredentialResolver(); val providers = new ArrayList<KeyInfoProvider>(5); providers.add(new RSAKeyValueProvider()); providers.add(new DSAKeyValueProvider()); providers.add(new InlineX509DataProvider()); providers.add(new DEREncodedKeyValueProvider()); providers.add(new KeyInfoReferenceProvider()); val keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(providers); mdCredentialResolver.setKeyInfoCredentialResolver(keyInfoResolver); val roleDescriptorResolver = SamlIdPUtils.getRoleDescriptorResolver(adaptor, samlIdPProperties.getMetadata().isRequireValidMetadata()); mdCredentialResolver.setRoleDescriptorResolver(roleDescriptorResolver); mdCredentialResolver.initialize(); val criteriaSet = new CriteriaSet(); criteriaSet.add(new EncryptionConfigurationCriterion(encryptionConfiguration)); criteriaSet.add(new EntityIdCriterion(peerEntityId)); criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)); criteriaSet.add(new UsageCriterion(UsageType.ENCRYPTION)); criteriaSet.add(new SamlIdPSamlRegisteredServiceCriterion(service)); LOGGER.debug("Attempting to resolve the encryption key for entity id [{}]", peerEntityId); val credential = mdCredentialResolver.resolveSingle(criteriaSet); if (credential == null || credential.getPublicKey() == null) { if (service.isEncryptionOptional()) { LOGGER.warn("Unable to resolve the encryption [public] key for entity id [{}]", peerEntityId); return null; } throw new SamlException("Unable to resolve the encryption [public] key for entity id " + peerEntityId); } val encodedKey = EncodingUtils.encodeBase64(credential.getPublicKey().getEncoded()); LOGGER.debug("Found encryption public key: [{}]", encodedKey); encryptionConfiguration.setKeyTransportEncryptionCredentials(CollectionUtils.wrapList(credential)); return credential; }
Credential function(final String peerEntityId, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final SamlRegisteredService service, final BasicEncryptionConfiguration encryptionConfiguration) throws Exception { val mdCredentialResolver = new SamlIdPMetadataCredentialResolver(); val providers = new ArrayList<KeyInfoProvider>(5); providers.add(new RSAKeyValueProvider()); providers.add(new DSAKeyValueProvider()); providers.add(new InlineX509DataProvider()); providers.add(new DEREncodedKeyValueProvider()); providers.add(new KeyInfoReferenceProvider()); val keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(providers); mdCredentialResolver.setKeyInfoCredentialResolver(keyInfoResolver); val roleDescriptorResolver = SamlIdPUtils.getRoleDescriptorResolver(adaptor, samlIdPProperties.getMetadata().isRequireValidMetadata()); mdCredentialResolver.setRoleDescriptorResolver(roleDescriptorResolver); mdCredentialResolver.initialize(); val criteriaSet = new CriteriaSet(); criteriaSet.add(new EncryptionConfigurationCriterion(encryptionConfiguration)); criteriaSet.add(new EntityIdCriterion(peerEntityId)); criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)); criteriaSet.add(new UsageCriterion(UsageType.ENCRYPTION)); criteriaSet.add(new SamlIdPSamlRegisteredServiceCriterion(service)); LOGGER.debug(STR, peerEntityId); val credential = mdCredentialResolver.resolveSingle(criteriaSet); if (credential == null credential.getPublicKey() == null) { if (service.isEncryptionOptional()) { LOGGER.warn(STR, peerEntityId); return null; } throw new SamlException(STR + peerEntityId); } val encodedKey = EncodingUtils.encodeBase64(credential.getPublicKey().getEncoded()); LOGGER.debug(STR, encodedKey); encryptionConfiguration.setKeyTransportEncryptionCredentials(CollectionUtils.wrapList(credential)); return credential; }
/** * Gets key encryption credential. * * @param peerEntityId the peer entity id * @param adaptor the adaptor * @param service the service * @param encryptionConfiguration the encryption configuration * @return the key encryption credential * @throws Exception the exception */
Gets key encryption credential
configureKeyEncryptionCredential
{ "repo_name": "pdrados/cas", "path": "support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectEncrypter.java", "license": "apache-2.0", "size": 17791 }
[ "java.util.ArrayList", "net.shibboleth.utilities.java.support.resolver.CriteriaSet", "org.apereo.cas.support.saml.SamlException", "org.apereo.cas.support.saml.SamlIdPUtils", "org.apereo.cas.support.saml.idp.metadata.locator.SamlIdPMetadataCredentialResolver", "org.apereo.cas.support.saml.idp.metadata.locator.SamlIdPSamlRegisteredServiceCriterion", "org.apereo.cas.support.saml.services.SamlRegisteredService", "org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade", "org.apereo.cas.util.CollectionUtils", "org.apereo.cas.util.EncodingUtils", "org.opensaml.core.criterion.EntityIdCriterion", "org.opensaml.saml.criterion.EntityRoleCriterion", "org.opensaml.saml.saml2.metadata.SPSSODescriptor", "org.opensaml.security.credential.Credential", "org.opensaml.security.credential.UsageType", "org.opensaml.security.criteria.UsageCriterion", "org.opensaml.xmlsec.criterion.EncryptionConfigurationCriterion", "org.opensaml.xmlsec.impl.BasicEncryptionConfiguration", "org.opensaml.xmlsec.keyinfo.impl.BasicProviderKeyInfoCredentialResolver", "org.opensaml.xmlsec.keyinfo.impl.KeyInfoProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.DEREncodedKeyValueProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.DSAKeyValueProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.InlineX509DataProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.KeyInfoReferenceProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.RSAKeyValueProvider" ]
import java.util.ArrayList; import net.shibboleth.utilities.java.support.resolver.CriteriaSet; import org.apereo.cas.support.saml.SamlException; import org.apereo.cas.support.saml.SamlIdPUtils; import org.apereo.cas.support.saml.idp.metadata.locator.SamlIdPMetadataCredentialResolver; import org.apereo.cas.support.saml.idp.metadata.locator.SamlIdPSamlRegisteredServiceCriterion; import org.apereo.cas.support.saml.services.SamlRegisteredService; import org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade; import org.apereo.cas.util.CollectionUtils; import org.apereo.cas.util.EncodingUtils; import org.opensaml.core.criterion.EntityIdCriterion; import org.opensaml.saml.criterion.EntityRoleCriterion; import org.opensaml.saml.saml2.metadata.SPSSODescriptor; import org.opensaml.security.credential.Credential; import org.opensaml.security.credential.UsageType; import org.opensaml.security.criteria.UsageCriterion; import org.opensaml.xmlsec.criterion.EncryptionConfigurationCriterion; import org.opensaml.xmlsec.impl.BasicEncryptionConfiguration; import org.opensaml.xmlsec.keyinfo.impl.BasicProviderKeyInfoCredentialResolver; import org.opensaml.xmlsec.keyinfo.impl.KeyInfoProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.DEREncodedKeyValueProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.DSAKeyValueProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.InlineX509DataProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.KeyInfoReferenceProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.RSAKeyValueProvider;
import java.util.*; import net.shibboleth.utilities.java.support.resolver.*; import org.apereo.cas.support.saml.*; import org.apereo.cas.support.saml.idp.metadata.locator.*; import org.apereo.cas.support.saml.services.*; import org.apereo.cas.support.saml.services.idp.metadata.*; import org.apereo.cas.util.*; import org.opensaml.core.criterion.*; import org.opensaml.saml.criterion.*; import org.opensaml.saml.saml2.metadata.*; import org.opensaml.security.credential.*; import org.opensaml.security.criteria.*; import org.opensaml.xmlsec.criterion.*; import org.opensaml.xmlsec.impl.*; import org.opensaml.xmlsec.keyinfo.impl.*; import org.opensaml.xmlsec.keyinfo.impl.provider.*;
[ "java.util", "net.shibboleth.utilities", "org.apereo.cas", "org.opensaml.core", "org.opensaml.saml", "org.opensaml.security", "org.opensaml.xmlsec" ]
java.util; net.shibboleth.utilities; org.apereo.cas; org.opensaml.core; org.opensaml.saml; org.opensaml.security; org.opensaml.xmlsec;
2,437,432
public void removeTabToDo(String[] tabTodoId) throws TodoException { SilverTrace.info("todo", "ToDoSessionController.removeTabToDo()", "root.MSG_GEN_ENTER_METHOD"); try { for(String todoId : tabTodoId) { removeToDo(todoId); } SilverTrace.info("todo", "ToDoSessionController.removeTabToDo()", "root.MSG_GEN_EXIT_METHOD"); } catch (Exception e) { throw new TodoException("ToDoSessionController.removeTabToDo()", SilverpeasException.ERROR, "todo.MSG_CANT_REMOVE_TODO", e); } }
void function(String[] tabTodoId) throws TodoException { SilverTrace.info("todo", STR, STR); try { for(String todoId : tabTodoId) { removeToDo(todoId); } SilverTrace.info("todo", STR, STR); } catch (Exception e) { throw new TodoException(STR, SilverpeasException.ERROR, STR, e); } }
/** * Remove all the todo passed in parameter * @param tabTodoId * @throws TodoException * @see */
Remove all the todo passed in parameter
removeTabToDo
{ "repo_name": "CecileBONIN/Silverpeas-Core", "path": "war-core/src/main/java/com/stratelia/webactiv/todo/control/ToDoSessionController.java", "license": "agpl-3.0", "size": 20258 }
[ "com.stratelia.silverpeas.silvertrace.SilverTrace", "com.stratelia.webactiv.util.exception.SilverpeasException" ]
import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.util.exception.SilverpeasException;
import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.util.exception.*;
[ "com.stratelia.silverpeas", "com.stratelia.webactiv" ]
com.stratelia.silverpeas; com.stratelia.webactiv;
915,234
protected KualiRuleService getKualiRuleService() { return kualiRuleService; }
KualiRuleService function() { return kualiRuleService; }
/** * Gets the kualiRuleService attribute. * * @return Returns the kualiRuleService. */
Gets the kualiRuleService attribute
getKualiRuleService
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/batch/service/impl/ProcessFeeTransactionsServiceImpl.java", "license": "apache-2.0", "size": 71214 }
[ "org.kuali.rice.krad.service.KualiRuleService" ]
import org.kuali.rice.krad.service.KualiRuleService;
import org.kuali.rice.krad.service.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,799,480
private void removeAt(int i) { final Object[] es = queue; final int n = size - 1; if (n == i) // removed last element es[i] = null; else { E moved = (E) es[n]; es[n] = null; final Comparator<? super E> cmp; if ((cmp = comparator) == null) siftDownComparable(i, moved, es, n); else siftDownUsingComparator(i, moved, es, n, cmp); if (es[i] == moved) { if (cmp == null) siftUpComparable(i, moved, es); else siftUpUsingComparator(i, moved, es, cmp); } } size = n; }
void function(int i) { final Object[] es = queue; final int n = size - 1; if (n == i) es[i] = null; else { E moved = (E) es[n]; es[n] = null; final Comparator<? super E> cmp; if ((cmp = comparator) == null) siftDownComparable(i, moved, es, n); else siftDownUsingComparator(i, moved, es, n, cmp); if (es[i] == moved) { if (cmp == null) siftUpComparable(i, moved, es); else siftUpUsingComparator(i, moved, es, cmp); } } size = n; }
/** * Removes the ith element from queue. */
Removes the ith element from queue
removeAt
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java", "license": "gpl-2.0", "size": 39104 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
260,965
public void describe(PrintWriter pw, boolean omitDefaults) { final Bean properties = getBean(); final String[] propertyNames = properties.getPropertyNames(); int count = 0; for (String key : propertyNames) { final Object value = bean.get(key); final Object defaultValue = DEFAULT_BEAN.get(key); if (Objects.equals(value, defaultValue)) { continue; } if (count++ > 0) { pw.print(","); } pw.print(key + "=" + value); } }
void function(PrintWriter pw, boolean omitDefaults) { final Bean properties = getBean(); final String[] propertyNames = properties.getPropertyNames(); int count = 0; for (String key : propertyNames) { final Object value = bean.get(key); final Object defaultValue = DEFAULT_BEAN.get(key); if (Objects.equals(value, defaultValue)) { continue; } if (count++ > 0) { pw.print(","); } pw.print(key + "=" + value); } }
/** * Prints the property settings of this pretty-writer to a writer. * * @param pw Writer * @param omitDefaults Whether to omit properties whose value is the same as * the default */
Prints the property settings of this pretty-writer to a writer
describe
{ "repo_name": "minji-kim/calcite", "path": "core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java", "license": "apache-2.0", "size": 32904 }
[ "java.io.PrintWriter", "java.util.Objects" ]
import java.io.PrintWriter; import java.util.Objects;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
853,104
public static String getRetRequiredCheck(String express, Field field) { String code = "if (CodedConstant.isNull(" + express + ")) {\n"; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"));\n"; code += "}\n"; return code; }
static String function(String express, Field field) { String code = STR + express + STR; code += STRSTR\"));\n"; code += "}\n"; return code; }
/** * get return required field check java expression * * @param express java expression * @param field java field * @return full java expression */
get return required field check java expression
getRetRequiredCheck
{ "repo_name": "eonezhang/jprotobuf", "path": "src/main/java/com/baidu/bjf/remoting/protobuf/CodedConstant.java", "license": "apache-2.0", "size": 26988 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,648,161
public void testMethodParameter( @Nullable final Object instance, final Method method, int paramIndex) { method.setAccessible(true); testParameter(instance, invokable(instance, method), paramIndex, method.getDeclaringClass()); }
void function( @Nullable final Object instance, final Method method, int paramIndex) { method.setAccessible(true); testParameter(instance, invokable(instance, method), paramIndex, method.getDeclaringClass()); }
/** * Verifies that {@code method} produces a {@link NullPointerException} or * {@link UnsupportedOperationException} when the parameter in position {@code * paramIndex} is null. If this parameter is marked {@link Nullable}, this * method does nothing. * * @param instance the instance to invoke {@code method} on, or null if * {@code method} is static */
Verifies that method produces a <code>NullPointerException</code> or <code>UnsupportedOperationException</code> when the parameter in position paramIndex is null. If this parameter is marked <code>Nullable</code>, this method does nothing
testMethodParameter
{ "repo_name": "sensui/guava-libraries", "path": "guava-testlib/src/com/google/common/testing/NullPointerTester.java", "license": "apache-2.0", "size": 16346 }
[ "java.lang.reflect.Method", "javax.annotation.Nullable" ]
import java.lang.reflect.Method; import javax.annotation.Nullable;
import java.lang.reflect.*; import javax.annotation.*;
[ "java.lang", "javax.annotation" ]
java.lang; javax.annotation;
1,697,755
public void addFragment(Fragment fragment) { this.fragments.add(fragment); this.notifyDataSetChanged(); }
void function(Fragment fragment) { this.fragments.add(fragment); this.notifyDataSetChanged(); }
/** * add the fragment to the default position.the end of the list. * @param fragment */
add the fragment to the default position.the end of the list
addFragment
{ "repo_name": "yangjun2/android", "path": "changhong/ChanghongSmartHome/src/com/changhong/smarthome/phone/cinema/adapter/FragAdapter.java", "license": "unlicense", "size": 1678 }
[ "android.support.v4.app.Fragment" ]
import android.support.v4.app.Fragment;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
1,018,543
public static <T> ValueBuilder faultBodyAs(Class<T> type) { return Builder.faultBodyAs(type); }
static <T> ValueBuilder function(Class<T> type) { return Builder.faultBodyAs(type); }
/** * 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": "logzio/camel", "path": "camel-core/src/test/java/org/apache/camel/TestSupport.java", "license": "apache-2.0", "size": 18340 }
[ "org.apache.camel.builder.Builder", "org.apache.camel.builder.ValueBuilder" ]
import org.apache.camel.builder.Builder; import org.apache.camel.builder.ValueBuilder;
import org.apache.camel.builder.*;
[ "org.apache.camel" ]
org.apache.camel;
570,284
protected void unregisterBundle(Bundle bundle) { URL mailcap = mailCaps.remove(bundle.getBundleId()); if (mailcap != null ){ log(LogService.LOG_DEBUG, "removing mailcap at " + mailcap); rebuildCommandMap(); } }
void function(Bundle bundle) { URL mailcap = mailCaps.remove(bundle.getBundleId()); if (mailcap != null ){ log(LogService.LOG_DEBUG, STR + mailcap); rebuildCommandMap(); } }
/** * Remove a bundle from our potential mailcap pool. * * @param bundle The potential source bundle. */
Remove a bundle from our potential mailcap pool
unregisterBundle
{ "repo_name": "salyh/javamailspec", "path": "geronimo-activation_1.1_spec/src/main/java/org/apache/geronimo/specs/activation/CommandMapBundleTrackerCustomizer.java", "license": "apache-2.0", "size": 4869 }
[ "org.osgi.framework.Bundle", "org.osgi.service.log.LogService" ]
import org.osgi.framework.Bundle; import org.osgi.service.log.LogService;
import org.osgi.framework.*; import org.osgi.service.log.*;
[ "org.osgi.framework", "org.osgi.service" ]
org.osgi.framework; org.osgi.service;
588,930
private static Map<Integer, List<RichTextElement>> organizeElementsBySection(final List<RichTextElement> elements) { final Map<Integer, List<RichTextElement>> map = new HashMap<Integer, List<RichTextElement>>(); for (final RichTextElement element : elements) { List<RichTextElement> list = map.get(element.getSectionId()); if (list == null) { list = new ArrayList<RichTextElement>(); map.put(element.getSectionId(), list); } list.add(element); } return map; }
static Map<Integer, List<RichTextElement>> function(final List<RichTextElement> elements) { final Map<Integer, List<RichTextElement>> map = new HashMap<Integer, List<RichTextElement>>(); for (final RichTextElement element : elements) { List<RichTextElement> list = map.get(element.getSectionId()); if (list == null) { list = new ArrayList<RichTextElement>(); map.put(element.getSectionId(), list); } list.add(element); } return map; }
/** * Order the rich text elements by section. * * @param elements * Rich text elements. * @return A map containing lists of rich text elements. */
Order the rich text elements by section
organizeElementsBySection
{ "repo_name": "Raphcal/sigmah", "path": "src/main/java/org/sigmah/server/handler/GetProjectReportHandler.java", "license": "gpl-3.0", "size": 8292 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "org.sigmah.server.domain.report.RichTextElement" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.sigmah.server.domain.report.RichTextElement;
import java.util.*; import org.sigmah.server.domain.report.*;
[ "java.util", "org.sigmah.server" ]
java.util; org.sigmah.server;
2,253,094
public void testSendProtectedBroadcasts() { for (String action : BROADCASTS) { try { Intent intent = new Intent(action); getContext().sendBroadcast(intent); fail("expected security exception broadcasting action: " + action); } catch (SecurityException expected) { assertNotNull("security exception's error message.", expected.getMessage()); } } }
void function() { for (String action : BROADCASTS) { try { Intent intent = new Intent(action); getContext().sendBroadcast(intent); fail(STR + action); } catch (SecurityException expected) { assertNotNull(STR, expected.getMessage()); } } }
/** * Verify that protected broadcast actions can't be sent. */
Verify that protected broadcast actions can't be sent
testSendProtectedBroadcasts
{ "repo_name": "wiki2014/Learning-Summary", "path": "alps/cts/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java", "license": "gpl-3.0", "size": 4160 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
2,797,737
// Create a resource set to hold the resources. // ResourceSet resourceSet = new ResourceSetImpl(); // Register the appropriate resource factory to handle all file // extensions. // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); // Register the package to ensure it is available during loading. // resourceSet.getPackageRegistry().put(Wc2014Package.eNS_URI, Wc2014Package.eINSTANCE); // If there are no arguments, emit an appropriate usage message. // if (args.length == 0) { System.out.println("Enter a list of file paths or URIs that have content like this:"); try { Resource resource = resourceSet.createResource(URI.createURI("http:///My.wc2014")); WorldCup root = Wc2014Factory.eINSTANCE.createWorldCup(); resource.getContents().add((EObject) root); resource.save(System.out, null); } catch (IOException exception) { exception.printStackTrace(); } } else { // Iterate over all the arguments. // for (int i = 0; i < args.length; ++i) { // Construct the URI for the instance file. // The argument is treated as a file path only if it denotes an // existing file. // Otherwise, it's directly treated as a URL. // File file = new File(args[i]); URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()) : URI.createURI(args[i]); try { // Demand load resource for this file. // Resource resource = resourceSet.getResource(uri, true); System.out.println("Loaded " + uri); // Validate the contents of the loaded resource. // for (EObject eObject : resource.getContents()) { Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject); if (diagnostic.getSeverity() != Diagnostic.OK) { printDiagnostic(diagnostic, ""); } // ADD BY GGXX try { File writename = new File(".\\output.txt"); writename.createNewFile(); BufferedWriter out = new BufferedWriter(new FileWriter(writename)); if (eObject instanceof WorldCup) { for (EObject obj : eObject.eContents()) { if (obj instanceof Match) { Match match = (Match) obj; String line = match.getId() + "|" + match.getHome().getCountry() + "|" + match.getAway().getCountry() + "|" + match.getMatchDate().getTime() + "|" + match.getStadium(); out.write(line + "\r\n"); } } } out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } // END } } catch (RuntimeException exception) { System.out.println("Problem loading " + uri); exception.printStackTrace(); } } } }
System.out.println(STR); try { Resource resource = resourceSet.createResource(URI.createURI(STRLoaded STRSTR.\\output.txtSTR STR STR STR STR\r\nSTRProblem loading " + uri); exception.printStackTrace(); } } } }
/** * <!-- begin-user-doc --> Load all the argument file paths or URIs as instances of the model. <!-- end-user-doc --> * * @param args * the file paths or URIs. * @generated */
Load all the argument file paths or URIs as instances of the model.
main
{ "repo_name": "ggxx/HelloBrazil", "path": "src/edu.thu.ggxx.hellobrazil.tests/src/edu/thu/ggxx/hellobrazil/wc2014/tests/Wc2014Example.java", "license": "mit", "size": 4529 }
[ "org.eclipse.emf.common.util.URI", "org.eclipse.emf.ecore.resource.Resource" ]
import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.resource.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,152,634
protected void startActivityForResult(Intent intent, int code) { activity.startActivityForResult(intent, code); }
void function(Intent intent, int code) { activity.startActivityForResult(intent, code); }
/** * Start an activity. This method is defined to allow different methods of activity starting for * newer versions of Android and for compatibility library. * * @param intent Intent to start. * @param code Request code for the activity * @see android.app.Activity#startActivityForResult(Intent, int) * @see android.app.Fragment#startActivityForResult(Intent, int) */
Start an activity. This method is defined to allow different methods of activity starting for newer versions of Android and for compatibility library
startActivityForResult
{ "repo_name": "hank/armorycompanion", "path": "src/main/java/org/jointsecurityarea/android/armorycompanion/IntentIntegrator.java", "license": "mit", "size": 16845 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
1,242,284
private FileChannel prepareOutputFileChannel(File target) throws IOException { if (endpoint.getFileExist() == GenericFileExist.Append) { FileChannel out = new RandomAccessFile(target, "rw").getChannel(); return out.position(out.size()); } return new FileOutputStream(target).getChannel(); }
FileChannel function(File target) throws IOException { if (endpoint.getFileExist() == GenericFileExist.Append) { FileChannel out = new RandomAccessFile(target, "rw").getChannel(); return out.position(out.size()); } return new FileOutputStream(target).getChannel(); }
/** * Creates and prepares the output file channel. Will position itself in correct position if the file is writable * eg. it should append or override any existing content. */
Creates and prepares the output file channel. Will position itself in correct position if the file is writable eg. it should append or override any existing content
prepareOutputFileChannel
{ "repo_name": "logzio/camel", "path": "camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java", "license": "apache-2.0", "size": 19250 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.RandomAccessFile", "java.nio.channels.FileChannel" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel;
import java.io.*; import java.nio.channels.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
622,778
@VisibleForTesting public static boolean isSequenceIdFile(final Path file) { return file.getName().endsWith(SEQUENCE_ID_FILE_SUFFIX) || file.getName().endsWith(OLD_SEQUENCE_ID_FILE_SUFFIX); }
static boolean function(final Path file) { return file.getName().endsWith(SEQUENCE_ID_FILE_SUFFIX) file.getName().endsWith(OLD_SEQUENCE_ID_FILE_SUFFIX); }
/** * Is the given file a region open sequence id file. */
Is the given file a region open sequence id file
isSequenceIdFile
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java", "license": "apache-2.0", "size": 84996 }
[ "org.apache.hadoop.fs.Path" ]
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,114,361
private TDataSourceTable getDataSourceTable() { return new TDataSourceTable(dataSource_, initString_); }
TDataSourceTable function() { return new TDataSourceTable(dataSource_, initString_); }
/** * Returns a thrift {@link TDataSourceTable} structure for the data source table. */
Returns a thrift <code>TDataSourceTable</code> structure for the data source table
getDataSourceTable
{ "repo_name": "andybab/Impala", "path": "fe/src/main/java/com/cloudera/impala/catalog/DataSourceTable.java", "license": "apache-2.0", "size": 9015 }
[ "com.cloudera.impala.thrift.TDataSourceTable" ]
import com.cloudera.impala.thrift.TDataSourceTable;
import com.cloudera.impala.thrift.*;
[ "com.cloudera.impala" ]
com.cloudera.impala;
1,050,183
public StateMachine<T> withTransition(T from, T to, T... moreTo) { transitions.put(from, EnumSet.of(to, moreTo)); return this; } /** * Transition to next state * * @throws IllegalStateException if transition is not allowed * @throws NullPointerException if the {@code nextState} is {@code null}
StateMachine<T> function(T from, T to, T... moreTo) { transitions.put(from, EnumSet.of(to, moreTo)); return this; } /** * Transition to next state * * @throws IllegalStateException if transition is not allowed * @throws NullPointerException if the {@code nextState} is {@code null}
/** * Add a valid transition from one state to one or more states **/
Add a valid transition from one state to one or more states
withTransition
{ "repo_name": "emre-aydin/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/internal/util/StateMachine.java", "license": "apache-2.0", "size": 2823 }
[ "java.util.EnumSet" ]
import java.util.EnumSet;
import java.util.*;
[ "java.util" ]
java.util;
1,601,051
LocalFileSystem getLocalFileSystem() throws IOException { return localFs; }
LocalFileSystem getLocalFileSystem() throws IOException { return localFs; }
/** * Get JobTracker's LocalFileSystem handle. This is used by jobs for * localizing job files to the local disk. */
Get JobTracker's LocalFileSystem handle. This is used by jobs for localizing job files to the local disk
getLocalFileSystem
{ "repo_name": "williamsentosa/hadoop-modified", "path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java", "license": "apache-2.0", "size": 192030 }
[ "java.io.IOException", "org.apache.hadoop.fs.LocalFileSystem" ]
import java.io.IOException; import org.apache.hadoop.fs.LocalFileSystem;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
9,997
setMinimumSize(new Dimension(460, 235)); setModalityType(ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setTitle(I18n.get("DownloadMainFilesTitle")); { // ContentPane getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new TitledBorder(null, I18n .get("DownloadMainFilesOptions"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gblContentPanel = new GridBagLayout(); gblContentPanel.columnWidths = new int[] { 20, 130 }; gblContentPanel.rowHeights = new int[] { 40, 40, 40 }; gblContentPanel.columnWeights = new double[] { 0.0, 1.0 }; gblContentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0 }; contentPanel.setLayout(gblContentPanel); { // Second row chckOwCond = new JCheckBox( I18n.get("DownloadMainFilesConditions")); GridBagConstraints gbcChckOwCond = new GridBagConstraints(); gbcChckOwCond.anchor = GridBagConstraints.WEST; gbcChckOwCond.insets = new Insets(0, 0, 5, 5); gbcChckOwCond.gridx = 0; gbcChckOwCond.gridy = 0; contentPanel.add(chckOwCond, gbcChckOwCond);
setMinimumSize(new Dimension(460, 235)); setModalityType(ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setTitle(I18n.get(STR)); { getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new TitledBorder(null, I18n .get(STR), TitledBorder.LEADING, TitledBorder.TOP, null, null)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gblContentPanel = new GridBagLayout(); gblContentPanel.columnWidths = new int[] { 20, 130 }; gblContentPanel.rowHeights = new int[] { 40, 40, 40 }; gblContentPanel.columnWeights = new double[] { 0.0, 1.0 }; gblContentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0 }; contentPanel.setLayout(gblContentPanel); { chckOwCond = new JCheckBox( I18n.get(STR)); GridBagConstraints gbcChckOwCond = new GridBagConstraints(); gbcChckOwCond.anchor = GridBagConstraints.WEST; gbcChckOwCond.insets = new Insets(0, 0, 5, 5); gbcChckOwCond.gridx = 0; gbcChckOwCond.gridy = 0; contentPanel.add(chckOwCond, gbcChckOwCond);
/** * Initializes the dialog. */
Initializes the dialog
init
{ "repo_name": "sing-group/BEW", "path": "plugins_src/bew/es/uvigo/ei/sing/bew/view/dialogs/UpdateMetadataDialog.java", "license": "gpl-3.0", "size": 6927 }
[ "es.uvigo.ei.sing.bew.constants.I18n", "java.awt.BorderLayout", "java.awt.Dimension", "java.awt.GridBagConstraints", "java.awt.GridBagLayout", "java.awt.Insets", "javax.swing.JCheckBox", "javax.swing.JDialog", "javax.swing.border.TitledBorder" ]
import es.uvigo.ei.sing.bew.constants.I18n; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.border.TitledBorder;
import es.uvigo.ei.sing.bew.constants.*; import java.awt.*; import javax.swing.*; import javax.swing.border.*;
[ "es.uvigo.ei", "java.awt", "javax.swing" ]
es.uvigo.ei; java.awt; javax.swing;
2,376,101
private static MethodDescription getExtraContextFactoryMethodDescription( String methodName, Class<?>... parameterTypes) { try { return new MethodDescription.ForLoadedMethod( DoFnInvoker.ArgumentProvider.class.getMethod(methodName, parameterTypes)); } catch (Exception e) { throw new IllegalStateException( String.format( "Failed to locate required method %s.%s", DoFnInvoker.ArgumentProvider.class.getSimpleName(), methodName), e); } }
static MethodDescription function( String methodName, Class<?>... parameterTypes) { try { return new MethodDescription.ForLoadedMethod( DoFnInvoker.ArgumentProvider.class.getMethod(methodName, parameterTypes)); } catch (Exception e) { throw new IllegalStateException( String.format( STR, DoFnInvoker.ArgumentProvider.class.getSimpleName(), methodName), e); } }
/** * This wrapper exists to convert checked exceptions to unchecked exceptions, since if this fails * the library itself is malformed. */
This wrapper exists to convert checked exceptions to unchecked exceptions, since if this fails the library itself is malformed
getExtraContextFactoryMethodDescription
{ "repo_name": "vikkyrk/incubator-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java", "license": "apache-2.0", "size": 36345 }
[ "net.bytebuddy.description.method.MethodDescription" ]
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.method.*;
[ "net.bytebuddy.description" ]
net.bytebuddy.description;
831,560
public static String toString(URL url, Charset charset) throws IOException { return asCharSource(url, charset).read(); }
static String function(URL url, Charset charset) throws IOException { return asCharSource(url, charset).read(); }
/** * Reads all characters from a URL into a {@link String}, using the given character set. * * @param url the URL to read from * @param charset the charset used to decode the input stream; see {@link Charsets} for helpful * predefined constants * @return a string containing all the characters from the URL * @throws IOException if an I/O error occurs. */
Reads all characters from a URL into a <code>String</code>, using the given character set
toString
{ "repo_name": "simonzhangsm/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/io/Resources.java", "license": "agpl-3.0", "size": 7573 }
[ "java.io.IOException", "java.nio.charset.Charset" ]
import java.io.IOException; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
432,007
public synchronized GCJournalEntry read() { if (latest == null) { List<String> all = readLines(); if (all.isEmpty()) { latest = GCJournalEntry.EMPTY; } else { String info = all.get(all.size() - 1); latest = GCJournalEntry.fromString(info); } } return latest; }
synchronized GCJournalEntry function() { if (latest == null) { List<String> all = readLines(); if (all.isEmpty()) { latest = GCJournalEntry.EMPTY; } else { String info = all.get(all.size() - 1); latest = GCJournalEntry.fromString(info); } } return latest; }
/** * Returns the latest entry available */
Returns the latest entry available
read
{ "repo_name": "yesil/jackrabbit-oak", "path": "oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCJournal.java", "license": "apache-2.0", "size": 8308 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,952,747
public Elements getElementsByAttributeValueNot(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValueNot(key, value), this); }
Elements function(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValueNot(key, value), this); }
/** * Find elements that either do not have this attribute, or have it with a different value. Case insensitive. * * @param key name of the attribute * @param value value of the attribute * @return elements that do not have a matching attribute */
Find elements that either do not have this attribute, or have it with a different value. Case insensitive
getElementsByAttributeValueNot
{ "repo_name": "SpoonLabs/astor", "path": "examples/librepair-experiments-jhy-jsoup-285353482-20171009-062400_bugonly_with_package_info/src/main/java/org/jsoup/nodes/Element.java", "license": "gpl-2.0", "size": 50843 }
[ "org.jsoup.select.Collector", "org.jsoup.select.Elements", "org.jsoup.select.Evaluator" ]
import org.jsoup.select.Collector; import org.jsoup.select.Elements; import org.jsoup.select.Evaluator;
import org.jsoup.select.*;
[ "org.jsoup.select" ]
org.jsoup.select;
1,260,945
Map<String, String> getAppStringMap(String language);
Map<String, String> getAppStringMap(String language);
/** * Get all defined Strings from an app for the specified language. * * @param language strings language code * @return a map with localized strings defined in the app */
Get all defined Strings from an app for the specified language
getAppStringMap
{ "repo_name": "JoeUtt/menggeqa", "path": "src/main/java/com/mengge/HasAppStrings.java", "license": "apache-2.0", "size": 1565 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,465,560
public CallHandle createMovie(SecurityContext ctx, long imageID, long pixelsID, List<Integer> channels, MovieExportParam param, AgentEventListener observer);
CallHandle function(SecurityContext ctx, long imageID, long pixelsID, List<Integer> channels, MovieExportParam param, AgentEventListener observer);
/** * Creates a movie. * * @param ctx The security context. * @param imageID The id of the image. * @param pixelsID The id of the pixels set. * @param channels The channels to map. * @param param The parameters to create the movie. * @param observer Call-back handler. * @return See above. */
Creates a movie
createMovie
{ "repo_name": "mtbc/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/views/ImageDataView.java", "license": "gpl-2.0", "size": 17217 }
[ "java.util.List", "org.openmicroscopy.shoola.env.data.model.MovieExportParam", "org.openmicroscopy.shoola.env.data.util.SecurityContext", "org.openmicroscopy.shoola.env.event.AgentEventListener" ]
import java.util.List; import org.openmicroscopy.shoola.env.data.model.MovieExportParam; import org.openmicroscopy.shoola.env.data.util.SecurityContext; import org.openmicroscopy.shoola.env.event.AgentEventListener;
import java.util.*; import org.openmicroscopy.shoola.env.data.model.*; import org.openmicroscopy.shoola.env.data.util.*; import org.openmicroscopy.shoola.env.event.*;
[ "java.util", "org.openmicroscopy.shoola" ]
java.util; org.openmicroscopy.shoola;
1,575,218
public TNotifyTrigger copy() throws TorqueException { return copy(true); }
TNotifyTrigger function() throws TorqueException { return copy(true); }
/** * Makes a copy of this object. * It creates a new object filling in the simple attributes. * It then fills all the association collections and sets the * related objects to isNew=true. */
Makes a copy of this object. It creates a new object filling in the simple attributes. It then fills all the association collections and sets the related objects to isNew=true
copy
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTNotifyTrigger.java", "license": "gpl-3.0", "size": 52299 }
[ "org.apache.torque.TorqueException" ]
import org.apache.torque.TorqueException;
import org.apache.torque.*;
[ "org.apache.torque" ]
org.apache.torque;
2,764,719