method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private Object[] getDefaults(LookAndFeelAddons addon) { List<Object> defaults = new ArrayList<Object>(); if (isWindows(addon)) { addWindowsDefaults(addon, defaults); } else if (isMetal(addon)) { addMetalDefaults(addon, defaults); } else if (isMac(addon)) { addMacDefaults(addon, defaults); } else if (isMotif(addon)) { addMotifDefaults(addon, defaults); } else { // at least add basic defaults addBasicDefaults(addon, defaults); } return defaults.toArray(); } // // Helper methods to make ComponentAddon developer life easier //
Object[] function(LookAndFeelAddons addon) { List<Object> defaults = new ArrayList<Object>(); if (isWindows(addon)) { addWindowsDefaults(addon, defaults); } else if (isMetal(addon)) { addMetalDefaults(addon, defaults); } else if (isMac(addon)) { addMacDefaults(addon, defaults); } else if (isMotif(addon)) { addMotifDefaults(addon, defaults); } else { addBasicDefaults(addon, defaults); } return defaults.toArray(); } //
/** * Gets the defaults for the given addon. * * Based on the addon, it calls * {@link #addMacDefaults(LookAndFeelAddons, List)} if isMac() * or * {@link #addMetalDefaults(LookAndFeelAddons, List)} if isMetal() * or * {@link #addMotifDefaults(LookAndFeelAddons, List)} if isMotif() * or * {@link #addWindowsDefaults(LookAndFeelAddons, List)} if isWindows() * or * {@link #addBasicDefaults(LookAndFeelAddons, List)} if none of the above was called. * @param addon * @return an array of key/value pairs. For example: * <pre> * Object[] uiDefaults = { * "Font", new Font("Dialog", Font.BOLD, 12), * "Color", Color.red, * "five", new Integer(5) * }; * </pre> */
Gets the defaults for the given addon. Based on the addon, it calls <code>#addMacDefaults(LookAndFeelAddons, List)</code> if isMac() or <code>#addMetalDefaults(LookAndFeelAddons, List)</code> if isMetal() or <code>#addMotifDefaults(LookAndFeelAddons, List)</code> if isMotif() or <code>#addWindowsDefaults(LookAndFeelAddons, List)</code> if isWindows() or <code>#addBasicDefaults(LookAndFeelAddons, List)</code> if none of the above was called
getDefaults
{ "repo_name": "charlycoste/TreeD", "path": "src/org/jdesktop/swingx/plaf/AbstractComponentAddon.java", "license": "gpl-2.0", "size": 6215 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
169,121
void enterBuiltin_prev(@NotNull EsperEPL2GrammarParser.Builtin_prevContext ctx); void exitBuiltin_prev(@NotNull EsperEPL2GrammarParser.Builtin_prevContext ctx);
void enterBuiltin_prev(@NotNull EsperEPL2GrammarParser.Builtin_prevContext ctx); void exitBuiltin_prev(@NotNull EsperEPL2GrammarParser.Builtin_prevContext ctx);
/** * Exit a parse tree produced by {@link EsperEPL2GrammarParser#builtin_prev}. * @param ctx the parse tree */
Exit a parse tree produced by <code>EsperEPL2GrammarParser#builtin_prev</code>
exitBuiltin_prev
{ "repo_name": "georgenicoll/esper", "path": "esper/src/main/java/com/espertech/esper/epl/generated/EsperEPL2GrammarListener.java", "license": "gpl-2.0", "size": 114105 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,637,110
public List<Integer> getSubCategory(String email) { TypedQuery<Integer> query = em.createQuery( "SELECT p.id.subCategoryId FROM Userpreference p WHERE p.user.emailId = :email", Integer.class); List<Integer> results = query.setParameter("email", email).getResultList(); em.close(); return results; }
List<Integer> function(String email) { TypedQuery<Integer> query = em.createQuery( STR, Integer.class); List<Integer> results = query.setParameter("email", email).getResultList(); em.close(); return results; }
/** * List user preferences * @param email * @return */
List user preferences
getSubCategory
{ "repo_name": "yumminhuang/WHAM", "path": "src/main/java/wham/operation/PreferenceOperation.java", "license": "mit", "size": 1991 }
[ "java.util.List", "javax.persistence.TypedQuery" ]
import java.util.List; import javax.persistence.TypedQuery;
import java.util.*; import javax.persistence.*;
[ "java.util", "javax.persistence" ]
java.util; javax.persistence;
1,782,592
public static VuforiaFrameGrabberInit init(String licenseKey, @IdRes int cameraMonitorViewIdParent, int widthRequest, int heightRequest) { //display the camera on the screen Parameters params = new Parameters(cameraMonitorViewIdParent); //do not display the camera on the screen // VuforiaLocalizer.Parameters params = new VuforiaLocalizer.Parameters(); params.cameraDirection = CameraDirection.BACK; params.vuforiaLicenseKey = licenseKey; params.cameraMonitorFeedback = Parameters.CameraMonitorFeedback.AXES; //create a new VuforiaFrameGrabberInit object (this takes a few seconds) VuforiaFrameGrabberInit vuforia = new VuforiaFrameGrabberInit(params, widthRequest, heightRequest); //there are 4 beacons, so set the max image targets to 4 Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4); return vuforia; } private final FrameGrabber.CameraOrientation cameraOrientation; private final boolean ignoreOrientationForDisplay; public VuforiaFrameGrabberInit(Parameters params, int widthRequest, int heightRequest) { this(params, widthRequest, heightRequest, FrameGrabber.CameraOrientation.PORTRAIT_UP, false); } public VuforiaFrameGrabberInit(Parameters params, FrameGrabber.CameraOrientation cameraOrientation, int widthRequest, int heightRequest) { this(params, widthRequest, heightRequest, cameraOrientation, false); } public VuforiaFrameGrabberInit(Parameters params, boolean ignoreOrientationForDisplay, int heightRequest, int widthRequest) { this(params, widthRequest, heightRequest, FrameGrabber.CameraOrientation.PORTRAIT_UP, ignoreOrientationForDisplay); } class CloseableFrame extends Frame { public CloseableFrame(Frame other) { // clone the frame so we can be useful beyond callback super(other); }
static VuforiaFrameGrabberInit function(String licenseKey, @IdRes int cameraMonitorViewIdParent, int widthRequest, int heightRequest) { Parameters params = new Parameters(cameraMonitorViewIdParent); params.cameraDirection = CameraDirection.BACK; params.vuforiaLicenseKey = licenseKey; params.cameraMonitorFeedback = Parameters.CameraMonitorFeedback.AXES; VuforiaFrameGrabberInit vuforia = new VuforiaFrameGrabberInit(params, widthRequest, heightRequest); Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4); return vuforia; } private final FrameGrabber.CameraOrientation cameraOrientation; private final boolean ignoreOrientationForDisplay; public VuforiaFrameGrabberInit(Parameters params, int widthRequest, int heightRequest) { this(params, widthRequest, heightRequest, FrameGrabber.CameraOrientation.PORTRAIT_UP, false); } public VuforiaFrameGrabberInit(Parameters params, FrameGrabber.CameraOrientation cameraOrientation, int widthRequest, int heightRequest) { this(params, widthRequest, heightRequest, cameraOrientation, false); } public VuforiaFrameGrabberInit(Parameters params, boolean ignoreOrientationForDisplay, int heightRequest, int widthRequest) { this(params, widthRequest, heightRequest, FrameGrabber.CameraOrientation.PORTRAIT_UP, ignoreOrientationForDisplay); } class CloseableFrame extends Frame { public CloseableFrame(Frame other) { super(other); }
/** * Initialize vuforia * This method takes a few seconds to complete * * @param licenseKey the Vuforia PTC licence key from https://developer.vuforia.com/license-manager * @param cameraMonitorViewIdParent the place in the layout where the camera display is * @param widthRequest the width to scale the image to for the FrameGrabber * @param heightRequest the height to scale the image to for the FrameGrabber * @return the VuforiaFrameGrabberInit object */
Initialize vuforia This method takes a few seconds to complete
init
{ "repo_name": "FTC7393/EVLib", "path": "EVLib/src/main/java/ftc/evlib/vision/framegrabber/VuforiaFrameGrabberInit.java", "license": "mit", "size": 12931 }
[ "android.support.annotation.IdRes", "com.vuforia.Frame", "com.vuforia.Vuforia" ]
import android.support.annotation.IdRes; import com.vuforia.Frame; import com.vuforia.Vuforia;
import android.support.annotation.*; import com.vuforia.*;
[ "android.support", "com.vuforia" ]
android.support; com.vuforia;
2,630,695
private static void loadMission(EventData eventData, Class<?> clz) { try { unloadMission(eventData); eventData.setMission(clz); ((Mission) clz.newInstance()).create(eventData); MissionDescription missionDescription = MissionFunctions.getDescriptionForMission(clz); if (missionDescription != null) { for (Player player : EventFunctions.getAllPlayers(eventData)) { player.sendMessage(localizedStringSet.format(player, "Event.Class.Missions.Create.CreatedMessage", MissionFunctions.getName(player, missionDescription.name()))); } } } catch (InstantiationException | IllegalAccessException e) { System.out.println(e); e.printStackTrace(); } }
static void function(EventData eventData, Class<?> clz) { try { unloadMission(eventData); eventData.setMission(clz); ((Mission) clz.newInstance()).create(eventData); MissionDescription missionDescription = MissionFunctions.getDescriptionForMission(clz); if (missionDescription != null) { for (Player player : EventFunctions.getAllPlayers(eventData)) { player.sendMessage(localizedStringSet.format(player, STR, MissionFunctions.getName(player, missionDescription.name()))); } } } catch (InstantiationException IllegalAccessException e) { System.out.println(e); e.printStackTrace(); } }
/** * load a mission * @param eventData the event * @param clz the class of mission */
load a mission
loadMission
{ "repo_name": "Alf21/event-system", "path": "src/main/java/me/alf21/events/MissionBase.java", "license": "gpl-3.0", "size": 14391 }
[ "me.alf21.events.mission.util.Mission", "me.alf21.events.mission.util.MissionDescription", "me.alf21.events.mission.util.MissionFunctions", "me.alf21.eventsystem.EventData", "me.alf21.eventsystem.EventFunctions", "net.gtaun.shoebill.object.Player" ]
import me.alf21.events.mission.util.Mission; import me.alf21.events.mission.util.MissionDescription; import me.alf21.events.mission.util.MissionFunctions; import me.alf21.eventsystem.EventData; import me.alf21.eventsystem.EventFunctions; import net.gtaun.shoebill.object.Player;
import me.alf21.events.mission.util.*; import me.alf21.eventsystem.*; import net.gtaun.shoebill.object.*;
[ "me.alf21.events", "me.alf21.eventsystem", "net.gtaun.shoebill" ]
me.alf21.events; me.alf21.eventsystem; net.gtaun.shoebill;
1,764,604
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.aws.ec2.edit/src-gen/org/eclipse/cmf/occi/multicloud/aws/ec2/provider/M2_2xlargeItemProvider.java", "license": "epl-1.0", "size": 7018 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,898,794
Integer save(TDashboardParameterBean dashboardParameterBean);
Integer save(TDashboardParameterBean dashboardParameterBean);
/** * Save parameter in the TDashboardParameter table * @param dashboardParameterBean * @return */
Save parameter in the TDashboardParameter table
save
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/dao/DashboardParameterDAO.java", "license": "gpl-3.0", "size": 1443 }
[ "com.aurel.track.beans.TDashboardParameterBean" ]
import com.aurel.track.beans.TDashboardParameterBean;
import com.aurel.track.beans.*;
[ "com.aurel.track" ]
com.aurel.track;
2,110,473
@VisibleForTesting void cleanUpSession(final CustomTabsSessionToken session) { PostTask.runOrPostTask( UiThreadTaskTraits.DEFAULT, () -> mClientManager.cleanupSession(session)); }
void cleanUpSession(final CustomTabsSessionToken session) { PostTask.runOrPostTask( UiThreadTaskTraits.DEFAULT, () -> mClientManager.cleanupSession(session)); }
/** * Handle any clean up left after a session is destroyed. * @param session The session that has been destroyed. */
Handle any clean up left after a session is destroyed
cleanUpSession
{ "repo_name": "scheib/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java", "license": "bsd-3-clause", "size": 70775 }
[ "androidx.browser.customtabs.CustomTabsSessionToken", "org.chromium.base.task.PostTask", "org.chromium.content_public.browser.UiThreadTaskTraits" ]
import androidx.browser.customtabs.CustomTabsSessionToken; import org.chromium.base.task.PostTask; import org.chromium.content_public.browser.UiThreadTaskTraits;
import androidx.browser.customtabs.*; import org.chromium.base.task.*; import org.chromium.content_public.browser.*;
[ "androidx.browser", "org.chromium.base", "org.chromium.content_public" ]
androidx.browser; org.chromium.base; org.chromium.content_public;
828,291
public void test_graphContexts_constants_legal() throws MalformedQueryException { final String queryStr = ""// + "PREFIX : <http://example.org/>\n"// + "SELECT ?s\n"// + "WHERE {\n"// + " GRAPH :foo {\n"// + " ?s :p :o .\n"// + " GRAPH :foo { ?o :p2 ?s }\n"// + " }\n"// + "}"; final ASTContainer astContainer = new Bigdata2ASTSPARQLParser() .parseQuery2(queryStr, baseURI); final AST2BOpContext context = new AST2BOpContext(astContainer, store); new ASTGraphGroupOptimizer().optimize(context, new QueryNodeWithBindingSet(astContainer.getOriginalAST(), null)); }
void function() throws MalformedQueryException { final String queryStr = STRPREFIX : <http: + STR + STR + STR + STR + STR + STR + "}"; final ASTContainer astContainer = new Bigdata2ASTSPARQLParser() .parseQuery2(queryStr, baseURI); final AST2BOpContext context = new AST2BOpContext(astContainer, store); new ASTGraphGroupOptimizer().optimize(context, new QueryNodeWithBindingSet(astContainer.getOriginalAST(), null)); }
/** * A unit test where two nested graph groups have the same URI as their * context. This case is legal and there is nothing that needs to be changed * in the AST for enforce the graph context constraint. * * @throws MalformedQueryException */
A unit test where two nested graph groups have the same URI as their context. This case is legal and there is nothing that needs to be changed in the AST for enforce the graph context constraint
test_graphContexts_constants_legal
{ "repo_name": "blazegraph/database", "path": "bigdata-rdf-test/src/test/java/com/bigdata/rdf/sparql/ast/optimizers/TestASTGraphGroupOptimizer.java", "license": "gpl-2.0", "size": 38566 }
[ "com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser", "com.bigdata.rdf.sparql.ast.ASTContainer", "com.bigdata.rdf.sparql.ast.QueryNodeWithBindingSet", "com.bigdata.rdf.sparql.ast.eval.AST2BOpContext", "org.openrdf.query.MalformedQueryException" ]
import com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser; import com.bigdata.rdf.sparql.ast.ASTContainer; import com.bigdata.rdf.sparql.ast.QueryNodeWithBindingSet; import com.bigdata.rdf.sparql.ast.eval.AST2BOpContext; import org.openrdf.query.MalformedQueryException;
import com.bigdata.rdf.sail.sparql.*; import com.bigdata.rdf.sparql.ast.*; import com.bigdata.rdf.sparql.ast.eval.*; import org.openrdf.query.*;
[ "com.bigdata.rdf", "org.openrdf.query" ]
com.bigdata.rdf; org.openrdf.query;
1,382,453
public SplitBookDataDisplay getPassagePane() { return pnlPassg; }
SplitBookDataDisplay function() { return pnlPassg; }
/** * Accessor for the SplitBookDataDisplay */
Accessor for the SplitBookDataDisplay
getPassagePane
{ "repo_name": "truhanen/JSana", "path": "JSana/src_others/org/crosswire/bibledesktop/book/BibleViewPane.java", "license": "gpl-2.0", "size": 12958 }
[ "org.crosswire.bibledesktop.display.basic.SplitBookDataDisplay" ]
import org.crosswire.bibledesktop.display.basic.SplitBookDataDisplay;
import org.crosswire.bibledesktop.display.basic.*;
[ "org.crosswire.bibledesktop" ]
org.crosswire.bibledesktop;
2,090,257
TableUpdateResponse updateSearchStatus(UserInfo userInfo, TableSearchChangeRequest change, TableTransactionContext txContext) { boolean statusChanged = updateSearchStatus(userInfo, change.getEntityId(), change.getSearchEnabled(), txContext); if (statusChanged) { // Make sure to align the searchEnabled property in the node representing the table Node tableNode = nodeManager.getNode(userInfo, change.getEntityId()); tableNode.setIsSearchEnabled(change.getSearchEnabled()); nodeManager.update(userInfo, tableNode, null, false); } return new TableSearchChangeResponse().setSearchEnabled(change.getSearchEnabled()); }
TableUpdateResponse updateSearchStatus(UserInfo userInfo, TableSearchChangeRequest change, TableTransactionContext txContext) { boolean statusChanged = updateSearchStatus(userInfo, change.getEntityId(), change.getSearchEnabled(), txContext); if (statusChanged) { Node tableNode = nodeManager.getNode(userInfo, change.getEntityId()); tableNode.setIsSearchEnabled(change.getSearchEnabled()); nodeManager.update(userInfo, tableNode, null, false); } return new TableSearchChangeResponse().setSearchEnabled(change.getSearchEnabled()); }
/** * Updates the search status of a table through a search change request, makes sure to also update the table entity property * * @param callback * @param userInfo * @param change * @param transactionId * @return */
Updates the search status of a table through a search change request, makes sure to also update the table entity property
updateSearchStatus
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/table/TableEntityManagerImpl.java", "license": "apache-2.0", "size": 41780 }
[ "org.sagebionetworks.repo.model.Node", "org.sagebionetworks.repo.model.UserInfo", "org.sagebionetworks.repo.model.table.TableSearchChangeRequest", "org.sagebionetworks.repo.model.table.TableSearchChangeResponse", "org.sagebionetworks.repo.model.table.TableUpdateResponse" ]
import org.sagebionetworks.repo.model.Node; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.model.table.TableSearchChangeRequest; import org.sagebionetworks.repo.model.table.TableSearchChangeResponse; import org.sagebionetworks.repo.model.table.TableUpdateResponse;
import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.table.*;
[ "org.sagebionetworks.repo" ]
org.sagebionetworks.repo;
836,667
public List<MeasureSteward> getAllStewardList() { return allStewardList; }
List<MeasureSteward> function() { return allStewardList; }
/** * Gets the all steward list. * * @return the all steward list */
Gets the all steward list
getAllStewardList
{ "repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint", "path": "mat/src/mat/client/clause/clauseworkspace/model/MeasureDetailResult.java", "license": "apache-2.0", "size": 2082 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,179,495
private long truncateFile(String srcURLstr, long size) throws FileNotFoundException, IOException, NoModificationAllowedException { try { LocalFilesystemURL inputURL = LocalFilesystemURL.parse(srcURLstr); Filesystem fs = this.filesystemForURL(inputURL); if (fs == null) { throw new MalformedURLException("No installed handlers for this URL"); } return fs.truncateFileAtURL(inputURL, size); } catch (IllegalArgumentException e) { throw new MalformedURLException("Unrecognized filesystem URL"); } }
long function(String srcURLstr, long size) throws FileNotFoundException, IOException, NoModificationAllowedException { try { LocalFilesystemURL inputURL = LocalFilesystemURL.parse(srcURLstr); Filesystem fs = this.filesystemForURL(inputURL); if (fs == null) { throw new MalformedURLException(STR); } return fs.truncateFileAtURL(inputURL, size); } catch (IllegalArgumentException e) { throw new MalformedURLException(STR); } }
/** * Truncate the file to size */
Truncate the file to size
truncateFile
{ "repo_name": "WisapeAgency/WisapeAndroid", "path": "app/src/main/java/com/wisape/android/cordova/FileUtils.java", "license": "apache-2.0", "size": 46110 }
[ "java.io.FileNotFoundException", "java.io.IOException", "java.net.MalformedURLException" ]
import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
1,082,612
public GQuery keydown(Function... f) { return bindOrFire(Event.ONKEYDOWN, null, f); }
GQuery function(Function... f) { return bindOrFire(Event.ONKEYDOWN, null, f); }
/** * Bind a set of functions to the keydown event of each matched element. Or trigger the event if * no functions are provided. */
Bind a set of functions to the keydown event of each matched element. Or trigger the event if no functions are provided
keydown
{ "repo_name": "stori-es/stori_es", "path": "dashboard/src/main/java/com/google/gwt/query/client/GQuery.java", "license": "apache-2.0", "size": 177285 }
[ "com.google.gwt.user.client.Event" ]
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,364,303
private boolean addLinkToStructure(Map<NodePortTuple, Set<Link>> s, Link l) { boolean result1 = false, result2 = false; NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort()); NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort()); if (s.get(n1) == null) { s.put(n1, new HashSet<Link>()); } if (s.get(n2) == null) { s.put(n2, new HashSet<Link>()); } result1 = s.get(n1).add(l); result2 = s.get(n2).add(l); return (result1 || result2); }
boolean function(Map<NodePortTuple, Set<Link>> s, Link l) { boolean result1 = false, result2 = false; NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort()); NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort()); if (s.get(n1) == null) { s.put(n1, new HashSet<Link>()); } if (s.get(n2) == null) { s.put(n2, new HashSet<Link>()); } result1 = s.get(n1).add(l); result2 = s.get(n2).add(l); return (result1 result2); }
/** * Add the given link to the data structure. Returns true if a link was * added. * @param s * @param l * @return */
Add the given link to the data structure. Returns true if a link was added
addLinkToStructure
{ "repo_name": "jmiserez/floodlight", "path": "src/main/java/net/floodlightcontroller/topology/TopologyManager.java", "license": "apache-2.0", "size": 56464 }
[ "java.util.HashSet", "java.util.Map", "java.util.Set", "net.floodlightcontroller.routing.Link" ]
import java.util.HashSet; import java.util.Map; import java.util.Set; import net.floodlightcontroller.routing.Link;
import java.util.*; import net.floodlightcontroller.routing.*;
[ "java.util", "net.floodlightcontroller.routing" ]
java.util; net.floodlightcontroller.routing;
1,053,147
public void testCompareToDiffSigns2() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; int aSign = -1; int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); assertEquals(-1, aNumber.compareTo(bNumber)); }
void function() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; int aSign = -1; int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); assertEquals(-1, aNumber.compareTo(bNumber)); }
/** * compareTo(BigInteger a). Compare two numbers of different signs. The first * is negative. */
compareTo(BigInteger a). Compare two numbers of different signs. The first is negative
testCompareToDiffSigns2
{ "repo_name": "google/j2cl", "path": "jre/javatests/com/google/gwt/emultest/java/math/BigIntegerCompareTest.java", "license": "apache-2.0", "size": 18108 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
251,476
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(Jenkins.ADMINISTER); description = req.getParameter("description"); save(); rsp.sendRedirect("."); // go to the top page }
synchronized void function( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(Jenkins.ADMINISTER); description = req.getParameter(STR); save(); rsp.sendRedirect("."); }
/** * Accepts the new description. */
Accepts the new description
doSubmitDescription
{ "repo_name": "ydubreuil/jenkins", "path": "core/src/main/java/hudson/model/User.java", "license": "mit", "size": 41745 }
[ "java.io.IOException", "javax.servlet.ServletException", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*;
[ "java.io", "javax.servlet", "org.kohsuke.stapler" ]
java.io; javax.servlet; org.kohsuke.stapler;
1,655,544
protected void addSourceXMLPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EnrichMediator_sourceXML_feature"), getString("_UI_PropertyDescriptor_description", "_UI_EnrichMediator_sourceXML_feature", "_UI_EnrichMediator_type"), EsbPackage.Literals.ENRICH_MEDIATOR__SOURCE_XML, true, true, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, "Source", null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.ENRICH_MEDIATOR__SOURCE_XML, true, true, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, STR, null)); }
/** * This adds a property descriptor for the Source XML feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */
This adds a property descriptor for the Source XML feature.
addSourceXMLPropertyDescriptor
{ "repo_name": "sohaniwso2/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EnrichMediatorItemProvider.java", "license": "apache-2.0", "size": 16091 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
261,094
@Override public CreationHelper getCreationHelper() { throw new UnsupportedOperationException(); }
CreationHelper function() { throw new UnsupportedOperationException(); }
/** * Not supported */
Not supported
getCreationHelper
{ "repo_name": "monitorjbl/excel-streaming-reader", "path": "src/main/java/com/monitorjbl/xlsx/impl/StreamingWorkbook.java", "license": "apache-2.0", "size": 9971 }
[ "org.apache.poi.ss.usermodel.CreationHelper" ]
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.*;
[ "org.apache.poi" ]
org.apache.poi;
1,621,391
public void setThreadFactory(ForkJoinPool.ForkJoinWorkerThreadFactory threadFactory) { this.threadFactory = threadFactory; }
void function(ForkJoinPool.ForkJoinWorkerThreadFactory threadFactory) { this.threadFactory = threadFactory; }
/** * Set the factory for creating new ForkJoinWorkerThreads. * Default is {@link ForkJoinPool#defaultForkJoinWorkerThreadFactory}. */
Set the factory for creating new ForkJoinWorkerThreads. Default is <code>ForkJoinPool#defaultForkJoinWorkerThreadFactory</code>
setThreadFactory
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-context/src/main/java/org/springframework/scheduling/concurrent/ForkJoinPoolFactoryBean.java", "license": "apache-2.0", "size": 6390 }
[ "java.util.concurrent.ForkJoinPool" ]
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,760,916
@NotNull public PsiFile[] getFilesByName(@NotNull String name) { return PsiFile.EMPTY_ARRAY; }
PsiFile[] function(@NotNull String name) { return PsiFile.EMPTY_ARRAY; }
/** * Returns the list of files with the specified name. * * @param name the name of the files to find. * @return the list of files in the project which have the specified name. */
Returns the list of files with the specified name
getFilesByName
{ "repo_name": "paplorinc/intellij-community", "path": "java/java-indexing-api/src/com/intellij/psi/search/PsiShortNamesCache.java", "license": "apache-2.0", "size": 7616 }
[ "com.intellij.psi.PsiFile", "org.jetbrains.annotations.NotNull" ]
import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull;
import com.intellij.psi.*; import org.jetbrains.annotations.*;
[ "com.intellij.psi", "org.jetbrains.annotations" ]
com.intellij.psi; org.jetbrains.annotations;
1,464,510
protected static ExpressionOperator greatest() { ExpressionOperator exOperator = new ExpressionOperator(); exOperator.setType(ExpressionOperator.FunctionOperator); exOperator.setSelector(ExpressionOperator.Greatest); Vector<String> v = NonSynchronizedVector.newInstance(5); v.addElement("(CASE WHEN "); v.addElement(" >= "); v.addElement(" THEN "); v.addElement(" ELSE "); v.addElement(" END)"); exOperator.printsAs(v); exOperator.bePrefix(); int[] indices = {0, 1, 0, 1}; exOperator.setArgumentIndices(indices); exOperator.setNodeClass(ClassConstants.FunctionExpression_Class); return exOperator; }
static ExpressionOperator function() { ExpressionOperator exOperator = new ExpressionOperator(); exOperator.setType(ExpressionOperator.FunctionOperator); exOperator.setSelector(ExpressionOperator.Greatest); Vector<String> v = NonSynchronizedVector.newInstance(5); v.addElement(STR); v.addElement(STR); v.addElement(STR); v.addElement(STR); v.addElement(STR); exOperator.printsAs(v); exOperator.bePrefix(); int[] indices = {0, 1, 0, 1}; exOperator.setArgumentIndices(indices); exOperator.setNodeClass(ClassConstants.FunctionExpression_Class); return exOperator; }
/** * Returns the greatest of two values.<br/> * Builds Symfoware equivalent to GREATEST(x, y).<br/> * * Symfoware: CASE WHEN x >= y THEN x ELSE y END * * @return the defined expression operator. */
Returns the greatest of two values. Builds Symfoware equivalent to GREATEST(x, y). Symfoware: CASE WHEN x >= y THEN x ELSE y END
greatest
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/database/SymfowarePlatform.java", "license": "epl-1.0", "size": 53301 }
[ "java.util.Vector", "org.eclipse.persistence.expressions.ExpressionOperator", "org.eclipse.persistence.internal.expressions.FunctionExpression", "org.eclipse.persistence.internal.helper.ClassConstants", "org.eclipse.persistence.internal.helper.NonSynchronizedVector" ]
import java.util.Vector; import org.eclipse.persistence.expressions.ExpressionOperator; import org.eclipse.persistence.internal.expressions.FunctionExpression; import org.eclipse.persistence.internal.helper.ClassConstants; import org.eclipse.persistence.internal.helper.NonSynchronizedVector;
import java.util.*; import org.eclipse.persistence.expressions.*; import org.eclipse.persistence.internal.expressions.*; import org.eclipse.persistence.internal.helper.*;
[ "java.util", "org.eclipse.persistence" ]
java.util; org.eclipse.persistence;
1,663,145
public void addAuthority(ScriptNode parentGroup, ScriptNode authority) { ParameterCheck.mandatory("Authority", authority); ParameterCheck.mandatory("ParentGroup", parentGroup); if (parentGroup.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) { String parentGroupName = (String)parentGroup.getProperties().get(ContentModel.PROP_AUTHORITY_NAME); String authorityName; if (authority.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) { authorityName = (String)authority.getProperties().get(ContentModel.PROP_AUTHORITY_NAME); } else { authorityName = (String)authority.getProperties().get(ContentModel.PROP_USERNAME); } authorityService.addAuthority(parentGroupName, authorityName); } }
void function(ScriptNode parentGroup, ScriptNode authority) { ParameterCheck.mandatory(STR, authority); ParameterCheck.mandatory(STR, parentGroup); if (parentGroup.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) { String parentGroupName = (String)parentGroup.getProperties().get(ContentModel.PROP_AUTHORITY_NAME); String authorityName; if (authority.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) { authorityName = (String)authority.getProperties().get(ContentModel.PROP_AUTHORITY_NAME); } else { authorityName = (String)authority.getProperties().get(ContentModel.PROP_USERNAME); } authorityService.addAuthority(parentGroupName, authorityName); } }
/** * Add an authority (a user or group) to a group container as a new child * * @param parentGroup The parent container group * @param authority The authority (user or group) to add */
Add an authority (a user or group) to a group container as a new child
addAuthority
{ "repo_name": "surevine/alfresco-repository-client-customisations", "path": "source/java/com/surevine/alfresco/repo/jscript/People.java", "license": "gpl-2.0", "size": 36669 }
[ "org.alfresco.model.ContentModel", "org.alfresco.repo.jscript.ScriptNode", "org.springframework.extensions.surf.util.ParameterCheck" ]
import org.alfresco.model.ContentModel; import org.alfresco.repo.jscript.ScriptNode; import org.springframework.extensions.surf.util.ParameterCheck;
import org.alfresco.model.*; import org.alfresco.repo.jscript.*; import org.springframework.extensions.surf.util.*;
[ "org.alfresco.model", "org.alfresco.repo", "org.springframework.extensions" ]
org.alfresco.model; org.alfresco.repo; org.springframework.extensions;
2,385,704
@SuppressWarnings("unchecked") public synchronized void registerRepository(HierarchicalConfiguration repConf) throws ConfigurationException { String className = repConf.getString("[@class]"); boolean infoEnabled = getLogger().isInfoEnabled(); for (String protocol : repConf.getStringArray("protocols.protocol")) { HierarchicalConfiguration defConf = null; if (repConf.getKeys("config").hasNext()) { // Get the default configuration for these protocol/type // combinations. defConf = repConf.configurationAt("config"); } if (infoEnabled) { StringBuilder infoBuffer = new StringBuilder(128); infoBuffer.append("Registering Repository instance of class "); infoBuffer.append(className); infoBuffer.append(" to handle "); infoBuffer.append(protocol); infoBuffer.append(" protocol requests for repositories with key "); infoBuffer.append(protocol); getLogger().info(infoBuffer.toString()); } if (classes.get(protocol) != null) { throw new ConfigurationException("The combination of protocol and type comprise a unique key for repositories. This constraint has been violated. Please check your repository configuration."); } classes.put(protocol, className); if (defConf != null) { defaultConfigs.put(protocol, defConf); } } }
@SuppressWarnings(STR) synchronized void function(HierarchicalConfiguration repConf) throws ConfigurationException { String className = repConf.getString(STR); boolean infoEnabled = getLogger().isInfoEnabled(); for (String protocol : repConf.getStringArray(STR)) { HierarchicalConfiguration defConf = null; if (repConf.getKeys(STR).hasNext()) { defConf = repConf.configurationAt(STR); } if (infoEnabled) { StringBuilder infoBuffer = new StringBuilder(128); infoBuffer.append(STR); infoBuffer.append(className); infoBuffer.append(STR); infoBuffer.append(protocol); infoBuffer.append(STR); infoBuffer.append(protocol); getLogger().info(infoBuffer.toString()); } if (classes.get(protocol) != null) { throw new ConfigurationException(STR); } classes.put(protocol, className); if (defConf != null) { defaultConfigs.put(protocol, defConf); } } }
/** * <p> * Registers a new mail repository type in the mail store's registry based * upon a passed in <code>Configuration</code> object. * </p> * <p/> * <p> * This is presumably synchronized to prevent corruption of the internal * registry. * </p> * * @param repConf the Configuration object used to register the repository * @throws ConfigurationException if an error occurs accessing the Configuration object */
Registers a new mail repository type in the mail store's registry based upon a passed in <code>Configuration</code> object. This is presumably synchronized to prevent corruption of the internal registry.
registerRepository
{ "repo_name": "chibenwa/james", "path": "container/spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java", "license": "apache-2.0", "size": 10324 }
[ "org.apache.commons.configuration.ConfigurationException", "org.apache.commons.configuration.HierarchicalConfiguration" ]
import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.configuration.*;
[ "org.apache.commons" ]
org.apache.commons;
1,403,782
protected static String checkAndSanitize( final String in ) { if ( in == null ) { throw new IllegalArgumentException(); } String extension = null; if ( in.endsWith( RepositoryObjectType.CLUSTER_SCHEMA.getExtension() ) ) { extension = RepositoryObjectType.CLUSTER_SCHEMA.getExtension(); } else if ( in.endsWith( RepositoryObjectType.DATABASE.getExtension() ) ) { extension = RepositoryObjectType.DATABASE.getExtension(); } else if ( in.endsWith( JOB.getExtension() ) ) { extension = JOB.getExtension(); } else if ( in.endsWith( RepositoryObjectType.PARTITION_SCHEMA.getExtension() ) ) { extension = RepositoryObjectType.PARTITION_SCHEMA.getExtension(); } else if ( in.endsWith( RepositoryObjectType.SLAVE_SERVER.getExtension() ) ) { extension = RepositoryObjectType.SLAVE_SERVER.getExtension(); } else if ( in.endsWith( TRANSFORMATION.getExtension() ) ) { extension = TRANSFORMATION.getExtension(); } String out = in; if ( extension != null ) { out = out.substring( 0, out.length() - extension.length() ); } if ( out.contains( "/" ) || out.equals( ".." ) || out.equals( "." ) || StringUtils.isBlank( out ) ) { throw new IllegalArgumentException(); } if ( System.getProperty( "KETTLE_COMPATIBILITY_PUR_OLD_NAMING_MODE", "N" ).equals( "Y" ) ) { out = out.replaceAll( "[/:\\[\\]\\*'\"\\|\\s\\.]", "_" ); //$NON-NLS-1$//$NON-NLS-2$ } if ( extension != null ) { return out + extension; } else { return out; } }
static String function( final String in ) { if ( in == null ) { throw new IllegalArgumentException(); } String extension = null; if ( in.endsWith( RepositoryObjectType.CLUSTER_SCHEMA.getExtension() ) ) { extension = RepositoryObjectType.CLUSTER_SCHEMA.getExtension(); } else if ( in.endsWith( RepositoryObjectType.DATABASE.getExtension() ) ) { extension = RepositoryObjectType.DATABASE.getExtension(); } else if ( in.endsWith( JOB.getExtension() ) ) { extension = JOB.getExtension(); } else if ( in.endsWith( RepositoryObjectType.PARTITION_SCHEMA.getExtension() ) ) { extension = RepositoryObjectType.PARTITION_SCHEMA.getExtension(); } else if ( in.endsWith( RepositoryObjectType.SLAVE_SERVER.getExtension() ) ) { extension = RepositoryObjectType.SLAVE_SERVER.getExtension(); } else if ( in.endsWith( TRANSFORMATION.getExtension() ) ) { extension = TRANSFORMATION.getExtension(); } String out = in; if ( extension != null ) { out = out.substring( 0, out.length() - extension.length() ); } if ( out.contains( "/" ) out.equals( ".." ) out.equals( "." ) StringUtils.isBlank( out ) ) { throw new IllegalArgumentException(); } if ( System.getProperty( STR, "N" ).equals( "Y" ) ) { out = out.replaceAll( STR\\ \\s\\.]STR_" ); } if ( extension != null ) { return out + extension; } else { return out; } }
/** * Performs one-way conversion on incoming String to produce a syntactically valid JCR path (section 4.6 Path Syntax). */
Performs one-way conversion on incoming String to produce a syntactically valid JCR path (section 4.6 Path Syntax)
checkAndSanitize
{ "repo_name": "akhayrutdinov/pentaho-kettle", "path": "plugins/pdi-pur-plugin/src/org/pentaho/di/repository/pur/PurRepository.java", "license": "apache-2.0", "size": 120821 }
[ "org.apache.commons.lang.StringUtils", "org.pentaho.di.repository.RepositoryObjectType" ]
import org.apache.commons.lang.StringUtils; import org.pentaho.di.repository.RepositoryObjectType;
import org.apache.commons.lang.*; import org.pentaho.di.repository.*;
[ "org.apache.commons", "org.pentaho.di" ]
org.apache.commons; org.pentaho.di;
2,111,245
public static String[] getFirmwareData() { String fwPath[], fwName[]; String returnValue[] = new String[2]; fwPath = MyApplication.getAppContext().getResources().getStringArray(R.array.firmware_paths); fwName = MyApplication.getAppContext().getResources().getStringArray(R.array.firmware_names); File fwData; for(String path : fwPath) { for(String name : fwName) { fwData = new File(path + name); if(fwData.exists()) { returnValue[0] = path; returnValue[1] = name; return returnValue; } } } return returnValue; }
static String[] function() { String fwPath[], fwName[]; String returnValue[] = new String[2]; fwPath = MyApplication.getAppContext().getResources().getStringArray(R.array.firmware_paths); fwName = MyApplication.getAppContext().getResources().getStringArray(R.array.firmware_names); File fwData; for(String path : fwPath) { for(String name : fwName) { fwData = new File(path + name); if(fwData.exists()) { returnValue[0] = path; returnValue[1] = name; return returnValue; } } } return returnValue; }
/** * Search firmware path and filename. * * @return array of path and name. */
Search firmware path and filename
getFirmwareData
{ "repo_name": "aagallag/nexmon", "path": "app/app/src/main/java/de/tu_darmstadt/seemoo/nexmon/FirmwareUtils.java", "license": "gpl-3.0", "size": 1206 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
181,496
Single<Integer> addAllCounted(Collection<? extends V> c);
Single<Integer> addAllCounted(Collection<? extends V> c);
/** * Adds all elements contained in the specified collection. * Returns number of added elements. * * @param c - collection of elements to add * @return number of added elements */
Adds all elements contained in the specified collection. Returns number of added elements
addAllCounted
{ "repo_name": "redisson/redisson", "path": "redisson/src/main/java/org/redisson/api/RSetRx.java", "license": "apache-2.0", "size": 6873 }
[ "io.reactivex.rxjava3.core.Single", "java.util.Collection" ]
import io.reactivex.rxjava3.core.Single; import java.util.Collection;
import io.reactivex.rxjava3.core.*; import java.util.*;
[ "io.reactivex.rxjava3", "java.util" ]
io.reactivex.rxjava3; java.util;
90,226
void deleteFacility(PerunSession perunSession, Facility facility, Boolean force) throws InternalErrorException, RelationExistsException, FacilityNotExistsException, PrivilegeException, FacilityAlreadyRemovedException, HostAlreadyRemovedException, ResourceAlreadyRemovedException, GroupAlreadyRemovedFromResourceException;
void deleteFacility(PerunSession perunSession, Facility facility, Boolean force) throws InternalErrorException, RelationExistsException, FacilityNotExistsException, PrivilegeException, FacilityAlreadyRemovedException, HostAlreadyRemovedException, ResourceAlreadyRemovedException, GroupAlreadyRemovedFromResourceException;
/** * Delete the facility by id. * * @throws FacilityAlreadyRemovedException if 0 rows affected by delete from DB * @throws HostAlreadyRemovedException if there is at least 1 hosts not affected by deleting from DB * @throws ResourceAlreadyRemovedException if there is at least 1 resource not affected by deleting from DB * @throws GroupAlreadyRemovedFromResourceException if there is at least 1 group on any resource affected by removing from DB */
Delete the facility by id
deleteFacility
{ "repo_name": "stavamichal/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/FacilitiesManager.java", "license": "bsd-2-clause", "size": 31409 }
[ "cz.metacentrum.perun.core.api.exceptions.FacilityAlreadyRemovedException", "cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException", "cz.metacentrum.perun.core.api.exceptions.GroupAlreadyRemovedFromResourceException", "cz.metacentrum.perun.core.api.exceptions.HostAlreadyRemovedException", "cz....
import cz.metacentrum.perun.core.api.exceptions.FacilityAlreadyRemovedException; import cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException; import cz.metacentrum.perun.core.api.exceptions.GroupAlreadyRemovedFromResourceException; import cz.metacentrum.perun.core.api.exceptions.HostAlreadyRemovedException; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.RelationExistsException; import cz.metacentrum.perun.core.api.exceptions.ResourceAlreadyRemovedException;
import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,685,202
public static Date dateOf(final Instant time) { return Date.from(time); }
static Date function(final Instant time) { return Date.from(time); }
/** * Gets Date for Instant. * * @param time Time object to be converted. * @return Date representing time */
Gets Date for Instant
dateOf
{ "repo_name": "robertoschwald/cas", "path": "core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java", "license": "apache-2.0", "size": 9289 }
[ "java.time.Instant", "java.util.Date" ]
import java.time.Instant; import java.util.Date;
import java.time.*; import java.util.*;
[ "java.time", "java.util" ]
java.time; java.util;
1,959,689
@Deprecated public Writable call(Writable param, long receiveTime) throws Exception { return call(RPC.RpcKind.RPC_BUILTIN, null, param, receiveTime); }
Writable function(Writable param, long receiveTime) throws Exception { return call(RPC.RpcKind.RPC_BUILTIN, null, param, receiveTime); }
/** * Called for each call. * @deprecated Use {@link #call(RpcPayloadHeader.RpcKind, String, * Writable, long)} instead */
Called for each call
call
{ "repo_name": "sungsoo/hadoop-2.4.0", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java", "license": "apache-2.0", "size": 102570 }
[ "org.apache.hadoop.io.Writable" ]
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
301,114
private void generatePushNestedSessionContext( ActivationClassBuilder acb, MethodBuilder mb, boolean hadDefinersRights, String definer) throws StandardException { // Generates the following Java code: // ((Activation)this).getLanguageConnectionContext(). // pushNestedSessionContext((Activation)this); acb.pushThisAsActivation(mb); mb.callMethod(VMOpcode.INVOKEINTERFACE, null, "getLanguageConnectionContext", ClassName.LanguageConnectionContext, 0); acb.pushThisAsActivation(mb); mb.push(hadDefinersRights); mb.push(definer); mb.callMethod(VMOpcode.INVOKEINTERFACE, null, "pushNestedSessionContext", "void", 3); }
void function( ActivationClassBuilder acb, MethodBuilder mb, boolean hadDefinersRights, String definer) throws StandardException { acb.pushThisAsActivation(mb); mb.callMethod(VMOpcode.INVOKEINTERFACE, null, STR, ClassName.LanguageConnectionContext, 0); acb.pushThisAsActivation(mb); mb.push(hadDefinersRights); mb.push(definer); mb.callMethod(VMOpcode.INVOKEINTERFACE, null, STR, "void", 3); }
/** * Add code to set up the SQL session context for a stored * procedure or function which needs a nested SQL session * context (only needed for those which can contain SQL). * * The generated code calls pushNestedSessionContext. * @see LanguageConnectionContext#pushNestedSessionContext * * @param acb activation class builder * @param mb method builder */
Add code to set up the SQL session context for a stored procedure or function which needs a nested SQL session context (only needed for those which can contain SQL). The generated code calls pushNestedSessionContext
generatePushNestedSessionContext
{ "repo_name": "scnakandala/derby", "path": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "license": "apache-2.0", "size": 52208 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.reference.ClassName", "org.apache.derby.iapi.services.classfile.VMOpcode", "org.apache.derby.iapi.services.compiler.MethodBuilder", "org.apache.derby.iapi.sql.conn.LanguageConnectionContext" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.ClassName; import org.apache.derby.iapi.services.classfile.VMOpcode; import org.apache.derby.iapi.services.compiler.MethodBuilder; import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*; import org.apache.derby.iapi.services.classfile.*; import org.apache.derby.iapi.services.compiler.*; import org.apache.derby.iapi.sql.conn.*;
[ "org.apache.derby" ]
org.apache.derby;
1,718,630
@ServiceMethod(returns = ReturnType.SINGLE) void stop(String resourceGroupName, String automationAccountName, String watcherName);
@ServiceMethod(returns = ReturnType.SINGLE) void stop(String resourceGroupName, String automationAccountName, String watcherName);
/** * Resume the watcher identified by watcher name. * * @param resourceGroupName Name of an Azure Resource group. * @param automationAccountName The name of the automation account. * @param watcherName The watcher name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Resume the watcher identified by watcher name
stop
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/automation/azure-resourcemanager-automation/src/main/java/com/azure/resourcemanager/automation/fluent/WatchersClient.java", "license": "mit", "size": 12282 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
2,347,095
JRBaseFiller getFiller();
JRBaseFiller getFiller();
/** * Returns the filler object. * * @return the filler object */
Returns the filler object
getFiller
{ "repo_name": "sikachu/jasperreports", "path": "src/net/sf/jasperreports/engine/component/FillContext.java", "license": "lgpl-3.0", "size": 5100 }
[ "net.sf.jasperreports.engine.fill.JRBaseFiller" ]
import net.sf.jasperreports.engine.fill.JRBaseFiller;
import net.sf.jasperreports.engine.fill.*;
[ "net.sf.jasperreports" ]
net.sf.jasperreports;
1,706,556
public OIndex<?> createIndex(String iName, INDEX_TYPE iType, OProgressListener iProgressListener, String... fields);
OIndex<?> function(String iName, INDEX_TYPE iType, OProgressListener iProgressListener, String... fields);
/** * Creates database index that is based on passed in field names. Given index will be added into class instance. * * @param fields * Field names from which index will be created. * @param iName * Database index name. * @param iType * Index type. * @param iProgressListener * Progress listener. * * @return Class index registered inside of given class ans associated with database index. */
Creates database index that is based on passed in field names. Given index will be added into class instance
createIndex
{ "repo_name": "MaDaPHaKa/Orient-object", "path": "core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OClass.java", "license": "apache-2.0", "size": 8639 }
[ "com.orientechnologies.common.listener.OProgressListener", "com.orientechnologies.orient.core.index.OIndex" ]
import com.orientechnologies.common.listener.OProgressListener; import com.orientechnologies.orient.core.index.OIndex;
import com.orientechnologies.common.listener.*; import com.orientechnologies.orient.core.index.*;
[ "com.orientechnologies.common", "com.orientechnologies.orient" ]
com.orientechnologies.common; com.orientechnologies.orient;
2,280,592
public static boolean containsOver(RexProgram program) { try { RexUtil.apply(FINDER, program.getExprList(), null); return false; } catch (OverFound e) { Util.swallow(e, null); return true; } }
static boolean function(RexProgram program) { try { RexUtil.apply(FINDER, program.getExprList(), null); return false; } catch (OverFound e) { Util.swallow(e, null); return true; } }
/** * Returns whether a program contains an OVER clause. */
Returns whether a program contains an OVER clause
containsOver
{ "repo_name": "xhoong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/rex/RexOver.java", "license": "apache-2.0", "size": 5398 }
[ "org.apache.calcite.util.Util" ]
import org.apache.calcite.util.Util;
import org.apache.calcite.util.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,684,404
private Document getRestConfiguration() { Document restConfiguration = null; DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); File restConfigFile = new File(getRestConfigPath()); try { DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder(); FileInputStream restConfigStream = new FileInputStream(restConfigFile); // StreamSource xmlSource = new StreamSource(restConfigStream, "http://sampleApps.net/static/dataDef1.1.dtd"); restConfiguration = documentBuilder.parse(restConfigStream); restConfigStream.close(); } catch (Exception ex) { System.err.println("Error getting Jasper Server rest configuration: " + ex.getLocalizedMessage()); } return restConfiguration; }
Document function() { Document restConfiguration = null; DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); File restConfigFile = new File(getRestConfigPath()); try { DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder(); FileInputStream restConfigStream = new FileInputStream(restConfigFile); restConfiguration = documentBuilder.parse(restConfigStream); restConfigStream.close(); } catch (Exception ex) { System.err.println(STR + ex.getLocalizedMessage()); } return restConfiguration; }
/** * Method that loads the Document representation of the REST adapters * configuration file. * * @return REST Adapters configurations as a Document. */
Method that loads the Document representation of the REST adapters configuration file
getRestConfiguration
{ "repo_name": "WedjaaOpen/ElasticJasperServer", "path": "src/main/java/net/wedjaa/jasper/elasticsearch/server/Installer.java", "license": "apache-2.0", "size": 19955 }
[ "java.io.File", "java.io.FileInputStream", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "org.w3c.dom.Document" ]
import java.io.File; import java.io.FileInputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document;
import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
2,634,312
public Observable<ServiceResponse<Page<ExpressRouteCrossConnectionInner>>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<Page<ExpressRouteCrossConnectionInner>>> function() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Retrieves all the ExpressRouteCrossConnections in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;ExpressRouteCrossConnectionInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Retrieves all the ExpressRouteCrossConnections in a subscription
listSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/network/v2020_04_01/implementation/ExpressRouteCrossConnectionsInner.java", "license": "mit", "size": 100923 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
670,249
EAttribute getCurve_CurveStyle();
EAttribute getCurve_CurveStyle();
/** * Returns the meta object for the attribute '{@link CIM.IEC61970.Core.Curve#getCurveStyle <em>Curve Style</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Curve Style</em>'. * @see CIM.IEC61970.Core.Curve#getCurveStyle() * @see #getCurve() * @generated */
Returns the meta object for the attribute '<code>CIM.IEC61970.Core.Curve#getCurveStyle Curve Style</code>'.
getCurve_CurveStyle
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Core/CorePackage.java", "license": "mit", "size": 253784 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,481,107
public void closeAllFrames() throws CloseVetoException { for (AbstractSdiFrame curFrame : dependentFrameColl) { if( curFrame.isVisible()) { curFrame.closeAllFrames(); } } closeFrame(); }
void function() throws CloseVetoException { for (AbstractSdiFrame curFrame : dependentFrameColl) { if( curFrame.isVisible()) { curFrame.closeAllFrames(); } } closeFrame(); }
/** * Closes this Frame and all dependent Frames by calling their closeFrame() Method * @throws CloseVetoException throws this exception, when the frame could not be closed, sender is responsible for * a proper user notification */
Closes this Frame and all dependent Frames by calling their closeFrame() Method
closeAllFrames
{ "repo_name": "schnurlei/jdynameta", "path": "jdy/jdy.base.swing/src/main/java/de/jdynameta/view/sdi/AbstractSdiFrame.java", "license": "apache-2.0", "size": 6907 }
[ "de.jdynameta.view.panel.CloseVetoException" ]
import de.jdynameta.view.panel.CloseVetoException;
import de.jdynameta.view.panel.*;
[ "de.jdynameta.view" ]
de.jdynameta.view;
2,762,704
private Object getValuesFromBlockValSet(BlockValSet blockValSet, FieldSpec.DataType dataType) { Object values; switch (dataType) { case INT: values = blockValSet.getIntValuesSV(); break; case LONG: values = blockValSet.getLongValuesSV(); break; case FLOAT: values = blockValSet.getFloatValuesSV(); break; case DOUBLE: values = blockValSet.getDoubleValuesSV(); break; case STRING: values = blockValSet.getStringValuesSV(); break; default: throw new IllegalArgumentException("Illegal data type for no-dictionary key generator: " + dataType); } return values; }
Object function(BlockValSet blockValSet, FieldSpec.DataType dataType) { Object values; switch (dataType) { case INT: values = blockValSet.getIntValuesSV(); break; case LONG: values = blockValSet.getLongValuesSV(); break; case FLOAT: values = blockValSet.getFloatValuesSV(); break; case DOUBLE: values = blockValSet.getDoubleValuesSV(); break; case STRING: values = blockValSet.getStringValuesSV(); break; default: throw new IllegalArgumentException(STR + dataType); } return values; }
/** * Helper method to fetch values from BlockValSet * @param dataType Data type * @param blockValSet Block val set * @return Values from block val set */
Helper method to fetch values from BlockValSet
getValuesFromBlockValSet
{ "repo_name": "apucher/pinot", "path": "pinot-core/src/main/java/com/linkedin/pinot/core/query/aggregation/groupby/NoDictionaryMultiColumnGroupKeyGenerator.java", "license": "apache-2.0", "size": 8839 }
[ "com.linkedin.pinot.common.data.FieldSpec", "com.linkedin.pinot.core.common.BlockValSet" ]
import com.linkedin.pinot.common.data.FieldSpec; import com.linkedin.pinot.core.common.BlockValSet;
import com.linkedin.pinot.common.data.*; import com.linkedin.pinot.core.common.*;
[ "com.linkedin.pinot" ]
com.linkedin.pinot;
1,626,061
String currentPathString(ImageDisplay parent) { StringBuffer buf = new StringBuffer(); List<String> titleBuf = new ArrayList<String>(); while (parent != null && !(parent instanceof RootDisplay)) { if (parent instanceof CellDisplay) { int type = ((CellDisplay) parent).getType(); if (type == CellDisplay.TYPE_HORIZONTAL) titleBuf.add("column: "+parent.getTitle()); else titleBuf.add("row: "+parent.getTitle()); } else if (parent instanceof WellImageSet) { WellImageSet wiNode = (WellImageSet) parent; titleBuf.add(wiNode.getTitle()); } else if (parent instanceof WellSampleNode) { Object o = ((WellSampleNode) parent).getParentObject(); if (o instanceof WellData) { titleBuf.add(((WellData) o).getPlate().getName()); //if (titleBuf.s() != 0) // titleBuf.append(" > "); titleBuf.add(parent.getTitle()); if (titleBuf.size() == 0) titleBuf.add("[..]"); //if (titleBuf.length() == 0) titleBuf.append("[..]"); } } else { //titleBuf.append(parent.getTitle()); titleBuf.add(parent.getTitle()); //if (titleBuf.length() == 0) titleBuf.append("[..]"); //if (parent instanceof ImageSet) buf.insert(0, " > "); } //buf.insert(0, titleBuf.toString()); parent = parent.getParentDisplay(); } int n = titleBuf.size(); for (int i = 0; i < n; i++) { buf.append(titleBuf.get(n-1-i)); if (i != (n-1)) buf.append(">"); } return buf.toString(); }
String currentPathString(ImageDisplay parent) { StringBuffer buf = new StringBuffer(); List<String> titleBuf = new ArrayList<String>(); while (parent != null && !(parent instanceof RootDisplay)) { if (parent instanceof CellDisplay) { int type = ((CellDisplay) parent).getType(); if (type == CellDisplay.TYPE_HORIZONTAL) titleBuf.add(STR+parent.getTitle()); else titleBuf.add(STR+parent.getTitle()); } else if (parent instanceof WellImageSet) { WellImageSet wiNode = (WellImageSet) parent; titleBuf.add(wiNode.getTitle()); } else if (parent instanceof WellSampleNode) { Object o = ((WellSampleNode) parent).getParentObject(); if (o instanceof WellData) { titleBuf.add(((WellData) o).getPlate().getName()); titleBuf.add(parent.getTitle()); if (titleBuf.size() == 0) titleBuf.add("[..]"); } } else { titleBuf.add(parent.getTitle()); } parent = parent.getParentDisplay(); } int n = titleBuf.size(); for (int i = 0; i < n; i++) { buf.append(titleBuf.get(n-1-i)); if (i != (n-1)) buf.append(">"); } return buf.toString(); }
/** * String-ifies the path from the specified node to the * {@link #rootDisplay}. * * @param parent The node to start from. * @return The above described string. */
String-ifies the path from the specified node to the <code>#rootDisplay</code>
currentPathString
{ "repo_name": "simleo/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/dataBrowser/browser/BrowserModel.java", "license": "gpl-2.0", "size": 28381 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,083,278
public CharBuffer getCharBuffer(Charset charset) throws IOException { return charset.decode(getByteBuffer()); }
CharBuffer function(Charset charset) throws IOException { return charset.decode(getByteBuffer()); }
/** * Get a character buffer of the bytes available in the serial data receive buffer * * @param charset the character-set used to construct the character buffer from the underlying byte array * @return CharBuffer of data from serial data receive buffer * @throws IOException */
Get a character buffer of the bytes available in the serial data receive buffer
getCharBuffer
{ "repo_name": "phueper/pi4j", "path": "pi4j-core/src/main/java/com/pi4j/io/serial/SerialDataEvent.java", "license": "lgpl-3.0", "size": 7111 }
[ "java.io.IOException", "java.nio.CharBuffer", "java.nio.charset.Charset" ]
import java.io.IOException; import java.nio.CharBuffer; import java.nio.charset.Charset;
import java.io.*; import java.nio.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
785,046
protected final @Nullable DataSchemaNode dataSchemaNode(final QName name) { // Only DataNodeContainer subclasses should be calling this method verify(this instanceof DataNodeContainer); final SchemaTreeEffectiveStatement<?> child = schemaTreeNamespace().get(requireNonNull(name)); return child instanceof DataSchemaNode ? (DataSchemaNode) child : null; }
final @Nullable DataSchemaNode function(final QName name) { verify(this instanceof DataNodeContainer); final SchemaTreeEffectiveStatement<?> child = schemaTreeNamespace().get(requireNonNull(name)); return child instanceof DataSchemaNode ? (DataSchemaNode) child : null; }
/** * Indexing support for {@link DataNodeContainer#findDataChildByName(QName)}. */
Indexing support for <code>DataNodeContainer#findDataChildByName(QName)</code>
dataSchemaNode
{ "repo_name": "opendaylight/yangtools", "path": "model/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/AbstractUndeclaredEffectiveStatement.java", "license": "epl-1.0", "size": 7679 }
[ "com.google.common.base.Verify", "org.eclipse.jdt.annotation.Nullable", "org.opendaylight.yangtools.yang.common.QName", "org.opendaylight.yangtools.yang.model.api.DataNodeContainer", "org.opendaylight.yangtools.yang.model.api.DataSchemaNode", "org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffec...
import com.google.common.base.Verify; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement;
import com.google.common.base.*; import org.eclipse.jdt.annotation.*; import org.opendaylight.yangtools.yang.common.*; import org.opendaylight.yangtools.yang.model.api.*; import org.opendaylight.yangtools.yang.model.api.stmt.*;
[ "com.google.common", "org.eclipse.jdt", "org.opendaylight.yangtools" ]
com.google.common; org.eclipse.jdt; org.opendaylight.yangtools;
885,502
public void testMetricsStatisticsEnabled() throws Exception { createCaches(true); populateCacheData(cache1, ENTRY_CNT_CACHE1); populateCacheData(cache2, ENTRY_CNT_CACHE2); readCacheData(cache1, ENTRY_CNT_CACHE1); readCacheData(cache2, ENTRY_CNT_CACHE2); awaitMetricsUpdate(); Collection<ClusterNode> nodes = grid(0).cluster().forRemotes().nodes(); for (ClusterNode node : nodes) { Map<Integer, CacheMetrics> metrics = ((TcpDiscoveryNode) node).cacheMetrics(); assertNotNull(metrics); assertFalse(metrics.isEmpty()); } assertMetrics(cache1); assertMetrics(cache2); destroyCaches(); }
void function() throws Exception { createCaches(true); populateCacheData(cache1, ENTRY_CNT_CACHE1); populateCacheData(cache2, ENTRY_CNT_CACHE2); readCacheData(cache1, ENTRY_CNT_CACHE1); readCacheData(cache2, ENTRY_CNT_CACHE2); awaitMetricsUpdate(); Collection<ClusterNode> nodes = grid(0).cluster().forRemotes().nodes(); for (ClusterNode node : nodes) { Map<Integer, CacheMetrics> metrics = ((TcpDiscoveryNode) node).cacheMetrics(); assertNotNull(metrics); assertFalse(metrics.isEmpty()); } assertMetrics(cache1); assertMetrics(cache2); destroyCaches(); }
/** * Test cluster group metrics in case of statistics enabled. */
Test cluster group metrics in case of statistics enabled
testMetricsStatisticsEnabled
{ "repo_name": "vadopolski/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java", "license": "apache-2.0", "size": 7898 }
[ "java.util.Collection", "java.util.Map", "org.apache.ignite.cache.CacheMetrics", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode" ]
import java.util.Collection; import java.util.Map; import org.apache.ignite.cache.CacheMetrics; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
import java.util.*; import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.spi.discovery.tcp.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,001,581
public List<Employee> buildEmployeeList(String fileName) throws IOException { // Override default date format and get Gson object Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); //Define the ArrayList<Employee> to store the JSON representation from input file Type listType = new TypeToken<ArrayList<Employee>>() { }.getType(); InputStream inputStream = GsonJsonObjModelReaderExample.class.getResourceAsStream(fileName); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); //Converts JSON representation of employee objects in to List<Employee> List<Employee> employees = gson.fromJson(reader, listType); //Following is just to exercise toJson method, not relevant otherwise //String jsonEmp = gson.toJson(employees); return employees; }
List<Employee> function(String fileName) throws IOException { Gson gson = new GsonBuilder().setDateFormat(STR).create(); Type listType = new TypeToken<ArrayList<Employee>>() { }.getType(); InputStream inputStream = GsonJsonObjModelReaderExample.class.getResourceAsStream(fileName); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); List<Employee> employees = gson.fromJson(reader, listType); return employees; }
/** * Reads JSON representation of employee array present in the input file and * converts the contents in to List of employee objects * * @param fileName * @return * @throws IOException */
Reads JSON representation of employee array present in the input file and converts the contents in to List of employee objects
buildEmployeeList
{ "repo_name": "jobinesh/restful-java-web-services-edition2", "path": "rest-chapter2-jsonp/src/main/java/com/packtpub/rest/ch2/gson/GsonJsonObjModelReaderExample.java", "license": "mit", "size": 2301 }
[ "com.google.gson.Gson", "com.google.gson.GsonBuilder", "com.google.gson.reflect.TypeToken", "com.packtpub.rest.ch2.model.Employee", "java.io.BufferedReader", "java.io.IOException", "java.io.InputStream", "java.io.InputStreamReader", "java.lang.reflect.Type", "java.util.ArrayList", "java.util.Lis...
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.packtpub.rest.ch2.model.Employee; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List;
import com.google.gson.*; import com.google.gson.reflect.*; import com.packtpub.rest.ch2.model.*; import java.io.*; import java.lang.reflect.*; import java.util.*;
[ "com.google.gson", "com.packtpub.rest", "java.io", "java.lang", "java.util" ]
com.google.gson; com.packtpub.rest; java.io; java.lang; java.util;
312,896
public void addPath(Path list) { this.sourcePaths.add(list); }
void function(Path list) { this.sourcePaths.add(list); }
/** * Adds a <path/> entry. */
Adds a entry
addPath
{ "repo_name": "phistuck/closure-compiler", "path": "src/com/google/javascript/jscomp/ant/CompileTask.java", "license": "apache-2.0", "size": 21825 }
[ "org.apache.tools.ant.types.Path" ]
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.*;
[ "org.apache.tools" ]
org.apache.tools;
1,742,288
public static void snapshotWithoutCFS(String keyspace, String columnFamily) throws IOException { Directories directories = Directories.create(keyspace, columnFamily); String snapshotName = "pre-sstablemetamigration"; logger.info("Snapshotting {}, {} to {}", keyspace, columnFamily, snapshotName); for (Map.Entry<Descriptor, Set<Component>> entry : directories.sstableLister().includeBackups(false).skipTemporary(true).list().entrySet()) { Descriptor descriptor = entry.getKey(); File snapshotDirectoryPath = Directories.getSnapshotDirectory(descriptor, snapshotName); for (Component component : entry.getValue()) { File sourceFile = new File(descriptor.filenameFor(component)); File targetLink = new File(snapshotDirectoryPath, sourceFile.getName()); FileUtils.createHardLink(sourceFile, targetLink); } } File manifestFile = directories.tryGetLeveledManifest(); if (manifestFile != null) { File snapshotDirectory = new File(new File(manifestFile.getParentFile(), Directories.SNAPSHOT_SUBDIR), snapshotName); File target = new File(snapshotDirectory, manifestFile.getName()); FileUtils.createHardLink(manifestFile, target); } }
static void function(String keyspace, String columnFamily) throws IOException { Directories directories = Directories.create(keyspace, columnFamily); String snapshotName = STR; logger.info(STR, keyspace, columnFamily, snapshotName); for (Map.Entry<Descriptor, Set<Component>> entry : directories.sstableLister().includeBackups(false).skipTemporary(true).list().entrySet()) { Descriptor descriptor = entry.getKey(); File snapshotDirectoryPath = Directories.getSnapshotDirectory(descriptor, snapshotName); for (Component component : entry.getValue()) { File sourceFile = new File(descriptor.filenameFor(component)); File targetLink = new File(snapshotDirectoryPath, sourceFile.getName()); FileUtils.createHardLink(sourceFile, targetLink); } } File manifestFile = directories.tryGetLeveledManifest(); if (manifestFile != null) { File snapshotDirectory = new File(new File(manifestFile.getParentFile(), Directories.SNAPSHOT_SUBDIR), snapshotName); File target = new File(snapshotDirectory, manifestFile.getName()); FileUtils.createHardLink(manifestFile, target); } }
/** * Snapshot a CF without having to load the sstables in that directory * * @param keyspace * @param columnFamily * @throws IOException */
Snapshot a CF without having to load the sstables in that directory
snapshotWithoutCFS
{ "repo_name": "DavidHerzogTU-Berlin/cassandraToRun", "path": "src/java/org/apache/cassandra/db/compaction/LegacyLeveledManifest.java", "license": "apache-2.0", "size": 5745 }
[ "java.io.File", "java.io.IOException", "java.util.Map", "java.util.Set", "org.apache.cassandra.db.Directories", "org.apache.cassandra.io.sstable.Component", "org.apache.cassandra.io.sstable.Descriptor", "org.apache.cassandra.io.util.FileUtils" ]
import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Set; import org.apache.cassandra.db.Directories; import org.apache.cassandra.io.sstable.Component; import org.apache.cassandra.io.sstable.Descriptor; import org.apache.cassandra.io.util.FileUtils;
import java.io.*; import java.util.*; import org.apache.cassandra.db.*; import org.apache.cassandra.io.sstable.*; import org.apache.cassandra.io.util.*;
[ "java.io", "java.util", "org.apache.cassandra" ]
java.io; java.util; org.apache.cassandra;
932,930
public synchronized static void destroy(ServletContext context) throws ServletException { }
synchronized static void function(ServletContext context) throws ServletException { }
/** * Releases all shared resources on the first invocation of this method. All * other invocations are ignored. This method is synchronized to ensure only * the first invocation performs the destruction. * * <p> * Call this method in the <code>destroy</code> method of your servlet or * JSP. * </p> * * @param context * the <code>ServletContext</code> instance in which your * servlet is running * @throws javax.servlet.ServletException if any. */
Releases all shared resources on the first invocation of this method. All other invocations are ignored. This method is synchronized to ensure only the first invocation performs the destruction. Call this method in the <code>destroy</code> method of your servlet or JSP.
destroy
{ "repo_name": "rfdrake/opennms", "path": "opennms-web-api/src/main/java/org/opennms/web/servlet/ServletInitializer.java", "license": "gpl-2.0", "size": 7541 }
[ "javax.servlet.ServletContext", "javax.servlet.ServletException" ]
import javax.servlet.ServletContext; import javax.servlet.ServletException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,704,793
public String getImports() { StringBuffer buf = new StringBuffer(); int index = 0; HashMap<Integer, HashSet<String>> relative; String relativeName; for (int i = 0; i < 2; ++i) { if (i == 0) { relative = parentImport; relativeName = "parent"; } else { relative = childImport; relativeName = "child"; if (childImport.size() > 0 && parentImport.size() > 0) { buf.append("|"); } } if (relative.size() > 0) { index = 0; for (Integer level : relative.keySet()) { if (index > 0) { buf.append("|"); } HashSet<String> list = relative.get(level); buf.append(relativeName); buf.append(level); buf.append(".["); int p = 0; for (String tab : list) { if (p > 0) { buf.append(","); } buf.append(tab); ++p; } buf.append("]"); ++index; } } } if (buf.length() == 0) { return null; } return buf.toString(); }
String function() { StringBuffer buf = new StringBuffer(); int index = 0; HashMap<Integer, HashSet<String>> relative; String relativeName; for (int i = 0; i < 2; ++i) { if (i == 0) { relative = parentImport; relativeName = STR; } else { relative = childImport; relativeName = "child"; if (childImport.size() > 0 && parentImport.size() > 0) { buf.append(" "); } } if (relative.size() > 0) { index = 0; for (Integer level : relative.keySet()) { if (index > 0) { buf.append(" "); } HashSet<String> list = relative.get(level); buf.append(relativeName); buf.append(level); buf.append(".["); int p = 0; for (String tab : list) { if (p > 0) { buf.append(","); } buf.append(tab); ++p; } buf.append("]"); ++index; } } } if (buf.length() == 0) { return null; } return buf.toString(); }
/** * Returns the tab imports from other CIs as a string. * * @return tab tab imports */
Returns the tab imports from other CIs as a string
getImports
{ "repo_name": "pezi/treedb-cmdb", "path": "src/main/java/at/treedb/at/treedb/ui/Import.java", "license": "lgpl-2.1", "size": 9399 }
[ "java.util.HashMap", "java.util.HashSet" ]
import java.util.HashMap; import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,514,166
@Override public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(5); newVector.addElement(new Option( "\tThe number of dimensions (attributes) the data should be reduced to\n" + "\t(default 10; exclusive of the class attribute, if it is set).", "N", 1, "-N <number>")); newVector .addElement(new Option( "\tThe distribution to use for calculating the random matrix.\n" + "\tSparse1 is:\n" + "\t sqrt(3)*{-1 with prob(1/6), 0 with prob(2/3), +1 with prob(1/6)}\n" + "\tSparse2 is:\n" + "\t {-1 with prob(1/2), +1 with prob(1/2)}\n", "D", 1, "-D [SPARSE1|SPARSE2|GAUSSIAN]")); // newVector.addElement(new Option( // "\tUse Gaussian distribution for calculating the random matrix.", // "G", 0, "-G")); newVector .addElement(new Option( "\tThe percentage of dimensions (attributes) the data should\n" + "\tbe reduced to (exclusive of the class attribute, if it is set). The -N\n" + "\toption is ignored if this option is present and is greater\n" + "\tthan zero.", "P", 1, "-P <percent>")); newVector.addElement(new Option( "\tReplace missing values using the ReplaceMissingValues filter", "M", 0, "-M")); newVector.addElement(new Option( "\tThe random seed for the random number generator used for\n" + "\tcalculating the random matrix (default 42).", "R", 0, "-R <num>")); return newVector.elements(); } /** * Parses a given list of options. * <p/> * * <!-- options-start --> * Valid options are: <p/> * * <pre> -N &lt;number&gt; * The number of dimensions (attributes) the data should be reduced to * (default 10; exclusive of the class attribute, if it is set).</pre> * * <pre> -D [SPARSE1|SPARSE2|GAUSSIAN] * The distribution to use for calculating the random matrix. * Sparse1 is: * sqrt(3)*{-1 with prob(1/6), 0 with prob(2/3), +1 with prob(1/6)} * Sparse2 is: * {-1 with prob(1/2), +1 with prob(1/2)}
Enumeration<Option> function() { Vector<Option> newVector = new Vector<Option>(5); newVector.addElement(new Option( STR + STR, "N", 1, STR)); newVector .addElement(new Option( STR + STR + STR + STR + STR, "D", 1, STR)); newVector .addElement(new Option( STR + STR + STR + STR, "P", 1, STR)); newVector.addElement(new Option( STR, "M", 0, "-M")); newVector.addElement(new Option( STR + STR, "R", 0, STR)); return newVector.elements(); } /** * Parses a given list of options. * <p/> * * <!-- options-start --> * Valid options are: <p/> * * <pre> -N &lt;number&gt; * The number of dimensions (attributes) the data should be reduced to * (default 10; exclusive of the class attribute, if it is set).</pre> * * <pre> -D [SPARSE1 SPARSE2 GAUSSIAN] * The distribution to use for calculating the random matrix. * Sparse1 is: * sqrt(3)*{-1 with prob(1/6), 0 with prob(2/3), +1 with prob(1/6)} * Sparse2 is: * {-1 with prob(1/2), +1 with prob(1/2)}
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */
Returns an enumeration describing the available options
listOptions
{ "repo_name": "mydzigear/weka.kmeanspp.silhouette_score", "path": "src/weka/filters/unsupervised/attribute/RandomProjection.java", "license": "gpl-3.0", "size": 28109 }
[ "java.util.Enumeration", "java.util.Vector" ]
import java.util.Enumeration; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
1,881,715
@Override public void onSwitchChanged(Switch switchView, boolean isChecked) { if (isChecked) { setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); } else { setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_OFF); } }
void function(Switch switchView, boolean isChecked) { if (isChecked) { setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); } else { setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_OFF); } }
/** * Listens to the state change of the location master switch. */
Listens to the state change of the location master switch
onSwitchChanged
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/Settings/src/com/android/settings/location/LocationSettings.java", "license": "gpl-3.0", "size": 13471 }
[ "android.provider.Settings", "android.widget.Switch" ]
import android.provider.Settings; import android.widget.Switch;
import android.provider.*; import android.widget.*;
[ "android.provider", "android.widget" ]
android.provider; android.widget;
8,005
@UiThread void alert(@StringRes int messageId) { alert(messageId, null); }
void alert(@StringRes int messageId) { alert(messageId, null); }
/** * Show an alert dialog to the user * @param messageId String id to display inside the alert dialog */
Show an alert dialog to the user
alert
{ "repo_name": "googlecodelabs/play-billing-codelab", "path": "work/app/src/main/java/com/codelab/GamePlayActivity.java", "license": "apache-2.0", "size": 6310 }
[ "android.support.annotation.StringRes" ]
import android.support.annotation.StringRes;
import android.support.annotation.*;
[ "android.support" ]
android.support;
2,892,572
public static void assertInBounds(final String param, final long value, final long min, final long max) { if (value < min || value > max) { throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format(Locale.ROOT, PARAMETER_NOT_IN_RANGE, param, min, max))); } }
static void function(final String param, final long value, final long min, final long max) { if (value < min value > max) { throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format(Locale.ROOT, PARAMETER_NOT_IN_RANGE, param, min, max))); } }
/** * Asserts that the specified number is in the valid range. The range is inclusive. * * @param param Name of the parameter * @param value Value of the parameter * @param min The minimum allowed value * @param max The maximum allowed value * @throws IllegalArgumentException If {@code value} is less than {@code min} or {@code value} is greater than * {@code max}. */
Asserts that the specified number is in the valid range. The range is inclusive
assertInBounds
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/StorageImplUtils.java", "license": "mit", "size": 11010 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
600,929
static void maybeAddFinally(Node tryNode) { Preconditions.checkState(tryNode.isTry()); if (!NodeUtil.hasFinally(tryNode)) { tryNode.addChildrenToBack(IR.block().srcref(tryNode)); } }
static void maybeAddFinally(Node tryNode) { Preconditions.checkState(tryNode.isTry()); if (!NodeUtil.hasFinally(tryNode)) { tryNode.addChildrenToBack(IR.block().srcref(tryNode)); } }
/** * Add a finally block if one does not exist. */
Add a finally block if one does not exist
maybeAddFinally
{ "repo_name": "maio/closure-compiler", "path": "src/com/google/javascript/jscomp/NodeUtil.java", "license": "apache-2.0", "size": 116745 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.IR", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
205,385
public static boolean hasAuthorization(User user, ISecuredResource resource, IResourceRoles resourceAdminRole, IResourceRoles... expectedRoles) { if (resource == null) { // Trick for topology's template return true; } Set<String> alienRoles = getRoles(user); // With ADMIN role, all rights if (alienRoles.contains(Role.ADMIN.toString())) { return true; } Set<String> appRoles = getRolesForResource(user, resource); return hasAtLeastOneRole(appRoles, resourceAdminRole, expectedRoles); }
static boolean function(User user, ISecuredResource resource, IResourceRoles resourceAdminRole, IResourceRoles... expectedRoles) { if (resource == null) { return true; } Set<String> alienRoles = getRoles(user); if (alienRoles.contains(Role.ADMIN.toString())) { return true; } Set<String> appRoles = getRolesForResource(user, resource); return hasAtLeastOneRole(appRoles, resourceAdminRole, expectedRoles); }
/** * Check if user is authorized * * @param user the user to check for * @param resource the resource to check for * @param resourceAdminRole the role which has the god/admin right on the resource * @param expectedRoles the role that the user is expected to have in order to have access to the resources * @return true if user has access, false otherwise */
Check if user is authorized
hasAuthorization
{ "repo_name": "alien4cloud/alien4cloud", "path": "alien4cloud-security/src/main/java/alien4cloud/security/AuthorizationUtil.java", "license": "apache-2.0", "size": 19983 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,434,517
public OffsetDateTime lastPasswordChangeDateTime() { return this.lastPasswordChangeDateTime; }
OffsetDateTime function() { return this.lastPasswordChangeDateTime; }
/** * Get the lastPasswordChangeDateTime property: The time when this Azure AD user last changed their password. The * date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, * 2014 would look like this: '2014-01-01T00:00:00Z'. * * @return the lastPasswordChangeDateTime value. */
Get the lastPasswordChangeDateTime property: The time when this Azure AD user last changed their password. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 would look like this: '2014-01-01T00:00:00Z'
lastPasswordChangeDateTime
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/MicrosoftGraphUserInner.java", "license": "mit", "size": 120247 }
[ "java.time.OffsetDateTime" ]
import java.time.OffsetDateTime;
import java.time.*;
[ "java.time" ]
java.time;
546,677
@Override @Deprecated MasterKeepAliveConnection getKeepAliveMasterService() throws MasterNotRunningException;
MasterKeepAliveConnection getKeepAliveMasterService() throws MasterNotRunningException;
/** * This function allows HBaseAdmin and potentially others to get a shared MasterService * connection. * @return The shared instance. Never returns null. * @throws MasterNotRunningException */
This function allows HBaseAdmin and potentially others to get a shared MasterService connection
getKeepAliveMasterService
{ "repo_name": "zshao/hbase-1.0.0-cdh5.4.1", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java", "license": "apache-2.0", "size": 10685 }
[ "org.apache.hadoop.hbase.MasterNotRunningException" ]
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,360,581
private void refreshConnectionTimeout(NetworkConnectivityReceiver networkConnectivityReceiver) { OkHttpClient.Builder builder = mOkHttpClient.newBuilder(); if (networkConnectivityReceiver.isConnected()) { float factor = networkConnectivityReceiver.getTimeoutScale(); builder .connectTimeout((int) (CONNECTION_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS) .readTimeout((int) (RestClientHttpClientFactory.READ_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS) .writeTimeout((int) (RestClientHttpClientFactory.WRITE_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS); Log.d(LOG_TAG, "## refreshConnectionTimeout() : update setConnectTimeout to " + (CONNECTION_TIMEOUT_MS * factor) + " ms"); Log.d(LOG_TAG, "## refreshConnectionTimeout() : update setReadTimeout to " + (RestClientHttpClientFactory.READ_TIMEOUT_MS * factor) + " ms"); Log.d(LOG_TAG, "## refreshConnectionTimeout() : update setWriteTimeout to " + (RestClientHttpClientFactory.WRITE_TIMEOUT_MS * factor) + " ms"); } else { builder.connectTimeout(1, TimeUnit.MILLISECONDS); Log.d(LOG_TAG, "## refreshConnectionTimeout() : update the requests timeout to 1 ms"); } // FIXME It has no effect to the rest client mOkHttpClient = builder.build(); }
void function(NetworkConnectivityReceiver networkConnectivityReceiver) { OkHttpClient.Builder builder = mOkHttpClient.newBuilder(); if (networkConnectivityReceiver.isConnected()) { float factor = networkConnectivityReceiver.getTimeoutScale(); builder .connectTimeout((int) (CONNECTION_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS) .readTimeout((int) (RestClientHttpClientFactory.READ_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS) .writeTimeout((int) (RestClientHttpClientFactory.WRITE_TIMEOUT_MS * factor), TimeUnit.MILLISECONDS); Log.d(LOG_TAG, STR + (CONNECTION_TIMEOUT_MS * factor) + STR); Log.d(LOG_TAG, STR + (RestClientHttpClientFactory.READ_TIMEOUT_MS * factor) + STR); Log.d(LOG_TAG, STR + (RestClientHttpClientFactory.WRITE_TIMEOUT_MS * factor) + STR); } else { builder.connectTimeout(1, TimeUnit.MILLISECONDS); Log.d(LOG_TAG, STR); } mOkHttpClient = builder.build(); }
/** * Refresh the connection timeouts. * * @param networkConnectivityReceiver the network connectivity receiver */
Refresh the connection timeouts
refreshConnectionTimeout
{ "repo_name": "matrix-org/matrix-android-sdk", "path": "matrix-sdk-core/src/main/java/org/matrix/androidsdk/RestClient.java", "license": "apache-2.0", "size": 14374 }
[ "java.util.concurrent.TimeUnit", "org.matrix.androidsdk.core.Log", "org.matrix.androidsdk.network.NetworkConnectivityReceiver" ]
import java.util.concurrent.TimeUnit; import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.network.NetworkConnectivityReceiver;
import java.util.concurrent.*; import org.matrix.androidsdk.core.*; import org.matrix.androidsdk.network.*;
[ "java.util", "org.matrix.androidsdk" ]
java.util; org.matrix.androidsdk;
2,451,196
@SuppressWarnings("unchecked") public Collection<T> nearestNeighbourSearch(int K, T value) { if (value == null || root == null) return Collections.EMPTY_LIST; // Map used for results TreeSet<KdNode> results = new TreeSet<KdNode>(new EuclideanComparator(value)); // Find the closest leaf node KdNode prev = null; KdNode node = root; while (node != null) { if (KdNode.compareTo(node.depth, node.k, value, node.id) <= 0) { // Lesser prev = node; node = node.lesser; } else { // Greater prev = node; node = node.greater; } } KdNode leaf = prev; if (leaf != null) { // Used to not re-examine nodes Set<KdNode> examined = new HashSet<KdNode>(); // Go up the tree, looking for better solutions node = leaf; while (node != null) { // Search node searchNode(value, node, K, results, examined); node = node.parent; } } // Load up the collection of the results Collection<T> collection = new ArrayList<T>(K); for (KdNode kdNode : results) collection.add((T) kdNode.id); return collection; }
@SuppressWarnings(STR) Collection<T> function(int K, T value) { if (value == null root == null) return Collections.EMPTY_LIST; TreeSet<KdNode> results = new TreeSet<KdNode>(new EuclideanComparator(value)); KdNode prev = null; KdNode node = root; while (node != null) { if (KdNode.compareTo(node.depth, node.k, value, node.id) <= 0) { prev = node; node = node.lesser; } else { prev = node; node = node.greater; } } KdNode leaf = prev; if (leaf != null) { Set<KdNode> examined = new HashSet<KdNode>(); node = leaf; while (node != null) { searchNode(value, node, K, results, examined); node = node.parent; } } Collection<T> collection = new ArrayList<T>(K); for (KdNode kdNode : results) collection.add((T) kdNode.id); return collection; }
/** * K Nearest Neighbor search * * @param K * Number of neighbors to retrieve. Can return more than K, if * last nodes are equal distances. * @param value * to find neighbors of. * @return Collection of T neighbors. */
K Nearest Neighbor search
nearestNeighbourSearch
{ "repo_name": "Maktub714/java-algorithms-implementation", "path": "src/com/jwetherell/algorithms/data_structures/KdTree.java", "license": "apache-2.0", "size": 21380 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "java.util.HashSet", "java.util.Set", "java.util.TreeSet" ]
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.TreeSet;
import java.util.*;
[ "java.util" ]
java.util;
233,762
void enterNormalClassDeclaration(@NotNull Java8Parser.NormalClassDeclarationContext ctx);
void enterNormalClassDeclaration(@NotNull Java8Parser.NormalClassDeclarationContext ctx);
/** * Enter a parse tree produced by {@link Java8Parser#normalClassDeclaration}. * * @param ctx the parse tree */
Enter a parse tree produced by <code>Java8Parser#normalClassDeclaration</code>
enterNormalClassDeclaration
{ "repo_name": "BigDaddy-Germany/WHOAMI", "path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java", "license": "mit", "size": 97945 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
100,166
public Optional<ConnectPoint> sink() { return sink; } /** * The source which has been removed or added.
Optional<ConnectPoint> function() { return sink; } /** * The source which has been removed or added.
/** * The sink which has been removed or added. The field may not be set * if the sink has not been detected yet or has been removed. * * @return an optional connect point */
The sink which has been removed or added. The field may not be set if the sink has not been detected yet or has been removed
sink
{ "repo_name": "kkkane/ONOS", "path": "core/api/src/main/java/org/onosproject/net/mcast/McastEvent.java", "license": "apache-2.0", "size": 3379 }
[ "java.util.Optional", "org.onosproject.net.ConnectPoint" ]
import java.util.Optional; import org.onosproject.net.ConnectPoint;
import java.util.*; import org.onosproject.net.*;
[ "java.util", "org.onosproject.net" ]
java.util; org.onosproject.net;
2,382,284
public static QDataSet fltarr(int len0) { return Ops.replicate(0.f, len0); }
static QDataSet function(int len0) { return Ops.replicate(0.f, len0); }
/** * create a dataset filled with zeros, stored in 4-byte floats. * @param len0 the zeroth dimension length * @return rank 1 dataset filled with zeros. * @see #zeros(int) * @see #dblarr(int) */
create a dataset filled with zeros, stored in 4-byte floats
fltarr
{ "repo_name": "autoplot/app", "path": "QDataSet/src/org/das2/qds/ops/Ops.java", "license": "gpl-2.0", "size": 492716 }
[ "org.das2.qds.QDataSet" ]
import org.das2.qds.QDataSet;
import org.das2.qds.*;
[ "org.das2.qds" ]
org.das2.qds;
524,899
public void addAttributes(Object... attributes) { if (attributes == null) { return; } for (int i = 0, length = attributes.length; i < length; ++ i) { Object name = attributes[i]; if (name == null) { ++ i; } else if (name instanceof Map) { for (Map.Entry<?, ?> entry : ((Map<?, ?>) name).entrySet()) { Object n = entry.getKey(); Object v = entry.getValue(); if (n != null && v != null) { getAttributes().put(n.toString(), v.toString()); } } } else { ++ i; if (i < length) { Object value = attributes[i]; if (value != null) { getAttributes().put(name.toString(), value.toString()); } } } } }
void function(Object... attributes) { if (attributes == null) { return; } for (int i = 0, length = attributes.length; i < length; ++ i) { Object name = attributes[i]; if (name == null) { ++ i; } else if (name instanceof Map) { for (Map.Entry<?, ?> entry : ((Map<?, ?>) name).entrySet()) { Object n = entry.getKey(); Object v = entry.getValue(); if (n != null && v != null) { getAttributes().put(n.toString(), v.toString()); } } } else { ++ i; if (i < length) { Object value = attributes[i]; if (value != null) { getAttributes().put(name.toString(), value.toString()); } } } } }
/** * Adds all given {@code attributes}. * * @param attributes May be {@code null}. */
Adds all given attributes
addAttributes
{ "repo_name": "iamedu/dari", "path": "util/src/main/java/com/psddev/dari/util/HtmlElement.java", "license": "bsd-3-clause", "size": 5071 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,106,943
@Override public ListenableFuture<TaskStatus> run(final Task task) { final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask; if ((pendingTask = pendingTasks.get(task.getId())) != null) { log.info("Assigned a task[%s] that is already pending, not doing anything", task.getId()); return pendingTask.getResult(); } else if ((runningTask = runningTasks.get(task.getId())) != null) { ZkWorker zkWorker = findWorkerRunningTask(task.getId()); if (zkWorker == null) { log.warn("Told to run task[%s], but no worker has started running it yet.", task.getId()); } else { log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost()); TaskAnnouncement announcement = zkWorker.getRunningTasks().get(task.getId()); if (announcement.getTaskStatus().isComplete()) { taskComplete(runningTask, zkWorker, announcement.getTaskStatus()); } } return runningTask.getResult(); } else if ((completeTask = completeTasks.get(task.getId())) != null) { return completeTask.getResult(); } else { return addPendingTask(task).getResult(); } }
ListenableFuture<TaskStatus> function(final Task task) { final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask; if ((pendingTask = pendingTasks.get(task.getId())) != null) { log.info(STR, task.getId()); return pendingTask.getResult(); } else if ((runningTask = runningTasks.get(task.getId())) != null) { ZkWorker zkWorker = findWorkerRunningTask(task.getId()); if (zkWorker == null) { log.warn(STR, task.getId()); } else { log.info(STR, task.getId(), zkWorker.getWorker().getHost()); TaskAnnouncement announcement = zkWorker.getRunningTasks().get(task.getId()); if (announcement.getTaskStatus().isComplete()) { taskComplete(runningTask, zkWorker, announcement.getTaskStatus()); } } return runningTask.getResult(); } else if ((completeTask = completeTasks.get(task.getId())) != null) { return completeTask.getResult(); } else { return addPendingTask(task).getResult(); } }
/** * A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task. * * @param task task to run */
A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task
run
{ "repo_name": "nvoron23/druid", "path": "indexing-service/src/main/java/io/druid/indexing/overlord/RemoteTaskRunner.java", "license": "apache-2.0", "size": 33692 }
[ "com.google.common.util.concurrent.ListenableFuture", "io.druid.indexing.common.TaskStatus", "io.druid.indexing.common.task.Task", "io.druid.indexing.worker.TaskAnnouncement" ]
import com.google.common.util.concurrent.ListenableFuture; import io.druid.indexing.common.TaskStatus; import io.druid.indexing.common.task.Task; import io.druid.indexing.worker.TaskAnnouncement;
import com.google.common.util.concurrent.*; import io.druid.indexing.common.*; import io.druid.indexing.common.task.*; import io.druid.indexing.worker.*;
[ "com.google.common", "io.druid.indexing" ]
com.google.common; io.druid.indexing;
108,774
public static <T> Task<T> async(final Callable<Promise<? extends T>> callable) { return async("async: " + _taskDescriptor.getDescription(callable.getClass().getName()), callable); } /** * Creates a new task from a callable that returns a {@link Promise}. * This method is mainly used to build functionality that has not been provided * by ParSeq API. It gives access to {@link Context} which allows scheduling * tasks in current plan. This method almost never should be necessary. If you * feel the need to use this method, please contact ParSeq team to help us * improve our API. * * @param <T> the type of the return value for this task * @param name a name that describes the task, it will show up in a trace * @param func a function to execute when this task is run, it must return * a {@code Promise<T>}
static <T> Task<T> function(final Callable<Promise<? extends T>> callable) { return async(STR + _taskDescriptor.getDescription(callable.getClass().getName()), callable); } /** * Creates a new task from a callable that returns a {@link Promise}. * This method is mainly used to build functionality that has not been provided * by ParSeq API. It gives access to {@link Context} which allows scheduling * tasks in current plan. This method almost never should be necessary. If you * feel the need to use this method, please contact ParSeq team to help us * improve our API. * * @param <T> the type of the return value for this task * @param name a name that describes the task, it will show up in a trace * @param func a function to execute when this task is run, it must return * a {@code Promise<T>}
/** * Equivalent to {@code async("async", callable)}. * @see #async(String, Callable) */
Equivalent to async("async", callable)
async
{ "repo_name": "linkedin/parseq", "path": "subprojects/parseq/src/main/java/com/linkedin/parseq/Task.java", "license": "apache-2.0", "size": 95879 }
[ "com.linkedin.parseq.promise.Promise", "java.util.concurrent.Callable" ]
import com.linkedin.parseq.promise.Promise; import java.util.concurrent.Callable;
import com.linkedin.parseq.promise.*; import java.util.concurrent.*;
[ "com.linkedin.parseq", "java.util" ]
com.linkedin.parseq; java.util;
17,229
default Stream<FedoraResource> getChildren() { return getChildren(false); }
default Stream<FedoraResource> getChildren() { return getChildren(false); }
/** * Get the children of this resource * @return a stream of Fedora resources */
Get the children of this resource
getChildren
{ "repo_name": "ajs6f/fcrepo4", "path": "fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/models/FedoraResource.java", "license": "apache-2.0", "size": 7827 }
[ "java.util.stream.Stream" ]
import java.util.stream.Stream;
import java.util.stream.*;
[ "java.util" ]
java.util;
1,005,744
public static EnumType getEnumType(Field f) { EnumType enumType = null; if (f.getType().isEnum()) { enumType = EnumType.DEFAULT_TYPE; if (f.getType().isAnnotationPresent(IQEnum.class)) { // enum definition is annotated for all instances IQEnum iqenum = f.getType().getAnnotation(IQEnum.class); enumType = iqenum.value(); } if (f.isAnnotationPresent(IQEnum.class)) { // this instance of the enum is annotated IQEnum iqenum = f.getAnnotation(IQEnum.class); enumType = iqenum.value(); } } return enumType; }
static EnumType function(Field f) { EnumType enumType = null; if (f.getType().isEnum()) { enumType = EnumType.DEFAULT_TYPE; if (f.getType().isAnnotationPresent(IQEnum.class)) { IQEnum iqenum = f.getType().getAnnotation(IQEnum.class); enumType = iqenum.value(); } if (f.isAnnotationPresent(IQEnum.class)) { IQEnum iqenum = f.getAnnotation(IQEnum.class); enumType = iqenum.value(); } } return enumType; }
/** * Identify the EnumType for the field. * * @param f * @return null or the EnumType */
Identify the EnumType for the field
getEnumType
{ "repo_name": "gitblit/iciql", "path": "src/main/java/com/iciql/util/Utils.java", "license": "apache-2.0", "size": 24100 }
[ "com.iciql.Iciql", "java.lang.reflect.Field" ]
import com.iciql.Iciql; import java.lang.reflect.Field;
import com.iciql.*; import java.lang.reflect.*;
[ "com.iciql", "java.lang" ]
com.iciql; java.lang;
1,082,437
static public int second() { return Calendar.getInstance().get(Calendar.SECOND); }
static int function() { return Calendar.getInstance().get(Calendar.SECOND); }
/** * ( begin auto-generated from second.xml ) Processing communicates with the clock on your * computer. The <b>second()</b> function returns the current second as a value from 0 - 59. ( * end auto-generated ) * * @webref input:time_date * @see PApplet#millis() * @see PApplet#minute() * @see PApplet#hour() * @see PApplet#day() * @see PApplet#month() * @see PApplet#year() */
( begin auto-generated from second.xml ) Processing communicates with the clock on your computer. The second() function returns the current second as a value from 0 - 59. ( end auto-generated )
second
{ "repo_name": "aarongolliver/FractalFlameV3", "path": "src/processing/core/PApplet.java", "license": "lgpl-2.1", "size": 507010 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
48,794
public void writePacketData(PacketBuffer p_148840_1_) throws IOException { p_148840_1_.writeInt(this.field_149424_a); p_148840_1_.writeByte(this.field_149423_b); }
void function(PacketBuffer p_148840_1_) throws IOException { p_148840_1_.writeInt(this.field_149424_a); p_148840_1_.writeByte(this.field_149423_b); }
/** * Writes the raw packet data to the data stream. */
Writes the raw packet data to the data stream
writePacketData
{ "repo_name": "mviitanen/marsmod", "path": "mcp/src/minecraft/net/minecraft/network/play/client/C0APacketAnimation.java", "license": "gpl-2.0", "size": 1855 }
[ "java.io.IOException", "net.minecraft.network.PacketBuffer" ]
import java.io.IOException; import net.minecraft.network.PacketBuffer;
import java.io.*; import net.minecraft.network.*;
[ "java.io", "net.minecraft.network" ]
java.io; net.minecraft.network;
921,454
public List<TableColumn> getColumns(boolean onlyVisible) { return Collections.unmodifiableList(getColumnsFast(onlyVisible)); }
List<TableColumn> function(boolean onlyVisible) { return Collections.unmodifiableList(getColumnsFast(onlyVisible)); }
/** * Returns all the columns in the model. * * @param onlyVisible if set all invisible columns will be missing from the result. * @return the columns in the model */
Returns all the columns in the model
getColumns
{ "repo_name": "mbshopM/openconcerto", "path": "OpenConcerto/src/org/openconcerto/ui/table/XTableColumnModel.java", "license": "gpl-3.0", "size": 10860 }
[ "java.util.Collections", "java.util.List", "javax.swing.table.TableColumn" ]
import java.util.Collections; import java.util.List; import javax.swing.table.TableColumn;
import java.util.*; import javax.swing.table.*;
[ "java.util", "javax.swing" ]
java.util; javax.swing;
289,428
@GET(DOCTOR_SEARCHCHECKINS_PATH) public ArrayList<Checkin> searchPatientCheckins(@Path(DOCTOR_ID) Long doctorId);
@GET(DOCTOR_SEARCHCHECKINS_PATH) ArrayList<Checkin> function(@Path(DOCTOR_ID) Long doctorId);
/** * This method returns the new doctor patients' checkins information. Only Doctors can call this method. * Once the checkins are returned, they will never be returned again. * * @param doctorId a Long with database doctor Id * @return an ArrayList<Checkin>. Every Checkin object contains CheckinMedication list * @see org.coursera.symptomserver.beans.jpa.Checkin */
This method returns the new doctor patients' checkins information. Only Doctors can call this method. Once the checkins are returned, they will never be returned again
searchPatientCheckins
{ "repo_name": "estebanluengo/symptommanagment", "path": "Symptom/src/org/coursera/symptom/client/SymptomSvcApi.java", "license": "apache-2.0", "size": 10921 }
[ "java.util.ArrayList", "org.coursera.symptom.orm.Checkin" ]
import java.util.ArrayList; import org.coursera.symptom.orm.Checkin;
import java.util.*; import org.coursera.symptom.orm.*;
[ "java.util", "org.coursera.symptom" ]
java.util; org.coursera.symptom;
2,423,790
private String createAuditApi(String collectionId, String apiToken, APIIdentifier apiIdentifier, String apiDefinition, String baseUrl, boolean isDebugEnabled) throws IOException, APIManagementException, ParseException { HttpURLConnection httpConn; OutputStream outputStream; PrintWriter writer; String auditUuid = null; URL url = new URL(baseUrl); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); // indicates POST method httpConn.setDoInput(true); httpConn.setRequestProperty(APIConstants.HEADER_CONTENT_TYPE, APIConstants.MULTIPART_CONTENT_TYPE + APIConstants.MULTIPART_FORM_BOUNDARY); httpConn.setRequestProperty(APIConstants.HEADER_ACCEPT, APIConstants.APPLICATION_JSON_MEDIA_TYPE); httpConn.setRequestProperty(APIConstants.HEADER_API_TOKEN, apiToken); httpConn.setRequestProperty(APIConstants.HEADER_USER_AGENT, APIConstants.USER_AGENT_APIM); outputStream = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), true); // Name property writer.append("--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append("Content-Disposition: form-data; name=\"name\"") .append(APIConstants.MULTIPART_LINE_FEED).append(APIConstants.MULTIPART_LINE_FEED) .append(apiIdentifier.getApiName()).append(APIConstants.MULTIPART_LINE_FEED); writer.flush(); // Specfile property writer.append("--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append("Content-Disposition: form-data; name=\"specfile\"; filename=\"swagger.json\"") .append(APIConstants.MULTIPART_LINE_FEED) .append(APIConstants.HEADER_CONTENT_TYPE + ": " + APIConstants.APPLICATION_JSON_MEDIA_TYPE) .append(APIConstants.MULTIPART_LINE_FEED).append(APIConstants.MULTIPART_LINE_FEED) .append(apiDefinition).append(APIConstants.MULTIPART_LINE_FEED); writer.flush(); // CollectionID property writer.append("--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append("Content-Disposition: form-data; name=\"cid\"").append(APIConstants.MULTIPART_LINE_FEED) .append(APIConstants.MULTIPART_LINE_FEED).append(collectionId) .append(APIConstants.MULTIPART_LINE_FEED); writer.flush(); writer.append("--" + APIConstants.MULTIPART_FORM_BOUNDARY + "--") .append(APIConstants.MULTIPART_LINE_FEED); writer.close(); // Checks server's status code first int status = httpConn.getResponseCode(); if (status == HttpURLConnection.HTTP_OK) { if (isDebugEnabled) { log.debug("HTTP status " + status); } BufferedReader reader = new BufferedReader( new InputStreamReader(httpConn.getInputStream(), StandardCharsets.UTF_8)); String inputLine; StringBuilder responseString = new StringBuilder(); while ((inputLine = reader.readLine()) != null) { responseString.append(inputLine); } reader.close(); httpConn.disconnect(); JSONObject responseJson = (JSONObject) new JSONParser().parse(responseString.toString()); auditUuid = (String) ((JSONObject) responseJson.get(APIConstants.DESC)).get(APIConstants.ID); ApiMgtDAO.getInstance().addAuditApiMapping(apiIdentifier, auditUuid); } else { throw new APIManagementException( "Error while retrieving data for the API Security Audit Report. Found http status: " + httpConn.getResponseCode() + " - " + httpConn.getResponseMessage()); } return auditUuid; }
String function(String collectionId, String apiToken, APIIdentifier apiIdentifier, String apiDefinition, String baseUrl, boolean isDebugEnabled) throws IOException, APIManagementException, ParseException { HttpURLConnection httpConn; OutputStream outputStream; PrintWriter writer; String auditUuid = null; URL url = new URL(baseUrl); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); httpConn.setDoInput(true); httpConn.setRequestProperty(APIConstants.HEADER_CONTENT_TYPE, APIConstants.MULTIPART_CONTENT_TYPE + APIConstants.MULTIPART_FORM_BOUNDARY); httpConn.setRequestProperty(APIConstants.HEADER_ACCEPT, APIConstants.APPLICATION_JSON_MEDIA_TYPE); httpConn.setRequestProperty(APIConstants.HEADER_API_TOKEN, apiToken); httpConn.setRequestProperty(APIConstants.HEADER_USER_AGENT, APIConstants.USER_AGENT_APIM); outputStream = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), true); writer.append("--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append(STRname\STR--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append(STRspecfile\"; filename=\STRSTR: STR--" + APIConstants.MULTIPART_FORM_BOUNDARY).append(APIConstants.MULTIPART_LINE_FEED) .append(STRcid\"STR--STR--STRHTTP status STRError while retrieving data for the API Security Audit Report. Found http status: STR - " + httpConn.getResponseMessage()); } return auditUuid; }
/** * Send API Definition to Security Audit for the first time * @param collectionId Collection ID in which the Definition should be sent to * @param apiToken API Token to access Security Audit * @param apiIdentifier API Identifier object * @param apiDefinition API Definition of API * @param baseUrl Base URL to communicate with Security Audit * @param isDebugEnabled Boolean whether debug is enabled * @return String UUID of API in Security Audit * @throws IOException In the event of any problems in the request * @throws APIManagementException In the event of unexpected response * @throws ParseException In the event of any parse errors from the response */
Send API Definition to Security Audit for the first time
createAuditApi
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java", "license": "apache-2.0", "size": 253126 }
[ "java.io.IOException", "java.io.OutputStream", "java.io.OutputStreamWriter", "java.io.PrintWriter", "java.net.HttpURLConnection", "java.nio.charset.StandardCharsets", "org.json.simple.parser.ParseException", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.APIId...
import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; import org.json.simple.parser.ParseException; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.impl.APIConstants;
import java.io.*; import java.net.*; import java.nio.charset.*; import org.json.simple.parser.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*;
[ "java.io", "java.net", "java.nio", "org.json.simple", "org.wso2.carbon" ]
java.io; java.net; java.nio; org.json.simple; org.wso2.carbon;
1,753,095
EReference getMetamodel_ExtractedMetamodel();
EReference getMetamodel_ExtractedMetamodel();
/** * Returns the meta object for the containment reference '{@link bento.componetization.reveng.Metamodel#getExtractedMetamodel <em>Extracted Metamodel</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Extracted Metamodel</em>'. * @see bento.componetization.reveng.Metamodel#getExtractedMetamodel() * @see #getMetamodel() * @generated */
Returns the meta object for the containment reference '<code>bento.componetization.reveng.Metamodel#getExtractedMetamodel Extracted Metamodel</code>'.
getMetamodel_ExtractedMetamodel
{ "repo_name": "jesusc/bento", "path": "componetization/bento.componetization.model/src-gen/bento/componetization/reveng/RevengPackage.java", "license": "epl-1.0", "size": 26106 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,149,462
private StringBuffer singleFieldToPigScript(FieldDescriptor fieldDescriptor, int numTabs, boolean isLast) throws FrontendException { assert fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE : "singleFieldToPigScript called with field of type " + fieldDescriptor.getType(); if (fieldDescriptor.isRepeated()) { return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append("_bag: bag {").append("\n") .append(tabs(numTabs + 1)).append(fieldDescriptor.getName()).append("_tuple: tuple (").append("\n") .append(tabs(numTabs + 2)).append(fieldDescriptor.getName()).append(": ").append(getPigScriptDataType(fieldDescriptor)).append("\n") .append(tabs(numTabs + 1)).append(")").append("\n") .append(tabs(numTabs)).append("}").append(isLast ? "" : ",").append("\n"); } else { return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append(": ") .append(getPigScriptDataType(fieldDescriptor)).append(isLast ? "" : ",").append("\n"); } }
StringBuffer function(FieldDescriptor fieldDescriptor, int numTabs, boolean isLast) throws FrontendException { assert fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE : STR + fieldDescriptor.getType(); if (fieldDescriptor.isRepeated()) { return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append(STR).append("\n") .append(tabs(numTabs + 1)).append(fieldDescriptor.getName()).append(STR).append("\n") .append(tabs(numTabs + 2)).append(fieldDescriptor.getName()).append(STR).append(getPigScriptDataType(fieldDescriptor)).append("\n") .append(tabs(numTabs + 1)).append(")STR\n") .append(tabs(numTabs)).append("}").append(isLast ? STR,STR\n"); } else { return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append(STR) .append(getPigScriptDataType(fieldDescriptor)).append(isLast ? STR,STR\n"); } }
/** * Turn a single field into a pig script load string. For repeated single fields, it generates a string for a bag of single-item tuples. * For non-repeated fields, it just generates a standard single-element string. * @param fieldDescriptor the descriptor object for the given field. * @param numTabs the tab depth at the current point in the recursion, for pretty printing. * @return the pig script load string for the nested message. * @throws FrontendException if Pig decides to. */
Turn a single field into a pig script load string. For repeated single fields, it generates a string for a bag of single-item tuples. For non-repeated fields, it just generates a standard single-element string
singleFieldToPigScript
{ "repo_name": "ketralnis/elephant-bird", "path": "src/java/com/twitter/elephantbird/pig/util/ProtobufToPig.java", "license": "apache-2.0", "size": 22800 }
[ "com.google.protobuf.Descriptors", "org.apache.pig.impl.logicalLayer.FrontendException" ]
import com.google.protobuf.Descriptors; import org.apache.pig.impl.logicalLayer.FrontendException;
import com.google.protobuf.*; import org.apache.pig.impl.*;
[ "com.google.protobuf", "org.apache.pig" ]
com.google.protobuf; org.apache.pig;
1,538,212
public static void setMillisecondsUntilLocked(int ms) { Properties pm; try { pm = PropertiesManager.getInstance(); pm.setProperty(PropertiesManager.MILLISECONDS_UNTIL_LOCKED, ms + ""); PropertiesManager.commit(); } catch (IOException ex) { Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex); } }
static void function(int ms) { Properties pm; try { pm = PropertiesManager.getInstance(); pm.setProperty(PropertiesManager.MILLISECONDS_UNTIL_LOCKED, ms + ""); PropertiesManager.commit(); } catch (IOException ex) { Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex); } }
/** * This method sets a persistent value. * * @param ms */
This method sets a persistent value
setMillisecondsUntilLocked
{ "repo_name": "matthew-macgregor/isecurepasswords", "path": "iSecurePasswords/src/com/sudolink/isp/app/Application.java", "license": "gpl-3.0", "size": 12064 }
[ "java.io.IOException", "java.util.Properties", "java.util.logging.Level", "java.util.logging.Logger" ]
import java.io.IOException; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger;
import java.io.*; import java.util.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,711,123
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "jacksonokuhn/dataverse", "path": "src/main/java/edu/harvard/iq/dataverse/HomepageServlet.java", "license": "apache-2.0", "size": 2970 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
214,899
@ApiModelProperty(required = true, value = "Valid order range, numbers are ranges in jumps") public RangeEnum getRange() { if (rangeEnum == null) { rangeEnum = RangeEnum.fromValue(range); } return rangeEnum; }
@ApiModelProperty(required = true, value = STR) RangeEnum function() { if (rangeEnum == null) { rangeEnum = RangeEnum.fromValue(range); } return rangeEnum; }
/** * Valid order range, numbers are ranges in jumps * * @return range **/
Valid order range, numbers are ranges in jumps
getRange
{ "repo_name": "burberius/eve-esi", "path": "src/main/java/net/troja/eve/esi/model/CharacterOrdersHistoryResponse.java", "license": "apache-2.0", "size": 17989 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
136,394
UndoableEdit removeLinkInternal(Link link) { CompoundEdit edit = new CompoundEdit(); UndoableEdit unselectionEdit = changeLinkSelectionInternal( Collections.emptySet(), Collections.singleton(link)); if (unselectionEdit != null) { edit.addEdit(unselectionEdit); } MutableFlow flow = flowWorkspace.getFlow(); flow.removeLink(link); UndoableEdit deletionEdit = new LinkDeletionEdit(this, link); edit.addEdit(deletionEdit); edit.end(); return edit; }
UndoableEdit removeLinkInternal(Link link) { CompoundEdit edit = new CompoundEdit(); UndoableEdit unselectionEdit = changeLinkSelectionInternal( Collections.emptySet(), Collections.singleton(link)); if (unselectionEdit != null) { edit.addEdit(unselectionEdit); } MutableFlow flow = flowWorkspace.getFlow(); flow.removeLink(link); UndoableEdit deletionEdit = new LinkDeletionEdit(this, link); edit.addEdit(deletionEdit); edit.end(); return edit; }
/** * Remove the given {@link Link} from the currently edited * {@link MutableFlow}. * * @param link The {@link Link} to remove * @return The UndoableEdit describing the modification */
Remove the given <code>Link</code> from the currently edited <code>MutableFlow</code>
removeLinkInternal
{ "repo_name": "javagl/Flow", "path": "flow-gui/src/main/java/de/javagl/flow/gui/editor/FlowEditor.java", "license": "mit", "size": 25957 }
[ "de.javagl.flow.MutableFlow", "de.javagl.flow.link.Link", "java.util.Collections", "javax.swing.undo.CompoundEdit", "javax.swing.undo.UndoableEdit" ]
import de.javagl.flow.MutableFlow; import de.javagl.flow.link.Link; import java.util.Collections; import javax.swing.undo.CompoundEdit; import javax.swing.undo.UndoableEdit;
import de.javagl.flow.*; import de.javagl.flow.link.*; import java.util.*; import javax.swing.undo.*;
[ "de.javagl.flow", "java.util", "javax.swing" ]
de.javagl.flow; java.util; javax.swing;
2,719,590
public void putParams(final Map<String, String> args) { args.put("api_key", this.apiKey); }
void function(final Map<String, String> args) { args.put(STR, this.apiKey); }
/** * Write parameters values for the request. * * @param args Map of Parameter/Value to send to the API */
Write parameters values for the request
putParams
{ "repo_name": "ghusse/Dolomite", "path": "src/com/ghusse/dolomite/flickr/Credentials.java", "license": "gpl-3.0", "size": 911 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,115,160
private static long getFragment(final Date date, final int fragment, final TimeUnit unit) { if(date == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return getFragment(calendar, fragment, unit); }
static long function(final Date date, final int fragment, final TimeUnit unit) { if(date == null) { throw new IllegalArgumentException(STR); } final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return getFragment(calendar, fragment, unit); }
/** * Gets a Date fragment for any unit. * * @param date the date to work with, not null * @param fragment the Calendar field part of date to calculate * @param unit the time unit * @return number of units within the fragment of the date * @throws IllegalArgumentException if the date is <code>null</code> or * fragment is not supported * @since 2.4 */
Gets a Date fragment for any unit
getFragment
{ "repo_name": "tdopires/cJUnit-mc626", "path": "toStringBuilder/src/main/java/org/apache/commons/lang3/time/DateUtils.java", "license": "apache-2.0", "size": 81435 }
[ "java.util.Calendar", "java.util.Date", "java.util.concurrent.TimeUnit" ]
import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,260,148
public static InboundQueueEvent createInboundQueueEvent(AMQQueue amqQueue) { String queueName = amqQueue.getName(); String queueOwner = (amqQueue.getOwner() != null) ? amqQueue.getOwner().toString() : "null"; return new InboundQueueEvent(queueName, amqQueue.isDurable(), true, queueOwner, amqQueue.isExclusive()); }
static InboundQueueEvent function(AMQQueue amqQueue) { String queueName = amqQueue.getName(); String queueOwner = (amqQueue.getOwner() != null) ? amqQueue.getOwner().toString() : "null"; return new InboundQueueEvent(queueName, amqQueue.isDurable(), true, queueOwner, amqQueue.isExclusive()); }
/** * convert qpid queue to Andes queue * * @param amqQueue qpid queue * @return andes queue */
convert qpid queue to Andes queue
createInboundQueueEvent
{ "repo_name": "hastef88/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/amqp/AMQPUtils.java", "license": "apache-2.0", "size": 17581 }
[ "org.wso2.andes.kernel.disruptor.inbound.InboundQueueEvent", "org.wso2.andes.server.queue.AMQQueue" ]
import org.wso2.andes.kernel.disruptor.inbound.InboundQueueEvent; import org.wso2.andes.server.queue.AMQQueue;
import org.wso2.andes.kernel.disruptor.inbound.*; import org.wso2.andes.server.queue.*;
[ "org.wso2.andes" ]
org.wso2.andes;
317,801
public void setCurrentDirectory(File dir) { if (currentDir != dir || dir == null) { if (dir == null) dir = fsv.getDefaultDirectory(); File old = currentDir; currentDir = dir; firePropertyChange(DIRECTORY_CHANGED_PROPERTY, old, currentDir); } }
void function(File dir) { if (currentDir != dir dir == null) { if (dir == null) dir = fsv.getDefaultDirectory(); File old = currentDir; currentDir = dir; firePropertyChange(DIRECTORY_CHANGED_PROPERTY, old, currentDir); } }
/** * Sets the current directory and fires a {@link PropertyChangeEvent} (with * the property name {@link #DIRECTORY_CHANGED_PROPERTY}) to all registered * listeners. If <code>dir</code> is <code>null</code>, the current * directory is set to the default directory returned by the file system * view. * * @param dir the new directory (<code>null</code> permitted). * * @see FileSystemView#getDefaultDirectory() */
Sets the current directory and fires a <code>PropertyChangeEvent</code> (with the property name <code>#DIRECTORY_CHANGED_PROPERTY</code>) to all registered listeners. If <code>dir</code> is <code>null</code>, the current directory is set to the default directory returned by the file system view
setCurrentDirectory
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/JFileChooser.java", "license": "gpl-2.0", "size": 44341 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,970,367
public GroupRoleDto setGroupId(@Nullable Long groupId) { this.groupId = groupId; return this; }
GroupRoleDto function(@Nullable Long groupId) { this.groupId = groupId; return this; }
/** * Null when Anyone */
Null when Anyone
setGroupId
{ "repo_name": "xinghuangxu/xinghuangxu.sonarqube", "path": "sonar-core/src/main/java/org/sonar/core/user/GroupRoleDto.java", "license": "lgpl-3.0", "size": 1746 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,191,467
public Color getMarkAllHighlightColor() { return (Color) markAllHighlightPainter.getPaint(); }
Color function() { return (Color) markAllHighlightPainter.getPaint(); }
/** * Returns the color used in "mark all." * * @return The color. * @see #setMarkAllHighlightColor(Color) */
Returns the color used in "mark all."
getMarkAllHighlightColor
{ "repo_name": "kevinmcgoldrick/Tank", "path": "tools/agent_debugger/src/main/java/org/fife/ui/rtextarea/RTextArea.java", "license": "epl-1.0", "size": 54300 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,121,242
@Nonnull default EChange addAll (@Nullable final Iterable <? extends ELEMENTTYPE> aElements) { EChange eChange = EChange.UNCHANGED; if (aElements != null) for (final ELEMENTTYPE aElement : aElements) eChange = eChange.or (add (aElement)); return eChange; }
default EChange addAll (@Nullable final Iterable <? extends ELEMENTTYPE> aElements) { EChange eChange = EChange.UNCHANGED; if (aElements != null) for (final ELEMENTTYPE aElement : aElements) eChange = eChange.or (add (aElement)); return eChange; }
/** * Add all elements of the passed iterable to this collection. * * @param aElements * The elements to be added. May be <code>null</code>. * @return {@link EChange#CHANGED} if at least one element was added, * {@link EChange#UNCHANGED}. Never <code>null</code>. */
Add all elements of the passed iterable to this collection
addAll
{ "repo_name": "phax/ph-commons", "path": "ph-commons/src/main/java/com/helger/commons/collection/impl/ICommonsCollection.java", "license": "apache-2.0", "size": 30543 }
[ "com.helger.commons.state.EChange", "javax.annotation.Nullable" ]
import com.helger.commons.state.EChange; import javax.annotation.Nullable;
import com.helger.commons.state.*; import javax.annotation.*;
[ "com.helger.commons", "javax.annotation" ]
com.helger.commons; javax.annotation;
1,042,742
private RowProcessingStatus updateTermDatabase(DodDrugRowMapping oDodDrugRowMapping) throws TermLoadException { RowProcessingStatus eProcessingStatus = null; if (NullChecker.isNullish(oDodDrugRowMapping.getDodNcid())) { throw new TermLoadException("Row did not contain a valid DoD NCID."); } String sDodNcidUrn = "urn:ncid:" + oDodDrugRowMapping.getDodNcid(); Concept oDodConcept = retrieveConcept(sDodNcidUrn); if (oDodConcept == null) { createConcept(oDodDrugRowMapping); if (NullChecker.isNotNullish(oDodDrugRowMapping.getRxnormCode())) { if (isAlreadyMappedToAnother(oDodDrugRowMapping.getRxnormCode(), "ncid")) { outputRowMessage("Status", "Cannot Add Mapping: RxNorm Code: " + oDodDrugRowMapping.getRxnormCode() + " has already been mapped to another DOD NCID.", oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_MAPPING_COLLIDED; } else if (!doesConceptExist("urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode())) { outputRowMessage("Status", "Cannot Add Mapping: RxNorm Code: " + oDodDrugRowMapping.getRxnormCode() + " does not exist in the database.", oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_RXNORM_NOT_EXIST; } else { addSameAsItem(sDodNcidUrn, "urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode()); addSameAsItem("urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_WITH_MAPPING; } } else { eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_NO_MAPPING; } } else { if (NullChecker.isNotNullish(oDodDrugRowMapping.getRxnormCode())) { if (isAlreadyMapped(oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn)) { eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_EXISTED; } else if (isAlreadyMappedToAnother(oDodDrugRowMapping.getRxnormCode(), "ncid")) { outputRowMessage("Status", "Cannot Add Mapping: RxNorm Code: " + oDodDrugRowMapping.getRxnormCode() + " has already been mapped to another DOD NCID.", oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_COLLIDED; } else if (!doesConceptExist("urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode())) { outputRowMessage("Status", "Cannot Add Mapping: RxNorm Code: " + oDodDrugRowMapping.getRxnormCode() + " does not exist in the database.", oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_RXNORM_NOT_EXIST; } else { addSameAsItem(sDodNcidUrn, "urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode()); addSameAsItem("urn:rxnorm:" + oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_ADDED; } } } return eProcessingStatus; }
RowProcessingStatus function(DodDrugRowMapping oDodDrugRowMapping) throws TermLoadException { RowProcessingStatus eProcessingStatus = null; if (NullChecker.isNullish(oDodDrugRowMapping.getDodNcid())) { throw new TermLoadException(STR); } String sDodNcidUrn = STR + oDodDrugRowMapping.getDodNcid(); Concept oDodConcept = retrieveConcept(sDodNcidUrn); if (oDodConcept == null) { createConcept(oDodDrugRowMapping); if (NullChecker.isNotNullish(oDodDrugRowMapping.getRxnormCode())) { if (isAlreadyMappedToAnother(oDodDrugRowMapping.getRxnormCode(), "ncid")) { outputRowMessage(STR, STR + oDodDrugRowMapping.getRxnormCode() + STR, oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_MAPPING_COLLIDED; } else if (!doesConceptExist(STR + oDodDrugRowMapping.getRxnormCode())) { outputRowMessage(STR, STR + oDodDrugRowMapping.getRxnormCode() + STR, oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_RXNORM_NOT_EXIST; } else { addSameAsItem(sDodNcidUrn, STR + oDodDrugRowMapping.getRxnormCode()); addSameAsItem(STR + oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_WITH_MAPPING; } } else { eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_CREATED_NO_MAPPING; } } else { if (NullChecker.isNotNullish(oDodDrugRowMapping.getRxnormCode())) { if (isAlreadyMapped(oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn)) { eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_EXISTED; } else if (isAlreadyMappedToAnother(oDodDrugRowMapping.getRxnormCode(), "ncid")) { outputRowMessage(STR, STR + oDodDrugRowMapping.getRxnormCode() + STR, oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_COLLIDED; } else if (!doesConceptExist(STR + oDodDrugRowMapping.getRxnormCode())) { outputRowMessage(STR, STR + oDodDrugRowMapping.getRxnormCode() + STR, oDodDrugRowMapping); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_RXNORM_NOT_EXIST; } else { addSameAsItem(sDodNcidUrn, STR + oDodDrugRowMapping.getRxnormCode()); addSameAsItem(STR + oDodDrugRowMapping.getRxnormCode(), sDodNcidUrn); eProcessingStatus = RowProcessingStatus.DOD_MAP_CONCEPT_EXISTED_MAPPING_ADDED; } } } return eProcessingStatus; }
/** * This method takes the information in the given row and updates the terminology database with the information. * * @param oDodDrugRowMapping The drug information in a single row of the JLV DoD medication load table. */
This method takes the information in the given row and updates the terminology database with the information
updateTermDatabase
{ "repo_name": "KRMAssociatesInc/eHMP", "path": "ehmp/product/production/soap-handler/src/main/java/us/vistacore/vxsync/term/jlv/JLVDrugLoadUtil.java", "license": "apache-2.0", "size": 54259 }
[ "us.vistacore.vxsync.term.hmp.Concept", "us.vistacore.vxsync.term.hmp.TermLoadException", "us.vistacore.vxsync.utility.NullChecker" ]
import us.vistacore.vxsync.term.hmp.Concept; import us.vistacore.vxsync.term.hmp.TermLoadException; import us.vistacore.vxsync.utility.NullChecker;
import us.vistacore.vxsync.term.hmp.*; import us.vistacore.vxsync.utility.*;
[ "us.vistacore.vxsync" ]
us.vistacore.vxsync;
917,462
public static void setField(final Object parent, final String name, final Object obj) { try { final Field f = findField(parent.getClass(), name); f.setAccessible(true); f.set(parent, obj); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { throw new RuntimeException(e); } }
static void function(final Object parent, final String name, final Object obj) { try { final Field f = findField(parent.getClass(), name); f.setAccessible(true); f.set(parent, obj); } catch (IllegalArgumentException IllegalAccessException NoSuchFieldException e) { throw new RuntimeException(e); } }
/** * Set a field via reflection * * @param parent the owner object of the field * @param name the name of the field * @param obj the value to set */
Set a field via reflection
setField
{ "repo_name": "bbranan/fcrepo4", "path": "fcrepo-http-commons/src/test/java/org/fcrepo/http/commons/test/util/TestHelpers.java", "license": "apache-2.0", "size": 13472 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,933,814
public int whichSide(Plane plane) { // float distance = plane.pseudoDistance(center); // if (distance <= -radius) { return Side.NEGATIVE; } // if (distance >= radius) { return Side.POSITIVE; } // return Side.NONE; int side = plane.classifyPoint(center); return side; } // // public BoundingVolume merge(BoundingVolume volume) { // if (volume == null) { // return this; // } // // switch(volume.getType()) { // // case Sphere: { // BoundingSphere sphere = (BoundingSphere) volume; // float temp_radius = sphere.getRadius(); // Vector3D temp_center = sphere.getCenter(); // BoundingSphere rVal = new BoundingSphere(); // return merge(temp_radius, temp_center, rVal); // } // // case Capsule: { // BoundingCapsule capsule = (BoundingCapsule) volume; // float temp_radius = capsule.getRadius() // + capsule.getLineSegment().getExtent(); // Vector3D temp_center = capsule.getCenter(); // BoundingSphere rVal = new BoundingSphere(); // return merge(temp_radius, temp_center, rVal); // } // // case AABB: { // BoundingBox box = (BoundingBox) volume; // Vector3D radVect = new Vector3D(box.xExtent, box.yExtent, // box.zExtent); // Vector3D temp_center = box.center; // BoundingSphere rVal = new BoundingSphere(); // return merge(radVect.length(), temp_center, rVal); // } // // case OBB: { // OrientedBoundingBox box = (OrientedBoundingBox) volume; // BoundingSphere rVal = (BoundingSphere) this.clone(null); // return rVal.mergeOBB(box); // } // // default: // return null; // // } // } private Vector3D tmpRadVect = new Vector3D(); // // public BoundingVolume mergeLocal(BoundingVolume volume) { // if (volume == null) { // return this; // } // // switch (volume.getType()) { // // case Sphere: { // BoundingSphere sphere = (BoundingSphere) volume; // float temp_radius = sphere.getRadius(); // Vector3D temp_center = sphere.getCenter(); // return merge(temp_radius, temp_center, this); // } // // case AABB: { // BoundingBox box = (BoundingBox) volume; // Vector3D radVect = tmpRadVect; // radVect.set(box.xExtent, box.yExtent, box.zExtent); // Vector3D temp_center = box.center; // return merge(radVect.length(), temp_center, this); // } // // case OBB: { // return mergeOBB((OrientedBoundingBox) volume); // } // // case Capsule: { // BoundingCapsule capsule = (BoundingCapsule) volume; // return merge(capsule.getRadius() + capsule.getLineSegment().getExtent(), // capsule.getCenter(), this); // } // // default: // return null; // } // } // // private BoundingSphere mergeOBB(OrientedBoundingBox volume) { // // compute edge points from the obb // if (!volume.correctCorners) // volume.computeCorners(); // _mergeBuf.rewind(); // for (int i = 0; i < 8; i++) { // _mergeBuf.put(volume.vectorStore[i].x); // _mergeBuf.put(volume.vectorStore[i].y); // _mergeBuf.put(volume.vectorStore[i].z); // } // // // remember old radius and center // float oldRadius = radius; // Vector3D oldCenter = _compVect2.set( center ); // // // compute new radius and center from obb points // computeFromPoints(_mergeBuf); // Vector3D newCenter = _compVect3.set( center ); // float newRadius = radius; // // // restore old center and radius // center.set( oldCenter ); // radius = oldRadius; // // //merge obb points result // merge( newRadius, newCenter, this ); // // return this; // } // // private BoundingVolume merge(float temp_radius, Vector3D temp_center, // BoundingSphere rVal) { // Vector3D diff = temp_center.subtract(center, _compVect1); // float lengthSquared = diff.lengthSquared(); // float radiusDiff = temp_radius - radius; // // float fRDiffSqr = radiusDiff * radiusDiff; // // if (fRDiffSqr >= lengthSquared) { // if (radiusDiff <= 0.0f) { // return this; // } // // Vector3D rCenter = rVal.getCenter(); // if ( rCenter == null ) { // rVal.setCenter( rCenter = new Vector3D() ); // } // rCenter.set(temp_center); // rVal.setRadius(temp_radius); // return rVal; // } // // float length = (float) Math.sqrt(lengthSquared); // // Vector3D rCenter = rVal.getCenter(); // if ( rCenter == null ) { // rVal.setCenter( rCenter = new Vector3D() ); // } // if (length > radiusEpsilon) { // float coeff = (length + radiusDiff) / (2.0f * length); // rCenter.set(center.addLocal(diff.multLocal(coeff))); // } else { // rCenter.set(center); // } // // rVal.setRadius(0.5f * (length + radius + temp_radius)); // return rVal; // }
int function(Plane plane) { int side = plane.classifyPoint(center); return side; } private Vector3D tmpRadVect = new Vector3D();
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane the plane to check against. * * @return int */
<code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is on
whichSide
{ "repo_name": "Max90/MT4j_Breakout", "path": "src/org/mt4j/components/bounds/BoundingSphere.java", "license": "gpl-2.0", "size": 43006 }
[ "org.mt4j.util.math.Plane", "org.mt4j.util.math.Vector3D" ]
import org.mt4j.util.math.Plane; import org.mt4j.util.math.Vector3D;
import org.mt4j.util.math.*;
[ "org.mt4j.util" ]
org.mt4j.util;
782,822
@Override public void update(Observable o, Object arg) { if ((o instanceof AEChip) && (o instanceof HasSyncEventOutput)) { // if hw interface is not correct type then disable menu items if (syncEnabledMenuItem != null) { syncEnabledMenuItem.setEnabled(false); } } else { syncEnabledMenuItem.setEnabled(true); syncEnabledMenuItem.setSelected(isSyncEventEnabled()); if (!isSyncEventEnabled()) { WarningDialogWithDontShowPreference d = new WarningDialogWithDontShowPreference(null, false, "Timestamps disabled", "<html>Timestamps may not advance if you are using the DVS128 as a standalone camera. <br>Use CochleaAMS/Timestamp master / Enable sync event output to enable them."); d.setVisible(true); } // show warning dialog (which can be suppressed) about this setting if special disabled and we are the only device, since // timestamps will not advance in this case } } private JComponent helpsep,help1, help2,help3;
void function(Observable o, Object arg) { if ((o instanceof AEChip) && (o instanceof HasSyncEventOutput)) { if (syncEnabledMenuItem != null) { syncEnabledMenuItem.setEnabled(false); } } else { syncEnabledMenuItem.setEnabled(true); syncEnabledMenuItem.setSelected(isSyncEventEnabled()); if (!isSyncEventEnabled()) { WarningDialogWithDontShowPreference d = new WarningDialogWithDontShowPreference(null, false, STR, STR); d.setVisible(true); } } } private JComponent helpsep,help1, help2,help3;
/** * Updates AEViewer specialized menu items according to capabilities of * HardwareInterface. * * @param o the observable, i.e. this Chip. * @param arg the argument (e.g. the HardwareInterface). */
Updates AEViewer specialized menu items according to capabilities of HardwareInterface
update
{ "repo_name": "viktorbahr/jaer", "path": "src/ch/unizh/ini/jaer/chip/cochlea/CochleaAMS1c.java", "license": "lgpl-2.1", "size": 117086 }
[ "java.util.Observable", "javax.swing.JComponent", "net.sf.jaer.chip.AEChip", "net.sf.jaer.hardwareinterface.usb.cypressfx2.HasSyncEventOutput", "net.sf.jaer.util.WarningDialogWithDontShowPreference" ]
import java.util.Observable; import javax.swing.JComponent; import net.sf.jaer.chip.AEChip; import net.sf.jaer.hardwareinterface.usb.cypressfx2.HasSyncEventOutput; import net.sf.jaer.util.WarningDialogWithDontShowPreference;
import java.util.*; import javax.swing.*; import net.sf.jaer.chip.*; import net.sf.jaer.hardwareinterface.usb.cypressfx2.*; import net.sf.jaer.util.*;
[ "java.util", "javax.swing", "net.sf.jaer" ]
java.util; javax.swing; net.sf.jaer;
412,013
private static String calcaulateMD5(String build) throws RestfulAPIException { String url = RestAPI.getSpoutcraftURL(build); InputStream stream = null; try { stream = RestAPI.getCachingInputStream(new URL(url), true); Project project = mapper.readValue(stream, Project.class); return project.getMd5(); } catch (IOException e) { throw new RestfulAPIException("Error accessing URL [" + url + "]", e); } finally { IOUtils.closeQuietly(stream); } }
static String function(String build) throws RestfulAPIException { String url = RestAPI.getSpoutcraftURL(build); InputStream stream = null; try { stream = RestAPI.getCachingInputStream(new URL(url), true); Project project = mapper.readValue(stream, Project.class); return project.getMd5(); } catch (IOException e) { throw new RestfulAPIException(STR + url + "]", e); } finally { IOUtils.closeQuietly(stream); } }
/** * Retrieves the md5 hashsum for the given Spoutcraft build from the REST API * * @param build * @return md5 hashsum * @throws RestfulAPIException if the REST API could not be accessed */
Retrieves the md5 hashsum for the given Spoutcraft build from the REST API
calcaulateMD5
{ "repo_name": "sazert103/sazert103-studios", "path": "Sazcraft-Launcher/src/main/java/org/spoutcraft/launcher/SpoutcraftData.java", "license": "gpl-3.0", "size": 10798 }
[ "java.io.IOException", "java.io.InputStream", "org.apache.commons.io.IOUtils", "org.spoutcraft.launcher.exceptions.RestfulAPIException", "org.spoutcraft.launcher.rest.Project", "org.spoutcraft.launcher.rest.RestAPI" ]
import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.spoutcraft.launcher.exceptions.RestfulAPIException; import org.spoutcraft.launcher.rest.Project; import org.spoutcraft.launcher.rest.RestAPI;
import java.io.*; import org.apache.commons.io.*; import org.spoutcraft.launcher.exceptions.*; import org.spoutcraft.launcher.rest.*;
[ "java.io", "org.apache.commons", "org.spoutcraft.launcher" ]
java.io; org.apache.commons; org.spoutcraft.launcher;
366,831
public TreeItem buildComponentsTree() { return buildTree(); } // PropertyChangeListener implementation
TreeItem function() { return buildTree(); }
/** * Builds a tree of the component hierarchy of the form for display in the * {@code SourceStructureExplorer}. * * @return tree showing the component hierarchy of the form */
Builds a tree of the component hierarchy of the form for display in the SourceStructureExplorer
buildComponentsTree
{ "repo_name": "jisqyv/appinventor-sources", "path": "appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockForm.java", "license": "apache-2.0", "size": 60467 }
[ "com.google.gwt.user.client.ui.TreeItem" ]
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.*;
[ "com.google.gwt" ]
com.google.gwt;
2,542,037
@Nullable public Date getPickerDate() { return pickerDate; }
Date function() { return pickerDate; }
/** * Returns the default picker date that should be used if no persisted value exists and no * default date is set. * * @return The default picker date that should be used if no persisted value exists and no * default date is set. */
Returns the default picker date that should be used if no persisted value exists and no default date is set
getPickerDate
{ "repo_name": "Gericop/Android-Support-Preference-V7-Fix", "path": "preferencex-datetimepicker/src/main/java/com/takisoft/preferencex/DatePickerPreference.java", "license": "apache-2.0", "size": 15865 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,772,289
private IndexMetaData markAsUpgraded(IndexMetaData indexMetaData) { Settings settings = Settings.builder().put(indexMetaData.getSettings()).put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.CURRENT).build(); return IndexMetaData.builder(indexMetaData).settings(settings).build(); }
IndexMetaData function(IndexMetaData indexMetaData) { Settings settings = Settings.builder().put(indexMetaData.getSettings()).put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.CURRENT).build(); return IndexMetaData.builder(indexMetaData).settings(settings).build(); }
/** * Marks index as upgraded so we don't have to test it again */
Marks index as upgraded so we don't have to test it again
markAsUpgraded
{ "repo_name": "s1monw/elasticsearch", "path": "server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java", "license": "apache-2.0", "size": 10959 }
[ "org.elasticsearch.Version", "org.elasticsearch.common.settings.Settings" ]
import org.elasticsearch.Version; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.*; import org.elasticsearch.common.settings.*;
[ "org.elasticsearch", "org.elasticsearch.common" ]
org.elasticsearch; org.elasticsearch.common;
1,886,501
public void deleteTables() throws SQLException { String query="DROP TABLE IF EXISTS `"+this.table+"`"; Statement statement=this.link.createStatement(); statement.execute(query); }
void function() throws SQLException { String query=STR+this.table+"`"; Statement statement=this.link.createStatement(); statement.execute(query); }
/** * Drops the table from the database. Nothing occurs if the table does not exist. * * @throws SQLException if a database access error occurs */
Drops the table from the database. Nothing occurs if the table does not exist
deleteTables
{ "repo_name": "dieng444/e-artisan", "path": "userslib/src/users/SQLUserDB.java", "license": "mit", "size": 9279 }
[ "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,551,952
private void removeMessageViewFragment() { if (mMessageViewFragment != null) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.remove(mMessageViewFragment); mMessageViewFragment = null; ft.commit(); showDefaultTitleView(); } }
void function() { if (mMessageViewFragment != null) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.remove(mMessageViewFragment); mMessageViewFragment = null; ft.commit(); showDefaultTitleView(); } }
/** * Remove MessageViewFragment if necessary. */
Remove MessageViewFragment if necessary
removeMessageViewFragment
{ "repo_name": "jca02266/k-9", "path": "k9mail/src/main/java/com/fsck/k9/activity/MessageList.java", "license": "apache-2.0", "size": 59590 }
[ "android.app.FragmentTransaction" ]
import android.app.FragmentTransaction;
import android.app.*;
[ "android.app" ]
android.app;
177,346
private void asyncGenerateText(final List<String> names, final String listName) { final File directory = GUIUtils.chooseDirectory(this, db.getDeckDirectory()); if (directory == null) { return; }
void function(final List<String> names, final String listName) { final File directory = GUIUtils.chooseDirectory(this, db.getDeckDirectory()); if (directory == null) { return; }
/** * Writes an html file for the current list. * @param names * @param listName */
Writes an html file for the current list
asyncGenerateText
{ "repo_name": "kilroyrlc/kaflib", "path": "src/kaflib/applications/mtg/CardCenter.java", "license": "mit", "size": 16482 }
[ "java.io.File", "java.util.List" ]
import java.io.File; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,533,558
public Context getContext(final EnterableState state) { Context context = contexts.get(state); if (context == null) { if (singleContext) { context = getGlobalContext(); } else { final EnterableState parent = state.getParent(); if (parent == null) { // docroot context = evaluator.newContext(getGlobalContext()); } else { context = evaluator.newContext(getContext(parent)); } } if (state instanceof TransitionalState) { final Datamodel datamodel = ((TransitionalState)state).getDatamodel(); cloneDatamodel(datamodel, context, evaluator, errorReporter); } contexts.put(state, context); } return context; }
Context function(final EnterableState state) { Context context = contexts.get(state); if (context == null) { if (singleContext) { context = getGlobalContext(); } else { final EnterableState parent = state.getParent(); if (parent == null) { context = evaluator.newContext(getGlobalContext()); } else { context = evaluator.newContext(getContext(parent)); } } if (state instanceof TransitionalState) { final Datamodel datamodel = ((TransitionalState)state).getDatamodel(); cloneDatamodel(datamodel, context, evaluator, errorReporter); } contexts.put(state, context); } return context; }
/** * Get the context for an EnterableState or create one if not created before. * * @param state The EnterableState. * @return The context. */
Get the context for an EnterableState or create one if not created before
getContext
{ "repo_name": "apache/commons-scxml", "path": "src/main/java/org/apache/commons/scxml2/SCInstance.java", "license": "apache-2.0", "size": 19868 }
[ "org.apache.commons.scxml2.model.Datamodel", "org.apache.commons.scxml2.model.EnterableState", "org.apache.commons.scxml2.model.TransitionalState" ]
import org.apache.commons.scxml2.model.Datamodel; import org.apache.commons.scxml2.model.EnterableState; import org.apache.commons.scxml2.model.TransitionalState;
import org.apache.commons.scxml2.model.*;
[ "org.apache.commons" ]
org.apache.commons;
1,996
public static MessageField getColGroupingField() { return (MessageField) getNewComponentInstance(COLLECTION_GROUPING_FIELD); }
static MessageField function() { return (MessageField) getNewComponentInstance(COLLECTION_GROUPING_FIELD); }
/** * Gets the collection grouping field * * @return message field */
Gets the collection grouping field
getColGroupingField
{ "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/util/ComponentFactory.java", "license": "apache-2.0", "size": 43761 }
[ "org.kuali.rice.krad.uif.field.MessageField" ]
import org.kuali.rice.krad.uif.field.MessageField;
import org.kuali.rice.krad.uif.field.*;
[ "org.kuali.rice" ]
org.kuali.rice;
329,426
private static SQLConversionOverflowException newOverflowException( String methodLabel, String valueTypeLabel, Object value ) { return new SQLConversionOverflowException( methodLabel + " can't return " + valueTypeLabel + " value " + value + " (too large) "); } ////////////////////////////////////////////////////////////////////// // Column accessor (getXxx(...)) methods, in same order as in JDBC 4.2 spec. // TABLE B-6: //////////////////////////////////////// // - getByte: // - TINYINT, SMALLINT, INTEGER, BIGINT - supported/implemented (here) // - REAL, FLOAT, DOUBLE - supported/implemented (here) // - DECIMAL, NUMERIC- supported/implemented (here) // - BIT, BOOLEAN; // - CHAR, VARCHAR, LONGVARCHAR; // - ROWID;
static SQLConversionOverflowException function( String methodLabel, String valueTypeLabel, Object value ) { return new SQLConversionOverflowException( methodLabel + STR + valueTypeLabel + STR + value + STR); }
/** * Creates SQLConversionOverflowException using given parameters to form * exception message text. * * @param methodLabel label for (string to use to identify) method that * couldn't convert source value to target type * (e.g., "getInt(...)") * @param valueTypeLabel label for type of source value that couldn't be * converted (e.g., "Java long / SQL BIGINT") * @param value representation of source value that couldn't be converted; * object whose toString() shows (part of) value; not null * @return the created exception */
Creates SQLConversionOverflowException using given parameters to form exception message text
newOverflowException
{ "repo_name": "kristinehahn/drill", "path": "exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/TypeConvertingSqlAccessor.java", "license": "apache-2.0", "size": 25428 }
[ "org.apache.drill.jdbc.SQLConversionOverflowException" ]
import org.apache.drill.jdbc.SQLConversionOverflowException;
import org.apache.drill.jdbc.*;
[ "org.apache.drill" ]
org.apache.drill;
646,200
public Reliability getMaxReliability();
Reliability function();
/** * Returns the destination's maximum reliability - the highest reliability of * message that will be accepted on to the destination. * @return the destination's maximum reliability */
Returns the destination's maximum reliability - the highest reliability of message that will be accepted on to the destination
getMaxReliability
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.messaging.common/src/com/ibm/wsspi/sib/core/DestinationConfiguration.java", "license": "epl-1.0", "size": 4398 }
[ "com.ibm.websphere.sib.Reliability" ]
import com.ibm.websphere.sib.Reliability;
import com.ibm.websphere.sib.*;
[ "com.ibm.websphere" ]
com.ibm.websphere;
593,163