method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
List<Integer> glyphMappingTable() {
return this.newToOldGlyphs;
} | List<Integer> glyphMappingTable() { return this.newToOldGlyphs; } | /**
* Get the permutation table of the new glyph id to the old glyph id.
*
* @return the permutation table
*/ | Get the permutation table of the new glyph id to the old glyph id | glyphMappingTable | {
"repo_name": "jtanx/sfntly-java-mod",
"path": "src/com/google/typography/font/tools/subsetter/Subsetter.java",
"license": "apache-2.0",
"size": 5957
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,971,312 |
public ModelAndView resolveException(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
if (shouldApplyTo(request, handler)) {
return doResolveException(request, response, handler, ex);
}
else {
return null;
}
}
| ModelAndView function( HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { if (shouldApplyTo(request, handler)) { return doResolveException(request, response, handler, ex); } else { return null; } } | /**
* Checks whether this resolver is supposed to apply (i.e. the handler
* matches in case of "mappedHandlers" having been specified), then
* delegates to the {@link #doResolveException} template method.
*/ | Checks whether this resolver is supposed to apply (i.e. the handler matches in case of "mappedHandlers" having been specified), then delegates to the <code>#doResolveException</code> template method | resolveException | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java",
"license": "unlicense",
"size": 18051
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.springframework.web.servlet.ModelAndView"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; | import javax.servlet.http.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.springframework.web"
] | javax.servlet; org.springframework.web; | 105,012 |
public void addCommittedProposal(Request request) {
WriteLock wl = logLock.writeLock();
try {
wl.lock();
if (committedLog.size() > commitLogCount) {
committedLog.removeFirst();
minCommittedLog = committedLog.getFirst().packet.getZxid();
}
if (committedLog.size() == 0) {
minCommittedLog = request.zxid;
maxCommittedLog = request.zxid;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
try {
request.hdr.serialize(boa, "hdr");
if (request.txn != null) {
request.txn.serialize(boa, "txn");
}
baos.close();
} catch (IOException e) {
LOG.error("This really should be impossible", e);
}
QuorumPacket pp = new QuorumPacket(Leader.PROPOSAL, request.zxid,
baos.toByteArray(), null);
Proposal p = new Proposal();
p.packet = pp;
p.request = request;
committedLog.add(p);
maxCommittedLog = p.packet.getZxid();
} finally {
wl.unlock();
}
} | void function(Request request) { WriteLock wl = logLock.writeLock(); try { wl.lock(); if (committedLog.size() > commitLogCount) { committedLog.removeFirst(); minCommittedLog = committedLog.getFirst().packet.getZxid(); } if (committedLog.size() == 0) { minCommittedLog = request.zxid; maxCommittedLog = request.zxid; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos); try { request.hdr.serialize(boa, "hdr"); if (request.txn != null) { request.txn.serialize(boa, "txn"); } baos.close(); } catch (IOException e) { LOG.error(STR, e); } QuorumPacket pp = new QuorumPacket(Leader.PROPOSAL, request.zxid, baos.toByteArray(), null); Proposal p = new Proposal(); p.packet = pp; p.request = request; committedLog.add(p); maxCommittedLog = p.packet.getZxid(); } finally { wl.unlock(); } } | /**
* maintains a list of last <i>committedLog</i>
* or so committed requests. This is used for
* fast follower synchronization.
* @param request committed request
*/ | maintains a list of last committedLog or so committed requests. This is used for fast follower synchronization | addCommittedProposal | {
"repo_name": "sdw2330976/zookeeper-3.3.4-source",
"path": "zookeeper-release-3.3.4/src/java/main/org/apache/zookeeper/server/ZKDatabase.java",
"license": "apache-2.0",
"size": 16076
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.util.concurrent.locks.ReentrantReadWriteLock",
"org.apache.jute.BinaryOutputArchive",
"org.apache.zookeeper.server.quorum.Leader",
"org.apache.zookeeper.server.quorum.QuorumPacket"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.jute.BinaryOutputArchive; import org.apache.zookeeper.server.quorum.Leader; import org.apache.zookeeper.server.quorum.QuorumPacket; | import java.io.*; import java.util.concurrent.locks.*; import org.apache.jute.*; import org.apache.zookeeper.server.quorum.*; | [
"java.io",
"java.util",
"org.apache.jute",
"org.apache.zookeeper"
] | java.io; java.util; org.apache.jute; org.apache.zookeeper; | 37,835 |
public boolean isMULTINAMEwithOneNs(AVM2ConstantPool pool) {
return kind == MULTINAME && pool.getNamespaceSet(namespace_set_index).namespaces.length == 1;
} | boolean function(AVM2ConstantPool pool) { return kind == MULTINAME && pool.getNamespaceSet(namespace_set_index).namespaces.length == 1; } | /**
* Is this MULTINAME kind with only one namespace. Hint: it is sometimes
* used for interfaces
*
* @param pool
* @return
*/ | Is this MULTINAME kind with only one namespace. Hint: it is sometimes used for interfaces | isMULTINAMEwithOneNs | {
"repo_name": "jindrapetrik/jpexs-decompiler",
"path": "libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java",
"license": "gpl-3.0",
"size": 19603
} | [
"com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool"
] | import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; | import com.jpexs.decompiler.flash.abc.avm2.*; | [
"com.jpexs.decompiler"
] | com.jpexs.decompiler; | 833,503 |
public String makeGroupsfromXml(Groups groups, String xml)
throws ParserConfigurationException, SAXException, IOException {
StringBuffer selectedGroups = new StringBuffer();
Document document = null;
if (xml != null && xml.trim().length() > 0) {
document = DomUtil.makeDomFromString(xml, true);
} else {
return null;
}
if (document != null) {
NodeList principalNodes = document.getElementsByTagName("principal");
if (principalNodes != null && principalNodes.getLength() > 0) {
for (int i = 0; i < principalNodes.getLength(); i++) {
Node principalNode = principalNodes.item(i);
NamedNodeMap attributes = principalNode.getAttributes();
if (attributes.getNamedItem("type").getNodeValue().equalsIgnoreCase(
"groupDn")) {
Group group = groups.get(principalNode.getTextContent());
if (group != null)
selectedGroups.append(group.getName()).append(",");
}
}
}
}
return selectedGroups.length() > 0 ? selectedGroups.substring(0,
selectedGroups.length() - 1) : null;
}
| String function(Groups groups, String xml) throws ParserConfigurationException, SAXException, IOException { StringBuffer selectedGroups = new StringBuffer(); Document document = null; if (xml != null && xml.trim().length() > 0) { document = DomUtil.makeDomFromString(xml, true); } else { return null; } if (document != null) { NodeList principalNodes = document.getElementsByTagName(STR); if (principalNodes != null && principalNodes.getLength() > 0) { for (int i = 0; i < principalNodes.getLength(); i++) { Node principalNode = principalNodes.item(i); NamedNodeMap attributes = principalNode.getAttributes(); if (attributes.getNamedItem("type").getNodeValue().equalsIgnoreCase( STR)) { Group group = groups.get(principalNode.getTextContent()); if (group != null) selectedGroups.append(group.getName()).append(","); } } } } return selectedGroups.length() > 0 ? selectedGroups.substring(0, selectedGroups.length() - 1) : null; } | /**
* Returns groups from acl xml string
* @param groups group
* @param xml xml
* @return string representation of groups
* @throws IOException
* @throws SAXException
* @throws ParserConfigurationException
*/ | Returns groups from acl xml string | makeGroupsfromXml | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/framework/security/metadata/MetadataAcl.java",
"license": "apache-2.0",
"size": 11490
} | [
"com.esri.gpt.framework.security.principal.Group",
"com.esri.gpt.framework.security.principal.Groups",
"com.esri.gpt.framework.xml.DomUtil",
"java.io.IOException",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Document",
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList",
"org.xml.sax.SAXException"
] | import com.esri.gpt.framework.security.principal.Group; import com.esri.gpt.framework.security.principal.Groups; import com.esri.gpt.framework.xml.DomUtil; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; | import com.esri.gpt.framework.security.principal.*; import com.esri.gpt.framework.xml.*; import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.esri.gpt",
"java.io",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | com.esri.gpt; java.io; javax.xml; org.w3c.dom; org.xml.sax; | 951,552 |
public void setOptions(SystemOptions options) {
this.options = options;
} | void function(SystemOptions options) { this.options = options; } | /**
* Sets the options.
*
* @param options The options to set.
*/ | Sets the options | setOptions | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/businessobject/LaborJournalVoucherDetail.java",
"license": "agpl-3.0",
"size": 13015
} | [
"org.kuali.kfs.sys.businessobject.SystemOptions"
] | import org.kuali.kfs.sys.businessobject.SystemOptions; | import org.kuali.kfs.sys.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 233,630 |
@NotNull
List<RngData> getDatas(); | List<RngData> getDatas(); | /**
* Returns the list of data children.
*
* @return the list of data children.
*/ | Returns the list of data children | getDatas | {
"repo_name": "akosyakov/intellij-community",
"path": "xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngOpenPatterns.java",
"license": "apache-2.0",
"size": 6267
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,998,300 |
List<ScriptObject> loadRunnableScriptsWithUI()
throws DSOutOfServiceException, DSAccessException
{
isSessionAlive();
List<ScriptObject> scripts = new ArrayList<ScriptObject>();
try {
IScriptPrx svc = getScriptService();
if (svc == null) svc = getScriptService();
List<OriginalFile> storedScripts = svc.getScripts();
if (storedScripts == null || storedScripts.size() == 0)
return scripts;
Entry en;
Iterator<OriginalFile> j = storedScripts.iterator();
ScriptObject script;
OriginalFile of;
RString value;
String v = null;
while (j.hasNext()) {
of = j.next();
value = of.getName();
v = of.getPath().getValue()+ value.getValue();
if (SCRIPTS_UI_AVAILABLE.contains(v)) {
script = new ScriptObject(of.getId().getValue(),
of.getPath().getValue(), of.getName().getValue());
value = of.getMimetype();
if (value != null) script.setMIMEType(value.getValue());
scripts.add(script);
}
}
} catch (Exception e) {
handleException(e, "Cannot load the scripts with UI. ");
}
return scripts;
}
| List<ScriptObject> loadRunnableScriptsWithUI() throws DSOutOfServiceException, DSAccessException { isSessionAlive(); List<ScriptObject> scripts = new ArrayList<ScriptObject>(); try { IScriptPrx svc = getScriptService(); if (svc == null) svc = getScriptService(); List<OriginalFile> storedScripts = svc.getScripts(); if (storedScripts == null storedScripts.size() == 0) return scripts; Entry en; Iterator<OriginalFile> j = storedScripts.iterator(); ScriptObject script; OriginalFile of; RString value; String v = null; while (j.hasNext()) { of = j.next(); value = of.getName(); v = of.getPath().getValue()+ value.getValue(); if (SCRIPTS_UI_AVAILABLE.contains(v)) { script = new ScriptObject(of.getId().getValue(), of.getPath().getValue(), of.getName().getValue()); value = of.getMimetype(); if (value != null) script.setMIMEType(value.getValue()); scripts.add(script); } } } catch (Exception e) { handleException(e, STR); } return scripts; } | /**
* Returns all the official scripts with a UI.
*
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
*/ | Returns all the official scripts with a UI | loadRunnableScriptsWithUI | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java",
"license": "gpl-2.0",
"size": 264705
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"org.openmicroscopy.shoola.env.data.model.ScriptObject"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.openmicroscopy.shoola.env.data.model.ScriptObject; | import java.util.*; import org.openmicroscopy.shoola.env.data.model.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 854,309 |
public boolean isAdmin(String username) {
if (User.USERNAME_ADMIN.equals(username)) {
return true;
}
User user = getUserByName(username);
return user != null && user.isAdminRole();
}
| boolean function(String username) { if (User.USERNAME_ADMIN.equals(username)) { return true; } User user = getUserByName(username); return user != null && user.isAdminRole(); } | /**
* Returns whether the given user has administrative rights.
*/ | Returns whether the given user has administrative rights | isAdmin | {
"repo_name": "MadMarty/madsonic-server-5.1",
"path": "madsonic-main/src/main/java/org/madsonic/service/SecurityService.java",
"license": "gpl-3.0",
"size": 21600
} | [
"org.madsonic.domain.User"
] | import org.madsonic.domain.User; | import org.madsonic.domain.*; | [
"org.madsonic.domain"
] | org.madsonic.domain; | 1,853,319 |
public static String getRelativePath(Path sourceRootPath, Path childPath) {
String childPathString = childPath.toUri().getPath();
String sourceRootPathString = sourceRootPath.toUri().getPath();
return sourceRootPathString.equals("/") ? childPathString :
childPathString.substring(sourceRootPathString.length());
} | static String function(Path sourceRootPath, Path childPath) { String childPathString = childPath.toUri().getPath(); String sourceRootPathString = sourceRootPath.toUri().getPath(); return sourceRootPathString.equals("/") ? childPathString : childPathString.substring(sourceRootPathString.length()); } | /**
* Gets relative path of child path with respect to a root path
* For ex. If childPath = /tmp/abc/xyz/file and
* sourceRootPath = /tmp/abc
* Relative path would be /xyz/file
* If childPath = /file and
* sourceRootPath = /
* Relative path would be /file
* @param sourceRootPath - Source root path
* @param childPath - Path for which relative path is required
* @return - Relative portion of the child path (always prefixed with /
* unless it is empty
*/ | Gets relative path of child path with respect to a root path For ex. If childPath = /tmp/abc/xyz/file and sourceRootPath = /tmp/abc Relative path would be /xyz/file If childPath = /file and sourceRootPath = Relative path would be /file | getRelativePath | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java",
"license": "apache-2.0",
"size": 26119
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 765,576 |
List<Resource> findByResourceServer(String resourceServerId); | List<Resource> findByResourceServer(String resourceServerId); | /**
* Finds all {@link Resource} instances associated with a given resource server.
*
* @param resourceServerId the identifier of the resource server
* @return a list with all resources associated with the given resource server
*/ | Finds all <code>Resource</code> instances associated with a given resource server | findByResourceServer | {
"repo_name": "iperdomo/keycloak",
"path": "server-spi/src/main/java/org/keycloak/authorization/store/ResourceStore.java",
"license": "apache-2.0",
"size": 3971
} | [
"java.util.List",
"org.keycloak.authorization.model.Resource"
] | import java.util.List; import org.keycloak.authorization.model.Resource; | import java.util.*; import org.keycloak.authorization.model.*; | [
"java.util",
"org.keycloak.authorization"
] | java.util; org.keycloak.authorization; | 1,925,811 |
public static NodeRef createRoot(Node node) {
Preconditions.checkArgument(NodeRef.ROOT.equals(node.getName()),
"A root NodeRef can only be created for a root node");
return new NodeRef(node, null, ObjectId.NULL);
} | static NodeRef function(Node node) { Preconditions.checkArgument(NodeRef.ROOT.equals(node.getName()), STR); return new NodeRef(node, null, ObjectId.NULL); } | /**
* Creates a {@link NodeRef} pointing to {@code node} with a {@code null} parent path, which is
* the only exception
*/ | Creates a <code>NodeRef</code> pointing to node with a null parent path, which is the only exception | createRoot | {
"repo_name": "marcusthebrown/geogig",
"path": "src/core/src/main/java/org/locationtech/geogig/api/NodeRef.java",
"license": "bsd-3-clause",
"size": 13366
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,323,949 |
NamedSet getNamedSet(List<Id.Segment> nameParts); | NamedSet getNamedSet(List<Id.Segment> nameParts); | /**
* Looks up a set by name. If the name is not found in the current scope,
* returns null.
*/ | Looks up a set by name. If the name is not found in the current scope, returns null | getNamedSet | {
"repo_name": "citycloud-bigdata/mondrian",
"path": "src/main/mondrian/olap/SchemaReader.java",
"license": "epl-1.0",
"size": 16965
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,039,799 |
Project p = ProjectManager.getManager().getCurrentProject();
if (p == null
|| !ProjectBrowser.getInstance().getSaveAction().isEnabled()) {
return;
}
String message =
MessageFormat.format(
Translator.localize(
"optionpane.revert-to-saved-confirm"),
new Object[] {
p.getName(),
});
int response =
JOptionPane.showConfirmDialog(
ArgoFrame.getInstance(),
message,
Translator.localize(
"optionpane.revert-to-saved-confirm-title"),
JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
ProjectBrowser.getInstance().loadProjectWithProgressMonitor(
new File(p.getURI()), true);
}
}
| Project p = ProjectManager.getManager().getCurrentProject(); if (p == null !ProjectBrowser.getInstance().getSaveAction().isEnabled()) { return; } String message = MessageFormat.format( Translator.localize( STR), new Object[] { p.getName(), }); int response = JOptionPane.showConfirmDialog( ArgoFrame.getInstance(), message, Translator.localize( STR), JOptionPane.YES_NO_OPTION); if (response == JOptionPane.YES_OPTION) { ProjectBrowser.getInstance().loadProjectWithProgressMonitor( new File(p.getURI()), true); } } | /**
* Performs the action.
*
* @param e an event
*/ | Performs the action | actionPerformed | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/argouml_diagrams/argouml-app/src/org/argouml/uml/ui/ActionRevertToSaved.java",
"license": "gpl-3.0",
"size": 3568
} | [
"java.io.File",
"java.text.MessageFormat",
"javax.swing.JOptionPane",
"org.argouml.i18n.Translator",
"org.argouml.kernel.Project",
"org.argouml.kernel.ProjectManager",
"org.argouml.ui.ProjectBrowser",
"org.argouml.util.ArgoFrame"
] | import java.io.File; import java.text.MessageFormat; import javax.swing.JOptionPane; import org.argouml.i18n.Translator; import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; import org.argouml.ui.ProjectBrowser; import org.argouml.util.ArgoFrame; | import java.io.*; import java.text.*; import javax.swing.*; import org.argouml.i18n.*; import org.argouml.kernel.*; import org.argouml.ui.*; import org.argouml.util.*; | [
"java.io",
"java.text",
"javax.swing",
"org.argouml.i18n",
"org.argouml.kernel",
"org.argouml.ui",
"org.argouml.util"
] | java.io; java.text; javax.swing; org.argouml.i18n; org.argouml.kernel; org.argouml.ui; org.argouml.util; | 439,280 |
public static <K, T extends Persistent> Query<K, T>
getQuery(DataStore<K, T> pDataStore) {
Query<K, T> query = pDataStore.newQuery();
query.setStartKey(null);
query.setEndKey(null);
return query;
} | static <K, T extends Persistent> Query<K, T> function(DataStore<K, T> pDataStore) { Query<K, T> query = pDataStore.newQuery(); query.setStartKey(null); query.setEndKey(null); return query; } | /**
* Gets a query object to be used as a simple get.
* @param pDataStore data store used.
* @param <K> key class
* @param <T> value class
* @return query object.
*/ | Gets a query object to be used as a simple get | getQuery | {
"repo_name": "KidEinstein/giraph",
"path": "giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/GoraUtils.java",
"license": "apache-2.0",
"size": 6091
} | [
"org.apache.gora.persistency.Persistent",
"org.apache.gora.query.Query",
"org.apache.gora.store.DataStore"
] | import org.apache.gora.persistency.Persistent; import org.apache.gora.query.Query; import org.apache.gora.store.DataStore; | import org.apache.gora.persistency.*; import org.apache.gora.query.*; import org.apache.gora.store.*; | [
"org.apache.gora"
] | org.apache.gora; | 924,950 |
private JPanel getIntermediatePanel() {
if (ivjIntermediatePanel == null) {
try {
ivjIntermediatePanel = new JPanel();
ivjIntermediatePanel.setName("IntermediatePanel");
ivjIntermediatePanel.setLayout(new BorderLayout());
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjIntermediatePanel;
}
| JPanel function() { if (ivjIntermediatePanel == null) { try { ivjIntermediatePanel = new JPanel(); ivjIntermediatePanel.setName(STR); ivjIntermediatePanel.setLayout(new BorderLayout()); } catch (Throwable ivjExc) { handleException(ivjExc); } } return ivjIntermediatePanel; } | /**
* Return the IntermediatePanel property value.
* @return JPanel
*/ | Return the IntermediatePanel property value | getIntermediatePanel | {
"repo_name": "levans/Open-Quark",
"path": "src/Quark_Gems/src/org/openquark/gems/client/valueentry/FileNameValueEditor.java",
"license": "bsd-3-clause",
"size": 7727
} | [
"java.awt.BorderLayout",
"javax.swing.JPanel"
] | import java.awt.BorderLayout; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,763,206 |
private void addDistributions(double[] weights, SimpleMatrix[] means, SimpleMatrix[] covariances) {
double sumOfNewWeights = 0;
for (int i = 0; i < weights.length; i++) {
sumOfNewWeights += weights[i];
mSubDistributions.add(new OneComponentDistribution(weights[i], means[i], covariances[i], mBandwidthMatrix));
}
// calculate mixing weights for old and new weights
double mixWeightOld = (mEffectiveNoOfSamples* mForgettingFactor) / (mEffectiveNoOfSamples * mForgettingFactor + sumOfNewWeights);
double mixWeightNew = sumOfNewWeights / (mEffectiveNoOfSamples * mForgettingFactor + sumOfNewWeights);
mEffectiveNoOfSamples = mEffectiveNoOfSamples * mForgettingFactor + weights.length;
// mGlobalWeight = mGlobalWeight * mForgettingFactor + sumOfNewWeights;
mGlobalWeight = mixWeightOld + mixWeightNew;
for (int i = 0; i < mSubDistributions.size() - weights.length; i++) {
double tmpWeight = mSubDistributions.get(i).getGlobalWeight();
mSubDistributions.get(i).setGlobalWeight(tmpWeight * mixWeightOld);
}
for (int i = mSubDistributions.size() - weights.length; i < mSubDistributions.size(); i++) {
double tmpWeight = mSubDistributions.get(i).getGlobalWeight();
mSubDistributions.get(i).setGlobalWeight(tmpWeight * mixWeightNew * (1d / weights.length));
}
// mEffectiveNoOfSamples = mSubDistributions.size();
} | void function(double[] weights, SimpleMatrix[] means, SimpleMatrix[] covariances) { double sumOfNewWeights = 0; for (int i = 0; i < weights.length; i++) { sumOfNewWeights += weights[i]; mSubDistributions.add(new OneComponentDistribution(weights[i], means[i], covariances[i], mBandwidthMatrix)); } double mixWeightOld = (mEffectiveNoOfSamples* mForgettingFactor) / (mEffectiveNoOfSamples * mForgettingFactor + sumOfNewWeights); double mixWeightNew = sumOfNewWeights / (mEffectiveNoOfSamples * mForgettingFactor + sumOfNewWeights); mEffectiveNoOfSamples = mEffectiveNoOfSamples * mForgettingFactor + weights.length; mGlobalWeight = mixWeightOld + mixWeightNew; for (int i = 0; i < mSubDistributions.size() - weights.length; i++) { double tmpWeight = mSubDistributions.get(i).getGlobalWeight(); mSubDistributions.get(i).setGlobalWeight(tmpWeight * mixWeightOld); } for (int i = mSubDistributions.size() - weights.length; i < mSubDistributions.size(); i++) { double tmpWeight = mSubDistributions.get(i).getGlobalWeight(); mSubDistributions.get(i).setGlobalWeight(tmpWeight * mixWeightNew * (1d / weights.length)); } } | /**
* Takes new incoming sample weights and updates this distribution using a
* forgetting factor.
*
* @param weights
*/ | Takes new incoming sample weights and updates this distribution using a forgetting factor | addDistributions | {
"repo_name": "kevoree/kevoree-brain",
"path": "de.tuhh.luethke.okde/src/main/java/de/tuhh/luethke/okde/model/SampleModel.java",
"license": "gpl-3.0",
"size": 31391
} | [
"org.ejml.simple.SimpleMatrix"
] | import org.ejml.simple.SimpleMatrix; | import org.ejml.simple.*; | [
"org.ejml.simple"
] | org.ejml.simple; | 487,177 |
public static java.util.Set extractOrderSpecimenSet(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.PathologySpecimenLiteVoCollection voCollection)
{
return extractOrderSpecimenSet(domainFactory, voCollection, null, new HashMap());
}
| static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.PathologySpecimenLiteVoCollection voCollection) { return extractOrderSpecimenSet(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.ocrr.orderingresults.domain.objects.OrderSpecimen set from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.ocrr.orderingresults.domain.objects.OrderSpecimen set from the value object collection | extractOrderSpecimenSet | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/PathologySpecimenLiteVoAssembler.java",
"license": "agpl-3.0",
"size": 23170
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,848,097 |
public void findPosition()
{
try
{
final double xPos = _x.at(XPOS);
final double yPos = _x.at(YPOS);
final double rangeMtrs = Math.sqrt(xPos*xPos + yPos*yPos);
final double azimuthRads = Math.atan2(xPos,yPos);
Vincenty.GetLatLon(_origin, rangeMtrs, azimuthRads, _vincLatLonData);
_position.copy(_vincLatLonData._position);
}
catch(final Exception e)
{
// deliberately left blank
}
} | void function() { try { final double xPos = _x.at(XPOS); final double yPos = _x.at(YPOS); final double rangeMtrs = Math.sqrt(xPos*xPos + yPos*yPos); final double azimuthRads = Math.atan2(xPos,yPos); Vincenty.GetLatLon(_origin, rangeMtrs, azimuthRads, _vincLatLonData); _position.copy(_vincLatLonData._position); } catch(final Exception e) { } } | /**
* Finds the position using the origin.
*/ | Finds the position using the origin | findPosition | {
"repo_name": "GeoffHayes/madmath-java",
"path": "various/tracking/Track2DPV.java",
"license": "bsd-3-clause",
"size": 10136
} | [
"com.madmath.geocoordinates.Vincenty"
] | import com.madmath.geocoordinates.Vincenty; | import com.madmath.geocoordinates.*; | [
"com.madmath.geocoordinates"
] | com.madmath.geocoordinates; | 184,499 |
private void drawHorizontalBorderColors(CellRangeAddress range, short color,
BorderExtent extent) {
switch (extent) {
case ALL:
case INSIDE:
int firstRow = range.getFirstRow();
int lastRow = range.getLastRow();
int firstCol = range.getFirstColumn();
int lastCol = range.getLastColumn();
for (int i = firstRow; i <= lastRow; i++) {
CellRangeAddress row = new CellRangeAddress(i, i, firstCol,
lastCol);
if (extent == BorderExtent.ALL || i > firstRow) {
drawTopBorderColor(row, color);
}
if (extent == BorderExtent.ALL || i < lastRow) {
drawBottomBorderColor(row, color);
}
}
break;
default:
throw new IllegalArgumentException(
"Unsupported PropertyTemplate.Extent, valid Extents are ALL and INSIDE");
}
} | void function(CellRangeAddress range, short color, BorderExtent extent) { switch (extent) { case ALL: case INSIDE: int firstRow = range.getFirstRow(); int lastRow = range.getLastRow(); int firstCol = range.getFirstColumn(); int lastCol = range.getLastColumn(); for (int i = firstRow; i <= lastRow; i++) { CellRangeAddress row = new CellRangeAddress(i, i, firstCol, lastCol); if (extent == BorderExtent.ALL i > firstRow) { drawTopBorderColor(row, color); } if (extent == BorderExtent.ALL i < lastRow) { drawBottomBorderColor(row, color); } } break; default: throw new IllegalArgumentException( STR); } } | /**
* <p>
* Sets the color of the horizontal borders for a range of cells.
* </p>
*
* @param range
* - {@link CellRangeAddress} range of cells on which colors are
* set.
* @param color
* - Color index from {@link IndexedColors} used to draw the
* borders.
* @param extent
* - {@link BorderExtent} of the borders for which
* colors are set. Valid Values are:
* <ul>
* <li>BorderExtent.ALL</li>
* <li>BorderExtent.INSIDE</li>
* </ul>
*/ | Sets the color of the horizontal borders for a range of cells. | drawHorizontalBorderColors | {
"repo_name": "lvweiwolf/poi-3.16",
"path": "src/java/org/apache/poi/ss/util/PropertyTemplate.java",
"license": "apache-2.0",
"size": 34382
} | [
"org.apache.poi.ss.usermodel.BorderExtent"
] | import org.apache.poi.ss.usermodel.BorderExtent; | import org.apache.poi.ss.usermodel.*; | [
"org.apache.poi"
] | org.apache.poi; | 1,604,496 |
public ApiResponse version() throws ClientApiException {
Map<String, String> map = null;
return api.callApi("core", "view", "version", map);
} | ApiResponse function() throws ClientApiException { Map<String, String> map = null; return api.callApi("core", "view", STR, map); } | /**
* Gets ZAP version
*/ | Gets ZAP version | version | {
"repo_name": "UjuE/zaproxy",
"path": "src/org/zaproxy/clientapi/gen/Core.java",
"license": "apache-2.0",
"size": 20542
} | [
"java.util.Map",
"org.zaproxy.clientapi.core.ApiResponse",
"org.zaproxy.clientapi.core.ClientApiException"
] | import java.util.Map; import org.zaproxy.clientapi.core.ApiResponse; import org.zaproxy.clientapi.core.ClientApiException; | import java.util.*; import org.zaproxy.clientapi.core.*; | [
"java.util",
"org.zaproxy.clientapi"
] | java.util; org.zaproxy.clientapi; | 336,753 |
@Override public T visitNamedPrimitive(@NotNull GikiParser.NamedPrimitiveContext ctx) { return visitChildren(ctx); } | @Override public T visitNamedPrimitive(@NotNull GikiParser.NamedPrimitiveContext ctx) { return visitChildren(ctx); } | /**
* {@inheritDoc}
* <p/>
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/ | The default implementation returns the result of calling <code>#visitChildren</code> on ctx | visitInterval | {
"repo_name": "jakobehmsen/giki-lang",
"path": "eclipse/src/giki/antlr4/GikiBaseVisitor.java",
"license": "mit",
"size": 11148
} | [
"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,897,655 |
public void doSortbygroupdescription(RunData data)
{
setupSort(data, SORTED_BY_GROUP_DESCRIPTION);
} // doSortbygroupdescription | void function(RunData data) { setupSort(data, SORTED_BY_GROUP_DESCRIPTION); } | /**
* Do sort by group description
*/ | Do sort by group description | doSortbygroupdescription | {
"repo_name": "frasese/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 686269
} | [
"org.sakaiproject.cheftool.RunData"
] | import org.sakaiproject.cheftool.RunData; | import org.sakaiproject.cheftool.*; | [
"org.sakaiproject.cheftool"
] | org.sakaiproject.cheftool; | 1,496,987 |
input = SALT + input;
StringBuilder hash = new StringBuilder();
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
byte[] hashedBytes = sha.digest(input.getBytes());
char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f' };
for (int idx = 0; idx < hashedBytes.length; ++idx) {
byte b = hashedBytes[idx];
hash.append(digits[(b & 0xf0) >> 4]);
hash.append(digits[b & 0x0f]);
}
} catch (NoSuchAlgorithmException e) {
// handle error here.
}
return hash.toString();
} | input = SALT + input; StringBuilder hash = new StringBuilder(); try { MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] hashedBytes = sha.digest(input.getBytes()); char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; for (int idx = 0; idx < hashedBytes.length; ++idx) { byte b = hashedBytes[idx]; hash.append(digits[(b & 0xf0) >> 4]); hash.append(digits[b & 0x0f]); } } catch (NoSuchAlgorithmException e) { } return hash.toString(); } | /**
* Tool to generate hashed password
*
* @param input the password to encrypt
* @return the encrypted password
*/ | Tool to generate hashed password | generateHash | {
"repo_name": "RICM5-ECOM-Groupe5-2017-2018/mes-transports",
"path": "src/main/java/security/PasswordEncryption.java",
"license": "mit",
"size": 1139
} | [
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException"
] | import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; | import java.security.*; | [
"java.security"
] | java.security; | 2,107,721 |
private NetResponse handleUnknownRequest(NetRequest request,Channel channel){
NetResponse response = null;
if (request.isTwoWay()) {
response = NetResponse.build(request,ErrorCode.SERVICE_NOT_FOUND);
response.setErrorDes("Unfound servcie id:" + request.getId());
}
LOG.error("Service not fount",new ServiceNotFoundException("Unfound servcie id :" + request.getId()));
return response;
} | NetResponse function(NetRequest request,Channel channel){ NetResponse response = null; if (request.isTwoWay()) { response = NetResponse.build(request,ErrorCode.SERVICE_NOT_FOUND); response.setErrorDes(STR + request.getId()); } LOG.error(STR,new ServiceNotFoundException(STR + request.getId())); return response; } | /**
* Handle service not found
* @param request
* @param session
* @throws NetResponse
*/ | Handle service not found | handleUnknownRequest | {
"repo_name": "qiuhd2015/Hpgsc-RPC",
"path": "hpgsc-rpc/src/main/java/org/hdl/hggsc/rpc/service/RequestHandler.java",
"license": "mit",
"size": 13697
} | [
"javax.management.ServiceNotFoundException",
"org.hdl.hggsc.rpc.protocol.NetRequest",
"org.hdl.hggsc.rpc.protocol.NetResponse",
"org.hdl.hpgsc.remoting.Channel"
] | import javax.management.ServiceNotFoundException; import org.hdl.hggsc.rpc.protocol.NetRequest; import org.hdl.hggsc.rpc.protocol.NetResponse; import org.hdl.hpgsc.remoting.Channel; | import javax.management.*; import org.hdl.hggsc.rpc.protocol.*; import org.hdl.hpgsc.remoting.*; | [
"javax.management",
"org.hdl.hggsc",
"org.hdl.hpgsc"
] | javax.management; org.hdl.hggsc; org.hdl.hpgsc; | 2,223,092 |
@ParameterizedTest
@ArgumentsSource(SslTransportLayerArgumentsProvider.class)
public void testInvalidKeystorePassword(Args args) {
try (SslChannelBuilder channelBuilder = newClientChannelBuilder()) {
args.sslClientConfigs.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, "invalid");
assertThrows(KafkaException.class, () -> channelBuilder.configure(args.sslClientConfigs));
}
} | @ArgumentsSource(SslTransportLayerArgumentsProvider.class) void function(Args args) { try (SslChannelBuilder channelBuilder = newClientChannelBuilder()) { args.sslClientConfigs.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, STR); assertThrows(KafkaException.class, () -> channelBuilder.configure(args.sslClientConfigs)); } } | /**
* Tests that channels cannot be created if keystore cannot be loaded
*/ | Tests that channels cannot be created if keystore cannot be loaded | testInvalidKeystorePassword | {
"repo_name": "TiVo/kafka",
"path": "clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java",
"license": "apache-2.0",
"size": 74796
} | [
"org.apache.kafka.common.KafkaException",
"org.apache.kafka.common.config.SslConfigs",
"org.junit.jupiter.api.Assertions",
"org.junit.jupiter.params.provider.ArgumentsSource"
] | import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.config.SslConfigs; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.provider.ArgumentsSource; | import org.apache.kafka.common.*; import org.apache.kafka.common.config.*; import org.junit.jupiter.api.*; import org.junit.jupiter.params.provider.*; | [
"org.apache.kafka",
"org.junit.jupiter"
] | org.apache.kafka; org.junit.jupiter; | 200,585 |
public void create(String path, byte[] rawDocument, Collection searchAttributes) throws StorageException;
| void function(String path, byte[] rawDocument, Collection searchAttributes) throws StorageException; | /**
* Creates a new resource (raises an error if it already exists).
* Raises an exception if the document already exists
* The created document has path/doc for path.
* @param path the full path of the resource (relative to a root)
* @param rawDocument value of the new resource
* @param searchAttributes a collection containing instances of com.actility.util.Pair
* @throws StorageException (if the doc already exists)
*/ | Creates a new resource (raises an error if it already exists). Raises an exception if the document already exists The created document has path/doc for path | create | {
"repo_name": "actility/ong",
"path": "gscl/storage.driver.api/src/main/java/com/actility/m2m/storage/driver/StorageRequestDriverExecutor.java",
"license": "gpl-2.0",
"size": 15549
} | [
"com.actility.m2m.storage.StorageException",
"java.util.Collection"
] | import com.actility.m2m.storage.StorageException; import java.util.Collection; | import com.actility.m2m.storage.*; import java.util.*; | [
"com.actility.m2m",
"java.util"
] | com.actility.m2m; java.util; | 2,361,061 |
public static Exhibit loadFromFolder(File exhibitFolder) {
if (exhibitFolder.isFile())
throw new IllegalArgumentException("Passed file, not folder");
Exhibit loadedExhibit = new Exhibit();
loadedExhibit.exhibitFolder = exhibitFolder;
// exhibit folder name matches the unique ID of the exhibit
loadedExhibit.id = Long.valueOf(exhibitFolder.getName());
// load the metadata file
File metadataFile = new File(exhibitFolder, METADATA_FILE_NAME);
loadedExhibit.metadata = loadMetadataFile(metadataFile);
// map of beacons to the folders their contents are stored
loadedExhibit.contentFolderForBeacon = findFoldersForBeacons(exhibitFolder);
// load exhibit contents per beacon into map
loadedExhibit.contentsForBeacon =
loadedExhibit.loadBeaconContentMap(loadedExhibit.contentFolderForBeacon);
return loadedExhibit;
} | static Exhibit function(File exhibitFolder) { if (exhibitFolder.isFile()) throw new IllegalArgumentException(STR); Exhibit loadedExhibit = new Exhibit(); loadedExhibit.exhibitFolder = exhibitFolder; loadedExhibit.id = Long.valueOf(exhibitFolder.getName()); File metadataFile = new File(exhibitFolder, METADATA_FILE_NAME); loadedExhibit.metadata = loadMetadataFile(metadataFile); loadedExhibit.contentFolderForBeacon = findFoldersForBeacons(exhibitFolder); loadedExhibit.contentsForBeacon = loadedExhibit.loadBeaconContentMap(loadedExhibit.contentFolderForBeacon); return loadedExhibit; } | /**
* Load an exhibit and return it from an already created folder
*
* @param exhibitFolder folder that contains exhibit
* @return loaded exhibit
*/ | Load an exhibit and return it from an already created folder | loadFromFolder | {
"repo_name": "mkyl/Physical-Web-CMS-Android",
"path": "app/src/main/java/org/physical_web/cms/exhibits/Exhibit.java",
"license": "apache-2.0",
"size": 19765
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,580,649 |
public void add(final HistoryEventHandler historyEventHandler) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandler);
historyEventHandlers.add(historyEventHandler);
} | void function(final HistoryEventHandler historyEventHandler) { EnsureUtil.ensureNotNull(STR, historyEventHandler); historyEventHandlers.add(historyEventHandler); } | /**
* Adds the {@link HistoryEventHandler} to the list of
* {@link HistoryEventHandler} that consume the event.
*
* @param historyEventHandler
* the {@link HistoryEventHandler} that consume the event.
*/ | Adds the <code>HistoryEventHandler</code> to the list of <code>HistoryEventHandler</code> that consume the event | add | {
"repo_name": "camunda/camunda-bpm-platform",
"path": "engine/src/main/java/org/camunda/bpm/engine/impl/history/handler/CompositeHistoryEventHandler.java",
"license": "apache-2.0",
"size": 3719
} | [
"org.camunda.bpm.engine.impl.util.EnsureUtil"
] | import org.camunda.bpm.engine.impl.util.EnsureUtil; | import org.camunda.bpm.engine.impl.util.*; | [
"org.camunda.bpm"
] | org.camunda.bpm; | 2,046,978 |
@Deprecated
public void dump() {
Log.e(TAG, "dump: size=" + mMap.size());
for (String k : mMap.keySet()) {
Log.e(TAG, "dump: " + k + "=" + mMap.get(k));
}
} | void function() { Log.e(TAG, STR + mMap.size()); for (String k : mMap.keySet()) { Log.e(TAG, STR + k + "=" + mMap.get(k)); } } | /**
* Writes the current Parameters to the log.
* @hide
* @deprecated
*/ | Writes the current Parameters to the log | dump | {
"repo_name": "OmniEvo/android_frameworks_base",
"path": "core/java/android/hardware/Camera.java",
"license": "gpl-3.0",
"size": 224245
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,223,244 |
@Test
public void testConcurrentRenaming() throws Exception {
int n = 10000;
AtomicInteger baseSelector = new AtomicInteger();
Path base = testFS.getPath("/base");
base.createDirectory();
// 1) Create a bunch of files.
for (int i = 0; i < n; i++) {
writeToFile(base.getRelative("file" + i), TEST_FILE_DATA);
}
// 2) Define our renaming strategy.
TestRunnable fileDeleter =
() -> {
for (int i = 0; i < n / NUM_THREADS_FOR_CONCURRENCY_TESTS; i++) {
int whichFile = baseSelector.getAndIncrement();
Path file = base.getRelative("file" + whichFile);
if (whichFile % 25 != 0) {
Path newName = base.getRelative("newname" + whichFile);
file.renameTo(newName);
} else {
// Throw another concurrent access point into the mix.
file.setExecutable(whichFile % 2 == 0);
}
assertThat(base.getRelative("doesnotexist" + whichFile).delete()).isFalse();
}
};
// 3) Rename some files.
Collection<TestThread> threads =
Lists.newArrayListWithCapacity(NUM_THREADS_FOR_CONCURRENCY_TESTS);
for (int i = 0; i < NUM_THREADS_FOR_CONCURRENCY_TESTS; i++) {
TestThread thread = new TestThread(fileDeleter);
thread.start();
threads.add(thread);
}
for (TestThread thread : threads) {
thread.joinAndAssertState(0);
}
// 4) Check the results.
for (int i = 0; i < n; i++) {
Path file = base.getRelative("file" + i);
if (i % 25 != 0) {
assertThat(file.exists()).isFalse();
assertThat(base.getRelative("newname" + i).exists()).isTrue();
} else {
assertThat(file.exists()).isTrue();
assertThat(file.isExecutable()).isEqualTo(i % 2 == 0);
}
}
} | void function() throws Exception { int n = 10000; AtomicInteger baseSelector = new AtomicInteger(); Path base = testFS.getPath("/base"); base.createDirectory(); for (int i = 0; i < n; i++) { writeToFile(base.getRelative("file" + i), TEST_FILE_DATA); } TestRunnable fileDeleter = () -> { for (int i = 0; i < n / NUM_THREADS_FOR_CONCURRENCY_TESTS; i++) { int whichFile = baseSelector.getAndIncrement(); Path file = base.getRelative("file" + whichFile); if (whichFile % 25 != 0) { Path newName = base.getRelative(STR + whichFile); file.renameTo(newName); } else { file.setExecutable(whichFile % 2 == 0); } assertThat(base.getRelative(STR + whichFile).delete()).isFalse(); } }; Collection<TestThread> threads = Lists.newArrayListWithCapacity(NUM_THREADS_FOR_CONCURRENCY_TESTS); for (int i = 0; i < NUM_THREADS_FOR_CONCURRENCY_TESTS; i++) { TestThread thread = new TestThread(fileDeleter); thread.start(); threads.add(thread); } for (TestThread thread : threads) { thread.joinAndAssertState(0); } for (int i = 0; i < n; i++) { Path file = base.getRelative("file" + i); if (i % 25 != 0) { assertThat(file.exists()).isFalse(); assertThat(base.getRelative(STR + i).exists()).isTrue(); } else { assertThat(file.exists()).isTrue(); assertThat(file.isExecutable()).isEqualTo(i % 2 == 0); } } } | /**
* Tests concurrent file renaming.
*/ | Tests concurrent file renaming | testConcurrentRenaming | {
"repo_name": "meteorcloudy/bazel",
"path": "src/test/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystemTest.java",
"license": "apache-2.0",
"size": 15072
} | [
"com.google.common.collect.Lists",
"com.google.common.truth.Truth",
"com.google.devtools.build.lib.testutil.TestThread",
"com.google.devtools.build.lib.vfs.Path",
"java.util.Collection",
"java.util.concurrent.atomic.AtomicInteger"
] | import com.google.common.collect.Lists; import com.google.common.truth.Truth; import com.google.devtools.build.lib.testutil.TestThread; import com.google.devtools.build.lib.vfs.Path; import java.util.Collection; import java.util.concurrent.atomic.AtomicInteger; | import com.google.common.collect.*; import com.google.common.truth.*; import com.google.devtools.build.lib.testutil.*; import com.google.devtools.build.lib.vfs.*; import java.util.*; import java.util.concurrent.atomic.*; | [
"com.google.common",
"com.google.devtools",
"java.util"
] | com.google.common; com.google.devtools; java.util; | 1,981,887 |
MutableBoundedValue<Integer> maxBurnTime(); | MutableBoundedValue<Integer> maxBurnTime(); | /**
* Gets the {@link MutableBoundedValue} for the maximum amount of fuel that can be supplied with
* the used fuel item.
*
* It is represented by the flame icon in the {@link Furnace}, if the flame is 100% filled the
* value is exactly this one. So its the maximum of the {@link #passedBurnTime()}.
*
* @return The value for the maximum amount of fuel that can be supplied with the used fuel item
*/ | Gets the <code>MutableBoundedValue</code> for the maximum amount of fuel that can be supplied with the used fuel item. It is represented by the flame icon in the <code>Furnace</code>, if the flame is 100% filled the value is exactly this one. So its the maximum of the <code>#passedBurnTime()</code> | maxBurnTime | {
"repo_name": "Kiskae/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/data/manipulator/mutable/tileentity/FurnaceData.java",
"license": "mit",
"size": 3490
} | [
"org.spongepowered.api.data.value.mutable.MutableBoundedValue"
] | import org.spongepowered.api.data.value.mutable.MutableBoundedValue; | import org.spongepowered.api.data.value.mutable.*; | [
"org.spongepowered.api"
] | org.spongepowered.api; | 336,120 |
public void setMatParameter(String name, float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
CGparameter p = CgGL.cgGetNamedParameter(currProgram, name);
if (p != null) {
float[] mat = new float[16];
mat[0] = m00;
mat[1] = m10;
mat[2] = m20;
mat[3] = m30;
mat[4] = m01;
mat[5] = m11;
mat[6] = m21;
mat[7] = m31;
mat[8] = m02;
mat[9] = m12;
mat[10] = m22;
mat[11] = m32;
mat[12] = m03;
mat[13] = m13;
mat[14] = m23;
mat[15] = m33;
CgGL.cgSetMatrixParameterfc(p, mat, 0);
}
}
| void function(String name, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) { CGparameter p = CgGL.cgGetNamedParameter(currProgram, name); if (p != null) { float[] mat = new float[16]; mat[0] = m00; mat[1] = m10; mat[2] = m20; mat[3] = m30; mat[4] = m01; mat[5] = m11; mat[6] = m21; mat[7] = m31; mat[8] = m02; mat[9] = m12; mat[10] = m22; mat[11] = m32; mat[12] = m03; mat[13] = m13; mat[14] = m23; mat[15] = m33; CgGL.cgSetMatrixParameterfc(p, mat, 0); } } | /**
* Sets the mat4 parameter with name to the given value
*
* @param name String
* @param m00 float
* ...
*/ | Sets the mat4 parameter with name to the given value | setMatParameter | {
"repo_name": "manorius/Processing",
"path": "libraries/GLGraphics/src/codeanticode/glgraphics/GLCgShader.java",
"license": "mit",
"size": 20193
} | [
"com.sun.opengl.cg.CGparameter",
"com.sun.opengl.cg.CgGL"
] | import com.sun.opengl.cg.CGparameter; import com.sun.opengl.cg.CgGL; | import com.sun.opengl.cg.*; | [
"com.sun.opengl"
] | com.sun.opengl; | 468,536 |
public List<SpiderParser> getParsers() {
return parsersUnmodifiableView;
} | List<SpiderParser> function() { return parsersUnmodifiableView; } | /**
* Gets an unmodifiable view of the list of that should be used during the scan.
*
* @return the parsers
*/ | Gets an unmodifiable view of the list of that should be used during the scan | getParsers | {
"repo_name": "gmaran23/zaproxy",
"path": "zap/src/main/java/org/zaproxy/zap/spider/SpiderController.java",
"license": "apache-2.0",
"size": 15242
} | [
"java.util.List",
"org.zaproxy.zap.spider.parser.SpiderParser"
] | import java.util.List; import org.zaproxy.zap.spider.parser.SpiderParser; | import java.util.*; import org.zaproxy.zap.spider.parser.*; | [
"java.util",
"org.zaproxy.zap"
] | java.util; org.zaproxy.zap; | 1,623,570 |
public DemoBuilder initBehavior(ModelEntity parent, Effect... effects) {
return behavior(parent, new Init(), effects);
} | DemoBuilder function(ModelEntity parent, Effect... effects) { return behavior(parent, new Init(), effects); } | /**
* Creates a new init behaviour with the given {@code effects} and adds it
* as component of given {@code parent} entity.
*
* @param parent
* The entity to add this component to
* @param effects
* Effects to launch when the entity is loaded.
*/ | Creates a new init behaviour with the given effects and adds it as component of given parent entity | initBehavior | {
"repo_name": "gorco/ead",
"path": "editor/desktop/src/main/java/es/eucm/ead/editor/demobuilder/DemoBuilder.java",
"license": "gpl-3.0",
"size": 43690
} | [
"es.eucm.ead.schema.components.behaviors.events.Init",
"es.eucm.ead.schema.effects.Effect",
"es.eucm.ead.schema.entities.ModelEntity"
] | import es.eucm.ead.schema.components.behaviors.events.Init; import es.eucm.ead.schema.effects.Effect; import es.eucm.ead.schema.entities.ModelEntity; | import es.eucm.ead.schema.components.behaviors.events.*; import es.eucm.ead.schema.effects.*; import es.eucm.ead.schema.entities.*; | [
"es.eucm.ead"
] | es.eucm.ead; | 1,037,167 |
public static void premain(String agentArgs, Instrumentation inst) throws Exception {
initialize(agentArgs, inst);
}
| static void function(String agentArgs, Instrumentation inst) throws Exception { initialize(agentArgs, inst); } | /**
* This method must only be called by the JVM, to provide the instrumentation object.
* In order for this to occur, the JVM must be started with "-javaagent:powermock-module-javaagent-nnn.jar" as a command line parameter
* (assuming the jar file is in the current directory).
*
*/ | This method must only be called by the JVM, to provide the instrumentation object. In order for this to occur, the JVM must be started with "-javaagent:powermock-module-javaagent-nnn.jar" as a command line parameter (assuming the jar file is in the current directory) | premain | {
"repo_name": "sujithps/powermock",
"path": "modules/module-impl/agent/src/main/java/org/powermock/modules/agent/PowerMockAgent.java",
"license": "apache-2.0",
"size": 4104
} | [
"java.lang.instrument.Instrumentation"
] | import java.lang.instrument.Instrumentation; | import java.lang.instrument.*; | [
"java.lang"
] | java.lang; | 385,676 |
public void setColors(@NonNull int[] colors) {
mColors = colors;
// if colors are reset, make sure to reset the color index as well
setColorIndex(0);
} | void function(@NonNull int[] colors) { mColors = colors; setColorIndex(0); } | /**
* Set the colors the progress spinner alternates between.
*
* @param colors Array of integers describing the colors. Must be non-<code>null</code>.
*/ | Set the colors the progress spinner alternates between | setColors | {
"repo_name": "leerduo/OschinaMainFrameWorkWithToolBar",
"path": "app/src/main/java/com/dystu/toolbar/widget/MaterialProgressDrawable.java",
"license": "apache-2.0",
"size": 24271
} | [
"android.support.annotation.NonNull"
] | import android.support.annotation.NonNull; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,776,351 |
public List<StoreDefinition> getCurrentStoreDefinitions(Cluster cluster) {
List<StoreDefinition> storeDefs = null;
for(Node node: cluster.getNodes()) {
List<StoreDefinition> storeDefList = metadataMgmtOps.getRemoteStoreDefList(node.getId())
.getValue();
if(storeDefs == null) {
storeDefs = storeDefList;
} else {
// Compare against the previous store definitions
if(!Utils.compareList(storeDefs, storeDefList)) {
throw new VoldemortException("Store definitions on node " + node.getId()
+ " does not match those on other nodes");
}
}
}
if(storeDefs == null) {
throw new VoldemortException("Could not retrieve list of store definitions correctly");
} else {
return storeDefs;
}
} | List<StoreDefinition> function(Cluster cluster) { List<StoreDefinition> storeDefs = null; for(Node node: cluster.getNodes()) { List<StoreDefinition> storeDefList = metadataMgmtOps.getRemoteStoreDefList(node.getId()) .getValue(); if(storeDefs == null) { storeDefs = storeDefList; } else { if(!Utils.compareList(storeDefs, storeDefList)) { throw new VoldemortException(STR + node.getId() + STR); } } } if(storeDefs == null) { throw new VoldemortException(STR); } else { return storeDefs; } } | /**
* Given the cluster metadata, retrieves the list of store definitions.
*
* <br>
*
* It also checks if the store definitions are consistent across the
* cluster
*
* @param cluster The cluster metadata
* @return List of store definitions
*/ | Given the cluster metadata, retrieves the list of store definitions. It also checks if the store definitions are consistent across the cluster | getCurrentStoreDefinitions | {
"repo_name": "mabh/voldemort",
"path": "src/java/voldemort/client/protocol/admin/AdminClient.java",
"license": "apache-2.0",
"size": 239790
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 75,649 |
ControllerServiceReferencingComponentsEntity getControllerServiceReferencingComponents(String controllerServiceId); | ControllerServiceReferencingComponentsEntity getControllerServiceReferencingComponents(String controllerServiceId); | /**
* Gets the references for specified controller service.
*
* @param controllerServiceId id
* @return service reference
*/ | Gets the references for specified controller service | getControllerServiceReferencingComponents | {
"repo_name": "PuspenduBanerjee/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 53497
} | [
"org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentsEntity"
] | import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentsEntity; | import org.apache.nifi.web.api.entity.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 1,078,337 |
private static void decodeHanziSegment(BitSource bits,
StringBuilder result,
int count) throws FormatException {
// Don't crash trying to read more bits than we have available.
if (count * 13 > bits.available()) {
throw FormatException.getFormatInstance();
}
// Each character will require 2 bytes. Read the characters as 2-byte pairs
// and decode as GB2312 afterwards
byte[] buffer = new byte[2 * count];
int offset = 0;
while (count > 0) {
// Each 13 bits encodes a 2-byte character
int twoBytes = bits.readBits(13);
int assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060);
if (assembledTwoBytes < 0x003BF) {
// In the 0xA1A1 to 0xAAFE range
assembledTwoBytes += 0x0A1A1;
} else {
// In the 0xB0A1 to 0xFAFE range
assembledTwoBytes += 0x0A6A1;
}
buffer[offset] = (byte) ((assembledTwoBytes >> 8) & 0xFF);
buffer[offset + 1] = (byte) (assembledTwoBytes & 0xFF);
offset += 2;
count--;
}
try {
result.append(new String(buffer, StringUtils.GB2312));
} catch (UnsupportedEncodingException ignored) {
throw FormatException.getFormatInstance();
}
} | static void function(BitSource bits, StringBuilder result, int count) throws FormatException { if (count * 13 > bits.available()) { throw FormatException.getFormatInstance(); } byte[] buffer = new byte[2 * count]; int offset = 0; while (count > 0) { int twoBytes = bits.readBits(13); int assembledTwoBytes = ((twoBytes / 0x060) << 8) (twoBytes % 0x060); if (assembledTwoBytes < 0x003BF) { assembledTwoBytes += 0x0A1A1; } else { assembledTwoBytes += 0x0A6A1; } buffer[offset] = (byte) ((assembledTwoBytes >> 8) & 0xFF); buffer[offset + 1] = (byte) (assembledTwoBytes & 0xFF); offset += 2; count--; } try { result.append(new String(buffer, StringUtils.GB2312)); } catch (UnsupportedEncodingException ignored) { throw FormatException.getFormatInstance(); } } | /**
* See specification GBT 18284-2000
*/ | See specification GBT 18284-2000 | decodeHanziSegment | {
"repo_name": "l-dobrev/zxing",
"path": "core/src/main/java/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java",
"license": "apache-2.0",
"size": 13211
} | [
"com.google.zxing.FormatException",
"com.google.zxing.common.BitSource",
"com.google.zxing.common.StringUtils",
"java.io.UnsupportedEncodingException"
] | import com.google.zxing.FormatException; import com.google.zxing.common.BitSource; import com.google.zxing.common.StringUtils; import java.io.UnsupportedEncodingException; | import com.google.zxing.*; import com.google.zxing.common.*; import java.io.*; | [
"com.google.zxing",
"java.io"
] | com.google.zxing; java.io; | 1,988,377 |
public void onClickPendingWidget(final PendingAppWidgetHostView v) {
if (mIsSafeModeEnabled) {
Toast.makeText(this, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
return;
}
final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag();
if (v.isReadyForClickSetup()) {
int widgetId = info.appWidgetId;
AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(widgetId);
if (appWidgetInfo != null) {
mPendingAddWidgetInfo = appWidgetInfo;
mPendingAddInfo.copyFrom(info);
mPendingAddWidgetId = widgetId;
AppWidgetManagerCompat.getInstance(this).startConfigActivity(appWidgetInfo,
info.appWidgetId, this, mAppWidgetHost, REQUEST_RECONFIGURE_APPWIDGET);
} | void function(final PendingAppWidgetHostView v) { if (mIsSafeModeEnabled) { Toast.makeText(this, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show(); return; } final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag(); if (v.isReadyForClickSetup()) { int widgetId = info.appWidgetId; AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(widgetId); if (appWidgetInfo != null) { mPendingAddWidgetInfo = appWidgetInfo; mPendingAddInfo.copyFrom(info); mPendingAddWidgetId = widgetId; AppWidgetManagerCompat.getInstance(this).startConfigActivity(appWidgetInfo, info.appWidgetId, this, mAppWidgetHost, REQUEST_RECONFIGURE_APPWIDGET); } | /**
* Event handler for the app widget view which has not fully restored.
*/ | Event handler for the app widget view which has not fully restored | onClickPendingWidget | {
"repo_name": "mkodekar/LB-Launcher",
"path": "app/src/main/java/com/lb/launcher/Launcher.java",
"license": "apache-2.0",
"size": 207616
} | [
"android.appwidget.AppWidgetProviderInfo",
"android.widget.Toast",
"com.lb.launcher.compat.AppWidgetManagerCompat"
] | import android.appwidget.AppWidgetProviderInfo; import android.widget.Toast; import com.lb.launcher.compat.AppWidgetManagerCompat; | import android.appwidget.*; import android.widget.*; import com.lb.launcher.compat.*; | [
"android.appwidget",
"android.widget",
"com.lb.launcher"
] | android.appwidget; android.widget; com.lb.launcher; | 2,848,329 |
public GroupManager getGroupManager(Context context) {
if (mGroupManager == null) {
mGroupManager = new GroupManager(context);
}
return mGroupManager;
} | GroupManager function(Context context) { if (mGroupManager == null) { mGroupManager = new GroupManager(context); } return mGroupManager; } | /**
* Get IP message group manager.
* @param the context
* @return GroupManager
*/ | Get IP message group manager | getGroupManager | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Mms/ext/src/com/mediatek/mms/ipmessage/IpMessagePluginImpl.java",
"license": "gpl-2.0",
"size": 6082
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 379,396 |
public static void fireOnCloseCompleted(RMQConnection rmqConnection) {
LOGGER.trace("ServerOperator", "fireOnCloseCompleted");
for (ServerOperator l : all()) {
try {
l.OnCloseCompleted(rmqConnection.getServiceUri());
} catch (Exception ex) {
LOGGER.warn("Caught exception during OnCloseCompleted()", ex);
}
}
} | static void function(RMQConnection rmqConnection) { LOGGER.trace(STR, STR); for (ServerOperator l : all()) { try { l.OnCloseCompleted(rmqConnection.getServiceUri()); } catch (Exception ex) { LOGGER.warn(STR, ex); } } } | /**
* Fires OnCloseCompleted event.
*
* @param controlChannel
* the control channel.
* @throws IOException if ControlRMQChannel has somthing wrong.
*/ | Fires OnCloseCompleted event | fireOnCloseCompleted | {
"repo_name": "Andrey9kin/rabbitmq-consumer-plugin",
"path": "src/main/java/org/jenkinsci/plugins/rabbitmqconsumer/extensions/ServerOperator.java",
"license": "mit",
"size": 2879
} | [
"org.jenkinsci.plugins.rabbitmqconsumer.RMQConnection"
] | import org.jenkinsci.plugins.rabbitmqconsumer.RMQConnection; | import org.jenkinsci.plugins.rabbitmqconsumer.*; | [
"org.jenkinsci.plugins"
] | org.jenkinsci.plugins; | 1,692,518 |
Iterator<QueuedElement> getQueued(String queueName); | Iterator<QueuedElement> getQueued(String queueName); | /**
* Get all elements that are queued in the specific queue.
*
* @param queueName Queue to get queued elements from.
* @return Iterator over all queued elements in the queue.
*/ | Get all elements that are queued in the specific queue | getQueued | {
"repo_name": "caskdata/coopr",
"path": "coopr-server/src/main/java/co/cask/coopr/common/queue/QueueGroup.java",
"license": "apache-2.0",
"size": 5073
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 931,571 |
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getTestParameters")
public void backupKeyNotFound(HttpClient httpClient, KeyServiceVersion serviceVersion) {
createKeyAsyncClient(httpClient, serviceVersion);
StepVerifier.create(client.backupKey("non-existing"))
.verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND));
} | @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource(STR) void function(HttpClient httpClient, KeyServiceVersion serviceVersion) { createKeyAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.backupKey(STR)) .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } | /**
* Tests that an attempt to backup a non existing key throws an error.
*/ | Tests that an attempt to backup a non existing key throws an error | backupKeyNotFound | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java",
"license": "mit",
"size": 23567
} | [
"com.azure.core.exception.ResourceNotFoundException",
"com.azure.core.http.HttpClient",
"java.net.HttpURLConnection",
"org.junit.jupiter.params.ParameterizedTest",
"org.junit.jupiter.params.provider.MethodSource"
] | import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import java.net.HttpURLConnection; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; | import com.azure.core.exception.*; import com.azure.core.http.*; import java.net.*; import org.junit.jupiter.params.*; import org.junit.jupiter.params.provider.*; | [
"com.azure.core",
"java.net",
"org.junit.jupiter"
] | com.azure.core; java.net; org.junit.jupiter; | 2,207,347 |
public interface ReservationRecommendationDetailsClient {
@ServiceMethod(returns = ReturnType.SINGLE)
ReservationRecommendationDetailsModelInner get(
String scope, String region, Term term, LookBackPeriod lookBackPeriod, String product); | interface ReservationRecommendationDetailsClient { @ServiceMethod(returns = ReturnType.SINGLE) ReservationRecommendationDetailsModelInner function( String scope, String region, Term term, LookBackPeriod lookBackPeriod, String product); | /**
* Details of a reservation recommendation for what-if analysis of reserved instances.
*
* @param scope The scope associated with reservation recommendation details operations. This includes
* '/subscriptions/{subscriptionId}/' for subscription scope,
* '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope,
* /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope.
* @param region Used to select the region the recommendation should be generated for.
* @param term Specify length of reservation recommendation term.
* @param lookBackPeriod Filter the time period on which reservation recommendation results are based.
* @param product Filter the products for which reservation recommendation results are generated. Examples:
* Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks).
* @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.
* @return reservation recommendation details.
*/ | Details of a reservation recommendation for what-if analysis of reserved instances | get | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/fluent/ReservationRecommendationDetailsClient.java",
"license": "mit",
"size": 4241
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner",
"com.azure.resourcemanager.consumption.models.LookBackPeriod",
"com.azure.resourcemanager.consumption.models.Term"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.consumption.fluent.models.ReservationRecommendationDetailsModelInner; import com.azure.resourcemanager.consumption.models.LookBackPeriod; import com.azure.resourcemanager.consumption.models.Term; | import com.azure.core.annotation.*; import com.azure.resourcemanager.consumption.fluent.models.*; import com.azure.resourcemanager.consumption.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 460,848 |
public PublicIPPrefixInner updateTags(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).toBlocking().single().body();
} | PublicIPPrefixInner function(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).toBlocking().single().body(); } | /**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/ | Updates public IP prefix tags | updateTags | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/implementation/PublicIPPrefixesInner.java",
"license": "mit",
"size": 69595
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 434,426 |
@Override
public Vector get(Particle particle) {
Vector velocity = (Vector) particle.getVelocity();
Vector position = (Vector) particle.getCandidateSolution();
Vector localGuide = (Vector) particle.getLocalGuide();
Vector globalGuide = (Vector) particle.getGlobalGuide();
Vector dampenedVelocity = Vector.copyOf(velocity).multiply(inertiaWeight.getParameter());
Vector cognitiveComponent = Vector.copyOf(localGuide).subtract(position).multiply(cp(cognitiveAcceleration)).multiply(random());
Vector socialComponent = Vector.copyOf(globalGuide).subtract(position).multiply(cp(socialAcceleration)).multiply(random());
return Vectors.sumOf(dampenedVelocity, cognitiveComponent, socialComponent).valueE("Cannot determine velocity");
} | Vector function(Particle particle) { Vector velocity = (Vector) particle.getVelocity(); Vector position = (Vector) particle.getCandidateSolution(); Vector localGuide = (Vector) particle.getLocalGuide(); Vector globalGuide = (Vector) particle.getGlobalGuide(); Vector dampenedVelocity = Vector.copyOf(velocity).multiply(inertiaWeight.getParameter()); Vector cognitiveComponent = Vector.copyOf(localGuide).subtract(position).multiply(cp(cognitiveAcceleration)).multiply(random()); Vector socialComponent = Vector.copyOf(globalGuide).subtract(position).multiply(cp(socialAcceleration)).multiply(random()); return Vectors.sumOf(dampenedVelocity, cognitiveComponent, socialComponent).valueE(STR); } | /**
* Perform the velocity update for the given {@linkplain Particle}.
* @param particle The {@linkplain Particle} velocity that should be updated.
*/ | Perform the velocity update for the given Particle | get | {
"repo_name": "filinep/cilib",
"path": "library/src/main/java/net/sourceforge/cilib/pso/velocityprovider/StandardVelocityProvider.java",
"license": "gpl-3.0",
"size": 5123
} | [
"net.sourceforge.cilib.pso.particle.Particle",
"net.sourceforge.cilib.type.types.container.Vector",
"net.sourceforge.cilib.util.Vectors"
] | import net.sourceforge.cilib.pso.particle.Particle; import net.sourceforge.cilib.type.types.container.Vector; import net.sourceforge.cilib.util.Vectors; | import net.sourceforge.cilib.pso.particle.*; import net.sourceforge.cilib.type.types.container.*; import net.sourceforge.cilib.util.*; | [
"net.sourceforge.cilib"
] | net.sourceforge.cilib; | 268,275 |
protected Assessment newImportable() {
return new Assessment();
} | Assessment function() { return new Assessment(); } | /**
* This is a factory method that allows sublasses to use a different type inside this class's methods
* @return an empty Assessment object ready to fill up.
*/ | This is a factory method that allows sublasses to use a different type inside this class's methods | newImportable | {
"repo_name": "payten/nyu-sakai-10.4",
"path": "common/import-parsers/blackboard_9_nyu/src/java/org/sakaiproject/importer/impl/translators/Bb9NYUAssessmentTranslator.java",
"license": "apache-2.0",
"size": 20021
} | [
"org.sakaiproject.importer.impl.importables.Assessment"
] | import org.sakaiproject.importer.impl.importables.Assessment; | import org.sakaiproject.importer.impl.importables.*; | [
"org.sakaiproject.importer"
] | org.sakaiproject.importer; | 1,038,414 |
public static ITypeBinding toTypeBinding(IBinding binding) {
if (binding instanceof ITypeBinding) {
return (ITypeBinding) binding;
} else if (binding instanceof IMethodBinding) {
IMethodBinding m = (IMethodBinding) binding;
return m.isConstructor() ? m.getDeclaringClass() : m.getReturnType();
} else if (binding instanceof IVariableBinding) {
return ((IVariableBinding) binding).getType();
} else if (binding instanceof IAnnotationBinding) {
return ((IAnnotationBinding) binding).getAnnotationType();
}
return null;
} | static ITypeBinding function(IBinding binding) { if (binding instanceof ITypeBinding) { return (ITypeBinding) binding; } else if (binding instanceof IMethodBinding) { IMethodBinding m = (IMethodBinding) binding; return m.isConstructor() ? m.getDeclaringClass() : m.getReturnType(); } else if (binding instanceof IVariableBinding) { return ((IVariableBinding) binding).getType(); } else if (binding instanceof IAnnotationBinding) { return ((IAnnotationBinding) binding).getAnnotationType(); } return null; } | /**
* Convert an IBinding to a ITypeBinding. Returns null if the binding cannot
* be converted to a type binding.
*/ | Convert an IBinding to a ITypeBinding. Returns null if the binding cannot be converted to a type binding | toTypeBinding | {
"repo_name": "hambroperks/j2objc",
"path": "translator/src/main/java/com/google/devtools/j2objc/util/BindingUtil.java",
"license": "apache-2.0",
"size": 12458
} | [
"org.eclipse.jdt.core.dom.IAnnotationBinding",
"org.eclipse.jdt.core.dom.IBinding",
"org.eclipse.jdt.core.dom.IMethodBinding",
"org.eclipse.jdt.core.dom.ITypeBinding",
"org.eclipse.jdt.core.dom.IVariableBinding"
] | import org.eclipse.jdt.core.dom.IAnnotationBinding; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; | import org.eclipse.jdt.core.dom.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 947,403 |
public void testFindSdkFor_RawJars() throws Exception {
IPath installationDir = GwtRuntimeTestUtilities.getDefaultRuntime().getInstallationPath();
checkSdkDetectionUsingRawClasspathEntries(installationDir);
} | void function() throws Exception { IPath installationDir = GwtRuntimeTestUtilities.getDefaultRuntime().getInstallationPath(); checkSdkDetectionUsingRawClasspathEntries(installationDir); } | /**
* Tests that {@link GWTRuntime#findSdkFor(IJavaProject)} returns a valid
* {@link com.google.gdt.eclipse.core.sdk.Sdk} when raw jars are being used on
* the project classpath.
*/ | Tests that <code>GWTRuntime#findSdkFor(IJavaProject)</code> returns a valid <code>com.google.gdt.eclipse.core.sdk.Sdk</code> when raw jars are being used on the project classpath | testFindSdkFor_RawJars | {
"repo_name": "briandealwis/gwt-eclipse-plugin",
"path": "plugins/com.gwtplugins.gwt.eclipse.core.test/src/com/google/gwt/eclipse/core/runtime/GWTRuntimeTest.java",
"license": "epl-1.0",
"size": 9676
} | [
"com.google.gwt.eclipse.testing.GwtRuntimeTestUtilities",
"org.eclipse.core.runtime.IPath"
] | import com.google.gwt.eclipse.testing.GwtRuntimeTestUtilities; import org.eclipse.core.runtime.IPath; | import com.google.gwt.eclipse.testing.*; import org.eclipse.core.runtime.*; | [
"com.google.gwt",
"org.eclipse.core"
] | com.google.gwt; org.eclipse.core; | 1,898,834 |
ServiceFuture<CheckNameAvailabilityResult> checkNameAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, final ServiceCallback<CheckNameAvailabilityResult> serviceCallback); | ServiceFuture<CheckNameAvailabilityResult> checkNameAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, final ServiceCallback<CheckNameAvailabilityResult> serviceCallback); | /**
* Checks that account name is valid and is not in use.
*
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceFuture} object
*/ | Checks that account name is valid and is not in use | checkNameAvailabilityAsync | {
"repo_name": "anudeepsharma/autorest",
"path": "Samples/azure-storage/Azure.Java/StorageAccounts.java",
"license": "mit",
"size": 29892
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,762,150 |
public static void d(Context context, Object obj, String msg, Throwable tr) {
if (isAllowed(context, Log.LEVEL_DEBUG)) {
android.util.Log.d(getTag(obj), msg, tr);
}
}
| static void function(Context context, Object obj, String msg, Throwable tr) { if (isAllowed(context, Log.LEVEL_DEBUG)) { android.util.Log.d(getTag(obj), msg, tr); } } | /**
* Write a "debug" message to the log.
*
* @param context Any context will do (application, service, activity, etc).
* @param obj The object whose name should be used as the tag.
* @param msg Message to write to the log.
* @param tr A throwable whose stack trace will also be written.
*/ | Write a "debug" message to the log | d | {
"repo_name": "fixedd/succinct_android_logging",
"path": "src/com/fixedd/util/Log.java",
"license": "apache-2.0",
"size": 18320
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 88,483 |
public void insertConversion(int index, FunctionDescriptor functionDescriptor) {
// Get target type for conversion
Class<?> t = functionDescriptor.getReturnType();
String typeName = DataTypeManager.getDataTypeName(t);
// Pull old expression at index
Expression newArg[] = new Expression[] { args[index], new Constant(typeName) };
// Replace old expression with new expression, using old as arg
Function func = new Function(functionDescriptor.getName(), newArg);
args[index] = func;
// Set function descriptor and type of new function
func.setFunctionDescriptor(functionDescriptor);
func.setType(t);
func.makeImplicit();
} | void function(int index, FunctionDescriptor functionDescriptor) { Class<?> t = functionDescriptor.getReturnType(); String typeName = DataTypeManager.getDataTypeName(t); Expression newArg[] = new Expression[] { args[index], new Constant(typeName) }; Function func = new Function(functionDescriptor.getName(), newArg); args[index] = func; func.setFunctionDescriptor(functionDescriptor); func.setType(t); func.makeImplicit(); } | /**
* Insert a conversion function at specified index. This is a convenience
* method to insert a conversion into the function tree.
* @param index Argument index to insert conversion function at
* @param functionDescriptor Conversion function descriptor
*/ | Insert a conversion function at specified index. This is a convenience method to insert a conversion into the function tree | insertConversion | {
"repo_name": "jagazee/teiid-8.7",
"path": "engine/src/main/java/org/teiid/query/sql/symbol/Function.java",
"license": "lgpl-2.1",
"size": 7099
} | [
"org.teiid.core.types.DataTypeManager",
"org.teiid.query.function.FunctionDescriptor"
] | import org.teiid.core.types.DataTypeManager; import org.teiid.query.function.FunctionDescriptor; | import org.teiid.core.types.*; import org.teiid.query.function.*; | [
"org.teiid.core",
"org.teiid.query"
] | org.teiid.core; org.teiid.query; | 2,748,211 |
public Paint getPaintHighlight() {
return mHighlightPaint;
} | Paint function() { return mHighlightPaint; } | /**
* Returns the Paint object this renderer uses for drawing highlight
* indicators.
*
* @return
*/ | Returns the Paint object this renderer uses for drawing highlight indicators | getPaintHighlight | {
"repo_name": "Stonesjtu/HEMS",
"path": "app/libs/mplib/src/com/github/mikephil/charting/renderer/DataRenderer.java",
"license": "gpl-2.0",
"size": 4604
} | [
"android.graphics.Paint"
] | import android.graphics.Paint; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,535,720 |
public void getData() {
wName.setText( Const.nullToEmpty( jobEntry.getName() ) );
if ( jobEntry.source_filefolder != null ) {
for ( int i = 0; i < jobEntry.source_filefolder.length; i++ ) {
TableItem ti = wFields.table.getItem( i );
ti.setText( FIELDS.ACTION.ordinal(), JobEntryPGPEncryptFiles.getActionTypeDesc( jobEntry.action_type[i] ) );
if ( jobEntry.source_filefolder[i] != null ) {
ti.setText( FIELDS.SOURCE.ordinal(), jobEntry.source_filefolder[i] );
}
if ( jobEntry.wildcard[i] != null ) {
ti.setText( FIELDS.WILDCARD.ordinal(), jobEntry.wildcard[i] );
}
if ( jobEntry.userid[i] != null ) {
ti.setText( FIELDS.USERID.ordinal(), jobEntry.userid[i] );
}
if ( jobEntry.destination_filefolder[i] != null ) {
ti.setText( FIELDS.DESTINATION.ordinal(), jobEntry.destination_filefolder[i] );
}
}
wFields.setRowNums();
wFields.optWidth( true );
}
wasciiMode.setSelection( jobEntry.isAsciiMode() );
wPrevious.setSelection( jobEntry.arg_from_previous );
wIncludeSubfolders.setSelection( jobEntry.include_subfolders );
wDestinationIsAFile.setSelection( jobEntry.destination_is_a_file );
wCreateDestinationFolder.setSelection( jobEntry.create_destination_folder );
wAddFileToResult.setSelection( jobEntry.add_result_filesname );
wCreateMoveToFolder.setSelection( jobEntry.create_move_to_folder );
if ( jobEntry.getNrErrorsLessThan() != null ) {
wNrErrorsLessThan.setText( jobEntry.getNrErrorsLessThan() );
} else {
wNrErrorsLessThan.setText( "10" );
}
if ( jobEntry.getSuccessCondition() != null ) {
if ( jobEntry.getSuccessCondition().equals( jobEntry.SUCCESS_IF_AT_LEAST_X_FILES_UN_ZIPPED ) ) {
wSuccessCondition.select( 1 );
} else if ( jobEntry.getSuccessCondition().equals( jobEntry.SUCCESS_IF_ERRORS_LESS ) ) {
wSuccessCondition.select( 2 );
} else {
wSuccessCondition.select( 0 );
}
} else {
wSuccessCondition.select( 0 );
}
if ( jobEntry.getIfFileExists() != null ) {
if ( jobEntry.getIfFileExists().equals( "overwrite_file" ) ) {
wIfFileExists.select( 1 );
} else if ( jobEntry.getIfFileExists().equals( "unique_name" ) ) {
wIfFileExists.select( 2 );
} else if ( jobEntry.getIfFileExists().equals( "delete_file" ) ) {
wIfFileExists.select( 3 );
} else if ( jobEntry.getIfFileExists().equals( "move_file" ) ) {
wIfFileExists.select( 4 );
} else if ( jobEntry.getIfFileExists().equals( "fail" ) ) {
wIfFileExists.select( 5 );
} else {
wIfFileExists.select( 0 );
}
} else {
wIfFileExists.select( 0 );
}
if ( jobEntry.getDestinationFolder() != null ) {
wDestinationFolder.setText( jobEntry.getDestinationFolder() );
}
if ( jobEntry.getIfMovedFileExists() != null ) {
if ( jobEntry.getIfMovedFileExists().equals( "overwrite_file" ) ) {
wIfMovedFileExists.select( 1 );
} else if ( jobEntry.getIfMovedFileExists().equals( "unique_name" ) ) {
wIfMovedFileExists.select( 2 );
} else if ( jobEntry.getIfMovedFileExists().equals( "fail" ) ) {
wIfMovedFileExists.select( 3 );
} else {
wIfMovedFileExists.select( 0 );
}
} else {
wIfMovedFileExists.select( 0 );
}
wDoNotKeepFolderStructure.setSelection( jobEntry.isDoNotKeepFolderStructure() );
wAddDateBeforeExtension.setSelection( jobEntry.isAddDateBeforeExtension() );
wAddDate.setSelection( jobEntry.isAddDate() );
wAddTime.setSelection( jobEntry.isAddTime() );
wSpecifyFormat.setSelection( jobEntry.isSpecifyFormat() );
if ( jobEntry.getDateTimeFormat() != null ) {
wDateTimeFormat.setText( jobEntry.getDateTimeFormat() );
}
if ( jobEntry.getGPGLocation() != null ) {
wGpgExe.setText( jobEntry.getGPGLocation() );
}
wAddMovedDate.setSelection( jobEntry.isAddMovedDate() );
wAddMovedTime.setSelection( jobEntry.isAddMovedTime() );
wSpecifyMoveFormat.setSelection( jobEntry.isSpecifyMoveFormat() );
if ( jobEntry.getMovedDateTimeFormat() != null ) {
wMovedDateTimeFormat.setText( jobEntry.getMovedDateTimeFormat() );
}
wAddMovedDateBeforeExtension.setSelection( jobEntry.isAddMovedDateBeforeExtension() );
wName.selectAll();
wName.setFocus();
} | void function() { wName.setText( Const.nullToEmpty( jobEntry.getName() ) ); if ( jobEntry.source_filefolder != null ) { for ( int i = 0; i < jobEntry.source_filefolder.length; i++ ) { TableItem ti = wFields.table.getItem( i ); ti.setText( FIELDS.ACTION.ordinal(), JobEntryPGPEncryptFiles.getActionTypeDesc( jobEntry.action_type[i] ) ); if ( jobEntry.source_filefolder[i] != null ) { ti.setText( FIELDS.SOURCE.ordinal(), jobEntry.source_filefolder[i] ); } if ( jobEntry.wildcard[i] != null ) { ti.setText( FIELDS.WILDCARD.ordinal(), jobEntry.wildcard[i] ); } if ( jobEntry.userid[i] != null ) { ti.setText( FIELDS.USERID.ordinal(), jobEntry.userid[i] ); } if ( jobEntry.destination_filefolder[i] != null ) { ti.setText( FIELDS.DESTINATION.ordinal(), jobEntry.destination_filefolder[i] ); } } wFields.setRowNums(); wFields.optWidth( true ); } wasciiMode.setSelection( jobEntry.isAsciiMode() ); wPrevious.setSelection( jobEntry.arg_from_previous ); wIncludeSubfolders.setSelection( jobEntry.include_subfolders ); wDestinationIsAFile.setSelection( jobEntry.destination_is_a_file ); wCreateDestinationFolder.setSelection( jobEntry.create_destination_folder ); wAddFileToResult.setSelection( jobEntry.add_result_filesname ); wCreateMoveToFolder.setSelection( jobEntry.create_move_to_folder ); if ( jobEntry.getNrErrorsLessThan() != null ) { wNrErrorsLessThan.setText( jobEntry.getNrErrorsLessThan() ); } else { wNrErrorsLessThan.setText( "10" ); } if ( jobEntry.getSuccessCondition() != null ) { if ( jobEntry.getSuccessCondition().equals( jobEntry.SUCCESS_IF_AT_LEAST_X_FILES_UN_ZIPPED ) ) { wSuccessCondition.select( 1 ); } else if ( jobEntry.getSuccessCondition().equals( jobEntry.SUCCESS_IF_ERRORS_LESS ) ) { wSuccessCondition.select( 2 ); } else { wSuccessCondition.select( 0 ); } } else { wSuccessCondition.select( 0 ); } if ( jobEntry.getIfFileExists() != null ) { if ( jobEntry.getIfFileExists().equals( STR ) ) { wIfFileExists.select( 1 ); } else if ( jobEntry.getIfFileExists().equals( STR ) ) { wIfFileExists.select( 2 ); } else if ( jobEntry.getIfFileExists().equals( STR ) ) { wIfFileExists.select( 3 ); } else if ( jobEntry.getIfFileExists().equals( STR ) ) { wIfFileExists.select( 4 ); } else if ( jobEntry.getIfFileExists().equals( "fail" ) ) { wIfFileExists.select( 5 ); } else { wIfFileExists.select( 0 ); } } else { wIfFileExists.select( 0 ); } if ( jobEntry.getDestinationFolder() != null ) { wDestinationFolder.setText( jobEntry.getDestinationFolder() ); } if ( jobEntry.getIfMovedFileExists() != null ) { if ( jobEntry.getIfMovedFileExists().equals( STR ) ) { wIfMovedFileExists.select( 1 ); } else if ( jobEntry.getIfMovedFileExists().equals( STR ) ) { wIfMovedFileExists.select( 2 ); } else if ( jobEntry.getIfMovedFileExists().equals( "fail" ) ) { wIfMovedFileExists.select( 3 ); } else { wIfMovedFileExists.select( 0 ); } } else { wIfMovedFileExists.select( 0 ); } wDoNotKeepFolderStructure.setSelection( jobEntry.isDoNotKeepFolderStructure() ); wAddDateBeforeExtension.setSelection( jobEntry.isAddDateBeforeExtension() ); wAddDate.setSelection( jobEntry.isAddDate() ); wAddTime.setSelection( jobEntry.isAddTime() ); wSpecifyFormat.setSelection( jobEntry.isSpecifyFormat() ); if ( jobEntry.getDateTimeFormat() != null ) { wDateTimeFormat.setText( jobEntry.getDateTimeFormat() ); } if ( jobEntry.getGPGLocation() != null ) { wGpgExe.setText( jobEntry.getGPGLocation() ); } wAddMovedDate.setSelection( jobEntry.isAddMovedDate() ); wAddMovedTime.setSelection( jobEntry.isAddMovedTime() ); wSpecifyMoveFormat.setSelection( jobEntry.isSpecifyMoveFormat() ); if ( jobEntry.getMovedDateTimeFormat() != null ) { wMovedDateTimeFormat.setText( jobEntry.getMovedDateTimeFormat() ); } wAddMovedDateBeforeExtension.setSelection( jobEntry.isAddMovedDateBeforeExtension() ); wName.selectAll(); wName.setFocus(); } | /**
* Copy information from the meta-data input to the dialog fields.
*/ | Copy information from the meta-data input to the dialog fields | getData | {
"repo_name": "tkafalas/pentaho-kettle",
"path": "ui/src/main/java/org/pentaho/di/ui/job/entries/pgpencryptfiles/JobEntryPGPEncryptFilesDialog.java",
"license": "apache-2.0",
"size": 85756
} | [
"org.eclipse.swt.widgets.TableItem",
"org.pentaho.di.core.Const",
"org.pentaho.di.job.entries.pgpencryptfiles.JobEntryPGPEncryptFiles"
] | import org.eclipse.swt.widgets.TableItem; import org.pentaho.di.core.Const; import org.pentaho.di.job.entries.pgpencryptfiles.JobEntryPGPEncryptFiles; | import org.eclipse.swt.widgets.*; import org.pentaho.di.core.*; import org.pentaho.di.job.entries.pgpencryptfiles.*; | [
"org.eclipse.swt",
"org.pentaho.di"
] | org.eclipse.swt; org.pentaho.di; | 312,756 |
protected void addSchoolClassPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Course_schoolClass_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Course_schoolClass_feature", "_UI_Course_type"),
SchoolPackage.Literals.COURSE__SCHOOL_CLASS,
true,
false,
true,
null,
null,
null));
}
| void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), SchoolPackage.Literals.COURSE__SCHOOL_CLASS, true, false, true, null, null, null)); } | /**
* This adds a property descriptor for the School Class feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the School Class feature. | addSchoolClassPropertyDescriptor | {
"repo_name": "imbur/EMF-IncQuery-Examples",
"path": "derived-features-by-queries/school-derived.edit/src/school/provider/CourseItemProvider.java",
"license": "epl-1.0",
"size": 7157
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,721,104 |
static Integer getCommonClassId(Class<?> clazz) {
HashMap<Class<?>, Integer> map = COMMON_CLASSES_MAP;
if (map.size() == 0) {
// lazy initialization
for (int i = 0, size = COMMON_CLASSES.length; i < size; i++) {
COMMON_CLASSES_MAP.put(COMMON_CLASSES[i], i);
}
}
return map.get(clazz);
} | static Integer getCommonClassId(Class<?> clazz) { HashMap<Class<?>, Integer> map = COMMON_CLASSES_MAP; if (map.size() == 0) { for (int i = 0, size = COMMON_CLASSES.length; i < size; i++) { COMMON_CLASSES_MAP.put(COMMON_CLASSES[i], i); } } return map.get(clazz); } | /**
* Get the class id, or null if not found.
*
* @param clazz the class
* @return the class id or null
*/ | Get the class id, or null if not found | getCommonClassId | {
"repo_name": "miloszpiglas/h2mod",
"path": "src/main/org/h2/mvstore/type/ObjectDataType.java",
"license": "mpl-2.0",
"size": 50009
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 838,569 |
public Activation getActivation()
{
return activation;
} | Activation function() { return activation; } | /**
* Get activation
* @return The value
*/ | Get activation | getActivation | {
"repo_name": "jandsu/ironjacamar",
"path": "core/src/main/java/org/ironjacamar/core/deploymentrepository/DeploymentBuilder.java",
"license": "epl-1.0",
"size": 6753
} | [
"org.ironjacamar.common.api.metadata.resourceadapter.Activation"
] | import org.ironjacamar.common.api.metadata.resourceadapter.Activation; | import org.ironjacamar.common.api.metadata.resourceadapter.*; | [
"org.ironjacamar.common"
] | org.ironjacamar.common; | 2,770,189 |
//-----------------------------------------------------------------------
public final MetaProperty<String> classifier() {
return _classifier;
} | final MetaProperty<String> function() { return _classifier; } | /**
* The meta-property for the {@code classifier} property.
* @return the meta-property, not null
*/ | The meta-property for the classifier property | classifier | {
"repo_name": "McLeodMoores/starling",
"path": "projects/finmath/src/test/java/com/mcleodmoores/integration/simulatedexamples/component/TestMarketDataComponentFactory.java",
"license": "apache-2.0",
"size": 15814
} | [
"org.joda.beans.MetaProperty"
] | import org.joda.beans.MetaProperty; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 2,097,652 |
private final void dataProviderService(File file, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
logger.debug("dataprovider '{}' requested", file.getPath());
List<Object> beans = new ArrayList<Object>();
String resultString = null;
File resourceFolder = rootFolder;
String rel = file.getPath().substring(rootFolder.getPath().length());
// is CometVisu version >= 0.11 (Qooxdoo based)
if (rel.startsWith("/source/") || rel.startsWith("/build/")) {
// Qooxdoo based CometVisu in source/build mode
// change the folder
String[] parts = rel.substring(1).split("/");
resourceFolder = new File(rootFolder, parts[0] + "/resource");
logger.debug("new resource folder is {}", resourceFolder.getPath());
}
if (file.getName().equals("dpt_list.json")) {
// return all transforms available for openhab
for (Transform transform : Transform.values()) {
DataBean bean = new DataBean();
bean.label = transform.toString().toLowerCase();
bean.value = "OH:" + bean.label;
beans.add(bean);
}
} else if (file.getName().equals("list_all_addresses.php")) {
// all item names
// collect all available transform types
ArrayList<String> transformTypes = new ArrayList<String>();
for (Transform transform : Transform.values()) {
transformTypes.add(transform.toString().toLowerCase());
}
Map<String, ArrayList<Object>> groups = new HashMap<String, ArrayList<Object>>();
for (Item item : this.cometVisuApp.getItemRegistry().getItems()) {
ItemBean bean = new ItemBean();
bean.value = item.getName();
String type = item.getType();
if (item.getType() == "Group") {
if (((GroupItem) item).getBaseItem() != null) {
type = ((GroupItem) item).getBaseItem().getType();
} else {
continue;
}
}
bean.label = item.getName();
String transform = type.toLowerCase().replace("Item", "");
if (transformTypes.contains(transform)) {
bean.hints.put("transform", "OH:" + transform);
} else {
logger.debug("no transform type found for item type {}, skipping this item", type);
continue;
}
if (!groups.containsKey(type)) {
groups.put(type, new ArrayList<Object>());
}
groups.get(type).add(bean);
}
resultString = marshalJson(groups);
} else if (file.getName().equals("list_all_icons.php")) {
// all item names
File svgFile = new File(resourceFolder, "icon/knx-uf-iconset.svg");
if (svgFile.exists()) {
// extract names from SVG file
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(svgFile);
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr = xpath.compile("//symbol/@id");
NodeList nl = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
for (int i = 0, len = nl.getLength(); i < len; i++) {
Node node = nl.item(i);
DataBean bean = new DataBean();
bean.label = node.getTextContent();
bean.value = node.getTextContent();
beans.add(bean);
}
} catch (SAXException e) {
logger.error("error parsing SVG file: {}", e.getMessage(), e);
} catch (ParserConfigurationException e) {
logger.error("error extracting items from SVG file: {}", e.getMessage(), e);
} catch (XPathExpressionException e) {
logger.error("error extracting items from SVG file: {}", e.getMessage(), e);
} | final void function(File file, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.debug(STR, file.getPath()); List<Object> beans = new ArrayList<Object>(); String resultString = null; File resourceFolder = rootFolder; String rel = file.getPath().substring(rootFolder.getPath().length()); if (rel.startsWith(STR) rel.startsWith(STR)) { String[] parts = rel.substring(1).split("/"); resourceFolder = new File(rootFolder, parts[0] + STR); logger.debug(STR, resourceFolder.getPath()); } if (file.getName().equals(STR)) { for (Transform transform : Transform.values()) { DataBean bean = new DataBean(); bean.label = transform.toString().toLowerCase(); bean.value = "OH:" + bean.label; beans.add(bean); } } else if (file.getName().equals(STR)) { ArrayList<String> transformTypes = new ArrayList<String>(); for (Transform transform : Transform.values()) { transformTypes.add(transform.toString().toLowerCase()); } Map<String, ArrayList<Object>> groups = new HashMap<String, ArrayList<Object>>(); for (Item item : this.cometVisuApp.getItemRegistry().getItems()) { ItemBean bean = new ItemBean(); bean.value = item.getName(); String type = item.getType(); if (item.getType() == "Group") { if (((GroupItem) item).getBaseItem() != null) { type = ((GroupItem) item).getBaseItem().getType(); } else { continue; } } bean.label = item.getName(); String transform = type.toLowerCase().replace("Item", STRtransformSTROH:STRno transform type found for item type {}, skipping this itemSTRlist_all_icons.phpSTRicon/knx-uf-iconset.svgSTR NodeList nl = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); for (int i = 0, len = nl.getLength(); i < len; i++) { Node node = nl.item(i); DataBean bean = new DataBean(); bean.label = node.getTextContent(); bean.value = node.getTextContent(); beans.add(bean); } } catch (SAXException e) { logger.error(STR, e.getMessage(), e); } catch (ParserConfigurationException e) { logger.error(STR, e.getMessage(), e); } catch (XPathExpressionException e) { logger.error(STR, e.getMessage(), e); } | /**
* replaces the dataproviders in
* <cometvisu-src>/editor/dataproviders/*.(php|json) +
*
* @param file
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/ | replaces the dataproviders in /editor/dataproviders/*.(php|json) + | dataProviderService | {
"repo_name": "robbyb67/openhab2",
"path": "addons/ui/org.openhab.ui.cometvisu/src/main/java/org/openhab/ui/cometvisu/servlet/CometVisuServlet.java",
"license": "epl-1.0",
"size": 50080
} | [
"java.io.File",
"java.io.IOException",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.xml.parsers.ParserConfigurationException",
"javax.xml.xpath.XPathConstants",
"javax.xml.xpath.XPathExpressionException",
"org.eclipse.smarthome.core.items.GroupItem",
"org.eclipse.smarthome.core.items.Item",
"org.openhab.ui.cometvisu.internal.config.ConfigHelper",
"org.openhab.ui.cometvisu.internal.editor.dataprovider.beans.DataBean",
"org.openhab.ui.cometvisu.internal.editor.dataprovider.beans.ItemBean",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList",
"org.xml.sax.SAXException"
] | import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import org.eclipse.smarthome.core.items.GroupItem; import org.eclipse.smarthome.core.items.Item; import org.openhab.ui.cometvisu.internal.config.ConfigHelper; import org.openhab.ui.cometvisu.internal.editor.dataprovider.beans.DataBean; import org.openhab.ui.cometvisu.internal.editor.dataprovider.beans.ItemBean; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; | import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.eclipse.smarthome.core.items.*; import org.openhab.ui.cometvisu.internal.config.*; import org.openhab.ui.cometvisu.internal.editor.dataprovider.beans.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"java.util",
"javax.servlet",
"javax.xml",
"org.eclipse.smarthome",
"org.openhab.ui",
"org.w3c.dom",
"org.xml.sax"
] | java.io; java.util; javax.servlet; javax.xml; org.eclipse.smarthome; org.openhab.ui; org.w3c.dom; org.xml.sax; | 2,601,397 |
public static synchronized DeviceTypeLoader s_instance() {
if (s_deviceTypeLoader == null) {
s_deviceTypeLoader = new DeviceTypeLoader();
InputStream input = DeviceTypeLoader.class.getResourceAsStream("/device_types.xml");
try {
s_deviceTypeLoader.loadDeviceTypesXML(input);
} catch (ParserConfigurationException e) {
logger.error("parser config error when reading device types xml file: ", e);
} catch (SAXException e) {
logger.error("SAX exception when reading device types xml file: ", e);
} catch (IOException e) {
logger.error("I/O exception when reading device types xml file: ", e);
}
logger.debug("loaded {} devices: ", s_deviceTypeLoader.getDeviceTypes().size());
s_deviceTypeLoader.logDeviceTypes();
}
return s_deviceTypeLoader;
} | static synchronized DeviceTypeLoader function() { if (s_deviceTypeLoader == null) { s_deviceTypeLoader = new DeviceTypeLoader(); InputStream input = DeviceTypeLoader.class.getResourceAsStream(STR); try { s_deviceTypeLoader.loadDeviceTypesXML(input); } catch (ParserConfigurationException e) { logger.error(STR, e); } catch (SAXException e) { logger.error(STR, e); } catch (IOException e) { logger.error(STR, e); } logger.debug(STR, s_deviceTypeLoader.getDeviceTypes().size()); s_deviceTypeLoader.logDeviceTypes(); } return s_deviceTypeLoader; } | /**
* Singleton instance function, creates DeviceTypeLoader
* @return DeviceTypeLoader singleton reference
*/ | Singleton instance function, creates DeviceTypeLoader | s_instance | {
"repo_name": "rahulopengts/myhome",
"path": "bundles/binding/org.openhab.binding.insteonplm/src/main/java/org/openhab/binding/insteonplm/internal/device/DeviceTypeLoader.java",
"license": "epl-1.0",
"size": 6114
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.xml.parsers.ParserConfigurationException",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.xml.sax"
] | java.io; javax.xml; org.xml.sax; | 1,107,920 |
@NotNull public IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs) {
GridCompoundFuture<?, ?> compoundFut = new GridCompoundFuture<>();
for (DynamicCacheStartFuture fut : initiateCacheChanges(reqs))
compoundFut.add((IgniteInternalFuture)fut);
compoundFut.markInitialized();
return compoundFut;
} | @NotNull IgniteInternalFuture<?> function(List<DynamicCacheChangeRequest> reqs) { GridCompoundFuture<?, ?> compoundFut = new GridCompoundFuture<>(); for (DynamicCacheStartFuture fut : initiateCacheChanges(reqs)) compoundFut.add((IgniteInternalFuture)fut); compoundFut.markInitialized(); return compoundFut; } | /**
* Starts cache stop request as cache change batch.
*
* @param reqs cache stop requests.
* @return compound future.
*/ | Starts cache stop request as cache change batch | dynamicChangeCaches | {
"repo_name": "vladisav/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java",
"license": "apache-2.0",
"size": 163107
} | [
"java.util.List",
"org.apache.ignite.internal.IgniteInternalFuture",
"org.apache.ignite.internal.util.future.GridCompoundFuture",
"org.jetbrains.annotations.NotNull"
] | import java.util.List; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.future.GridCompoundFuture; import org.jetbrains.annotations.NotNull; | import java.util.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.future.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 2,359,602 |
public TreeList findCodeTreeChildren(String terminology, String version,
String terminologyId, PfsParameterJpa pfs, String authToken)
throws Exception; | TreeList function(String terminology, String version, String terminologyId, PfsParameterJpa pfs, String authToken) throws Exception; | /**
* Find code tree children.
*
* @param terminology the terminology
* @param version the version
* @param terminologyId the terminology id
* @param pfs the pfs
* @param authToken the auth token
* @return the tree list
* @throws Exception the exception
*/ | Find code tree children | findCodeTreeChildren | {
"repo_name": "WestCoastInformatics/UMLS-Terminology-Server",
"path": "jpa-services/src/main/java/com/wci/umls/server/jpa/services/rest/ContentServiceRest.java",
"license": "apache-2.0",
"size": 36052
} | [
"com.wci.umls.server.helpers.content.TreeList",
"com.wci.umls.server.jpa.helpers.PfsParameterJpa"
] | import com.wci.umls.server.helpers.content.TreeList; import com.wci.umls.server.jpa.helpers.PfsParameterJpa; | import com.wci.umls.server.helpers.content.*; import com.wci.umls.server.jpa.helpers.*; | [
"com.wci.umls"
] | com.wci.umls; | 613,621 |
public boolean DeleteNode(int nodeId) {
synchronized (stream) {
File file = new File(this.folderName, String.format("node%d.xml", nodeId));
return file.delete();
}
} | boolean function(int nodeId) { synchronized (stream) { File file = new File(this.folderName, String.format(STR, nodeId)); return file.delete(); } } | /**
* Deletes the persistence store for the specified node.
*
* @param nodeId The node ID to remove
* @return true if the file was deleted
*/ | Deletes the persistence store for the specified node | DeleteNode | {
"repo_name": "Greblys/openhab",
"path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/initialization/ZWaveNodeSerializer.java",
"license": "epl-1.0",
"size": 5584
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 152,025 |
DataValueSet getAggregatedDataValueSet( DataQueryParams params ); | DataValueSet getAggregatedDataValueSet( DataQueryParams params ); | /**
* Generates a data value set for the given query. The query must contain
* a data, period and organisation unit dimension.
*
* @param params the data query parameters.
* @return a data value set representing aggregated data.
*/ | Generates a data value set for the given query. The query must contain a data, period and organisation unit dimension | getAggregatedDataValueSet | {
"repo_name": "mortenoh/dhis2-core",
"path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java",
"license": "bsd-3-clause",
"size": 6798
} | [
"org.hisp.dhis.dxf2.datavalueset.DataValueSet"
] | import org.hisp.dhis.dxf2.datavalueset.DataValueSet; | import org.hisp.dhis.dxf2.datavalueset.*; | [
"org.hisp.dhis"
] | org.hisp.dhis; | 2,634,448 |
@Override
public long getForwardSeekOperations() {
return lookupCounterValue(StreamStatisticNames.STREAM_READ_SEEK_FORWARD_OPERATIONS);
} | long function() { return lookupCounterValue(StreamStatisticNames.STREAM_READ_SEEK_FORWARD_OPERATIONS); } | /**
* The total number of executed seek operations which went forward in an input stream.
*
* @return the number of Forward seek operations.
*/ | The total number of executed seek operations which went forward in an input stream | getForwardSeekOperations | {
"repo_name": "GoogleCloudDataproc/hadoop-connectors",
"path": "gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GhfsInstrumentation.java",
"license": "apache-2.0",
"size": 31961
} | [
"org.apache.hadoop.fs.statistics.StreamStatisticNames"
] | import org.apache.hadoop.fs.statistics.StreamStatisticNames; | import org.apache.hadoop.fs.statistics.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,468,448 |
int bufSize =
MessageFormatRecord.Metadata_Content_Format_V2.getMetadataContentSize(keys.get(0).sizeInBytes(), keys.size());
ByteBuffer outputBuf = ByteBuffer.allocate(bufSize);
MessageFormatRecord.Metadata_Content_Format_V2.serializeMetadataContentRecord(outputBuf, chunkSize, totalSize,
keys);
return outputBuf;
} | int bufSize = MessageFormatRecord.Metadata_Content_Format_V2.getMetadataContentSize(keys.get(0).sizeInBytes(), keys.size()); ByteBuffer outputBuf = ByteBuffer.allocate(bufSize); MessageFormatRecord.Metadata_Content_Format_V2.serializeMetadataContentRecord(outputBuf, chunkSize, totalSize, keys); return outputBuf; } | /**
* Serialize the input list of keys that form the metadata content.
* @param chunkSize the size of the intermediate data chunks for the object this metadata describes.
* @param totalSize the total size of the object this metadata describes.
* @param keys the input list of keys that form the metadata content.
* @return a ByteBuffer containing the serialized output.
*/ | Serialize the input list of keys that form the metadata content | serializeMetadataContentV2 | {
"repo_name": "cgtz/ambry",
"path": "ambry-messageformat/src/main/java/com/github/ambry/messageformat/MetadataContentSerDe.java",
"license": "apache-2.0",
"size": 4223
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,989,014 |
@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": "suthat/signal",
"path": "server/Signal/src/java/edu/sit/signal/feedback/NqlApis.java",
"license": "apache-2.0",
"size": 4093
} | [
"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; | 1,094,484 |
public void uninstallBundle(String symbolicName, String version) throws BundleException {
Bundle[] bundles = getBundleContext().getBundles();
if (bundles != null) {
for (Bundle bundle : bundles) {
if (bundle.getSymbolicName().equals(symbolicName) && bundle.getHeaders().get("Bundle-Version").toString().equals(version)) {
bundle.uninstall();
}
}
}
} | void function(String symbolicName, String version) throws BundleException { Bundle[] bundles = getBundleContext().getBundles(); if (bundles != null) { for (Bundle bundle : bundles) { if (bundle.getSymbolicName().equals(symbolicName) && bundle.getHeaders().get(STR).toString().equals(version)) { bundle.uninstall(); } } } } | /**
* Locally uninstall a bundle.
*
* @param symbolicName the bundle symbolic name.
* @param version the bundle version.
* @throws BundleException in case of un-installation failure.
*/ | Locally uninstall a bundle | uninstallBundle | {
"repo_name": "albertocsm/karaf-cellar",
"path": "bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java",
"license": "apache-2.0",
"size": 5383
} | [
"org.osgi.framework.Bundle",
"org.osgi.framework.BundleException"
] | import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; | import org.osgi.framework.*; | [
"org.osgi.framework"
] | org.osgi.framework; | 370,704 |
protected Callable<Date> makeDateCallable(ExpressionEvaluator... inputEvaluators) {
final ExpressionEvaluator date = inputEvaluators[0];
final ExpressionEvaluator pattern = inputEvaluators[1];
final Callable<String> funcDateString = date.getStringFunction();
final Callable<String> funcPattern = pattern.getStringFunction();
try {
final String valuePattern = pattern.isConstant() ? funcPattern.call() : null;
final String valueDate = date.isConstant() ? funcDateString.call() : null;
if (inputEvaluators.length > 2) {
ExpressionEvaluator locale = inputEvaluators[2];
final Callable<String> funcLocale = locale.getStringFunction();
final String valueLocale = locale.isConstant() ? funcLocale.call() : null;
if (pattern.isConstant()) {
if (date.isConstant() && locale.isConstant()) {
return new Callable<Date>() { | Callable<Date> function(ExpressionEvaluator... inputEvaluators) { final ExpressionEvaluator date = inputEvaluators[0]; final ExpressionEvaluator pattern = inputEvaluators[1]; final Callable<String> funcDateString = date.getStringFunction(); final Callable<String> funcPattern = pattern.getStringFunction(); try { final String valuePattern = pattern.isConstant() ? funcPattern.call() : null; final String valueDate = date.isConstant() ? funcDateString.call() : null; if (inputEvaluators.length > 2) { ExpressionEvaluator locale = inputEvaluators[2]; final Callable<String> funcLocale = locale.getStringFunction(); final String valueLocale = locale.isConstant() ? funcLocale.call() : null; if (pattern.isConstant()) { if (date.isConstant() && locale.isConstant()) { return new Callable<Date>() { | /**
* Builds a Date Callable from the given string arguments
*
* @param inputEvaluators
* The input date, input pattern and optional the input locale
* @return The resulting Callable<Date>
*/ | Builds a Date Callable from the given string arguments | makeDateCallable | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/tools/expression/internal/function/conversion/DateParseCustom.java",
"license": "agpl-3.0",
"size": 8595
} | [
"com.rapidminer.tools.expression.ExpressionEvaluator",
"java.util.Date",
"java.util.concurrent.Callable"
] | import com.rapidminer.tools.expression.ExpressionEvaluator; import java.util.Date; import java.util.concurrent.Callable; | import com.rapidminer.tools.expression.*; import java.util.*; import java.util.concurrent.*; | [
"com.rapidminer.tools",
"java.util"
] | com.rapidminer.tools; java.util; | 1,301,005 |
@Test
void selectMethodByFullyQualifiedNameEndingWithParenthesesAndWithParameterList() {
var className = "org.example.KotlinTestCase";
var methodName = "test name ends with parentheses()";
var methodParameters = "int, int, int";
var fqmn = String.format("%s#%s(%s)", className, methodName, methodParameters);
var selector = selectMethod(fqmn);
assertEquals(className, selector.getClassName());
assertEquals(methodName, selector.getMethodName());
assertEquals(methodParameters, selector.getMethodParameterTypes());
} | void selectMethodByFullyQualifiedNameEndingWithParenthesesAndWithParameterList() { var className = STR; var methodName = STR; var methodParameters = STR; var fqmn = String.format(STR, className, methodName, methodParameters); var selector = selectMethod(fqmn); assertEquals(className, selector.getClassName()); assertEquals(methodName, selector.getMethodName()); assertEquals(methodParameters, selector.getMethodParameterTypes()); } | /**
* Inspired by Kotlin tests.
*/ | Inspired by Kotlin tests | selectMethodByFullyQualifiedNameEndingWithParenthesesAndWithParameterList | {
"repo_name": "junit-team/junit-lambda",
"path": "platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java",
"license": "epl-1.0",
"size": 33426
} | [
"org.junit.jupiter.api.Assertions",
"org.junit.platform.engine.discovery.DiscoverySelectors"
] | import org.junit.jupiter.api.Assertions; import org.junit.platform.engine.discovery.DiscoverySelectors; | import org.junit.jupiter.api.*; import org.junit.platform.engine.discovery.*; | [
"org.junit.jupiter",
"org.junit.platform"
] | org.junit.jupiter; org.junit.platform; | 3,168 |
public static Rectangle2D rectangleByRadius(Rectangle2D rect,
double radiusW, double radiusH) {
if (rect == null) {
throw new IllegalArgumentException("Null 'rect' argument.");
}
double x = rect.getCenterX();
double y = rect.getCenterY();
double w = rect.getWidth() * radiusW;
double h = rect.getHeight() * radiusH;
return new Rectangle2D.Double(x - w / 2.0, y - h / 2.0, w, h);
} | static Rectangle2D function(Rectangle2D rect, double radiusW, double radiusH) { if (rect == null) { throw new IllegalArgumentException(STR); } double x = rect.getCenterX(); double y = rect.getCenterY(); double w = rect.getWidth() * radiusW; double h = rect.getHeight() * radiusH; return new Rectangle2D.Double(x - w / 2.0, y - h / 2.0, w, h); } | /**
* A utility method that computes a rectangle using relative radius values.
*
* @param rect the reference rectangle (<code>null</code> not permitted).
* @param radiusW the width radius (must be > 0.0)
* @param radiusH the height radius.
*
* @return A new rectangle.
*/ | A utility method that computes a rectangle using relative radius values | rectangleByRadius | {
"repo_name": "ibestvina/multithread-centiscape",
"path": "CentiScaPe2.1/src/main/java/org/jfree/chart/plot/dial/DialPlot.java",
"license": "mit",
"size": 25199
} | [
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,219,652 |
public Node getNodeBySessionid(String sessionid, Node failedNode) {
if (failedNode != null) {
// Set the node status to down
UndertowLogger.ROOT_LOGGER.warn("The node [" + failedNode.getNodeConfig().getHostname() + ":" + failedNode.getNodeConfig().getPort() + "] is down");
failedNode.getNodeState().setStatus(NodeState.NodeStatus.NODE_DOWN);
}
return getNodeBySessionid(sessionid);
} | Node function(String sessionid, Node failedNode) { if (failedNode != null) { UndertowLogger.ROOT_LOGGER.warn(STR + failedNode.getNodeConfig().getHostname() + ":" + failedNode.getNodeConfig().getPort() + STR); failedNode.getNodeState().setStatus(NodeState.NodeStatus.NODE_DOWN); } return getNodeBySessionid(sessionid); } | /**
* Select a new node for the specified request and mark the failed node as unreachable
*
* @param sessionid
* @param failedNode
* @return
*/ | Select a new node for the specified request and mark the failed node as unreachable | getNodeBySessionid | {
"repo_name": "emag/codereading-undertow",
"path": "core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java",
"license": "apache-2.0",
"size": 18449
} | [
"io.undertow.UndertowLogger"
] | import io.undertow.UndertowLogger; | import io.undertow.*; | [
"io.undertow"
] | io.undertow; | 2,426,367 |
private void addSubscription(final String key, final UUID sid, final SubscriptionInfo si) {
Map<UUID, SubscriptionInfo> m = subscriptions.get(key);
if (m == null) {
m = new HashMap<UUID, SubscriptionInfo>();
subscriptions.put(key, m);
}
m.put(sid, si);
} | void function(final String key, final UUID sid, final SubscriptionInfo si) { Map<UUID, SubscriptionInfo> m = subscriptions.get(key); if (m == null) { m = new HashMap<UUID, SubscriptionInfo>(); subscriptions.put(key, m); } m.put(sid, si); } | /**
* Adds a subscription to the map, creating a new one if necessary for the provided key.
*
* @param key
* Resource key
* @param sid
* subscription ID for this subscription
* @param si
* The SubscriptionInfo to be added.
*/ | Adds a subscription to the map, creating a new one if necessary for the provided key | addSubscription | {
"repo_name": "gsteckman/rpi-rest",
"path": "src/main/java/io/github/gsteckman/rpi_rest/SubscriptionManager.java",
"license": "apache-2.0",
"size": 15459
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,532,157 |
private void printUsage() {
new HelpFormatter().printHelp("Asterix YARN client. Usage: asterix [options] [mode]", opts);
} | void function() { new HelpFormatter().printHelp(STR, opts); } | /**
* Helper function to print out usage
*/ | Helper function to print out usage | printUsage | {
"repo_name": "waans11/incubator-asterixdb",
"path": "asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixYARNClient.java",
"license": "apache-2.0",
"size": 60691
} | [
"org.apache.commons.cli.HelpFormatter"
] | import org.apache.commons.cli.HelpFormatter; | import org.apache.commons.cli.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,305,205 |
@Override
public void prepareToInvalidate(Provider p, int action,
LanguageConnectionContext lcc)
throws StandardException
{
DependencyManager dm = getDataDictionary().getDependencyManager();
switch (action)
{
default:
throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_TABLE,
dm.getActionString(action),
p.getObjectName(),
getQualifiedName());
}
} | void function(Provider p, int action, LanguageConnectionContext lcc) throws StandardException { DependencyManager dm = getDataDictionary().getDependencyManager(); switch (action) { default: throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_TABLE, dm.getActionString(action), p.getObjectName(), getQualifiedName()); } } | /**
* Prepare to mark the dependent as invalid (due to at least one of
* its dependencies being invalid).
*
* @param action The action causing the invalidation
* @param p the provider
*
* @exception StandardException thrown if unable to make it invalid
*/ | Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid) | prepareToInvalidate | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/iapi/sql/dictionary/TableDescriptor.java",
"license": "apache-2.0",
"size": 45446
} | [
"com.pivotal.gemfirexd.internal.iapi.error.StandardException",
"com.pivotal.gemfirexd.internal.iapi.reference.SQLState",
"com.pivotal.gemfirexd.internal.iapi.sql.conn.LanguageConnectionContext",
"com.pivotal.gemfirexd.internal.iapi.sql.depend.DependencyManager",
"com.pivotal.gemfirexd.internal.iapi.sql.depend.Provider"
] | import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.reference.SQLState; import com.pivotal.gemfirexd.internal.iapi.sql.conn.LanguageConnectionContext; import com.pivotal.gemfirexd.internal.iapi.sql.depend.DependencyManager; import com.pivotal.gemfirexd.internal.iapi.sql.depend.Provider; | import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.reference.*; import com.pivotal.gemfirexd.internal.iapi.sql.conn.*; import com.pivotal.gemfirexd.internal.iapi.sql.depend.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 305,285 |
void logTimes(String src, long mtime, long atime) {
TimesOp op = TimesOp.getInstance(cache.get())
.setPath(src)
.setModificationTime(mtime)
.setAccessTime(atime);
logEdit(op);
} | void logTimes(String src, long mtime, long atime) { TimesOp op = TimesOp.getInstance(cache.get()) .setPath(src) .setModificationTime(mtime) .setAccessTime(atime); logEdit(op); } | /**
* Add access time record to edit log
*/ | Add access time record to edit log | logTimes | {
"repo_name": "cnfire/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java",
"license": "apache-2.0",
"size": 56758
} | [
"org.apache.hadoop.hdfs.server.namenode.FSEditLogOp"
] | import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp; | import org.apache.hadoop.hdfs.server.namenode.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 635,148 |
@Override
public CmsEventQueue rename(Name name) {
return new CmsEventQueue(name, null);
} | CmsEventQueue function(Name name) { return new CmsEventQueue(name, null); } | /**
* Rename this table
*/ | Rename this table | rename | {
"repo_name": "gauravlall/oneops",
"path": "crawler/src/generated-sources/java/com/oneops/crawler/jooq/cms/tables/CmsEventQueue.java",
"license": "apache-2.0",
"size": 5011
} | [
"org.jooq.Name"
] | import org.jooq.Name; | import org.jooq.*; | [
"org.jooq"
] | org.jooq; | 1,723,574 |
@Override
public SocketBar createSocket()
{
return new SocketChannelWrapperBar();
} | SocketBar function() { return new SocketChannelWrapperBar(); } | /**
* Creates a new socket object.
*/ | Creates a new socket object | createSocket | {
"repo_name": "baratine/baratine",
"path": "web/src/main/java/com/caucho/v5/jni/ServerSocketChannelWrapper.java",
"license": "gpl-2.0",
"size": 5383
} | [
"com.caucho.v5.io.SocketBar",
"com.caucho.v5.io.SocketChannelWrapperBar"
] | import com.caucho.v5.io.SocketBar; import com.caucho.v5.io.SocketChannelWrapperBar; | import com.caucho.v5.io.*; | [
"com.caucho.v5"
] | com.caucho.v5; | 1,157,298 |
private static boolean pointInTriangle(double minX, double maxX, double minY, double maxY, double x, double y,
double aX, double aY, double bX, double bY, double cX, double cY) {
//check the bounding box because if the triangle is degenerated, e.g points and lines, we need to filter out
//coplanar points that are not part of the triangle.
if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
int a = orient(x, y, aX, aY, bX, bY);
int b = orient(x, y, bX, bY, cX, cY);
if (a == 0 || b == 0 || a < 0 == b < 0) {
int c = orient(x, y, cX, cY, aX, aY);
return c == 0 || (c < 0 == (b < 0 || a < 0));
}
return false;
} else {
return false;
}
} | static boolean function(double minX, double maxX, double minY, double maxY, double x, double y, double aX, double aY, double bX, double bY, double cX, double cY) { if (x >= minX && x <= maxX && y >= minY && y <= maxY) { int a = orient(x, y, aX, aY, bX, bY); int b = orient(x, y, bX, bY, cX, cY); if (a == 0 b == 0 a < 0 == b < 0) { int c = orient(x, y, cX, cY, aX, aY); return c == 0 (c < 0 == (b < 0 a < 0)); } return false; } else { return false; } } | /**
* Compute whether the given x, y point is in a triangle; uses the winding order method
*/ | Compute whether the given x, y point is in a triangle; uses the winding order method | pointInTriangle | {
"repo_name": "nknize/elasticsearch",
"path": "x-pack/plugin/spatial/src/main/java/org/elasticsearch/xpack/spatial/index/fielddata/Tile2DVisitor.java",
"license": "apache-2.0",
"size": 8862
} | [
"org.apache.lucene.geo.GeoUtils"
] | import org.apache.lucene.geo.GeoUtils; | import org.apache.lucene.geo.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,312,173 |
RemoteProcessGroupStatusEntity getRemoteProcessGroupStatus(String id); | RemoteProcessGroupStatusEntity getRemoteProcessGroupStatus(String id); | /**
* Gets the remote process group status.
*
* @param id remote process group
* @return status
*/ | Gets the remote process group status | getRemoteProcessGroupStatus | {
"repo_name": "ijokarumawak/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 85103
} | [
"org.apache.nifi.web.api.entity.RemoteProcessGroupStatusEntity"
] | import org.apache.nifi.web.api.entity.RemoteProcessGroupStatusEntity; | import org.apache.nifi.web.api.entity.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 1,101,245 |
default void addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig)
throws IOException {
addReplicationPeer(peerId, peerConfig, true);
} | default void addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig) throws IOException { addReplicationPeer(peerId, peerConfig, true); } | /**
* Add a new replication peer for replicating data to slave cluster.
* @param peerId a short name that identifies the peer
* @param peerConfig configuration for the replication peer
* @throws IOException if a remote or network exception occurs
*/ | Add a new replication peer for replicating data to slave cluster | addReplicationPeer | {
"repo_name": "ChinmaySKulkarni/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java",
"license": "apache-2.0",
"size": 101053
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.replication.ReplicationPeerConfig"
] | import java.io.IOException; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; | import java.io.*; import org.apache.hadoop.hbase.replication.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,553,383 |
public void deleteMessage(
final int poolId,
final long messageId,
final UUID sessionId) {
final UUID locationId = UUID.fromString("c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("poolId", poolId); //$NON-NLS-1$
routeValues.put("messageId", messageId); //$NON-NLS-1$
final NameValueCollection queryParameters = new NameValueCollection();
queryParameters.addIfNotNull("sessionId", sessionId); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.DELETE,
locationId,
routeValues,
apiVersion,
queryParameters,
VssMediaTypes.APPLICATION_JSON_TYPE);
super.sendRequest(httpRequest);
} | void function( final int poolId, final long messageId, final UUID sessionId) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, poolId); routeValues.put(STR, messageId); final NameValueCollection queryParameters = new NameValueCollection(); queryParameters.addIfNotNull(STR, sessionId); final VssRestRequest httpRequest = super.createRequest(HttpMethod.DELETE, locationId, routeValues, apiVersion, queryParameters, VssMediaTypes.APPLICATION_JSON_TYPE); super.sendRequest(httpRequest); } | /**
* [Preview API 3.1-preview.1]
*
* @param poolId
*
* @param messageId
*
* @param sessionId
*
*/ | [Preview API 3.1-preview.1] | deleteMessage | {
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-distributedtask-client/src/main/generated/com/microsoft/alm/teamfoundation/distributedtask/webapi/TaskAgentHttpClientBase.java",
"license": "mit",
"size": 129237
} | [
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.client.model.NameValueCollection",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] | import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.client.model.NameValueCollection; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.microsoft.alm.client.*; import com.microsoft.alm.client.model.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*; | [
"com.microsoft.alm",
"java.util"
] | com.microsoft.alm; java.util; | 611 |
@Nullable
IStorageDisk getByStack(ItemStack disk); | IStorageDisk getByStack(ItemStack disk); | /**
* Gets a storage disk by disk stack (a {@link IStorageDiskProvider}).
*
* @param disk the disk stack
* @return the storage disk, or null if no storage disk is found
*/ | Gets a storage disk by disk stack (a <code>IStorageDiskProvider</code>) | getByStack | {
"repo_name": "raoulvdberge/refinedstorage",
"path": "src/main/java/com/refinedmods/refinedstorage/api/storage/disk/IStorageDiskManager.java",
"license": "mit",
"size": 1143
} | [
"net.minecraft.world.item.ItemStack"
] | import net.minecraft.world.item.ItemStack; | import net.minecraft.world.item.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 2,602,241 |
protected boolean checkReferer(String uriPrefix) {
String referer = (String) env.get("HTTP_REFERER");
if (referer == null)
return false;
String expectedPrefix = Browser.mapURL(uriPrefix);
return referer.startsWith(expectedPrefix);
} | boolean function(String uriPrefix) { String referer = (String) env.get(STR); if (referer == null) return false; String expectedPrefix = Browser.mapURL(uriPrefix); return referer.startsWith(expectedPrefix); } | /**
* Checks the HTTP Referer header to see whether it matches the default host
* and port that this dashboard is using to serve documents, and that the
* initial URI is also the same.
*
* @since 1.14.0.1
*/ | Checks the HTTP Referer header to see whether it matches the default host and port that this dashboard is using to serve documents, and that the initial URI is also the same | checkReferer | {
"repo_name": "superzadeh/processdash",
"path": "src/net/sourceforge/processdash/ui/web/TinyCGIBase.java",
"license": "gpl-3.0",
"size": 26317
} | [
"net.sourceforge.processdash.ui.Browser"
] | import net.sourceforge.processdash.ui.Browser; | import net.sourceforge.processdash.ui.*; | [
"net.sourceforge.processdash"
] | net.sourceforge.processdash; | 272,943 |
public String getSearchStringEscape() throws SQLException {
return "\\";
} | String function() throws SQLException { return "\\"; } | /**
* This is the string that can be used to escape '_' or '%' in the string
* pattern style catalog search parameters.
* <P>
* The '_' character represents any single character.
* </p>
* <P>
* The '%' character represents any sequence of zero or more characters.
* </p>
*
* @return the string used to escape wildcard characters
* @throws SQLException
*/ | This is the string that can be used to escape '_' or '%' in the string pattern style catalog search parameters. The '_' character represents any single character. The '%' character represents any sequence of zero or more characters. | getSearchStringEscape | {
"repo_name": "slockhart/sql-app",
"path": "mysql-connector-java-5.1.34/src/com/mysql/jdbc/DatabaseMetaData.java",
"license": "gpl-2.0",
"size": 338367
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,031,988 |
public static HttpResourceGroup createHttpResourceGroup(String name, ClientOptions options) {
return factory.createHttpResourceGroup(name, options);
} | static HttpResourceGroup function(String name, ClientOptions options) { return factory.createHttpResourceGroup(name, options); } | /**
* Create the {@link com.netflix.ribbon.http.HttpResourceGroup} with a name.
*
* @param name name of the resource group, as well as the transport client
* @param options Options to override the client configuration created
*/ | Create the <code>com.netflix.ribbon.http.HttpResourceGroup</code> with a name | createHttpResourceGroup | {
"repo_name": "spencergibb/ribbon",
"path": "ribbon/src/main/java/com/netflix/ribbon/Ribbon.java",
"license": "apache-2.0",
"size": 3160
} | [
"com.netflix.ribbon.http.HttpResourceGroup"
] | import com.netflix.ribbon.http.HttpResourceGroup; | import com.netflix.ribbon.http.*; | [
"com.netflix.ribbon"
] | com.netflix.ribbon; | 1,499,777 |
public static URL valueOf(String url) {
if (url == null || (url = url.trim()).length() == 0) {
throw new IllegalArgumentException("url == null");
}
String protocol = null;
String username = null;
String password = null;
String host = null;
int port = 0;
String path = null;
Map<String, String> parameters = null;
// ignore the url content following '#'
int poundIndex = url.indexOf('#');
if (poundIndex != -1) {
url = url.substring(0, poundIndex);
}
int i = url.indexOf('?'); // separator between body and parameters
if (i >= 0) {
String[] parts = url.substring(i + 1).split("&");
parameters = new HashMap<>();
for (String part : parts) {
part = part.trim();
if (part.length() > 0) {
int j = part.indexOf('=');
if (j >= 0) {
String key = part.substring(0, j);
String value = part.substring(j + 1);
parameters.put(key, value);
// compatible with lower versions registering "default." keys
if (key.startsWith(DEFAULT_KEY_PREFIX)) {
parameters.putIfAbsent(key.substring(DEFAULT_KEY_PREFIX.length()), value);
}
} else {
parameters.put(part, part);
}
}
}
url = url.substring(0, i);
}
i = url.indexOf("://");
if (i >= 0) {
if (i == 0) {
throw new IllegalStateException("url missing protocol: \"" + url + "\"");
}
protocol = url.substring(0, i);
url = url.substring(i + 3);
} else {
// case: file:/path/to/file.txt
i = url.indexOf(":/");
if (i >= 0) {
if (i == 0) {
throw new IllegalStateException("url missing protocol: \"" + url + "\"");
}
protocol = url.substring(0, i);
url = url.substring(i + 1);
}
}
i = url.indexOf('/');
if (i >= 0) {
path = url.substring(i + 1);
url = url.substring(0, i);
}
i = url.lastIndexOf('@');
if (i >= 0) {
username = url.substring(0, i);
int j = username.indexOf(':');
if (j >= 0) {
password = username.substring(j + 1);
username = username.substring(0, j);
}
url = url.substring(i + 1);
}
i = url.lastIndexOf(':');
if (i >= 0 && i < url.length() - 1) {
if (url.lastIndexOf('%') > i) {
// ipv6 address with scope id
// e.g. fe80:0:0:0:894:aeec:f37d:23e1%en0
// see https://howdoesinternetwork.com/2013/ipv6-zone-id
// ignore
} else {
port = Integer.parseInt(url.substring(i + 1));
url = url.substring(0, i);
}
}
if (url.length() > 0) {
host = url;
}
return new URL(protocol, username, password, host, port, path, parameters);
}
| static URL function(String url) { if (url == null (url = url.trim()).length() == 0) { throw new IllegalArgumentException(STR); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, String> parameters = null; int poundIndex = url.indexOf('#'); if (poundIndex != -1) { url = url.substring(0, poundIndex); } int i = url.indexOf('?'); if (i >= 0) { String[] parts = url.substring(i + 1).split("&"); parameters = new HashMap<>(); for (String part : parts) { part = part.trim(); if (part.length() > 0) { int j = part.indexOf('='); if (j >= 0) { String key = part.substring(0, j); String value = part.substring(j + 1); parameters.put(key, value); if (key.startsWith(DEFAULT_KEY_PREFIX)) { parameters.putIfAbsent(key.substring(DEFAULT_KEY_PREFIX.length()), value); } } else { parameters.put(part, part); } } } url = url.substring(0, i); } i = url.indexOf(STRurl missing protocol: \STR\STR:/STRurl missing protocol: \STR\""); } protocol = url.substring(0, i); url = url.substring(i + 1); } } i = url.indexOf('/'); if (i >= 0) { path = url.substring(i + 1); url = url.substring(0, i); } i = url.lastIndexOf('@'); if (i >= 0) { username = url.substring(0, i); int j = username.indexOf(':'); if (j >= 0) { password = username.substring(j + 1); username = username.substring(0, j); } url = url.substring(i + 1); } i = url.lastIndexOf(':'); if (i >= 0 && i < url.length() - 1) { if (url.lastIndexOf('%') > i) { } else { port = Integer.parseInt(url.substring(i + 1)); url = url.substring(0, i); } } if (url.length() > 0) { host = url; } return new URL(protocol, username, password, host, port, path, parameters); } | /**
* NOTICE: This method allocate too much objects, we can use {@link URLStrParser#parseDecodedStr(String)} instead.
* <p>
* Parse url string
*
* @param url URL string
* @return URL instance
* @see URL
*/ | Parse url string | valueOf | {
"repo_name": "yuyijq/dubbo",
"path": "dubbo-common/src/main/java/org/apache/dubbo/common/URL.java",
"license": "apache-2.0",
"size": 70249
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,040,789 |
public Configuration registerConfig(Properties extProperties) {
if (extProperties == null) {
return this;
}
try {
readWriteLock.writeLock().lockInterruptibly();
try {
merge(extProperties, this.allConfigs);
} finally {
readWriteLock.writeLock().unlock();
}
} catch (InterruptedException e) {
log.error("register lock error. {}" + extProperties);
}
return this;
} | Configuration function(Properties extProperties) { if (extProperties == null) { return this; } try { readWriteLock.writeLock().lockInterruptibly(); try { merge(extProperties, this.allConfigs); } finally { readWriteLock.writeLock().unlock(); } } catch (InterruptedException e) { log.error(STR + extProperties); } return this; } | /**
* register config properties
*
* @return the current Configuration object
*/ | register config properties | registerConfig | {
"repo_name": "lindzh/incubator-rocketmq",
"path": "common/src/main/java/org/apache/rocketmq/common/Configuration.java",
"license": "apache-2.0",
"size": 9163
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 672,520 |
public EditorType getEditorType() {
return this.editorType;
} | EditorType function() { return this.editorType; } | /**
* Returns the editor type wjich the keymap is associated with.
*
* @return the editor type
*/ | Returns the editor type wjich the keymap is associated with | getEditorType | {
"repo_name": "codenvy/che-core",
"path": "ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/keymap/Keymap.java",
"license": "epl-1.0",
"size": 5210
} | [
"org.eclipse.che.ide.jseditor.client.editortype.EditorType"
] | import org.eclipse.che.ide.jseditor.client.editortype.EditorType; | import org.eclipse.che.ide.jseditor.client.editortype.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 2,684,816 |
public static String getSelfURL() {
String selfURL = Window.Location.getHref();
if ( selfURL.contains( "#" ) ) {
selfURL = selfURL.substring( 0,
selfURL.indexOf( "#" ) );
}
return selfURL;
} | static String function() { String selfURL = Window.Location.getHref(); if ( selfURL.contains( "#" ) ) { selfURL = selfURL.substring( 0, selfURL.indexOf( "#" ) ); } return selfURL; } | /**
* The URL that will be used to open up assets in a feed.
* (by tacking asset id on the end, of course !).
*/ | The URL that will be used to open up assets in a feed. (by tacking asset id on the end, of course !) | getSelfURL | {
"repo_name": "Rikkola/guvnor",
"path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/util/Util.java",
"license": "apache-2.0",
"size": 2360
} | [
"com.google.gwt.user.client.Window"
] | import com.google.gwt.user.client.Window; | import com.google.gwt.user.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,493,580 |
public ContextEnvironment[] findEnvironments(); | ContextEnvironment[] function(); | /**
* Return the set of defined environment entries for this web
* application. If none have been defined, a zero-length array
* is returned.
*/ | Return the set of defined environment entries for this web application. If none have been defined, a zero-length array is returned | findEnvironments | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-5.0.18-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/DefaultContext.java",
"license": "apache-2.0",
"size": 17854
} | [
"org.apache.catalina.deploy.ContextEnvironment"
] | import org.apache.catalina.deploy.ContextEnvironment; | import org.apache.catalina.deploy.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 1,921,101 |
public String getAverage(List<Double> values) {
double sum = 0;
if (values.size() == 0) {
return NAN;
}
for (double dValue : values) {
sum += dValue;
}
return format(sum / values.size());
} | String function(List<Double> values) { double sum = 0; if (values.size() == 0) { return NAN; } for (double dValue : values) { sum += dValue; } return format(sum / values.size()); } | /**
* Returns the average of double values stored in a List or "NaN" for
* empty lists.
* @param values The list of double values
* @return average of double values stored in the List in a formatted String
*/ | Returns the average of double values stored in a List or "NaN" for empty lists | getAverage | {
"repo_name": "akeranen/the-one",
"path": "src/report/Report.java",
"license": "gpl-3.0",
"size": 11730
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,652,260 |
public void run() {
while (true) {
try {
//
// Thread runs periodically to check whether trackers should be expired.
// The sleep interval must be no more than half the maximum expiry time
// for a task tracker.
//
Thread.sleep(TASKTRACKER_EXPIRY_INTERVAL / 3);
//
// Loop through all expired items in the queue
//
// Need to lock the JobTracker here since we are
// manipulating it's data-structures via
// ExpireTrackers.run -> JobTracker.lostTaskTracker ->
// JobInProgress.failedTask -> JobTracker.markCompleteTaskAttempt
// Also need to lock JobTracker before locking 'taskTracker' &
// 'trackerExpiryQueue' to prevent deadlock:
// @see {@link JobTracker.processHeartbeat(TaskTrackerStatus, boolean)}
synchronized (JobTracker.this) {
synchronized (taskTrackers) {
synchronized (trackerExpiryQueue) {
long now = System.currentTimeMillis();
TaskTrackerStatus leastRecent = null;
while ((trackerExpiryQueue.size() > 0) &&
((leastRecent = trackerExpiryQueue.first()) != null) &&
(now - leastRecent.getLastSeen() > TASKTRACKER_EXPIRY_INTERVAL)) {
// Remove profile from head of queue
trackerExpiryQueue.remove(leastRecent);
String trackerName = leastRecent.getTrackerName();
// Figure out if last-seen time should be updated, or if tracker is dead
TaskTrackerStatus newProfile = taskTrackers.get(leastRecent.getTrackerName());
// Items might leave the taskTracker set through other means; the
// status stored in 'taskTrackers' might be null, which means the
// tracker has already been destroyed.
if (newProfile != null) {
if (now - newProfile.getLastSeen() > TASKTRACKER_EXPIRY_INTERVAL) {
// Remove completely after marking the tasks as 'KILLED'
lostTaskTracker(leastRecent.getTrackerName());
updateTaskTrackerStatus(trackerName, null);
} else {
// Update time by inserting latest profile
trackerExpiryQueue.add(newProfile);
}
}
}
}
}
}
} catch (InterruptedException iex) {
break;
} catch (Exception t) {
LOG.error("Tracker Expiry Thread got exception: " +
StringUtils.stringifyException(t));
}
}
}
}
///////////////////////////////////////////////////////
// Used to remove old finished Jobs that have been around for too long
///////////////////////////////////////////////////////
class RetireJobs implements Runnable {
public RetireJobs() {
} | void function() { while (true) { try { synchronized (JobTracker.this) { synchronized (taskTrackers) { synchronized (trackerExpiryQueue) { long now = System.currentTimeMillis(); TaskTrackerStatus leastRecent = null; while ((trackerExpiryQueue.size() > 0) && ((leastRecent = trackerExpiryQueue.first()) != null) && (now - leastRecent.getLastSeen() > TASKTRACKER_EXPIRY_INTERVAL)) { trackerExpiryQueue.remove(leastRecent); String trackerName = leastRecent.getTrackerName(); TaskTrackerStatus newProfile = taskTrackers.get(leastRecent.getTrackerName()); if (newProfile != null) { if (now - newProfile.getLastSeen() > TASKTRACKER_EXPIRY_INTERVAL) { lostTaskTracker(leastRecent.getTrackerName()); updateTaskTrackerStatus(trackerName, null); } else { trackerExpiryQueue.add(newProfile); } } } } } } } catch (InterruptedException iex) { break; } catch (Exception t) { LOG.error(STR + StringUtils.stringifyException(t)); } } } } class RetireJobs implements Runnable { public RetireJobs() { } | /**
* The run method lives for the life of the JobTracker, and removes TaskTrackers
* that have not checked in for some time.
*/ | The run method lives for the life of the JobTracker, and removes TaskTrackers that have not checked in for some time | run | {
"repo_name": "four2five/0.19.2",
"path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java",
"license": "apache-2.0",
"size": 108276
} | [
"org.apache.hadoop.util.StringUtils"
] | import org.apache.hadoop.util.StringUtils; | import org.apache.hadoop.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 161,979 |
public Collection<Order> getOrders()
{
return orders;
} | Collection<Order> function() { return orders; } | /**
* Return the orders property.
*
* @return the orders
*/ | Return the orders property | getOrders | {
"repo_name": "openfurther/further-open-core",
"path": "ds/ds-further/src/main/java/edu/utah/further/ds/further/model/impl/domain/Person.java",
"license": "apache-2.0",
"size": 21298
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,818,360 |
@Test(timeout = 20000)
public void testReceivedMessageWithQueueDestinationsOnConnectionWithBrokerDefinedPrefixProperties() throws Exception {
Class<? extends Destination> destType = Queue.class;
String destPrefix = "q-broker-provided-prefix-";
String destName = "myQueue";
String replyName = "myReplyQueue";
String destAddress = destPrefix + destName;
String replyAddress = destPrefix + replyName;
String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
Byte annotationValue = AmqpDestinationHelper.QUEUE_TYPE;
String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
Byte replyAnnotationValue = AmqpDestinationHelper.QUEUE_TYPE;
doReceivedMessageOnConnectionWithBrokerDefinedPrefixPropertiesTestImpl(destType, destPrefix, destName, replyName,
destAddress, replyAddress, annotationName,
annotationValue, replyAnnotationName, replyAnnotationValue);
} | @Test(timeout = 20000) void function() throws Exception { Class<? extends Destination> destType = Queue.class; String destPrefix = STR; String destName = STR; String replyName = STR; String destAddress = destPrefix + destName; String replyAddress = destPrefix + replyName; String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME; Byte annotationValue = AmqpDestinationHelper.QUEUE_TYPE; String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME; Byte replyAnnotationValue = AmqpDestinationHelper.QUEUE_TYPE; doReceivedMessageOnConnectionWithBrokerDefinedPrefixPropertiesTestImpl(destType, destPrefix, destName, replyName, destAddress, replyAddress, annotationName, annotationValue, replyAnnotationName, replyAnnotationValue); } | /**
* Tests that a connection with 'prefixes' set on it via broker-provided connection properties
* strips the prefix from the to/reply-to fields for incoming messages with Queue destinations.
*/ | Tests that a connection with 'prefixes' set on it via broker-provided connection properties strips the prefix from the to/reply-to fields for incoming messages with Queue destinations | testReceivedMessageWithQueueDestinationsOnConnectionWithBrokerDefinedPrefixProperties | {
"repo_name": "avranju/qpid-jms",
"path": "qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java",
"license": "apache-2.0",
"size": 92138
} | [
"javax.jms.Destination",
"javax.jms.Queue",
"org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper",
"org.junit.Test"
] | import javax.jms.Destination; import javax.jms.Queue; import org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper; import org.junit.Test; | import javax.jms.*; import org.apache.qpid.jms.provider.amqp.message.*; import org.junit.*; | [
"javax.jms",
"org.apache.qpid",
"org.junit"
] | javax.jms; org.apache.qpid; org.junit; | 782,004 |
public void setCacheMode(final CacheMode mode) {
cacheMode = databaseImpl.getEffectiveCacheMode(mode);
} | void function(final CacheMode mode) { cacheMode = databaseImpl.getEffectiveCacheMode(mode); } | /**
* Sets the effective cache mode to use for the next operation. The
* cacheMode field will never be set to null or DYNAMIC, and can be passed
* directly to latching methods.
*
* @see #performCacheEviction
*/ | Sets the effective cache mode to use for the next operation. The cacheMode field will never be set to null or DYNAMIC, and can be passed directly to latching methods | setCacheMode | {
"repo_name": "prat0318/dbms",
"path": "mini_dbms/je-5.0.103/src/com/sleepycat/je/dbi/CursorImpl.java",
"license": "mit",
"size": 111937
} | [
"com.sleepycat.je.CacheMode"
] | import com.sleepycat.je.CacheMode; | import com.sleepycat.je.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 1,017,906 |
BooleanQuery makeQuery(BooleanClause.Occur occur, Query... queries) {
BooleanQuery bq = new BooleanQuery();
for (Query query : queries) {
if (query != null)
bq.add(query, occur);
}
return bq;
} | BooleanQuery makeQuery(BooleanClause.Occur occur, Query... queries) { BooleanQuery bq = new BooleanQuery(); for (Query query : queries) { if (query != null) bq.add(query, occur); } return bq; } | /**
* Makes a boolean query based upon a collection of queries and a logical operator.
*
* @param occur the logical operator
* @param queries the query collection
* @return the query
*/ | Makes a boolean query based upon a collection of queries and a logical operator | makeQuery | {
"repo_name": "visouza/solr-5.0.0",
"path": "lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java",
"license": "apache-2.0",
"size": 27045
} | [
"org.apache.lucene.search.BooleanClause",
"org.apache.lucene.search.BooleanQuery",
"org.apache.lucene.search.Query"
] | import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; | import org.apache.lucene.search.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 2,229,474 |
EAttribute getSpatialBase_Y(); | EAttribute getSpatialBase_Y(); | /**
* Returns the meta object for the attribute '{@link org.tud.inf.st.mbt.scenario.SpatialBase#getY <em>Y</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Y</em>'.
* @see org.tud.inf.st.mbt.scenario.SpatialBase#getY()
* @see #getSpatialBase()
* @generated
*/ | Returns the meta object for the attribute '<code>org.tud.inf.st.mbt.scenario.SpatialBase#getY Y</code>'. | getSpatialBase_Y | {
"repo_name": "paetti1988/qmate",
"path": "MATE/org.tud.inf.st.mbt.emf/src-gen/org/tud/inf/st/mbt/scenario/ScenarioPackage.java",
"license": "apache-2.0",
"size": 25928
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,274,005 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.