method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
private void setInitial() {
//Defreeze graph
defreezeGraph();
// Reset coloring and highlighting
resetApplyVis();
resetHighlightVis();
// Clear and re-initialize graph
graph.clear();
graph.setAttribute("ui.stylesheet", styleSheet);
// Clear variables
nodeMap.clear();
edgeMap.clear();
nodeBlacklist.clear();
edgeBlacklist.clear();
nodeID = 0;
edgeID = 0;
// Move to initial state and create initial nodes and edges
localStateManager.moveToState(localStateManager.getModelStates().getInitialState(),false);
initialResourceContents = new LinkedList<EObject>(localStateManager.getModel().getContents());
createNodesFromList(initialResourceContents);
creadNonContainmentEdges(nodeMap.keySet());
// Clean info label
nodeInfoLabel.setText("");
jumpRuleInfo.setText("");
printRuleRates();
// Reset radio button selection
showNoApply.setSelection(true);
showFutureApply.setSelection(false);
showCurrentApply.setSelection(false);
showCurrent = false;
showFuture = false;
// Reset slider
slider.setSelection(0);
spinner.setSelection(0);
// curState.setText("Current State: 0");
// Reset rule and match labels
setMatchRuleInfo();
updatePlot();
}
| void function() { defreezeGraph(); resetApplyVis(); resetHighlightVis(); graph.clear(); graph.setAttribute(STR, styleSheet); nodeMap.clear(); edgeMap.clear(); nodeBlacklist.clear(); edgeBlacklist.clear(); nodeID = 0; edgeID = 0; localStateManager.moveToState(localStateManager.getModelStates().getInitialState(),false); initialResourceContents = new LinkedList<EObject>(localStateManager.getModel().getContents()); createNodesFromList(initialResourceContents); creadNonContainmentEdges(nodeMap.keySet()); nodeInfoLabel.setText(STR"); printRuleRates(); showNoApply.setSelection(true); showFutureApply.setSelection(false); showCurrentApply.setSelection(false); showCurrent = false; showFuture = false; slider.setSelection(0); spinner.setSelection(0); setMatchRuleInfo(); updatePlot(); } | /**
* Sets the graph to its initial state
*/ | Sets the graph to its initial state | setInitial | {
"repo_name": "eMoflon/emoflon-ibex",
"path": "org.emoflon.ibex.gt/src/org/emoflon/ibex/gt/ui/VaDoGT.java",
"license": "gpl-3.0",
"size": 65012
} | [
"java.util.LinkedList",
"org.eclipse.emf.ecore.EObject"
] | import java.util.LinkedList; import org.eclipse.emf.ecore.EObject; | import java.util.*; import org.eclipse.emf.ecore.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 809,784 |
private void readOverElement(XMLStreamReader reader) throws XMLStreamException
{
int depth = 1;
while (depth > 0)
{
int eventType = reader.next();
if (eventType == XMLStreamReader.START_ELEMENT)
{
depth++;
}
else if (eventType == XMLStreamReader.END_ELEMENT)
{
depth--;
}
}
} | void function(XMLStreamReader reader) throws XMLStreamException { int depth = 1; while (depth > 0) { int eventType = reader.next(); if (eventType == XMLStreamReader.START_ELEMENT) { depth++; } else if (eventType == XMLStreamReader.END_ELEMENT) { depth--; } } } | /**
* Reads over the current element. This assumes that the current XML stream event type is
* START_ELEMENT.
*
* @param reader The xml reader
*/ | Reads over the current element. This assumes that the current XML stream event type is START_ELEMENT | readOverElement | {
"repo_name": "qxo/ddlutils",
"path": "src/main/java/org/apache/ddlutils/io/DatabaseIO.java",
"license": "apache-2.0",
"size": 41250
} | [
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader"
] | import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; | import javax.xml.stream.*; | [
"javax.xml"
] | javax.xml; | 2,137,405 |
@Column(length = 255)
@Field
public String getHostSpecies() {
return hostSpecies;
} | @Column(length = 255) String function() { return hostSpecies; } | /**
* Gets the host species.
*
* @return the hostSpecies
*/ | Gets the host species | getHostSpecies | {
"repo_name": "AAFC-MBB/hpdb",
"path": "src/main/java/ca/gc/agr/mbb/hostpathogen/web/model/HostPathogen.java",
"license": "mit",
"size": 10975
} | [
"javax.persistence.Column"
] | import javax.persistence.Column; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 2,310,636 |
void browseTag(TreeImageDisplay node)
{
state = TreeViewer.LOADING_DATA;
ExperimenterData exp = getSelectedBrowser().getNodeOwner(node);
if (exp == null) exp = TreeViewerAgent.getUserDetails();
SecurityContext ctx = getSecurityContext();
currentLoader = new TagHierarchyLoader(component, ctx,
node, exp.getId());
currentLoader.load();
}
Browser getBrowser(int index) { return browsers.get(index); } | void browseTag(TreeImageDisplay node) { state = TreeViewer.LOADING_DATA; ExperimenterData exp = getSelectedBrowser().getNodeOwner(node); if (exp == null) exp = TreeViewerAgent.getUserDetails(); SecurityContext ctx = getSecurityContext(); currentLoader = new TagHierarchyLoader(component, ctx, node, exp.getId()); currentLoader.load(); } Browser getBrowser(int index) { return browsers.get(index); } | /**
* Browses the node hosting the tag linked to tags to browse.
*
* @param node The node to browse.
*/ | Browses the node hosting the tag linked to tags to browse | browseTag | {
"repo_name": "rleigh-dundee/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerModel.java",
"license": "gpl-2.0",
"size": 39451
} | [
"org.openmicroscopy.shoola.agents.treeviewer.TagHierarchyLoader",
"org.openmicroscopy.shoola.agents.treeviewer.TreeViewerAgent",
"org.openmicroscopy.shoola.agents.treeviewer.browser.Browser",
"org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay",
"org.openmicroscopy.shoola.env.data.util.SecurityC... | import org.openmicroscopy.shoola.agents.treeviewer.TagHierarchyLoader; import org.openmicroscopy.shoola.agents.treeviewer.TreeViewerAgent; import org.openmicroscopy.shoola.agents.treeviewer.browser.Browser; import org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay; import org.openmicroscopy.shoola.env.data.util.SecurityContext; | import org.openmicroscopy.shoola.agents.treeviewer.*; import org.openmicroscopy.shoola.agents.treeviewer.browser.*; import org.openmicroscopy.shoola.agents.util.browser.*; import org.openmicroscopy.shoola.env.data.util.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 607,398 |
public static IssuerCurveDiscountFactors getIssuerCurveDiscountFactors(LocalDate valuationDate) {
DiscountFactors dscIssuer = ZeroRateDiscountFactors.of(USD, valuationDate, ISSUER_CURVE);
return IssuerCurveDiscountFactors.of(dscIssuer, GROUP_ISSUER);
} | static IssuerCurveDiscountFactors function(LocalDate valuationDate) { DiscountFactors dscIssuer = ZeroRateDiscountFactors.of(USD, valuationDate, ISSUER_CURVE); return IssuerCurveDiscountFactors.of(dscIssuer, GROUP_ISSUER); } | /**
* Obtains issuer curve discount factors form valuation date.
*
* @param valuationDate the valuation date
* @return the discount factors
*/ | Obtains issuer curve discount factors form valuation date | getIssuerCurveDiscountFactors | {
"repo_name": "jmptrader/Strata",
"path": "modules/pricer/src/test/java/com/opengamma/strata/pricer/bond/CapitalIndexedBondCurveDataSet.java",
"license": "apache-2.0",
"size": 20087
} | [
"com.opengamma.strata.pricer.DiscountFactors",
"com.opengamma.strata.pricer.ZeroRateDiscountFactors",
"java.time.LocalDate"
] | import com.opengamma.strata.pricer.DiscountFactors; import com.opengamma.strata.pricer.ZeroRateDiscountFactors; import java.time.LocalDate; | import com.opengamma.strata.pricer.*; import java.time.*; | [
"com.opengamma.strata",
"java.time"
] | com.opengamma.strata; java.time; | 661,592 |
private static void manageCertificates(final String... args)
throws Exception
{
manageCertificates(ResultCode.SUCCESS, null, args);
} | static void function(final String... args) throws Exception { manageCertificates(ResultCode.SUCCESS, null, args); } | /**
* Runs the manage-certificates tool with the provided arguments and expects
* a success result code.
*
* @param args The command-line arguments to provide when running the tool.
*
* @throws Exception If an unexpected problem occurs.
*/ | Runs the manage-certificates tool with the provided arguments and expects a success result code | manageCertificates | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/util/ssl/cert/ManageCertificatesTestCase.java",
"license": "gpl-2.0",
"size": 311521
} | [
"com.unboundid.ldap.sdk.ResultCode"
] | import com.unboundid.ldap.sdk.ResultCode; | import com.unboundid.ldap.sdk.*; | [
"com.unboundid.ldap"
] | com.unboundid.ldap; | 351,089 |
protected void formulaLoaded(Expression formula)
{
if(onFormulaLoadListener != null)
onFormulaLoadListener.loaded(formula);
} | void function(Expression formula) { if(onFormulaLoadListener != null) onFormulaLoadListener.loaded(formula); } | /** Notifies that a formula has been loaded
* @param formula The loaded formula as an {@link Expression} */ | Notifies that a formula has been loaded | formulaLoaded | {
"repo_name": "Divendo/math-dragon",
"path": "mathdragon/src/main/java/org/teaminfty/math_dragon/view/fragments/FragmentSaveLoad.java",
"license": "lgpl-3.0",
"size": 19586
} | [
"org.teaminfty.math_dragon.view.math.Expression"
] | import org.teaminfty.math_dragon.view.math.Expression; | import org.teaminfty.math_dragon.view.math.*; | [
"org.teaminfty.math_dragon"
] | org.teaminfty.math_dragon; | 789,582 |
public void serialize(InfoflowResults results, String fileName)
throws FileNotFoundException, XMLStreamException {
OutputStream out = new FileOutputStream(fileName);
XMLOutputFactory factory = XMLOutputFactory.newInstance();
XMLStreamWriter writer = factory.createXMLStreamWriter(out);
writer.writeStartDocument();
writer.writeStartElement(XmlConstants.Tags.root);
writer.writeAttribute(XmlConstants.Attributes.fileFormatVersion,
FILE_FORMAT_VERSION + "");
writer.writeStartElement(XmlConstants.Tags.results);
writeDataFlows(results, writer);
writer.writeEndElement();
writer.writeEndDocument();
writer.close();
}
| void function(InfoflowResults results, String fileName) throws FileNotFoundException, XMLStreamException { OutputStream out = new FileOutputStream(fileName); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement(XmlConstants.Tags.root); writer.writeAttribute(XmlConstants.Attributes.fileFormatVersion, FILE_FORMAT_VERSION + ""); writer.writeStartElement(XmlConstants.Tags.results); writeDataFlows(results, writer); writer.writeEndElement(); writer.writeEndDocument(); writer.close(); } | /**
* Serializes the given FlowDroid result object into the given file
* @param resultxs The result object to serialize
* @param fileName The target file name
* @throws FileNotFoundException Thrown if target file cannot be used
* @throws XMLStreamException Thrown if the XML data cannot be written
*/ | Serializes the given FlowDroid result object into the given file | serialize | {
"repo_name": "wangxiayang/soot-infoflow",
"path": "src/soot/jimple/infoflow/results/xml/InfoflowResultsSerializer.java",
"license": "lgpl-2.1",
"size": 6075
} | [
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.OutputStream",
"javax.xml.stream.XMLOutputFactory",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamWriter"
] | import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; | import java.io.*; import javax.xml.stream.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 479,311 |
public synchronized void write(byte[] buf, int off, int len)
throws IOException
{
super.write(buf, off, len);
crc.update(buf, off, len);
} | synchronized void function(byte[] buf, int off, int len) throws IOException { super.write(buf, off, len); crc.update(buf, off, len); } | /**
* Writes array of bytes to the compressed output stream. This method
* will block until all the bytes are written.
* @param buf the data to be written
* @param off the start offset of the data
* @param len the length of the data
* @throws IOException If an I/O error has occurred.
*/ | Writes array of bytes to the compressed output stream. This method will block until all the bytes are written | write | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/java/util/zip/GZIPOutputStream.java",
"license": "gpl-2.0",
"size": 8019
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,065,365 |
public static File resetLog(Class<?> clazz, File logFile) throws Exception {
if (logFile != null)
logFile.delete();
Logger logger = Logger.getLogger(clazz);
logger.removeAllAppenders();
logger.setLevel(Level.DEBUG);
SimpleLayout layout = new SimpleLayout();
File newLogFile = File.createTempFile("log", "");
FileAppender appender = new FileAppender(layout, newLogFile.toString(),
false, false, 0);
logger.addAppender(appender);
return newLogFile;
} | static File function(Class<?> clazz, File logFile) throws Exception { if (logFile != null) logFile.delete(); Logger logger = Logger.getLogger(clazz); logger.removeAllAppenders(); logger.setLevel(Level.DEBUG); SimpleLayout layout = new SimpleLayout(); File newLogFile = File.createTempFile("log", ""); FileAppender appender = new FileAppender(layout, newLogFile.toString(), false, false, 0); logger.addAppender(appender); return newLogFile; } | /**
* Delete the existing logFile for the class and set the logging to a
* use a new log file and set log level to DEBUG
* @param clazz class for which the log file is being set
* @param logFile current log file
* @return new log file
* @throws Exception
*/ | Delete the existing logFile for the class and set the logging to a use a new log file and set log level to DEBUG | resetLog | {
"repo_name": "bsmedberg/pig",
"path": "test/org/apache/pig/test/Util.java",
"license": "apache-2.0",
"size": 44312
} | [
"java.io.File",
"org.apache.log4j.FileAppender",
"org.apache.log4j.Level",
"org.apache.log4j.Logger",
"org.apache.log4j.SimpleLayout"
] | import java.io.File; import org.apache.log4j.FileAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; | import java.io.*; import org.apache.log4j.*; | [
"java.io",
"org.apache.log4j"
] | java.io; org.apache.log4j; | 2,165,892 |
void tagServer(String serverId, Map<String, String> tags) throws NotFoundException, ResponseException; | void tagServer(String serverId, Map<String, String> tags) throws NotFoundException, ResponseException; | /**
* Adds meta data tags to a given server.
*
* @param serverId
* Identifier of the server to be tagged.
* @param tags
* Meta data tags to set on the server.
* @throws NotFoundException
* if the server doesn't exist.
* @throws ResponseException
* On communication errors.
*/ | Adds meta data tags to a given server | tagServer | {
"repo_name": "elastisys/scale.cloudpool",
"path": "openstack/src/main/java/com/elastisys/scale/cloudpool/openstack/driver/client/OpenstackClient.java",
"license": "apache-2.0",
"size": 4460
} | [
"com.elastisys.scale.cloudpool.api.NotFoundException",
"java.util.Map",
"org.openstack4j.api.exceptions.ResponseException"
] | import com.elastisys.scale.cloudpool.api.NotFoundException; import java.util.Map; import org.openstack4j.api.exceptions.ResponseException; | import com.elastisys.scale.cloudpool.api.*; import java.util.*; import org.openstack4j.api.exceptions.*; | [
"com.elastisys.scale",
"java.util",
"org.openstack4j.api"
] | com.elastisys.scale; java.util; org.openstack4j.api; | 820,246 |
public BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> buildScriptApplier() {
// The default script applier executes a no-op
return (request, searchHit) -> request;
} | BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> function() { return (request, searchHit) -> request; } | /**
* Build the {@link BiFunction} to apply to all {@link RequestWrapper}.
*
* Public for testings....
*/ | Build the <code>BiFunction</code> to apply to all <code>RequestWrapper</code>. Public for testings... | buildScriptApplier | {
"repo_name": "rajanm/elasticsearch",
"path": "modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java",
"license": "apache-2.0",
"size": 34540
} | [
"java.util.function.BiFunction"
] | import java.util.function.BiFunction; | import java.util.function.*; | [
"java.util"
] | java.util; | 1,347,599 |
public void update()
{
if (this.currentLoginState == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT)
{
this.tryAcceptPlayer();
}
else if (this.currentLoginState == NetHandlerLoginServer.LoginState.DELAY_ACCEPT)
{
EntityPlayerMP entityplayermp = this.server.getPlayerList().getPlayerByUUID(this.loginGameProfile.getId());
if (entityplayermp == null)
{
this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getPlayerList(), this.networkManager, this.player);
this.player = null;
}
}
if (this.connectionTimer++ == 600)
{
this.disconnect(new TextComponentTranslation("multiplayer.disconnect.slow_login", new Object[0]));
}
} | void function() { if (this.currentLoginState == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) { this.tryAcceptPlayer(); } else if (this.currentLoginState == NetHandlerLoginServer.LoginState.DELAY_ACCEPT) { EntityPlayerMP entityplayermp = this.server.getPlayerList().getPlayerByUUID(this.loginGameProfile.getId()); if (entityplayermp == null) { this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getPlayerList(), this.networkManager, this.player); this.player = null; } } if (this.connectionTimer++ == 600) { this.disconnect(new TextComponentTranslation(STR, new Object[0])); } } | /**
* Like the old updateEntity(), except more generic.
*/ | Like the old updateEntity(), except more generic | update | {
"repo_name": "TheGreatAndPowerfulWeegee/wipunknown",
"path": "build/tmp/recompileMc/sources/net/minecraft/server/network/NetHandlerLoginServer.java",
"license": "gpl-3.0",
"size": 11908
} | [
"net.minecraft.entity.player.EntityPlayerMP",
"net.minecraft.util.text.TextComponentTranslation"
] | import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.text.TextComponentTranslation; | import net.minecraft.entity.player.*; import net.minecraft.util.text.*; | [
"net.minecraft.entity",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.util; | 2,137,464 |
@BeforeClass
public static void setUpBeforeClass() {
TempDirectoryInitializer.INSTANCE.initTempFiles();
// Facilitates plain java testing, registers bundles manually if not executed as a plug-in test
if (!Environment.runsInEclipse() && !initialized) {
initialized = true;
EASyInitializer.setInitializer();
ReasonerFrontend.getInstance().getRegistry().register(new Reasoner());
BuiltIn.initialize();
TypeRegistry.DEFAULT.register(VelocityInstantiator.class);
}
} | static void function() { TempDirectoryInitializer.INSTANCE.initTempFiles(); if (!Environment.runsInEclipse() && !initialized) { initialized = true; EASyInitializer.setInitializer(); ReasonerFrontend.getInstance().getRegistry().register(new Reasoner()); BuiltIn.initialize(); TypeRegistry.DEFAULT.register(VelocityInstantiator.class); } } | /**
* Copies the test files into {@link #TESTDATA_DIR_COPY}.
* These files can be modified while testing.
*/ | Copies the test files into <code>#TESTDATA_DIR_COPY</code>. These files can be modified while testing | setUpBeforeClass | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/EASy-Producer/EASy.Persistence.test/src/net/ssehub/easy/producer/core/AllTests.java",
"license": "apache-2.0",
"size": 4139
} | [
"net.ssehub.easy.basics.Environment",
"net.ssehub.easy.instantiation.core.model.BuiltIn",
"net.ssehub.easy.instantiation.core.model.vilTypes.TypeRegistry",
"net.ssehub.easy.instantiation.velocity.VelocityInstantiator",
"net.ssehub.easy.producer.core.persistence.TempDirectoryInitializer",
"net.ssehub.easy.... | import net.ssehub.easy.basics.Environment; import net.ssehub.easy.instantiation.core.model.BuiltIn; import net.ssehub.easy.instantiation.core.model.vilTypes.TypeRegistry; import net.ssehub.easy.instantiation.velocity.VelocityInstantiator; import net.ssehub.easy.producer.core.persistence.TempDirectoryInitializer; import net.ssehub.easy.producer.core.persistence.standard.EASyInitializer; import net.ssehub.easy.reasoning.core.frontend.ReasonerFrontend; import net.ssehub.easy.reasoning.sseReasoner.Reasoner; | import net.ssehub.easy.basics.*; import net.ssehub.easy.instantiation.core.model.*; import net.ssehub.easy.instantiation.velocity.*; import net.ssehub.easy.producer.core.persistence.*; import net.ssehub.easy.producer.core.persistence.standard.*; import net.ssehub.easy.reasoning.*; import net.ssehub.easy.reasoning.core.frontend.*; | [
"net.ssehub.easy"
] | net.ssehub.easy; | 1,393,295 |
public void open(Controller c) {
System.out.println("controller="+c);
openCount++;
if (openCount >= 2) {
// Re-entered. Maybe by transform().
return;
}
// Get the URI of XSpec home
URI xspecHomeUri;
String xspecHomeUriProp = System.getProperty("xspec.home.uri");
if (xspecHomeUriProp == null) {
String xspecHomeProp = System.getProperty("xspec.home");
debugPrintf("%-17s: %s%n", "xspec.home", xspecHomeProp);
xspecHomeUri = filePathToUri(xspecHomeProp + File.separator);
}
else {
debugPrintf("%-17s: %s%n", "xspec.home.uri", xspecHomeUriProp);
try {
xspecHomeUri = new URI(xspecHomeUriProp);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
debugPrintf("%-17s: %s%n", "xspecHomeUri", xspecHomeUri);
// Get 'src/' URI and normalize it
try {
// Use net.sf.saxon.functions.ResolveURI#makeAbsolute, because
// java.net.URI#resolve cannot handle "jar:" scheme.
srcDir = ResolveURI.makeAbsolute("src/", xspecHomeUri.toString()).normalize().toString();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
debugPrintf("%-17s: %s%n", "srcDir", srcDir);
// Get the directory path to ignore
ignoreDir = System.getProperty("xspec.coverage.ignore");
debugPrintf("%-17s: %s%n", "ignoreDir (raw)", ignoreDir);
// Normalize the directory as URI
ignoreDir = filePathToUri(ignoreDir + File.separator).normalize().toString();
debugPrintf("%-17s: %s%n", "ignoreDir (norm)", ignoreDir);
// Coverage XML file
String outPath = System.getProperty("xspec.coverage.xml");
File outFile = new File(outPath);
// XSpec file
String xspecPath = System.getProperty("xspec.xspecfile");
xspecPath = filePathToUri(xspecPath).toString();
Serializer serializer = new Processor(false).newSerializer(outFile);
serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
try {
writer = serializer.getXMLStreamWriter();
} catch(SaxonApiException e) {
throw new RuntimeException(e);
}
try {
writer.writeStartDocument();
writer.writeStartElement("trace");
writer.writeAttribute("xspec", xspecPath);
} catch(XMLStreamException e) {
throw new RuntimeException(e);
}
} | void function(Controller c) { System.out.println(STR+c); openCount++; if (openCount >= 2) { return; } URI xspecHomeUri; String xspecHomeUriProp = System.getProperty(STR); if (xspecHomeUriProp == null) { String xspecHomeProp = System.getProperty(STR); debugPrintf(STR, STR, xspecHomeProp); xspecHomeUri = filePathToUri(xspecHomeProp + File.separator); } else { debugPrintf(STR, STR, xspecHomeUriProp); try { xspecHomeUri = new URI(xspecHomeUriProp); } catch (URISyntaxException e) { throw new RuntimeException(e); } } debugPrintf(STR, STR, xspecHomeUri); try { srcDir = ResolveURI.makeAbsolute("src/", xspecHomeUri.toString()).normalize().toString(); } catch (URISyntaxException e) { throw new RuntimeException(e); } debugPrintf(STR, STR, srcDir); ignoreDir = System.getProperty(STR); debugPrintf(STR, STR, ignoreDir); ignoreDir = filePathToUri(ignoreDir + File.separator).normalize().toString(); debugPrintf(STR, STR, ignoreDir); String outPath = System.getProperty(STR); File outFile = new File(outPath); String xspecPath = System.getProperty(STR); xspecPath = filePathToUri(xspecPath).toString(); Serializer serializer = new Processor(false).newSerializer(outFile); serializer.setOutputProperty(Serializer.Property.INDENT, "yes"); try { writer = serializer.getXMLStreamWriter(); } catch(SaxonApiException e) { throw new RuntimeException(e); } try { writer.writeStartDocument(); writer.writeStartElement("trace"); writer.writeAttribute("xspec", xspecPath); } catch(XMLStreamException e) { throw new RuntimeException(e); } } | /**
* Method called at the start of execution, that is, when the run-time transformation starts
* @param c Controller used
*/ | Method called at the start of execution, that is, when the run-time transformation starts | open | {
"repo_name": "markdunnoup/xspec",
"path": "java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java",
"license": "mit",
"size": 13114
} | [
"java.io.File",
"java.lang.String",
"java.net.URISyntaxException",
"javax.xml.stream.XMLStreamException",
"net.sf.saxon.Controller",
"net.sf.saxon.functions.ResolveURI",
"net.sf.saxon.s9api.Processor",
"net.sf.saxon.s9api.SaxonApiException",
"net.sf.saxon.s9api.Serializer"
] | import java.io.File; import java.lang.String; import java.net.URISyntaxException; import javax.xml.stream.XMLStreamException; import net.sf.saxon.Controller; import net.sf.saxon.functions.ResolveURI; import net.sf.saxon.s9api.Processor; import net.sf.saxon.s9api.SaxonApiException; import net.sf.saxon.s9api.Serializer; | import java.io.*; import java.lang.*; import java.net.*; import javax.xml.stream.*; import net.sf.saxon.*; import net.sf.saxon.functions.*; import net.sf.saxon.s9api.*; | [
"java.io",
"java.lang",
"java.net",
"javax.xml",
"net.sf.saxon"
] | java.io; java.lang; java.net; javax.xml; net.sf.saxon; | 2,331,152 |
public static final CloudTasksClient create(CloudTasksSettings settings) throws IOException {
return new CloudTasksClient(settings);
} | static final CloudTasksClient function(CloudTasksSettings settings) throws IOException { return new CloudTasksClient(settings); } | /**
* Constructs an instance of CloudTasksClient, using the given settings. The channels are created
* based on the settings passed in, or defaults for any settings that are not set.
*/ | Constructs an instance of CloudTasksClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set | create | {
"repo_name": "googleapis/java-tasks",
"path": "google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksClient.java",
"license": "apache-2.0",
"size": 127550
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,890,440 |
public ExtensionResultStatusType modifyDuplicateAssetURL(StringBuilder urlBuilder); | ExtensionResultStatusType function(StringBuilder urlBuilder); | /**
* Provide an extension point to modify the url for a StaticAsset in the case
* where multiple assets have the same url.
* @param urlBuilder
* @return
*/ | Provide an extension point to modify the url for a StaticAsset in the case where multiple assets have the same url | modifyDuplicateAssetURL | {
"repo_name": "cloudbearings/BroadleafCommerce",
"path": "common/src/main/java/org/broadleafcommerce/common/file/service/BroadleafStaticAssetExtensionHandler.java",
"license": "apache-2.0",
"size": 1468
} | [
"org.broadleafcommerce.common.extension.ExtensionResultStatusType"
] | import org.broadleafcommerce.common.extension.ExtensionResultStatusType; | import org.broadleafcommerce.common.extension.*; | [
"org.broadleafcommerce.common"
] | org.broadleafcommerce.common; | 2,855,940 |
public IssueAssert hasFileName(final String fileName) {
isNotNull();
if (!Objects.equals(actual.getFileName(), fileName)) {
failWithMessage(EXPECTED_BUT_WAS_MESSAGE, "file name", actual, fileName, actual.getFileName());
}
return this;
} | IssueAssert function(final String fileName) { isNotNull(); if (!Objects.equals(actual.getFileName(), fileName)) { failWithMessage(EXPECTED_BUT_WAS_MESSAGE, STR, actual, fileName, actual.getFileName()); } return this; } | /**
* Checks whether an Issue has a specific filename.
*
* @param fileName
* String specifying filename.
*
* @return this
*/ | Checks whether an Issue has a specific filename | hasFileName | {
"repo_name": "mschmidae/analysis-model",
"path": "src/test/java/edu/hm/hafner/analysis/assertj/IssueAssert.java",
"license": "mit",
"size": 9092
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 644,120 |
protected Collection<PacketCollector> getPacketCollectors() {
return collectors;
} | Collection<PacketCollector> function() { return collectors; } | /**
* Get the collection of all packet collectors for this connection.
*
* @return a collection of packet collectors for this connection.
*/ | Get the collection of all packet collectors for this connection | getPacketCollectors | {
"repo_name": "UzxMx/java-bells",
"path": "lib-src/smack_src_3_3_0/source/org/jivesoftware/smack/Connection.java",
"license": "bsd-3-clause",
"size": 35765
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,038,773 |
public static BigInteger toBigInteger(CharSequence self) {
return new BigInteger(self.toString().trim());
} | static BigInteger function(CharSequence self) { return new BigInteger(self.toString().trim()); } | /**
* Parse a CharSequence into a BigInteger
*
* @param self a CharSequence
* @return a BigInteger
* @since 1.8.2
*/ | Parse a CharSequence into a BigInteger | toBigInteger | {
"repo_name": "jwagenleitner/incubator-groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/StringGroovyMethods.java",
"license": "apache-2.0",
"size": 164055
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 1,036,116 |
public int findColumnIndex(String name)
throws SQLException
{
for (int i = 0; i < _exprs.length; i++) {
if (_exprs[i].getName().equals(name))
return i + 1;
}
throw new SQLException(L.l("column `{0}' does not exist.", name));
} | int function(String name) throws SQLException { for (int i = 0; i < _exprs.length; i++) { if (_exprs[i].getName().equals(name)) return i + 1; } throw new SQLException(L.l(STR, name)); } | /**
* Returns the column index with the given name.
*/ | Returns the column index with the given name | findColumnIndex | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/db/sql/SelectResultSetImpl.java",
"license": "gpl-2.0",
"size": 15769
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 159,425 |
public boolean isItemTool(ItemStack itemstack)
{
if(isCurrentToolSomething(itemstack)){
ItemStack tool = getCurrentTool(itemstack);
boolean ret = tool.getItem().isItemTool(tool);
setCurrentTool(itemstack, tool);
return ret;
}
return false;
} | boolean function(ItemStack itemstack) { if(isCurrentToolSomething(itemstack)){ ItemStack tool = getCurrentTool(itemstack); boolean ret = tool.getItem().isItemTool(tool); setCurrentTool(itemstack, tool); return ret; } return false; } | /**
* Checks isDamagable and if it cannot be stacked
*/ | Checks isDamagable and if it cannot be stacked | isItemTool | {
"repo_name": "elix-x/toolscompressor",
"path": "src/main/java/code/elix_x/mods/toolscompressor/items/ItemCompressedTools.java",
"license": "lgpl-3.0",
"size": 48122
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 1,654,460 |
static <M extends IModel> Map<M, M> addReplacing(M old, M model, Map<M, M> result) {
if (null == result) {
result = new HashMap<M, M>();
}
result.put(old, model);
return result;
} | static <M extends IModel> Map<M, M> addReplacing(M old, M model, Map<M, M> result) { if (null == result) { result = new HashMap<M, M>(); } result.put(old, model); return result; } | /**
* Adds a pair of original and replacing model into a new mapping structure.
*
* @param <M> the model type
* @param old the old model
* @param model the replacing model
* @param result the mapping structure before adding, may be <b>null</b> then a new one is created
* @return the mapping structure containing <code>old</code> and <code>model</code>
*/ | Adds a pair of original and replacing model into a new mapping structure | addReplacing | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/VarModel/Utils/src/net/ssehub/easy/basics/modelManagement/ModelUpdateUtils.java",
"license": "apache-2.0",
"size": 6268
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 42,444 |
synchronized void updateStatus() throws IOException {
this.status = jobSubmitClient.getJobStatus(profile.getJobID());
this.statustime = System.currentTimeMillis();
} | synchronized void updateStatus() throws IOException { this.status = jobSubmitClient.getJobStatus(profile.getJobID()); this.statustime = System.currentTimeMillis(); } | /**
* Some methods need to update status immediately. So, refresh
* immediately
*
* @throws IOException
*/ | Some methods need to update status immediately. So, refresh immediately | updateStatus | {
"repo_name": "shot/hadoop-source-reading",
"path": "src/mapred/org/apache/hadoop/mapred/JobClient.java",
"license": "apache-2.0",
"size": 59363
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,345,113 |
public void testCreateFromRandomAccessMulti() throws IOException
{
String tiffPath = "src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/ccittg4multi.tif";
ImageInputStream is = ImageIO.createImageInputStream(new File(tiffPath));
ImageReader imageReader = ImageIO.getImageReaders(is).next();
imageReader.setInput(is);
int countTiffImages = imageReader.getNumImages(true);
assertTrue(countTiffImages > 1);
PDDocument document = new PDDocument();
int pdfPageNum = 0;
while (true)
{
PDImageXObject ximage = CCITTFactory.createFromFile(document, new File(tiffPath), pdfPageNum);
if (ximage == null)
{
break;
}
BufferedImage bim = imageReader.read(pdfPageNum);
validate(ximage, 1, bim.getWidth(), bim.getHeight(), "tiff", PDDeviceGray.INSTANCE.getName());
checkIdent(bim, ximage.getOpaqueImage());
PDPage page = new PDPage(PDRectangle.A4);
float fX = ximage.getWidth() / page.getMediaBox().getWidth();
float fY = ximage.getHeight() / page.getMediaBox().getHeight();
float factor = Math.max(fX, fY);
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false);
contentStream.drawImage(ximage, 0, 0, ximage.getWidth() / factor, ximage.getHeight() / factor);
contentStream.close();
++pdfPageNum;
}
assertEquals(countTiffImages, pdfPageNum);
document.save(testResultsDir + "/multitiff.pdf");
document.close();
document = PDDocument.load(new File(testResultsDir, "multitiff.pdf"), null);
assertEquals(countTiffImages, document.getNumberOfPages());
document.close();
imageReader.dispose();
} | void function() throws IOException { String tiffPath = STR; ImageInputStream is = ImageIO.createImageInputStream(new File(tiffPath)); ImageReader imageReader = ImageIO.getImageReaders(is).next(); imageReader.setInput(is); int countTiffImages = imageReader.getNumImages(true); assertTrue(countTiffImages > 1); PDDocument document = new PDDocument(); int pdfPageNum = 0; while (true) { PDImageXObject ximage = CCITTFactory.createFromFile(document, new File(tiffPath), pdfPageNum); if (ximage == null) { break; } BufferedImage bim = imageReader.read(pdfPageNum); validate(ximage, 1, bim.getWidth(), bim.getHeight(), "tiff", PDDeviceGray.INSTANCE.getName()); checkIdent(bim, ximage.getOpaqueImage()); PDPage page = new PDPage(PDRectangle.A4); float fX = ximage.getWidth() / page.getMediaBox().getWidth(); float fY = ximage.getHeight() / page.getMediaBox().getHeight(); float factor = Math.max(fX, fY); document.addPage(page); PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false); contentStream.drawImage(ximage, 0, 0, ximage.getWidth() / factor, ximage.getHeight() / factor); contentStream.close(); ++pdfPageNum; } assertEquals(countTiffImages, pdfPageNum); document.save(testResultsDir + STR); document.close(); document = PDDocument.load(new File(testResultsDir, STR), null); assertEquals(countTiffImages, document.getNumberOfPages()); document.close(); imageReader.dispose(); } | /**
* Tests CCITTFactory#createFromRandomAccess(PDDocument document,
* RandomAccess reader) with a multi page TIFF
*/ | Tests CCITTFactory#createFromRandomAccess(PDDocument document, RandomAccess reader) with a multi page TIFF | testCreateFromRandomAccessMulti | {
"repo_name": "ZhenyaM/veraPDF-pdfbox",
"path": "pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/CCITTFactoryTest.java",
"license": "apache-2.0",
"size": 5638
} | [
"java.awt.image.BufferedImage",
"java.io.File",
"java.io.IOException",
"javax.imageio.ImageIO",
"javax.imageio.ImageReader",
"javax.imageio.stream.ImageInputStream",
"org.apache.pdfbox.pdmodel.PDDocument",
"org.apache.pdfbox.pdmodel.PDPage",
"org.apache.pdfbox.pdmodel.PDPageContentStream",
"org.ap... | import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceGray; import org.apache.pdfbox.pdmodel.graphics.image.ValidateXImage; | import java.awt.image.*; import java.io.*; import javax.imageio.*; import javax.imageio.stream.*; import org.apache.pdfbox.pdmodel.*; import org.apache.pdfbox.pdmodel.common.*; import org.apache.pdfbox.pdmodel.graphics.color.*; import org.apache.pdfbox.pdmodel.graphics.image.*; | [
"java.awt",
"java.io",
"javax.imageio",
"org.apache.pdfbox"
] | java.awt; java.io; javax.imageio; org.apache.pdfbox; | 2,267,499 |
public long getGeneratedKeyAsLong(int index){
Object key = getGeneratedKeys().get(index);
if(key instanceof Long) return ((Long) key).longValue();
else if(key instanceof BigDecimal) return ((BigDecimal) key).longValue();
return Long.parseLong(key.toString());
} | long function(int index){ Object key = getGeneratedKeys().get(index); if(key instanceof Long) return ((Long) key).longValue(); else if(key instanceof BigDecimal) return ((BigDecimal) key).longValue(); return Long.parseLong(key.toString()); } | /**
* Returns a generated key as a long. If no key was generated an IndexOutOfBoundsException is thrown.
*
* @param index The index of the generated key as long. Most often only one key is generated which has index 0.
* @return A generated key as a Long object.
*/ | Returns a generated key as a long. If no key was generated an IndexOutOfBoundsException is thrown | getGeneratedKeyAsLong | {
"repo_name": "takezoux2/ButterflyPersistence-expands",
"path": "src/main/java/com/jenkov/db/itf/UpdateResult.java",
"license": "apache-2.0",
"size": 4015
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 431,028 |
@ApiModelProperty(required = true, value = "The type of the variable (see variable type endpoint for list)")
public String getType() {
return type;
} | @ApiModelProperty(required = true, value = STR) String function() { return type; } | /**
* The type of the variable (see variable type endpoint for list)
* @return type
**/ | The type of the variable (see variable type endpoint for list) | getType | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/model/ActionVariableResource.java",
"license": "apache-2.0",
"size": 3593
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 295,571 |
public void setFtpClientTrustStoreParameters(Map<String, Object> param) {
this.ftpClientTrustStoreParameters = param;
} | void function(Map<String, Object> param) { this.ftpClientTrustStoreParameters = param; } | /**
* Set the trust store parameters
*/ | Set the trust store parameters | setFtpClientTrustStoreParameters | {
"repo_name": "ullgren/camel",
"path": "components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java",
"license": "apache-2.0",
"size": 12627
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,407,323 |
RestClient restClient(); | RestClient restClient(); | /**
* Gets the REST client.
*
* @return the {@link RestClient} object.
*/ | Gets the REST client | restClient | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-entitysearch/src/main/java/com/microsoft/azure/cognitiveservices/search/entitysearch/BingEntitySearchAPI.java",
"license": "mit",
"size": 2646
} | [
"com.microsoft.rest.RestClient"
] | import com.microsoft.rest.RestClient; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 470,222 |
public Label getWidthOfMultiLineLabel() {
return widthOfMultiLineLabel;
} | Label function() { return widthOfMultiLineLabel; } | /**
* To get Width Of MultiLine Label.
*
* @return Label
*/ | To get Width Of MultiLine Label | getWidthOfMultiLineLabel | {
"repo_name": "kuzavas/ephesoft",
"path": "dcma-gwt/dcma-gwt-admin/src/main/java/com/ephesoft/dcma/gwt/admin/bm/client/view/tableinfo/EditTableInfoView.java",
"license": "agpl-3.0",
"size": 21397
} | [
"com.google.gwt.user.client.ui.Label"
] | import com.google.gwt.user.client.ui.Label; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,004,723 |
void endJSON() throws ParseException, IOException;
| void endJSON() throws ParseException, IOException; | /**
* Receive notification of the end of JSON processing.
*
* @throws ParseException
*/ | Receive notification of the end of JSON processing | endJSON | {
"repo_name": "AntoineJanvier/Slyx",
"path": "Client/src/slyx/jsonsimple/parser/ContentHandler.java",
"license": "bsd-3-clause",
"size": 3067
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 490,559 |
public static void unCacheChunk(Chunk chunk) {
chunkKeys.remove(buildChunkKey(chunk));
} | static void function(Chunk chunk) { chunkKeys.remove(buildChunkKey(chunk)); } | /**
* Removes a chunk from the chunk key cache
*/ | Removes a chunk from the chunk key cache | unCacheChunk | {
"repo_name": "TealCube/facecore",
"path": "src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ChunkUtil.java",
"license": "isc",
"size": 2226
} | [
"org.bukkit.Chunk"
] | import org.bukkit.Chunk; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 1,206,296 |
private void createSupplementalDataElementNode(
Node measureStratificationsNode) throws XPathExpressionException {
Node supplementaDataElementsElement = findNode(originalDoc,
XPATH_MEASURE_SD_ELEMENTS);
if (supplementaDataElementsElement == null) {
supplementaDataElementsElement = originalDoc
.createElement("supplementalDataElements");
((Element) measureStratificationsNode.getParentNode())
.insertBefore(supplementaDataElementsElement,
measureStratificationsNode.getNextSibling());
}
// Create elementLookUp node
if (findNode(originalDoc, XPATH_MEASURE_ELEMENT_LOOKUP) == null) {
Element elementLookUpElement = originalDoc
.createElement("elementLookUp");
((Element) supplementaDataElementsElement.getParentNode())
.insertBefore(elementLookUpElement,
supplementaDataElementsElement.getNextSibling());
}
if (findNode(originalDoc, XPATH_MEASURE_SUBTREE_LOOKUP) == null) {
Element subTreeLookUpElement = originalDoc
.createElement("subTreeLookUp");
((Element) supplementaDataElementsElement.getParentNode())
.insertBefore(subTreeLookUpElement,
supplementaDataElementsElement.getNextSibling());
}
if (findNode(originalDoc, XPATH_DTLS_COMPONENT_MEASURE) == null) {
Element componentMeasureElement = originalDoc
.createElement("componentMeasures");
if (findNode(originalDoc, XPATH_DETAILS_MEASURETYPE) == null) {
Node scoringElement = findNode(originalDoc, XPATH_DETAILS_SCORING);
if (scoringElement != null) {
((Element) scoringElement.getParentNode())
.insertBefore(componentMeasureElement,
scoringElement.getNextSibling());
}
} else {
Node measureTypeElement = findNode(originalDoc, XPATH_DETAILS_MEASURETYPE);
((Element) measureTypeElement.getParentNode())
.insertBefore(componentMeasureElement,
measureTypeElement.getNextSibling());
}
}
if (findNode(originalDoc, XPATH_DETAILS_ITEM_COUNT) == null) {
Element itemCountElement = originalDoc
.createElement("itemCount");
Node componentMeasuresElement = findNode(originalDoc, XPATH_DTLS_COMPONENT_MEASURE);
((Element) componentMeasuresElement.getParentNode())
.insertBefore(itemCountElement,
componentMeasuresElement.getNextSibling());
}
// create Measure Grouping node
if (findNode(originalDoc, XPATH_MEASURE_GROUPING) == null) {
Element measureGroupingElement = originalDoc
.createElement("measureGrouping");
((Element) supplementaDataElementsElement.getParentNode())
.insertBefore(measureGroupingElement,
supplementaDataElementsElement.getNextSibling());
}
Node riskAdjustmentVariablesElement = findNode(originalDoc,
XPATH_MEASURE_RAV_ELEMENTS);
if (riskAdjustmentVariablesElement == null) {
riskAdjustmentVariablesElement = originalDoc
.createElement("riskAdjustmentVariables");
((Element) supplementaDataElementsElement.getParentNode())
.insertBefore(riskAdjustmentVariablesElement,
supplementaDataElementsElement.getNextSibling());
}
System.out.println("Original Doc: "+originalDoc.toString());
} | void function( Node measureStratificationsNode) throws XPathExpressionException { Node supplementaDataElementsElement = findNode(originalDoc, XPATH_MEASURE_SD_ELEMENTS); if (supplementaDataElementsElement == null) { supplementaDataElementsElement = originalDoc .createElement(STR); ((Element) measureStratificationsNode.getParentNode()) .insertBefore(supplementaDataElementsElement, measureStratificationsNode.getNextSibling()); } if (findNode(originalDoc, XPATH_MEASURE_ELEMENT_LOOKUP) == null) { Element elementLookUpElement = originalDoc .createElement(STR); ((Element) supplementaDataElementsElement.getParentNode()) .insertBefore(elementLookUpElement, supplementaDataElementsElement.getNextSibling()); } if (findNode(originalDoc, XPATH_MEASURE_SUBTREE_LOOKUP) == null) { Element subTreeLookUpElement = originalDoc .createElement(STR); ((Element) supplementaDataElementsElement.getParentNode()) .insertBefore(subTreeLookUpElement, supplementaDataElementsElement.getNextSibling()); } if (findNode(originalDoc, XPATH_DTLS_COMPONENT_MEASURE) == null) { Element componentMeasureElement = originalDoc .createElement(STR); if (findNode(originalDoc, XPATH_DETAILS_MEASURETYPE) == null) { Node scoringElement = findNode(originalDoc, XPATH_DETAILS_SCORING); if (scoringElement != null) { ((Element) scoringElement.getParentNode()) .insertBefore(componentMeasureElement, scoringElement.getNextSibling()); } } else { Node measureTypeElement = findNode(originalDoc, XPATH_DETAILS_MEASURETYPE); ((Element) measureTypeElement.getParentNode()) .insertBefore(componentMeasureElement, measureTypeElement.getNextSibling()); } } if (findNode(originalDoc, XPATH_DETAILS_ITEM_COUNT) == null) { Element itemCountElement = originalDoc .createElement(STR); Node componentMeasuresElement = findNode(originalDoc, XPATH_DTLS_COMPONENT_MEASURE); ((Element) componentMeasuresElement.getParentNode()) .insertBefore(itemCountElement, componentMeasuresElement.getNextSibling()); } if (findNode(originalDoc, XPATH_MEASURE_GROUPING) == null) { Element measureGroupingElement = originalDoc .createElement(STR); ((Element) supplementaDataElementsElement.getParentNode()) .insertBefore(measureGroupingElement, supplementaDataElementsElement.getNextSibling()); } Node riskAdjustmentVariablesElement = findNode(originalDoc, XPATH_MEASURE_RAV_ELEMENTS); if (riskAdjustmentVariablesElement == null) { riskAdjustmentVariablesElement = originalDoc .createElement(STR); ((Element) supplementaDataElementsElement.getParentNode()) .insertBefore(riskAdjustmentVariablesElement, supplementaDataElementsElement.getNextSibling()); } System.out.println(STR+originalDoc.toString()); } | /**
* Creates the Supplemental Data Element Node.
*
* @param measureStratificationsNode stratifications Node for the measure
* @throws XPathExpressionException the x path expression exception
*/ | Creates the Supplemental Data Element Node | createSupplementalDataElementNode | {
"repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/mat/server/util/XmlProcessor.java",
"license": "apache-2.0",
"size": 55880
} | [
"javax.xml.xpath.XPathExpressionException",
"org.w3c.dom.Element",
"org.w3c.dom.Node"
] | import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Element; import org.w3c.dom.Node; | import javax.xml.xpath.*; import org.w3c.dom.*; | [
"javax.xml",
"org.w3c.dom"
] | javax.xml; org.w3c.dom; | 2,523,763 |
public List getOrganizationalUnits(CmsRequestContext context, CmsOrganizationalUnit parent, boolean includeChildren)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
List result = null;
try {
result = m_driverManager.getOrganizationalUnits(dbc, parent, includeChildren);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_GET_ORGUNITS_1, parent.getName()), e);
} finally {
dbc.clear();
}
return result;
}
| List function(CmsRequestContext context, CmsOrganizationalUnit parent, boolean includeChildren) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); List result = null; try { result = m_driverManager.getOrganizationalUnits(dbc, parent, includeChildren); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_GET_ORGUNITS_1, parent.getName()), e); } finally { dbc.clear(); } return result; } | /**
* Returns all child organizational units of the given parent organizational unit including
* hierarchical deeper organization units if needed.<p>
*
* @param context the current request context
* @param parent the parent organizational unit
* @param includeChildren if hierarchical deeper organization units should also be returned
*
* @return a list of <code>{@link CmsOrganizationalUnit}</code> objects
*
* @throws CmsException if operation was not successful
*
* @see org.opencms.security.CmsOrgUnitManager#getOrganizationalUnits(CmsObject, String, boolean)
*/ | Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed | getOrganizationalUnits | {
"repo_name": "comundus/opencms-comundus",
"path": "src/main/java/org/opencms/db/CmsSecurityManager.java",
"license": "lgpl-2.1",
"size": 242914
} | [
"java.util.List",
"org.opencms.file.CmsRequestContext",
"org.opencms.main.CmsException",
"org.opencms.security.CmsOrganizationalUnit"
] | import java.util.List; import org.opencms.file.CmsRequestContext; import org.opencms.main.CmsException; import org.opencms.security.CmsOrganizationalUnit; | import java.util.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.security.*; | [
"java.util",
"org.opencms.file",
"org.opencms.main",
"org.opencms.security"
] | java.util; org.opencms.file; org.opencms.main; org.opencms.security; | 1,940,051 |
@Override
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer,
PlotRenderingInfo info) {
Iterator iterator = null;
if (layer.equals(Layer.FOREGROUND)) {
iterator = this.foregroundAnnotations.iterator();
}
else if (layer.equals(Layer.BACKGROUND)) {
iterator = this.backgroundAnnotations.iterator();
}
else {
// should not get here
throw new RuntimeException("Unknown layer.");
}
while (iterator.hasNext()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
int index = this.plot.getIndexOf(this);
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
index, info);
}
}
| void function(Graphics2D g2, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer, PlotRenderingInfo info) { Iterator iterator = null; if (layer.equals(Layer.FOREGROUND)) { iterator = this.foregroundAnnotations.iterator(); } else if (layer.equals(Layer.BACKGROUND)) { iterator = this.backgroundAnnotations.iterator(); } else { throw new RuntimeException(STR); } while (iterator.hasNext()) { XYAnnotation annotation = (XYAnnotation) iterator.next(); int index = this.plot.getIndexOf(this); annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis, index, info); } } | /**
* Draws all the annotations for the specified layer.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param layer the layer.
* @param info the plot rendering info.
*/ | Draws all the annotations for the specified layer | drawAnnotations | {
"repo_name": "Mr-Steve/LTSpice_Library_Manager",
"path": "libs/jfreechart-1.0.16/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java",
"license": "gpl-2.0",
"size": 74604
} | [
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"java.util.Iterator",
"org.jfree.chart.annotations.XYAnnotation",
"org.jfree.chart.axis.ValueAxis",
"org.jfree.chart.plot.PlotRenderingInfo",
"org.jfree.ui.Layer"
] | import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.util.Iterator; import org.jfree.chart.annotations.XYAnnotation; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.ui.Layer; | import java.awt.*; import java.awt.geom.*; import java.util.*; import org.jfree.chart.annotations.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.ui.*; | [
"java.awt",
"java.util",
"org.jfree.chart",
"org.jfree.ui"
] | java.awt; java.util; org.jfree.chart; org.jfree.ui; | 565,029 |
private String getDisplayName(String uuid) {
try {
return userDirectoryService.getUser(uuid).getDisplayName();
} catch (UserNotDefinedException e) {
//dont throw, return null
return null;
}
}
| String function(String uuid) { try { return userDirectoryService.getUser(uuid).getDisplayName(); } catch (UserNotDefinedException e) { return null; } } | /**
* Helper to get the displayname for a user.
* @param uuid uuid of the user
* @return displayname or null. We dont want to expose the uuid.
*/ | Helper to get the displayname for a user | getDisplayName | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "content/content-tool/tool/src/java/org/sakaiproject/content/entityproviders/ContentEntityProvider.java",
"license": "apache-2.0",
"size": 8332
} | [
"org.sakaiproject.user.api.UserNotDefinedException"
] | import org.sakaiproject.user.api.UserNotDefinedException; | import org.sakaiproject.user.api.*; | [
"org.sakaiproject.user"
] | org.sakaiproject.user; | 582,306 |
public Transmitter getTransmitter()
{
return transmitter;
} | Transmitter function() { return transmitter; } | /**
* Returns the transmitter.
* @return the transmitter
*/ | Returns the transmitter | getTransmitter | {
"repo_name": "wesen/nmedit",
"path": "libs/jnmprotocol2/src/net/sf/nmedit/jnmprotocol2/AbstractNmProtocol.java",
"license": "gpl-2.0",
"size": 17365
} | [
"javax.sound.midi.Transmitter"
] | import javax.sound.midi.Transmitter; | import javax.sound.midi.*; | [
"javax.sound"
] | javax.sound; | 1,813,704 |
@NotNull
public Builder<TYPE> withResultStaleTime(@Nullable final UnitDuration staleTime) {
mStaleTime = staleTime;
return this;
} | Builder<TYPE> function(@Nullable final UnitDuration staleTime) { mStaleTime = staleTime; return this; } | /**
* Sets the time after which results are considered to be stale. In case a clash is resolved
* by joining the two invocations, and the results of the running one are stale, the invocation
* execution is repeated. A null value means that the results are always valid.
*
* @param staleTime the stale time.
* @return this builder.
*/ | Sets the time after which results are considered to be stale. In case a clash is resolved by joining the two invocations, and the results of the running one are stale, the invocation execution is repeated. A null value means that the results are always valid | withResultStaleTime | {
"repo_name": "davide-maestroni/jroutine",
"path": "android-core/src/main/java/com/github/dm/jrt/android/core/config/LoaderConfiguration.java",
"license": "apache-2.0",
"size": 16587
} | [
"com.github.dm.jrt.core.util.UnitDuration",
"org.jetbrains.annotations.Nullable"
] | import com.github.dm.jrt.core.util.UnitDuration; import org.jetbrains.annotations.Nullable; | import com.github.dm.jrt.core.util.*; import org.jetbrains.annotations.*; | [
"com.github.dm",
"org.jetbrains.annotations"
] | com.github.dm; org.jetbrains.annotations; | 2,466,945 |
public Path[] repoFiles() {
return repoFiles;
} | Path[] function() { return repoFiles; } | /**
* The shared filesystem repo locations.
*/ | The shared filesystem repo locations | repoFiles | {
"repo_name": "weipinghe/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/env/Environment.java",
"license": "apache-2.0",
"size": 11359
} | [
"java.nio.file.Path"
] | import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 1,076,633 |
void set(int index, BufferedImage image) {
geomLock.getLock();
if(byReference) {
// Fix to issue 488.
setRefImage(image, index);
}
if(imageData == null) {
// Only do this once, on the first image
// Reset this flag to true, incase it was set to false due to
// the previous image type.
abgrSupported = true;
imageTypeIsSupported = isImageTypeSupported(image);
imageData = createRenderedImageDataObject(null);
}
else {
if(getImageType() != evaluateImageType(image)) {
// TODO need to throw illegal state exception
}
}
if (imageTypeIsSupported) {
copySupportedImageToImageData(image, index, imageData);
} else {
// image type is unsupported, need to create a supported local copy.
// TODO : borrow code from JAI to convert to right format.
copyUnsupportedImageToImageData(image, index, imageData);
}
geomLock.unLock();
if (source.isLive()) {
// send a IMAGE_CHANGED message in order to
// notify all the users of the change
sendMessage(IMAGE_CHANGED, null);
}
}
/**
* Copies the specified BufferedImage to this 3D image component
* object at the specified index.
* @param index the image index
* @param images BufferedImage object containing the image.
* The format and size must be the same as the current format in this
* ImageComponent3D object. The index must not exceed the depth of this
* ImageComponent3D object.
*
void set(int index, NioImageBuffer nioImage) {
int width = nioImage.getWidth();
int height = nioImage.getHeight();
if (!byReference) {
throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D7"));
}
if (!yUp) {
throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D8"));
}
if (width != this.width) {
throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D2"));
}
if (height != this.height) {
throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D4"));
}
geomLock.getLock();
setImageClass(nioImage);
// This is a byRef image.
setRefImage(nioImage,0);
if(imageData == null) {
// Only do this once, on the first image
// Reset this flag to true, incase it was set to false due to
// the previous image type.
abgrSupported = true;
imageTypeIsSupported = isImageTypeSupported(nioImage);
// TODO : Need to handle null ....
imageData = createNioImageBufferDataObject(null);
}
else {
//if(getImageType() != evaluateImageType(image)) {
// TODO need to throw illegal state exception
//}
}
if (imageTypeIsSupported) {
// TODO : Need to handle this ..... case ....
// copySupportedImageToImageData(image, index, imageData);
} else {
// System.err.println("Image format is unsupported -- illogical case");
throw new AssertionError();
}
geomLock.unLock();
if (source.isLive()) {
// send a IMAGE_CHANGED message in order to
// notify all the users of the change
sendMessage(IMAGE_CHANGED, null);
}
} | void set(int index, BufferedImage image) { geomLock.getLock(); if(byReference) { setRefImage(image, index); } if(imageData == null) { abgrSupported = true; imageTypeIsSupported = isImageTypeSupported(image); imageData = createRenderedImageDataObject(null); } else { if(getImageType() != evaluateImageType(image)) { } } if (imageTypeIsSupported) { copySupportedImageToImageData(image, index, imageData); } else { copyUnsupportedImageToImageData(image, index, imageData); } geomLock.unLock(); if (source.isLive()) { sendMessage(IMAGE_CHANGED, null); } } /** * Copies the specified BufferedImage to this 3D image component * object at the specified index. * @param index the image index * @param images BufferedImage object containing the image. * The format and size must be the same as the current format in this * ImageComponent3D object. The index must not exceed the depth of this * ImageComponent3D object. * void set(int index, NioImageBuffer nioImage) { int width = nioImage.getWidth(); int height = nioImage.getHeight(); if (!byReference) { throw new IllegalArgumentException(J3dI18N.getString(STR)); } if (!yUp) { throw new IllegalArgumentException(J3dI18N.getString(STR)); } if (width != this.width) { throw new IllegalArgumentException(J3dI18N.getString(STR)); } if (height != this.height) { throw new IllegalArgumentException(J3dI18N.getString(STR)); } geomLock.getLock(); setImageClass(nioImage); setRefImage(nioImage,0); if(imageData == null) { abgrSupported = true; imageTypeIsSupported = isImageTypeSupported(nioImage); imageData = createNioImageBufferDataObject(null); } else { } if (imageTypeIsSupported) { } else { throw new AssertionError(); } geomLock.unLock(); if (source.isLive()) { sendMessage(IMAGE_CHANGED, null); } } | /**
* Copies the specified BufferedImage to this 3D image component
* object at the specified index.
* @param index the image index
* @param images BufferedImage object containing the image.
* The format and size must be the same as the current format in this
* ImageComponent3D object. The index must not exceed the depth of this
* ImageComponent3D object.
*/ | Copies the specified BufferedImage to this 3D image component object at the specified index | set | {
"repo_name": "gouessej/java3d-core",
"path": "src/main/java/org/jogamp/java3d/ImageComponent3DRetained.java",
"license": "gpl-2.0",
"size": 12659
} | [
"java.awt.image.BufferedImage"
] | import java.awt.image.BufferedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 238,692 |
void connectToOneServerWithRetry(String server) {
int sleep = 1000;
while (runBenchmark) {
try {
client.createConnection(server);
break;
} catch (Exception e) {
log.error(_F("Connection failed - retrying in %d second(s).\n",
sleep / 1000));
try { Thread.sleep(sleep); }
catch (Exception interruted) { }
if (sleep < 8000)
sleep += sleep;
}
}
log.info(_F("Connected to VoltDB node at: %s.\n", server));
} | void connectToOneServerWithRetry(String server) { int sleep = 1000; while (runBenchmark) { try { client.createConnection(server); break; } catch (Exception e) { log.error(_F(STR, sleep / 1000)); try { Thread.sleep(sleep); } catch (Exception interruted) { } if (sleep < 8000) sleep += sleep; } } log.info(_F(STR, server)); } | /**
* Connect to a single server with retry. Limited exponential backoff. No
* timeout. This will run until the process is killed if it's not able to
* connect.
*
* @param server
* hostname:port or just hostname (hostname can be ip).
*/ | Connect to a single server with retry. Limited exponential backoff. No timeout. This will run until the process is killed if it's not able to connect | connectToOneServerWithRetry | {
"repo_name": "wolffcm/voltdb",
"path": "tests/test_apps/live-rejoin-consistency/src/AsyncBenchmark.java",
"license": "agpl-3.0",
"size": 31118
} | [
"java.lang.Thread"
] | import java.lang.Thread; | import java.lang.*; | [
"java.lang"
] | java.lang; | 2,267,145 |
@Test(timeout = 360000)
public void testTransitionToDecommission() throws IOException {
LOG.info("Starting testTransitionToDecommission");
final int numNamenodes = 1;
final int numDatanodes = 4;
startCluster(numNamenodes, numDatanodes);
final Path file = new Path("testTransitionToDecommission.dat");
final int replicas = 3;
FileSystem fileSys = getCluster().getFileSystem(0);
FSNamesystem ns = getCluster().getNamesystem(0);
writeFile(fileSys, file, replicas, 25);
DatanodeInfo nodeOutofService = takeNodeOutofService(0,
getFirstBlockFirstReplicaUuid(fileSys, file), Long.MAX_VALUE, null,
AdminStates.IN_MAINTENANCE);
DFSClient client = getDfsClient(0);
assertEquals("All datanodes must be alive", numDatanodes,
client.datanodeReport(DatanodeReportType.LIVE).length);
// test 1, verify the replica in IN_MAINTENANCE state isn't in LocatedBlock
checkWithRetry(ns, fileSys, file, replicas - 1,
nodeOutofService);
takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(), 0, null,
AdminStates.DECOMMISSIONED);
// test 2 after decommission has completed, the replication count is
// replicas + 1 which includes the decommissioned node.
checkWithRetry(ns, fileSys, file, replicas + 1, null);
// test 3, put the node in service, replication count should restore.
putNodeInService(0, nodeOutofService.getDatanodeUuid());
checkWithRetry(ns, fileSys, file, replicas, null);
cleanupFile(fileSys, file);
} | @Test(timeout = 360000) void function() throws IOException { LOG.info(STR); final int numNamenodes = 1; final int numDatanodes = 4; startCluster(numNamenodes, numDatanodes); final Path file = new Path(STR); final int replicas = 3; FileSystem fileSys = getCluster().getFileSystem(0); FSNamesystem ns = getCluster().getNamesystem(0); writeFile(fileSys, file, replicas, 25); DatanodeInfo nodeOutofService = takeNodeOutofService(0, getFirstBlockFirstReplicaUuid(fileSys, file), Long.MAX_VALUE, null, AdminStates.IN_MAINTENANCE); DFSClient client = getDfsClient(0); assertEquals(STR, numDatanodes, client.datanodeReport(DatanodeReportType.LIVE).length); checkWithRetry(ns, fileSys, file, replicas - 1, nodeOutofService); takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(), 0, null, AdminStates.DECOMMISSIONED); checkWithRetry(ns, fileSys, file, replicas + 1, null); putNodeInService(0, nodeOutofService.getDatanodeUuid()); checkWithRetry(ns, fileSys, file, replicas, null); cleanupFile(fileSys, file); } | /**
* Transition from IN_MAINTENANCE to DECOMMISSIONED.
*/ | Transition from IN_MAINTENANCE to DECOMMISSIONED | testTransitionToDecommission | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMaintenanceState.java",
"license": "apache-2.0",
"size": 45334
} | [
"java.io.IOException",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.protocol.DatanodeInfo",
"org.apache.hadoop.hdfs.protocol.HdfsConstants",
"org.apache.hadoop.hdfs.server.namenode.FSNamesystem",
"org.junit.Assert",
"org.junit.Test"
] | import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.junit.Assert; import org.junit.Test; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.namenode.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
] | java.io; org.apache.hadoop; org.junit; | 1,927,524 |
public void changeSubject(Message packet, MUCRole role) throws ForbiddenException; | void function(Message packet, MUCRole role) throws ForbiddenException; | /**
* Changes the room's subject if the occupant has enough permissions. The occupant must be
* a moderator or the room must be configured so that anyone can change its subject. Otherwise
* a forbidden exception will be thrown.<p>
*
* The new subject will be added to the history of the room.
*
* @param packet the sent packet to change the room's subject.
* @param role the role of the user that is trying to change the subject.
* @throws ForbiddenException If the user is not allowed to change the subject.
*/ | Changes the room's subject if the occupant has enough permissions. The occupant must be a moderator or the room must be configured so that anyone can change its subject. Otherwise a forbidden exception will be thrown. The new subject will be added to the history of the room | changeSubject | {
"repo_name": "AndrewChanChina/pps1",
"path": "src/java/org/jivesoftware/openfire/muc/MUCRoom.java",
"license": "apache-2.0",
"size": 44866
} | [
"org.xmpp.packet.Message"
] | import org.xmpp.packet.Message; | import org.xmpp.packet.*; | [
"org.xmpp.packet"
] | org.xmpp.packet; | 829,423 |
public HttpScaleRule withAuth(List<ScaleRuleAuth> auth) {
this.auth = auth;
return this;
} | HttpScaleRule function(List<ScaleRuleAuth> auth) { this.auth = auth; return this; } | /**
* Set the auth property: Authentication secrets for the custom scale rule.
*
* @param auth the auth value to set.
* @return the HttpScaleRule object itself.
*/ | Set the auth property: Authentication secrets for the custom scale rule | withAuth | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/models/HttpScaleRule.java",
"license": "mit",
"size": 2412
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 758,686 |
public static <T> String join(Collection<T> list, String separator) {
StringBuilder sb = new StringBuilder();
Iterator<T> iter = list.iterator();
while (iter.hasNext()) {
sb.append(iter.next());
if (iter.hasNext())
sb.append(separator);
}
return sb.toString();
} | static <T> String function(Collection<T> list, String separator) { StringBuilder sb = new StringBuilder(); Iterator<T> iter = list.iterator(); while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) sb.append(separator); } return sb.toString(); } | /**
* Create a string representation of a list joined by the given separator
* @param list The list of items
* @param separator The separator
* @return The string representation.
*/ | Create a string representation of a list joined by the given separator | join | {
"repo_name": "ErikKringen/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/utils/Utils.java",
"license": "apache-2.0",
"size": 29946
} | [
"java.util.Collection",
"java.util.Iterator"
] | import java.util.Collection; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,229,217 |
void initConnection()
throws SQLException;
class Activator
extends ActivatorAdapter<ServiceReference<SQLAppStartup>>
{ | void initConnection() throws SQLException; class Activator extends ActivatorAdapter<ServiceReference<SQLAppStartup>> { | /**
* This method is called when connection may be safely initialized - for example, possibly (re-)building database
* structure.
*
* @throws SQLException If SQL error.
*/ | This method is called when connection may be safely initialized - for example, possibly (re-)building database structure | initConnection | {
"repo_name": "joobn72/qi4j-sdk",
"path": "extensions/indexing-sql/src/main/java/org/qi4j/index/sql/support/api/SQLAppStartup.java",
"license": "apache-2.0",
"size": 1757
} | [
"java.sql.SQLException",
"org.qi4j.api.activation.ActivatorAdapter",
"org.qi4j.api.service.ServiceReference"
] | import java.sql.SQLException; import org.qi4j.api.activation.ActivatorAdapter; import org.qi4j.api.service.ServiceReference; | import java.sql.*; import org.qi4j.api.activation.*; import org.qi4j.api.service.*; | [
"java.sql",
"org.qi4j.api"
] | java.sql; org.qi4j.api; | 1,793,349 |
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
} | static boolean function(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; } | /**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/ | Helper method to determine if the device has an extra-large screen. For example, 10" tablets are extra-large | isXLargeTablet | {
"repo_name": "gnu3ra/Scatterbrain",
"path": "app/src/main/java/net/ballmerlabs/scatterbrain/SettingsActivity.java",
"license": "gpl-3.0",
"size": 11684
} | [
"android.content.Context",
"android.content.res.Configuration"
] | import android.content.Context; import android.content.res.Configuration; | import android.content.*; import android.content.res.*; | [
"android.content"
] | android.content; | 421,227 |
private void insertPolicyViewButton(Composite secComposite, final int scenarioNumber) { | void function(Composite secComposite, final int scenarioNumber) { | /**
* Create button for balloon to show the description of a specific security scenario
*
* @param secComposite
* @param scenarioNumber
*/ | Create button for balloon to show the description of a specific security scenario | insertPolicyViewButton | {
"repo_name": "knadikari/developer-studio",
"path": "common/org.wso2.developerstudio.eclipse.artifact.security/src/org/wso2/developerstudio/eclipse/security/project/ui/form/SecurityFormPage.java",
"license": "apache-2.0",
"size": 118741
} | [
"org.eclipse.swt.widgets.Composite"
] | import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,957,459 |
@PUT
@Path("{organizationId}/services/{serviceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public void updateService(@PathParam("organizationId") String organizationId,
@PathParam("serviceId") String serviceId, UpdateServiceBean bean)
throws ServiceNotFoundException, NotAuthorizedException; | @Path(STR) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) void function(@PathParam(STR) String organizationId, @PathParam(STR) String serviceId, UpdateServiceBean bean) throws ServiceNotFoundException, NotAuthorizedException; | /**
* Use this endpoint to update information about a Service.
* @summary Update Service
* @param organizationId The Organization ID.
* @param serviceId The Service ID.
* @param bean Updated Service information.
* @statuscode 204 If the Service is updated successfully.
* @statuscode 404 If the Service does not exist.
* @throws ServiceNotFoundException when trying to get, update, or delete an service that does not exist
* @throws NotAuthorizedException when the user attempts to do or see something that they are not authorized (do not have permission) to
*/ | Use this endpoint to update information about a Service | updateService | {
"repo_name": "kunallimaye/apiman",
"path": "manager/api/rest/src/main/java/io/apiman/manager/api/rest/contract/IOrganizationResource.java",
"license": "apache-2.0",
"size": 111368
} | [
"io.apiman.manager.api.beans.services.UpdateServiceBean",
"io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException",
"io.apiman.manager.api.rest.contract.exceptions.ServiceNotFoundException",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"ja... | import io.apiman.manager.api.beans.services.UpdateServiceBean; import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException; import io.apiman.manager.api.rest.contract.exceptions.ServiceNotFoundException; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; | import io.apiman.manager.api.beans.services.*; import io.apiman.manager.api.rest.contract.exceptions.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"io.apiman.manager",
"javax.ws"
] | io.apiman.manager; javax.ws; | 820,424 |
default List<PrimitiveTypeProvider> getUniqueValues(String column) {
Set<PrimitiveTypeProvider> uniques = new HashSet<>();
getAll().forEach(row -> row.forEach((key, value) -> {
if (key.equals(column)) {
uniques.add(value);
}
}));
return Lists.newArrayList(uniques);
} | default List<PrimitiveTypeProvider> getUniqueValues(String column) { Set<PrimitiveTypeProvider> uniques = new HashSet<>(); getAll().forEach(row -> row.forEach((key, value) -> { if (key.equals(column)) { uniques.add(value); } })); return Lists.newArrayList(uniques); } | /**
* SELECT DISTINCT column from table
*/ | SELECT DISTINCT column from table | getUniqueValues | {
"repo_name": "vitrivr/cineast",
"path": "cineast-core/src/main/java/org/vitrivr/cineast/core/db/DBSelector.java",
"license": "mit",
"size": 12471
} | [
"com.google.common.collect.Lists",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"org.vitrivr.cineast.core.data.providers.primitive.PrimitiveTypeProvider"
] | import com.google.common.collect.Lists; import java.util.HashSet; import java.util.List; import java.util.Set; import org.vitrivr.cineast.core.data.providers.primitive.PrimitiveTypeProvider; | import com.google.common.collect.*; import java.util.*; import org.vitrivr.cineast.core.data.providers.primitive.*; | [
"com.google.common",
"java.util",
"org.vitrivr.cineast"
] | com.google.common; java.util; org.vitrivr.cineast; | 1,436,020 |
protected Object[] convertToArray(ListModel model) {
int size = model.getSize();
Object[] result = new Object[size];
for (int i = 0; i < size; i++) {
result[i] = model.getElementAt(i);
}
return result;
}
| Object[] function(ListModel model) { int size = model.getSize(); Object[] result = new Object[size]; for (int i = 0; i < size; i++) { result[i] = model.getElementAt(i); } return result; } | /**
* Convert the list of objects in the specified list model
* into an array.
*/ | Convert the list of objects in the specified list model into an array | convertToArray | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "utils/eclipselink.utils.workbench/framework/source/org/eclipse/persistence/tools/workbench/framework/ui/chooser/DefaultListChooser.java",
"license": "epl-1.0",
"size": 7128
} | [
"javax.swing.ListModel"
] | import javax.swing.ListModel; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,337,867 |
public FunctionResult execute(final Evaluator evaluator, final String arguments)
throws FunctionException {
Integer result = null;
String exceptionMessage = "Two string arguments are required.";
ArrayList strings = FunctionHelper.getStrings(arguments,
EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR);
if (strings.size() != 2) {
throw new FunctionException(exceptionMessage);
}
try {
String argumentOne = FunctionHelper.trimAndRemoveQuoteChars(
(String) strings.get(0), evaluator.getQuoteCharacter());
String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars(
(String) strings.get(1), evaluator.getQuoteCharacter());
result = new Integer(argumentOne.compareToIgnoreCase(argumentTwo));
} catch (FunctionException fe) {
throw new FunctionException(fe.getMessage(), fe);
} catch (Exception e) {
throw new FunctionException(exceptionMessage, e);
}
return new FunctionResult(result.toString(),
FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
| FunctionResult function(final Evaluator evaluator, final String arguments) throws FunctionException { Integer result = null; String exceptionMessage = STR; ArrayList strings = FunctionHelper.getStrings(arguments, EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); if (strings.size() != 2) { throw new FunctionException(exceptionMessage); } try { String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( (String) strings.get(0), evaluator.getQuoteCharacter()); String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( (String) strings.get(1), evaluator.getQuoteCharacter()); result = new Integer(argumentOne.compareToIgnoreCase(argumentTwo)); } catch (FunctionException fe) { throw new FunctionException(fe.getMessage(), fe); } catch (Exception e) { throw new FunctionException(exceptionMessage, e); } return new FunctionResult(result.toString(), FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); } | /**
* Executes the function for the specified argument. This method is called
* internally by Evaluator.
*
* @param evaluator
* An instance of Evaluator.
* @param arguments
* A string argument that will be converted into two string
* arguments. The first argument is the first string to compare
* and the second argument is the second argument to compare. The
* string argument(s) HAS to be enclosed in quotes. White space
* that is not enclosed within quotes will be trimmed. Quote
* characters in the first and last positions of any string
* argument (after being trimmed) will be removed also. The quote
* characters used must be the same as the quote characters used
* by the current instance of Evaluator. If there are multiple
* arguments, they must be separated by a comma (",").
*
* @return Returns an integer value of zero if the strings are equal, an
* integer value less than zero if the first string precedes the
* second string or an integer value greater than zero if the first
* string follows the second string.
*
* @exception FunctionException
* Thrown if the argument(s) are not valid for this function.
*/ | Executes the function for the specified argument. This method is called internally by Evaluator | execute | {
"repo_name": "OpenSoftwareSolutions/PDFReporter",
"path": "pdfreporter-extensions/src/org/oss/pdfreporter/uses/net/sourceforge/jeval/function/string/CompareToIgnoreCase.java",
"license": "lgpl-3.0",
"size": 4206
} | [
"java.util.ArrayList",
"org.oss.pdfreporter.uses.net.sourceforge.jeval.EvaluationConstants",
"org.oss.pdfreporter.uses.net.sourceforge.jeval.Evaluator",
"org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionConstants",
"org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionException",
... | import java.util.ArrayList; import org.oss.pdfreporter.uses.net.sourceforge.jeval.EvaluationConstants; import org.oss.pdfreporter.uses.net.sourceforge.jeval.Evaluator; import org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionConstants; import org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionException; import org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionHelper; import org.oss.pdfreporter.uses.net.sourceforge.jeval.function.FunctionResult; | import java.util.*; import org.oss.pdfreporter.uses.net.sourceforge.jeval.*; import org.oss.pdfreporter.uses.net.sourceforge.jeval.function.*; | [
"java.util",
"org.oss.pdfreporter"
] | java.util; org.oss.pdfreporter; | 720,460 |
private String getSidClaim(OIDCSessionState sessionState) {
String sidClaim = sessionState.getSidClaim();
return sidClaim;
} | String function(OIDCSessionState sessionState) { String sidClaim = sessionState.getSidClaim(); return sidClaim; } | /**
* Returns the sid of the all the RPs belong to same session.
*
* @param sessionState
* @return
*/ | Returns the sid of the all the RPs belong to same session | getSidClaim | {
"repo_name": "IsuraD/identity-inbound-auth-oauth",
"path": "components/org.wso2.carbon.identity.oidc.session/src/main/java/org/wso2/carbon/identity/oidc/session/backchannellogout/DefaultLogoutTokenBuilder.java",
"license": "apache-2.0",
"size": 15043
} | [
"org.wso2.carbon.identity.oidc.session.OIDCSessionState"
] | import org.wso2.carbon.identity.oidc.session.OIDCSessionState; | import org.wso2.carbon.identity.oidc.session.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 1,853,564 |
@Test
public void testHexToShort() {
String src = "CDF1F0C10F12345678";
assertEquals((short)0x0000, Conversion.hexToShort(src, 0, (short)0, 0, 0));
assertEquals((short)0x000C, Conversion.hexToShort(src, 0, (short)0, 0, 1));
assertEquals((short)0x1FDC, Conversion.hexToShort(src, 0, (short)0, 0, 4));
assertEquals((short)0xF1FD, Conversion.hexToShort(src, 1, (short)0, 0, 4));
assertEquals((short)0x1234, Conversion.hexToShort(src, 0, (short)0x1234, 0, 0));
assertEquals((short)0x8764, Conversion.hexToShort(src, 15, (short)0x1234, 4, 3));
} | void function() { String src = STR; assertEquals((short)0x0000, Conversion.hexToShort(src, 0, (short)0, 0, 0)); assertEquals((short)0x000C, Conversion.hexToShort(src, 0, (short)0, 0, 1)); assertEquals((short)0x1FDC, Conversion.hexToShort(src, 0, (short)0, 0, 4)); assertEquals((short)0xF1FD, Conversion.hexToShort(src, 1, (short)0, 0, 4)); assertEquals((short)0x1234, Conversion.hexToShort(src, 0, (short)0x1234, 0, 0)); assertEquals((short)0x8764, Conversion.hexToShort(src, 15, (short)0x1234, 4, 3)); } | /**
* Tests {@link Conversion#hexToShort(String, int, short, int, int)}.
*/ | Tests <code>Conversion#hexToShort(String, int, short, int, int)</code> | testHexToShort | {
"repo_name": "martingwhite/astor",
"path": "examples/lang_7/src/test/java/org/apache/commons/lang3/ConversionTest.java",
"license": "gpl-2.0",
"size": 100416
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,267,082 |
public void show(final URL url) {
try {
helpView.setPage(url);
dialog.setVisible(true);
} catch (IOException e) {
showMessageDialog(dialog, e, "Dummy Error", ERROR_MESSAGE);
}
} | void function(final URL url) { try { helpView.setPage(url); dialog.setVisible(true); } catch (IOException e) { showMessageDialog(dialog, e, STR, ERROR_MESSAGE); } } | /** Show a URL.
* @param url URL to show by this HelpManager.
*/ | Show a URL | show | {
"repo_name": "christianhujer/japi",
"path": "historic2/src/prj/net/sf/japi/progs/jeduca/swing/HelpManager.java",
"license": "lgpl-3.0",
"size": 3035
} | [
"java.io.IOException",
"javax.swing.JOptionPane"
] | import java.io.IOException; import javax.swing.JOptionPane; | import java.io.*; import javax.swing.*; | [
"java.io",
"javax.swing"
] | java.io; javax.swing; | 1,950,786 |
long getNumberOfImagesInStorageDomain(Guid storageDomainId); | long getNumberOfImagesInStorageDomain(Guid storageDomainId); | /**
* Retrieves the number of images in the specified storage domain.
*
* @param storageId
* The storage domain ID
* @return the number of images in the specified storage domain, 0 for a domain that does not exist
*/ | Retrieves the number of images in the specified storage domain | getNumberOfImagesInStorageDomain | {
"repo_name": "halober/ovirt-engine",
"path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainDAO.java",
"license": "apache-2.0",
"size": 6547
} | [
"org.ovirt.engine.core.compat.Guid"
] | import org.ovirt.engine.core.compat.Guid; | import org.ovirt.engine.core.compat.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,890,036 |
public static KeyPurposeIdList createKeyPurposeIdList(final DEREncodable enc)
{
final org.bouncycastle.asn1.x509.ExtendedKeyUsage usages =
org.bouncycastle.asn1.x509.ExtendedKeyUsage.getInstance(enc);
final List<KeyPurposeId> idList = new ArrayList<KeyPurposeId>();
for (Object usage : usages.getUsages()) {
idList.add(KeyPurposeId.getByOid(usage.toString()));
}
return new KeyPurposeIdList(idList);
} | static KeyPurposeIdList function(final DEREncodable enc) { final org.bouncycastle.asn1.x509.ExtendedKeyUsage usages = org.bouncycastle.asn1.x509.ExtendedKeyUsage.getInstance(enc); final List<KeyPurposeId> idList = new ArrayList<KeyPurposeId>(); for (Object usage : usages.getUsages()) { idList.add(KeyPurposeId.getByOid(usage.toString())); } return new KeyPurposeIdList(idList); } | /**
* Creates a {@link KeyPurposeIdList} object from DER data.
*
* @param enc DER encoded key purpose identifier data.
*
* @return Key purpose ID list object.
*/ | Creates a <code>KeyPurposeIdList</code> object from DER data | createKeyPurposeIdList | {
"repo_name": "dfish3r/vt-crypt",
"path": "src/main/java/edu/vt/middleware/crypt/x509/ExtensionFactory.java",
"license": "apache-2.0",
"size": 16434
} | [
"edu.vt.middleware.crypt.x509.types.KeyPurposeId",
"edu.vt.middleware.crypt.x509.types.KeyPurposeIdList",
"java.util.ArrayList",
"java.util.List",
"org.bouncycastle.asn1.DEREncodable"
] | import edu.vt.middleware.crypt.x509.types.KeyPurposeId; import edu.vt.middleware.crypt.x509.types.KeyPurposeIdList; import java.util.ArrayList; import java.util.List; import org.bouncycastle.asn1.DEREncodable; | import edu.vt.middleware.crypt.x509.types.*; import java.util.*; import org.bouncycastle.asn1.*; | [
"edu.vt.middleware",
"java.util",
"org.bouncycastle.asn1"
] | edu.vt.middleware; java.util; org.bouncycastle.asn1; | 182,114 |
void onCreate(@NotNull User user, @Nullable String password) throws RepositoryException {
if (!user.isSystemUser()) {
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
action.onCreate(user, password, root, namePathMapper);
}
} else {
log.warn("onCreate(User,String) called for system user. Use onCreate(User) instead.");
}
} | void onCreate(@NotNull User user, @Nullable String password) throws RepositoryException { if (!user.isSystemUser()) { for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) { action.onCreate(user, password, root, namePathMapper); } } else { log.warn(STR); } } | /**
* Let the configured {@code AuthorizableAction}s perform additional
* tasks associated with the creation of the new user before the
* corresponding new node is persisted.
*
* @param user The new user.
* @param password The password.
* @throws RepositoryException If an exception occurs.
*/ | Let the configured AuthorizableActions perform additional tasks associated with the creation of the new user before the corresponding new node is persisted | onCreate | {
"repo_name": "apache/jackrabbit-oak",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java",
"license": "apache-2.0",
"size": 23870
} | [
"javax.jcr.RepositoryException",
"org.apache.jackrabbit.api.security.user.User",
"org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction",
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable"
] | import javax.jcr.RepositoryException; import org.apache.jackrabbit.api.security.user.User; import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; | import javax.jcr.*; import org.apache.jackrabbit.api.security.user.*; import org.apache.jackrabbit.oak.spi.security.user.action.*; import org.jetbrains.annotations.*; | [
"javax.jcr",
"org.apache.jackrabbit",
"org.jetbrains.annotations"
] | javax.jcr; org.apache.jackrabbit; org.jetbrains.annotations; | 1,893,157 |
protected CountDownLatch updateIndicesStats(final ActionListener<IndicesStatsResponse> listener) {
final CountDownLatch latch = new CountDownLatch(1);
final IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.clear();
indicesStatsRequest.store(true);
client.admin().indices().stats(indicesStatsRequest, new LatchedActionListener<>(listener, latch));
return latch;
} | CountDownLatch function(final ActionListener<IndicesStatsResponse> listener) { final CountDownLatch latch = new CountDownLatch(1); final IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); indicesStatsRequest.clear(); indicesStatsRequest.store(true); client.admin().indices().stats(indicesStatsRequest, new LatchedActionListener<>(listener, latch)); return latch; } | /**
* Retrieve the latest indices stats, calling the listener when complete
* @return a latch that can be used to wait for the indices stats to complete if desired
*/ | Retrieve the latest indices stats, calling the listener when complete | updateIndicesStats | {
"repo_name": "qwerty4030/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/cluster/InternalClusterInfoService.java",
"license": "apache-2.0",
"size": 21142
} | [
"java.util.concurrent.CountDownLatch",
"org.elasticsearch.action.ActionListener",
"org.elasticsearch.action.LatchedActionListener",
"org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest",
"org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse"
] | import java.util.concurrent.CountDownLatch; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.LatchedActionListener; import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; | import java.util.concurrent.*; import org.elasticsearch.action.*; import org.elasticsearch.action.admin.indices.stats.*; | [
"java.util",
"org.elasticsearch.action"
] | java.util; org.elasticsearch.action; | 2,177,384 |
@Override
public Adapter createBAMMediatorAdapter() {
if (bamMediatorItemProvider == null) {
bamMediatorItemProvider = new BAMMediatorItemProvider(this);
}
return bamMediatorItemProvider;
}
protected BAMMediatorInputConnectorItemProvider bamMediatorInputConnectorItemProvider; | Adapter function() { if (bamMediatorItemProvider == null) { bamMediatorItemProvider = new BAMMediatorItemProvider(this); } return bamMediatorItemProvider; } protected BAMMediatorInputConnectorItemProvider bamMediatorInputConnectorItemProvider; | /**
* This creates an adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.BAMMediator}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.wso2.developerstudio.eclipse.gmf.esb.BAMMediator</code>. | createBAMMediatorAdapter | {
"repo_name": "rajeevanv89/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 286852
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,344,637 |
public void addBtnImportListener(ActionListener l) {
btnImport.addActionListener(l);
} | void function(ActionListener l) { btnImport.addActionListener(l); } | /**
* Add listener.
*
* @param l
* listener to be added
*/ | Add listener | addBtnImportListener | {
"repo_name": "uncertweb/SOS-database-client",
"path": "src/main/java/org/uncertweb/sos_db_client/view/PhenomenonView.java",
"license": "gpl-3.0",
"size": 12094
} | [
"java.awt.event.ActionListener"
] | import java.awt.event.ActionListener; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 724,410 |
public static byte[] runReportToPdf(
JasperReport jasperReport,
Map parameters,
JRDataSource jrDataSource
) throws JRException
{
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, jrDataSource);
return JasperExportManager.exportReportToPdf(jasperPrint);
} | static byte[] function( JasperReport jasperReport, Map parameters, JRDataSource jrDataSource ) throws JRException { JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, jrDataSource); return JasperExportManager.exportReportToPdf(jasperPrint); } | /**
* Fills a report and returns byte array object containing the report in PDF format.
* The intermediate JasperPrint object is not saved on disk.
*/ | Fills a report and returns byte array object containing the report in PDF format. The intermediate JasperPrint object is not saved on disk | runReportToPdf | {
"repo_name": "delafer/j7project",
"path": "jasper352/csb-jasperreport-dep/src/net/sf/jasperreports/engine/JasperRunManager.java",
"license": "gpl-2.0",
"size": 16511
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 386,131 |
public void test_java_util_Arrays_sort_float_array_NPE() {
float[] float_array_null = null;
try {
java.util.Arrays.sort(float_array_null);
fail("Should throw java.lang.NullPointerException");
} catch (NullPointerException e) {
// Expected
}
try {
// Regression for HARMONY-378
java.util.Arrays.sort(float_array_null, (int) -1, (int) 1);
fail("Should throw java.lang.NullPointerException");
} catch (NullPointerException e) {
// Expected
}
} | void function() { float[] float_array_null = null; try { java.util.Arrays.sort(float_array_null); fail(STR); } catch (NullPointerException e) { } try { java.util.Arrays.sort(float_array_null, (int) -1, (int) 1); fail(STR); } catch (NullPointerException e) { } } | /**
* java.util.Arrays#sort(float[], int, int)
*/ | java.util.Arrays#sort(float[], int, int) | test_java_util_Arrays_sort_float_array_NPE | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java",
"license": "gpl-2.0",
"size": 156287
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,836,701 |
public Connection newConnection() throws RemoteException; | Connection function() throws RemoteException; | /**
* Generates a new connection to the endpoint of the address space
* for which this is a channel.
*/ | Generates a new connection to the endpoint of the address space for which this is a channel | newConnection | {
"repo_name": "md-5/jdk10",
"path": "src/java.rmi/share/classes/sun/rmi/transport/Channel.java",
"license": "gpl-2.0",
"size": 1933
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 151,987 |
Dispatch.call(this, "GetITObjectIDs", new Variant(sourceID), new Variant(playlistID), new Variant(trackID), new Variant(lastParam));
} | Dispatch.call(this, STR, new Variant(sourceID), new Variant(playlistID), new Variant(trackID), new Variant(lastParam)); } | /**
* Wrapper for calling the ActiveX-Method with input-parameter(s).
*
* @param sourceID an input-parameter of type int
* @param playlistID an input-parameter of type int
* @param trackID an input-parameter of type int
* @param lastParam an input-parameter of type int
*/ | Wrapper for calling the ActiveX-Method with input-parameter(s) | getITObjectIDs | {
"repo_name": "cpesch/MetaMusic",
"path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IITFileOrCDTrack.java",
"license": "gpl-2.0",
"size": 32709
} | [
"com.jacob.com.Dispatch",
"com.jacob.com.Variant"
] | import com.jacob.com.Dispatch; import com.jacob.com.Variant; | import com.jacob.com.*; | [
"com.jacob.com"
] | com.jacob.com; | 1,587,898 |
public static final FilesToRunProvider xcrunwrapper(RuleContext ruleContext) {
return ruleContext.getExecutablePrerequisite("$xcrunwrapper", Mode.HOST);
} | static final FilesToRunProvider function(RuleContext ruleContext) { return ruleContext.getExecutablePrerequisite(STR, Mode.HOST); } | /**
* Returns the location of the xcrunwrapper tool.
*/ | Returns the location of the xcrunwrapper tool | xcrunwrapper | {
"repo_name": "dropbox/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java",
"license": "apache-2.0",
"size": 82429
} | [
"com.google.devtools.build.lib.analysis.FilesToRunProvider",
"com.google.devtools.build.lib.analysis.RuleContext",
"com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget"
] | import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; | import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.analysis.configuredtargets.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,483,499 |
public PropertyValidator getValidator(String key) {
PropertyValidator propertyValidator = (PropertyValidator) validators.get(key);
return (propertyValidator == null) ? ignoreValidator : propertyValidator;
}
| PropertyValidator function(String key) { PropertyValidator propertyValidator = (PropertyValidator) validators.get(key); return (propertyValidator == null) ? ignoreValidator : propertyValidator; } | /**
* Returns a validator or a default one.
*
* @param key
* @return
*/ | Returns a validator or a default one | getValidator | {
"repo_name": "idega/is.idega.nest.rafverk",
"path": "src/java/is/idega/nest/rafverk/bean/validation/ValidationRulesApplication.java",
"license": "gpl-3.0",
"size": 6155
} | [
"com.idega.fop.validator.PropertyValidator"
] | import com.idega.fop.validator.PropertyValidator; | import com.idega.fop.validator.*; | [
"com.idega.fop"
] | com.idega.fop; | 701,912 |
public void writeFilteringRules() {
try {
// remove all old rules
if (Preferences.userRoot().nodeExists("/Filtering")) {
Preferences.userRoot().node("/Filtering").removeNode();
}
prefs.putInt(FILTERING_RULES_NUM_KEY, rules.size());
for (int i = 0; i < rules.size(); ++i) {
String ruleNoKey = "/Filtering/Rule" + i;
prefs.put(ruleNoKey + "/Name", rules.elementAt(i).getName());
prefs.put(ruleNoKey + "/Source", rules.elementAt(i).getSource());
prefs.put(ruleNoKey + "/EventType", rules.elementAt(i).getEventType());
prefs.put(ruleNoKey + "/EventText", rules.elementAt(i).getEventText());
prefs.put(ruleNoKey + "/AlertType", rules.elementAt(i).getAlertType().toString());
prefs.putBoolean(ruleNoKey + "/IsShowOn", rules.elementAt(i).isShowOn());
prefs.putBoolean(ruleNoKey + "/IsActive", rules.elementAt(i).isActive());
prefs.put(ruleNoKey + "/Severity", rules.elementAt(i).getSeverityAsText());
}
} catch (BackingStoreException e) {
prefs.putInt(FILTERING_RULES_NUM_KEY, 0);
}
} | void function() { try { if (Preferences.userRoot().nodeExists(STR)) { Preferences.userRoot().node(STR).removeNode(); } prefs.putInt(FILTERING_RULES_NUM_KEY, rules.size()); for (int i = 0; i < rules.size(); ++i) { String ruleNoKey = STR + i; prefs.put(ruleNoKey + "/Name", rules.elementAt(i).getName()); prefs.put(ruleNoKey + STR, rules.elementAt(i).getSource()); prefs.put(ruleNoKey + STR, rules.elementAt(i).getEventType()); prefs.put(ruleNoKey + STR, rules.elementAt(i).getEventText()); prefs.put(ruleNoKey + STR, rules.elementAt(i).getAlertType().toString()); prefs.putBoolean(ruleNoKey + STR, rules.elementAt(i).isShowOn()); prefs.putBoolean(ruleNoKey + STR, rules.elementAt(i).isActive()); prefs.put(ruleNoKey + STR, rules.elementAt(i).getSeverityAsText()); } } catch (BackingStoreException e) { prefs.putInt(FILTERING_RULES_NUM_KEY, 0); } } | /**
* Store all filtering rules to storage.
*/ | Store all filtering rules to storage | writeFilteringRules | {
"repo_name": "dhosa/yamcs",
"path": "yamcs-core/src/main/java/org/yamcs/ui/eventviewer/FilteringRulesTable.java",
"license": "agpl-3.0",
"size": 13705
} | [
"java.util.prefs.BackingStoreException",
"java.util.prefs.Preferences"
] | import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; | import java.util.prefs.*; | [
"java.util"
] | java.util; | 2,383,263 |
protected void printToTSD(double printTime) throws IOException
{
String commaSpace = "";
// dynamic printing requires re-printing the species values each time
// step
if (dynamicBoolean == true)
{
bufferedTSDWriter.write("(\"time\"");
commaSpace = ",";
// if there's an interesting species, only those get printed
if (interestingSpecies.size() > 0)
{
for (String speciesID : interestingSpecies)
{
bufferedTSDWriter.write(commaSpace + "\"" + speciesID + "\"");
}
// always print compartment location IDs
for (String componentLocationID : componentToLocationMap.keySet())
{
String locationX = componentLocationID + "__locationX";
String locationY = componentLocationID + "__locationY";
bufferedTSDWriter.write(commaSpace + "\"" + locationX + "\", \"" + locationY + "\"");
}
}
else
{
// print the species IDs
for (String speciesID : speciesIDSet)
{
bufferedTSDWriter.write(commaSpace + "\"" + speciesID + "\"");
}
// print compartment location IDs
for (String componentLocationID : componentToLocationMap.keySet())
{
String locationX = componentLocationID + "__locationX";
String locationY = componentLocationID + "__locationY";
bufferedTSDWriter.write(commaSpace + "\"" + locationX + "\", \"" + locationY + "\"");
}
// print compartment IDs (for sizes)
for (String componentID : compartmentIDSet)
{
try
{
bufferedTSDWriter.write(", \"" + componentID + "\"");
}
catch (IOException e)
{
e.printStackTrace();
}
}
// print nonconstant parameter IDs
for (String parameterID : nonconstantParameterIDSet)
{
try
{
bufferedTSDWriter.write(", \"" + parameterID + "\"");
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
bufferedTSDWriter.write("),\n");
}
bufferedTSDWriter.write("(");
commaSpace = "";
// print the current time
bufferedTSDWriter.write(printTime + ",");
// if there's an interesting species, only those get printed
if (interestingSpecies.size() > 0)
{
for (String speciesID : interestingSpecies)
{
if (printConcentrations == true)
{
bufferedTSDWriter.write(commaSpace + (variableToValueMap.get(speciesID) / variableToValueMap.get(speciesToCompartmentNameMap.get(speciesID))));
}
else
{
bufferedTSDWriter.write(commaSpace + variableToValueMap.get(speciesID));
}
commaSpace = ",";
}
// always print component location values
for (String componentID : componentToLocationMap.keySet())
{
bufferedTSDWriter.write(commaSpace + (int) componentToLocationMap.get(componentID).getX());
bufferedTSDWriter.write(commaSpace + (int) componentToLocationMap.get(componentID).getY());
}
}
else
{
// loop through the speciesIDs and print their current value to the
// file
for (String speciesID : speciesIDSet)
{
bufferedTSDWriter.write(commaSpace + variableToValueMap.get(speciesID));
commaSpace = ",";
}
// print component location values
for (String componentID : componentToLocationMap.keySet())
{
bufferedTSDWriter.write(commaSpace + (int) componentToLocationMap.get(componentID).getX());
commaSpace = ",";
bufferedTSDWriter.write(commaSpace + (int) componentToLocationMap.get(componentID).getY());
}
// print compartment sizes
for (String componentID : compartmentIDSet)
{
bufferedTSDWriter.write(commaSpace + variableToValueMap.get(componentID));
commaSpace = ",";
}
// print nonconstant parameter values
for (String parameterID : nonconstantParameterIDSet)
{
bufferedTSDWriter.write(commaSpace + variableToValueMap.get(parameterID));
commaSpace = ",";
}
}
bufferedTSDWriter.write(")");
bufferedTSDWriter.flush();
currProgress += printInterval;
message.setInteger((int)(Math.ceil(100*currProgress/maxProgress)));
parent.send(RequestType.REQUEST_PROGRESS, message);
} | void function(double printTime) throws IOException { String commaSpace = STR(\"time\"STR,STR\STR\STR__locationXSTR__locationYSTR\STR\STRSTR\STR\STR\STR__locationXSTR__locationYSTR\STR\STRSTR\""); } for (String componentID : compartmentIDSet) { try { bufferedTSDWriter.write(STR" + componentID + "\""); } catch (IOException e) { e.printStackTrace(); } } for (String parameterID : nonconstantParameterIDSet) { try { bufferedTSDWriter.write(STR" + parameterID + "\STR),\nSTR(STRSTR,STR,STR,STR,STR,STR,STR)"); bufferedTSDWriter.flush(); currProgress += printInterval; message.setInteger((int)(Math.ceil(100*currProgress/maxProgress))); parent.send(RequestType.REQUEST_PROGRESS, message); } | /**
* appends the current species states to the TSD file
*
* @throws IOException
*/ | appends the current species states to the TSD file | printToTSD | {
"repo_name": "MyersResearchGroup/iBioSim",
"path": "analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/simulation/flattened/Simulator.java",
"license": "apache-2.0",
"size": 210548
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,940,900 |
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
} | void function(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } | /**
* This is a helper function from Tabula to set the rotation of model parts
*/ | This is a helper function from Tabula to set the rotation of model parts | setRotateAngle | {
"repo_name": "Zalthrion/Zyl-Roth",
"path": "src/main/java/com/zalthrion/zylroth/model/armor/ModelVoidLordArmor.java",
"license": "gpl-3.0",
"size": 13604
} | [
"net.minecraft.client.model.ModelRenderer"
] | import net.minecraft.client.model.ModelRenderer; | import net.minecraft.client.model.*; | [
"net.minecraft.client"
] | net.minecraft.client; | 178,953 |
public List<MetricsSegmentInfo> segments() {
return this.segments;
} | List<MetricsSegmentInfo> function() { return this.segments; } | /**
* Get segmented metric data (if further segmented).
*
* @return the segments value
*/ | Get segmented metric data (if further segmented) | segments | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/applicationinsights/microsoft-azure-applicationinsights-query/src/main/java/com/microsoft/azure/applicationinsights/query/models/MetricsSegmentInfo.java",
"license": "mit",
"size": 3354
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 41,209 |
public UCrop withMaxResultSize(@IntRange(from = 100) int width, @IntRange(from = 100) int height) {
mCropOptionsBundle.putInt(EXTRA_MAX_SIZE_X, width);
mCropOptionsBundle.putInt(EXTRA_MAX_SIZE_Y, height);
return this;
} | UCrop function(@IntRange(from = 100) int width, @IntRange(from = 100) int height) { mCropOptionsBundle.putInt(EXTRA_MAX_SIZE_X, width); mCropOptionsBundle.putInt(EXTRA_MAX_SIZE_Y, height); return this; } | /**
* Set maximum size for result cropped image.
*
* @param width max cropped image width
* @param height max cropped image height
*/ | Set maximum size for result cropped image | withMaxResultSize | {
"repo_name": "gaojianyang/only",
"path": "Only/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java",
"license": "gpl-3.0",
"size": 20781
} | [
"android.support.annotation.IntRange"
] | import android.support.annotation.IntRange; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 1,992,099 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<PollResult<String>, String> beginStartPacketCapture(
String resourceGroupName, String gatewayName, VpnGatewayPacketCaptureStartParameters parameters) {
return beginStartPacketCaptureAsync(resourceGroupName, gatewayName, parameters).getSyncPoller();
} | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<String>, String> function( String resourceGroupName, String gatewayName, VpnGatewayPacketCaptureStartParameters parameters) { return beginStartPacketCaptureAsync(resourceGroupName, gatewayName, parameters).getSyncPoller(); } | /**
* Starts packet capture on vpn gateway in the specified resource group.
*
* @param resourceGroupName The resource group name of the VpnGateway.
* @param gatewayName The name of the gateway.
* @param parameters Vpn gateway packet capture parameters supplied to start packet capture on vpn gateway.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/ | Starts packet capture on vpn gateway in the specified resource group | beginStartPacketCapture | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VpnGatewaysClientImpl.java",
"license": "mit",
"size": 124002
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller",
"com.azure.resourcemanager.network.models.VpnGatewayPacketCaptureStartParameters"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.models.VpnGatewayPacketCaptureStartParameters; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 682,121 |
private void modifyFiltered(Filter filter, boolean expand) {
if (!isInstalled())
return;
ProjectionAnnotationModel model= getModel();
if (model == null)
return;
List<JavaProjectionAnnotation> modified= new ArrayList<>();
Iterator<Annotation> iter= model.getAnnotationIterator();
while (iter.hasNext()) {
Object annotation= iter.next();
if (annotation instanceof JavaProjectionAnnotation) {
JavaProjectionAnnotation java= (JavaProjectionAnnotation) annotation;
if (expand == java.isCollapsed() && filter.match(java)) {
if (expand)
java.markExpanded();
else
java.markCollapsed();
modified.add(java);
}
}
}
model.modifyAnnotations(null, null, modified.toArray(new Annotation[modified.size()]));
} | void function(Filter filter, boolean expand) { if (!isInstalled()) return; ProjectionAnnotationModel model= getModel(); if (model == null) return; List<JavaProjectionAnnotation> modified= new ArrayList<>(); Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { Object annotation= iter.next(); if (annotation instanceof JavaProjectionAnnotation) { JavaProjectionAnnotation java= (JavaProjectionAnnotation) annotation; if (expand == java.isCollapsed() && filter.match(java)) { if (expand) java.markExpanded(); else java.markCollapsed(); modified.add(java); } } } model.modifyAnnotations(null, null, modified.toArray(new Annotation[modified.size()])); } | /**
* Collapses or expands all annotations matched by the passed filter.
*
* @param filter the filter to use to select which annotations to collapse
* @param expand <code>true</code> to expand the matched annotations, <code>false</code> to
* collapse them
*/ | Collapses or expands all annotations matched by the passed filter | modifyFiltered | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/ui/text/folding/DefaultJavaFoldingStructureProvider.java",
"license": "epl-1.0",
"size": 48347
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"org.eclipse.jface.text.source.Annotation",
"org.eclipse.jface.text.source.projection.ProjectionAnnotationModel"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; | import java.util.*; import org.eclipse.jface.text.source.*; import org.eclipse.jface.text.source.projection.*; | [
"java.util",
"org.eclipse.jface"
] | java.util; org.eclipse.jface; | 2,668,069 |
protected Vector<String> toString(A scheme) {
Vector<String> result;
Iterator<String> names;
Vector<String> namesSorted;
result = new Vector<String>();
namesSorted = new Vector<String>();
names = scheme.statisticNames();
while (names.hasNext())
namesSorted.add(names.next());
Collections.sort(namesSorted);
for (String name: namesSorted)
result.add(name + ": " + scheme.getStatistic(name));
return result;
} | Vector<String> function(A scheme) { Vector<String> result; Iterator<String> names; Vector<String> namesSorted; result = new Vector<String>(); namesSorted = new Vector<String>(); names = scheme.statisticNames(); while (names.hasNext()) namesSorted.add(names.next()); Collections.sort(namesSorted); for (String name: namesSorted) result.add(name + STR + scheme.getStatistic(name)); return result; } | /**
* Turns the data stored in a data statistic into a string representation.
*
* @param scheme the data statistic to process
* @return the generated output
*/ | Turns the data stored in a data statistic into a string representation | toString | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/test/java/adams/data/statistics/AbstractDataStatisticTestCase.java",
"license": "gpl-3.0",
"size": 6301
} | [
"java.util.Collections",
"java.util.Iterator",
"java.util.Vector"
] | import java.util.Collections; import java.util.Iterator; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,100,773 |
public SandBox retrieveSandBoxManagementById(Long sandBoxId); | SandBox function(Long sandBoxId); | /**
* Returns the SandBox by id but only if the SandBox is associated with the current site.
* @param sandBoxId
* @return
*/ | Returns the SandBox by id but only if the SandBox is associated with the current site | retrieveSandBoxManagementById | {
"repo_name": "caosg/BroadleafCommerce",
"path": "common/src/main/java/org/broadleafcommerce/common/sandbox/service/SandBoxService.java",
"license": "apache-2.0",
"size": 3092
} | [
"org.broadleafcommerce.common.sandbox.domain.SandBox"
] | import org.broadleafcommerce.common.sandbox.domain.SandBox; | import org.broadleafcommerce.common.sandbox.domain.*; | [
"org.broadleafcommerce.common"
] | org.broadleafcommerce.common; | 1,700,271 |
public static Deserializer<Ethernet> deserializer() {
return (data, offset, length) -> {
checkInput(data, offset, length, ETHERNET_HEADER_LENGTH);
byte[] addressBuffer = new byte[DATALAYER_ADDRESS_LENGTH];
ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
Ethernet eth = new Ethernet();
// Read destination MAC address into buffer
bb.get(addressBuffer);
eth.setDestinationMACAddress(addressBuffer);
// Read source MAC address into buffer
bb.get(addressBuffer);
eth.setSourceMACAddress(addressBuffer);
short ethType = bb.getShort();
if (ethType == TYPE_QINQ) {
// in this case we excpect 2 VLAN headers
checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH + VLAN_HEADER_LENGTH);
final short tci = bb.getShort();
eth.setQinQPriorityCode((byte) (tci >> 13 & 0x07));
eth.setQinQVID((short) (tci & 0x0fff));
eth.setQinQTPID(TYPE_QINQ);
ethType = bb.getShort();
}
if (ethType == TYPE_VLAN) {
checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH);
final short tci = bb.getShort();
eth.setPriorityCode((byte) (tci >> 13 & 0x07));
eth.setVlanID((short) (tci & 0x0fff));
ethType = bb.getShort();
if (ethType == TYPE_VLAN) {
// We handle only double tagged packets here and assume that in this case
// TYPE_QINQ above was not hit
// We put the values retrieved above with TYPE_VLAN in
// qInQ fields
checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH);
eth.setQinQPriorityCode(eth.getPriorityCode());
eth.setQinQVID(eth.getVlanID());
eth.setQinQTPID(TYPE_VLAN);
final short innerTci = bb.getShort();
eth.setPriorityCode((byte) (innerTci >> 13 & 0x07));
eth.setVlanID((short) (innerTci & 0x0fff));
ethType = bb.getShort();
}
} else {
eth.setVlanID(Ethernet.VLAN_UNTAGGED);
}
eth.setEtherType(ethType);
IPacket payload;
Deserializer<? extends IPacket> deserializer;
if (Ethernet.ETHERTYPE_DESERIALIZER_MAP.containsKey(ethType)) {
deserializer = Ethernet.ETHERTYPE_DESERIALIZER_MAP.get(ethType);
} else {
deserializer = Data.deserializer();
}
payload = deserializer.deserialize(data, bb.position(),
bb.limit() - bb.position());
payload.setParent(eth);
eth.setPayload(payload);
return eth;
};
} | static Deserializer<Ethernet> function() { return (data, offset, length) -> { checkInput(data, offset, length, ETHERNET_HEADER_LENGTH); byte[] addressBuffer = new byte[DATALAYER_ADDRESS_LENGTH]; ByteBuffer bb = ByteBuffer.wrap(data, offset, length); Ethernet eth = new Ethernet(); bb.get(addressBuffer); eth.setDestinationMACAddress(addressBuffer); bb.get(addressBuffer); eth.setSourceMACAddress(addressBuffer); short ethType = bb.getShort(); if (ethType == TYPE_QINQ) { checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH + VLAN_HEADER_LENGTH); final short tci = bb.getShort(); eth.setQinQPriorityCode((byte) (tci >> 13 & 0x07)); eth.setQinQVID((short) (tci & 0x0fff)); eth.setQinQTPID(TYPE_QINQ); ethType = bb.getShort(); } if (ethType == TYPE_VLAN) { checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH); final short tci = bb.getShort(); eth.setPriorityCode((byte) (tci >> 13 & 0x07)); eth.setVlanID((short) (tci & 0x0fff)); ethType = bb.getShort(); if (ethType == TYPE_VLAN) { checkHeaderLength(length, ETHERNET_HEADER_LENGTH + VLAN_HEADER_LENGTH); eth.setQinQPriorityCode(eth.getPriorityCode()); eth.setQinQVID(eth.getVlanID()); eth.setQinQTPID(TYPE_VLAN); final short innerTci = bb.getShort(); eth.setPriorityCode((byte) (innerTci >> 13 & 0x07)); eth.setVlanID((short) (innerTci & 0x0fff)); ethType = bb.getShort(); } } else { eth.setVlanID(Ethernet.VLAN_UNTAGGED); } eth.setEtherType(ethType); IPacket payload; Deserializer<? extends IPacket> deserializer; if (Ethernet.ETHERTYPE_DESERIALIZER_MAP.containsKey(ethType)) { deserializer = Ethernet.ETHERTYPE_DESERIALIZER_MAP.get(ethType); } else { deserializer = Data.deserializer(); } payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); payload.setParent(eth); eth.setPayload(payload); return eth; }; } | /**
* Deserializer function for Ethernet packets.
*
* @return deserializer function
*/ | Deserializer function for Ethernet packets | deserializer | {
"repo_name": "osinstom/onos",
"path": "utils/misc/src/main/java/org/onlab/packet/Ethernet.java",
"license": "apache-2.0",
"size": 27374
} | [
"java.nio.ByteBuffer",
"org.onlab.packet.PacketUtils"
] | import java.nio.ByteBuffer; import org.onlab.packet.PacketUtils; | import java.nio.*; import org.onlab.packet.*; | [
"java.nio",
"org.onlab.packet"
] | java.nio; org.onlab.packet; | 1,988,232 |
User findTypedQuery(final Long pk); | User findTypedQuery(final Long pk); | /**
* Used for testing createTypedQuery method.
*
* @param pk
* a primary key.
* @return the user.
*/ | Used for testing createTypedQuery method | findTypedQuery | {
"repo_name": "qjafcunuas/jbromo",
"path": "jbromo-dao/jbromo-dao-jpa/jbromo-dao-jpa-lib/src/test/java/org/jbromo/sample/server/services/dao/src/user/IUserDao.java",
"license": "apache-2.0",
"size": 1969
} | [
"org.jbromo.sample.server.model.src.User"
] | import org.jbromo.sample.server.model.src.User; | import org.jbromo.sample.server.model.src.*; | [
"org.jbromo.sample"
] | org.jbromo.sample; | 8,175 |
public List<TableName> listTableNamesByNamespace(String name) throws IOException; | List<TableName> function(String name) throws IOException; | /**
* Get list of table names by namespace
* @param name namespace name
* @return table names
* @throws IOException
*/ | Get list of table names by namespace | listTableNamesByNamespace | {
"repo_name": "toshimasa-nasu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java",
"license": "apache-2.0",
"size": 8252
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.TableName"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.TableName; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 93,649 |
@Override
protected int getDefaultPort() {
return DFSConfigKeys.DFS_NAMENODE_HTTP_PORT_DEFAULT;
}
private static class HttpFSDataInputStream extends FilterInputStream implements Seekable, PositionedReadable {
protected HttpFSDataInputStream(InputStream in, int bufferSize) {
super(new BufferedInputStream(in, bufferSize));
} | int function() { return DFSConfigKeys.DFS_NAMENODE_HTTP_PORT_DEFAULT; } private static class HttpFSDataInputStream extends FilterInputStream implements Seekable, PositionedReadable { protected HttpFSDataInputStream(InputStream in, int bufferSize) { super(new BufferedInputStream(in, bufferSize)); } | /**
* Get the default port for this file system.
* @return the default port or 0 if there isn't one
*/ | Get the default port for this file system | getDefaultPort | {
"repo_name": "ronny-macmaster/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java",
"license": "apache-2.0",
"size": 57804
} | [
"java.io.BufferedInputStream",
"java.io.FilterInputStream",
"java.io.InputStream",
"org.apache.hadoop.fs.PositionedReadable",
"org.apache.hadoop.fs.Seekable",
"org.apache.hadoop.hdfs.DFSConfigKeys"
] | import java.io.BufferedInputStream; import java.io.FilterInputStream; import java.io.InputStream; import org.apache.hadoop.fs.PositionedReadable; import org.apache.hadoop.fs.Seekable; import org.apache.hadoop.hdfs.DFSConfigKeys; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,405,425 |
@Test
public void testPagedSearchTest3() throws Exception
{
getLdapServer().setMaxSizeLimit( 3 );
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, ( int ) LdapServer.NO_SIZE_LIMIT, 5 );
doLoop( ctx, controls, 5, 2, 10, false );
} | void function() throws Exception { getLdapServer().setMaxSizeLimit( 3 ); DirContext ctx = getWiredContext( getLdapServer() ); SearchControls controls = createSearchControls( ctx, ( int ) LdapServer.NO_SIZE_LIMIT, 5 ); doLoop( ctx, controls, 5, 2, 10, false ); } | /**
* Admin = yes <br>
* SL = 3<br>
* RL = none<br>
* PL = 5<br>
* expected exception : no<br>
* expected number of entries returned : 10 ( 5 + 5 )<br>
*/ | Admin = yes SL = 3 RL = none PL = 5 expected exception : no expected number of entries returned : 10 ( 5 + 5 ) | testPagedSearchTest3 | {
"repo_name": "drankye/directory-server",
"path": "server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java",
"license": "apache-2.0",
"size": 36622
} | [
"javax.naming.directory.DirContext",
"javax.naming.directory.SearchControls",
"org.apache.directory.server.integ.ServerIntegrationUtils",
"org.apache.directory.server.ldap.LdapServer"
] | import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; import org.apache.directory.server.integ.ServerIntegrationUtils; import org.apache.directory.server.ldap.LdapServer; | import javax.naming.directory.*; import org.apache.directory.server.integ.*; import org.apache.directory.server.ldap.*; | [
"javax.naming",
"org.apache.directory"
] | javax.naming; org.apache.directory; | 1,248,133 |
private void doPushMessage(Status status) {
StatusMessage message = new StatusMessage();
message.setBody(status);
doPushMessage(message);
} | void function(Status status) { StatusMessage message = new StatusMessage(); message.setBody(status); doPushMessage(message); } | /**
* Sends a status message.
*
* @param status
*/ | Sends a status message | doPushMessage | {
"repo_name": "OpenCorrelate/red5load",
"path": "red5/src/main/java/org/red5/server/stream/PlayEngine.java",
"license": "lgpl-3.0",
"size": 47873
} | [
"org.red5.server.net.rtmp.status.Status",
"org.red5.server.stream.message.StatusMessage"
] | import org.red5.server.net.rtmp.status.Status; import org.red5.server.stream.message.StatusMessage; | import org.red5.server.net.rtmp.status.*; import org.red5.server.stream.message.*; | [
"org.red5.server"
] | org.red5.server; | 1,813,448 |
private JComponent buildSeparator() {
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
separator.setBorder(new EmptyBorder(0, 0, 0, 25));
separator.setForeground(UIHelper.getColor("Node.separetor"));
separator.setBackground(UIHelper.getColor("Node.separetor"));
JPanel container = new JPanel(new BorderLayout());
container.setBorder(new EmptyBorder(0, 10, 0, 10));
container.add(separator);
container.setAlignmentX(JLabel.LEFT_ALIGNMENT);
container.setOpaque(false);
return container;
} | JComponent function() { JSeparator separator = new JSeparator(JSeparator.HORIZONTAL); separator.setBorder(new EmptyBorder(0, 0, 0, 25)); separator.setForeground(UIHelper.getColor(STR)); separator.setBackground(UIHelper.getColor(STR)); JPanel container = new JPanel(new BorderLayout()); container.setBorder(new EmptyBorder(0, 10, 0, 10)); container.add(separator); container.setAlignmentX(JLabel.LEFT_ALIGNMENT); container.setOpaque(false); return container; } | /**
* Builds a separator for the node parameters
*
* @return JComponent
*/ | Builds a separator for the node parameters | buildSeparator | {
"repo_name": "VISNode/VISNode",
"path": "src/main/java/visnode/application/NodeView.java",
"license": "apache-2.0",
"size": 6693
} | [
"java.awt.BorderLayout",
"javax.swing.JComponent",
"javax.swing.JLabel",
"javax.swing.JPanel",
"javax.swing.JSeparator",
"javax.swing.border.EmptyBorder"
] | import java.awt.BorderLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.border.EmptyBorder; | import java.awt.*; import javax.swing.*; import javax.swing.border.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,883,642 |
private static <T> int lookupOrAdd(List<T> list, T element) {
int ordinal = list.indexOf(element);
if (ordinal == -1) {
ordinal = list.size();
list.add(element);
}
return ordinal;
} | static <T> int function(List<T> list, T element) { int ordinal = list.indexOf(element); if (ordinal == -1) { ordinal = list.size(); list.add(element); } return ordinal; } | /**
* Finds the ordinal of an element in a list, or adds it.
*
* @param list List
* @param element Element to lookup or add
* @param <T> Element type
* @return Ordinal of element in list
*/ | Finds the ordinal of an element in a list, or adds it | lookupOrAdd | {
"repo_name": "apache/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java",
"license": "apache-2.0",
"size": 30490
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,029,239 |
@Test
public void testRemoveForEntity() {
List<Permission> before = dao.getAllForEntity(VM_ENTITY_ID);
// make sure we have some actual data to work with
assertFalse(before.isEmpty());
dao.removeForEntity(VM_ENTITY_ID);
List<Permission> after = dao.getAllForEntity(VM_ENTITY_ID);
assertTrue(after.isEmpty());
} | void function() { List<Permission> before = dao.getAllForEntity(VM_ENTITY_ID); assertFalse(before.isEmpty()); dao.removeForEntity(VM_ENTITY_ID); List<Permission> after = dao.getAllForEntity(VM_ENTITY_ID); assertTrue(after.isEmpty()); } | /**
* Ensures that all permissions for the specified entity are removed.
*/ | Ensures that all permissions for the specified entity are removed | testRemoveForEntity | {
"repo_name": "OpenUniversity/ovirt-engine",
"path": "backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/PermissionDaoTest.java",
"license": "apache-2.0",
"size": 22873
} | [
"java.util.List",
"org.junit.Assert",
"org.ovirt.engine.core.common.businessentities.Permission"
] | import java.util.List; import org.junit.Assert; import org.ovirt.engine.core.common.businessentities.Permission; | import java.util.*; import org.junit.*; import org.ovirt.engine.core.common.businessentities.*; | [
"java.util",
"org.junit",
"org.ovirt.engine"
] | java.util; org.junit; org.ovirt.engine; | 2,417,460 |
protected void onItemUseFinish()
{
if (this.itemInUse != null)
{
this.updateItemUse(this.itemInUse, 16);
int i = this.itemInUse.stackSize;
ItemStack itemstack = this.itemInUse.onFoodEaten(this.worldObj, this);
itemstack = ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack);
if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i)
{
this.inventory.mainInventory[this.inventory.currentItem] = itemstack;
if (itemstack != null && itemstack.stackSize == 0)
{
this.inventory.mainInventory[this.inventory.currentItem] = null;
}
}
this.clearItemInUse();
}
} | void function() { if (this.itemInUse != null) { this.updateItemUse(this.itemInUse, 16); int i = this.itemInUse.stackSize; ItemStack itemstack = this.itemInUse.onFoodEaten(this.worldObj, this); itemstack = ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); if (itemstack != this.itemInUse itemstack != null && itemstack.stackSize != i) { this.inventory.mainInventory[this.inventory.currentItem] = itemstack; if (itemstack != null && itemstack.stackSize == 0) { this.inventory.mainInventory[this.inventory.currentItem] = null; } } this.clearItemInUse(); } } | /**
* Used for when item use count runs out, ie: eating completed
*/ | Used for when item use count runs out, ie: eating completed | onItemUseFinish | {
"repo_name": "CheeseL0ver/Ore-TTM",
"path": "build/tmp/recompSrc/net/minecraft/entity/player/EntityPlayer.java",
"license": "lgpl-2.1",
"size": 87189
} | [
"net.minecraft.item.ItemStack",
"net.minecraftforge.event.ForgeEventFactory"
] | import net.minecraft.item.ItemStack; import net.minecraftforge.event.ForgeEventFactory; | import net.minecraft.item.*; import net.minecraftforge.event.*; | [
"net.minecraft.item",
"net.minecraftforge.event"
] | net.minecraft.item; net.minecraftforge.event; | 2,860,784 |
private String getStorageBucketName(StorageEntity storageEntity)
{
return storageDaoHelper.getStorageAttributeValueByName(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), storageEntity,
true);
} | String function(StorageEntity storageEntity) { return storageDaoHelper.getStorageAttributeValueByName(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), storageEntity, true); } | /**
* Gets the storage's bucket name. Throws if not defined.
*
* @param storageEntity The storage entity
* @return S3 bucket name
*/ | Gets the storage's bucket name. Throws if not defined | getStorageBucketName | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/UploadDownloadServiceImpl.java",
"license": "apache-2.0",
"size": 38356
} | [
"org.finra.herd.model.dto.ConfigurationValue",
"org.finra.herd.model.jpa.StorageEntity"
] | import org.finra.herd.model.dto.ConfigurationValue; import org.finra.herd.model.jpa.StorageEntity; | import org.finra.herd.model.dto.*; import org.finra.herd.model.jpa.*; | [
"org.finra.herd"
] | org.finra.herd; | 2,127,841 |
public boolean releaseLock(long nodeId)
throws DatabaseException {
assert isOpen;
boolean ret = lockManager.release(nodeId, this);
removeLock(nodeId);
return ret;
} | boolean function(long nodeId) throws DatabaseException { assert isOpen; boolean ret = lockManager.release(nodeId, this); removeLock(nodeId); return ret; } | /**
* Release the lock on this LN and remove from the transaction's owning
* set.
*/ | Release the lock on this LN and remove from the transaction's owning set | releaseLock | {
"repo_name": "plast-lab/DelphJ",
"path": "examples/berkeleydb/com/sleepycat/je/txn/Locker.java",
"license": "mit",
"size": 27031
} | [
"com.sleepycat.je.DatabaseException"
] | import com.sleepycat.je.DatabaseException; | import com.sleepycat.je.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 750,473 |
public String getIdentifier()
{
return ID3v24Frames.FRAME_ID_URL_COMMERCIAL;
} | String function() { return ID3v24Frames.FRAME_ID_URL_COMMERCIAL; } | /**
* The ID3v2 frame identifier
*
* @return the ID3v2 frame identifier for this frame type
*/ | The ID3v2 frame identifier | getIdentifier | {
"repo_name": "syntelos/cddb",
"path": "src/org/jaudiotagger/tag/id3/framebody/FrameBodyWCOM.java",
"license": "lgpl-3.0",
"size": 2491
} | [
"org.jaudiotagger.tag.id3.ID3v24Frames"
] | import org.jaudiotagger.tag.id3.ID3v24Frames; | import org.jaudiotagger.tag.id3.*; | [
"org.jaudiotagger.tag"
] | org.jaudiotagger.tag; | 2,868,723 |
public Statement getStatement() throws SQLException {
checkClosed();
return (Statement) statement;
} | Statement function() throws SQLException { checkClosed(); return (Statement) statement; } | /**
* <!-- start generic documentation -->
* Retrieves the <code>Statement</code> object that produced this
* <code>ResultSet</code> object.
* If the result set was generated some other way, such as by a
* <code>DatabaseMetaData</code> method, this method may return
* <code>null</code>.
* <!-- end generic documentation -->
*
* @return the <code>Statment</code> object that produced
* this <code>ResultSet</code> object or <code>null</code>
* if the result set was produced some other way
* @exception SQLException if a database access error occurs
* or this method is called on a closed result set
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCResultSet)
*/ | Retrieves the <code>Statement</code> object that produced this <code>ResultSet</code> object. If the result set was generated some other way, such as by a <code>DatabaseMetaData</code> method, this method may return <code>null</code>. | getStatement | {
"repo_name": "apavlo/h-store",
"path": "src/hsqldb19b3/org/hsqldb/jdbc/JDBCResultSet.java",
"license": "gpl-3.0",
"size": 304688
} | [
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,170,939 |
public void setCurrentItemShowing(int index, boolean animate) {
if (index != HOUR_INDEX && index != MINUTE_INDEX) {
Log.e(TAG, "TimePicker does not support view at index "+index);
return;
}
int lastIndex = getCurrentItemShowing();
mCurrentItemShowing = index;
if (animate && (index != lastIndex)) {
ObjectAnimator[] anims = new ObjectAnimator[4];
if (index == MINUTE_INDEX) {
anims[0] = mHourRadialTextsView.getDisappearAnimator();
anims[1] = mHourRadialSelectorView.getDisappearAnimator();
anims[2] = mMinuteRadialTextsView.getReappearAnimator();
anims[3] = mMinuteRadialSelectorView.getReappearAnimator();
} else if (index == HOUR_INDEX){
anims[0] = mHourRadialTextsView.getReappearAnimator();
anims[1] = mHourRadialSelectorView.getReappearAnimator();
anims[2] = mMinuteRadialTextsView.getDisappearAnimator();
anims[3] = mMinuteRadialSelectorView.getDisappearAnimator();
}
if (mTransition != null && mTransition.isRunning()) {
mTransition.end();
}
mTransition = new AnimatorSet();
mTransition.playTogether(anims);
mTransition.start();
} else {
int hourAlpha = (index == HOUR_INDEX) ? 255 : 0;
int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0;
mHourRadialTextsView.setAlpha(hourAlpha);
mHourRadialSelectorView.setAlpha(hourAlpha);
mMinuteRadialTextsView.setAlpha(minuteAlpha);
mMinuteRadialSelectorView.setAlpha(minuteAlpha);
}
} | void function(int index, boolean animate) { if (index != HOUR_INDEX && index != MINUTE_INDEX) { Log.e(TAG, STR+index); return; } int lastIndex = getCurrentItemShowing(); mCurrentItemShowing = index; if (animate && (index != lastIndex)) { ObjectAnimator[] anims = new ObjectAnimator[4]; if (index == MINUTE_INDEX) { anims[0] = mHourRadialTextsView.getDisappearAnimator(); anims[1] = mHourRadialSelectorView.getDisappearAnimator(); anims[2] = mMinuteRadialTextsView.getReappearAnimator(); anims[3] = mMinuteRadialSelectorView.getReappearAnimator(); } else if (index == HOUR_INDEX){ anims[0] = mHourRadialTextsView.getReappearAnimator(); anims[1] = mHourRadialSelectorView.getReappearAnimator(); anims[2] = mMinuteRadialTextsView.getDisappearAnimator(); anims[3] = mMinuteRadialSelectorView.getDisappearAnimator(); } if (mTransition != null && mTransition.isRunning()) { mTransition.end(); } mTransition = new AnimatorSet(); mTransition.playTogether(anims); mTransition.start(); } else { int hourAlpha = (index == HOUR_INDEX) ? 255 : 0; int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0; mHourRadialTextsView.setAlpha(hourAlpha); mHourRadialSelectorView.setAlpha(hourAlpha); mMinuteRadialTextsView.setAlpha(minuteAlpha); mMinuteRadialSelectorView.setAlpha(minuteAlpha); } } | /**
* Set either minutes or hours as showing.
* @param animate True to animate the transition, false to show with no animation.
*/ | Set either minutes or hours as showing | setCurrentItemShowing | {
"repo_name": "borax12/MaterialDateRangePicker",
"path": "library/src/main/java/com/borax12/materialdaterangepicker/time/RadialPickerLayout.java",
"license": "apache-2.0",
"size": 36622
} | [
"android.animation.AnimatorSet",
"android.animation.ObjectAnimator",
"android.util.Log"
] | import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.util.Log; | import android.animation.*; import android.util.*; | [
"android.animation",
"android.util"
] | android.animation; android.util; | 1,732,327 |
T onType(TypeDescription typeDescription); | T onType(TypeDescription typeDescription); | /**
* Applies the visitor on a type.
*
* @param typeDescription The type onto which this visitor is applied.
* @return The visitor's return value.
*/ | Applies the visitor on a type | onType | {
"repo_name": "DALDEI/byte-buddy",
"path": "byte-buddy-dep/src/main/java/net/bytebuddy/description/TypeVariableSource.java",
"license": "apache-2.0",
"size": 4174
} | [
"net.bytebuddy.description.type.TypeDescription"
] | import net.bytebuddy.description.type.TypeDescription; | import net.bytebuddy.description.type.*; | [
"net.bytebuddy.description"
] | net.bytebuddy.description; | 590,581 |
private void readHeader(int imageIndex, boolean reset)
throws IOException {
gotoImage(imageIndex);
readNativeHeader(reset); // Ignore return
currentImage = imageIndex;
} | void function(int imageIndex, boolean reset) throws IOException { gotoImage(imageIndex); readNativeHeader(reset); currentImage = imageIndex; } | /**
* Reads header information for the given image, if possible.
*/ | Reads header information for the given image, if possible | readHeader | {
"repo_name": "md-5/jdk10",
"path": "src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java",
"license": "gpl-2.0",
"size": 66982
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 804,001 |
default void connectionOpened( AsyncContext context, HttpSession session, HttpConnection connection ) {};
/**
* A connection was opened.
*
* @param session the session for which a new connection was opened.
* @param connection the connection that was just opened.
* @deprecated Replaced by {@link #connectionOpened(AsyncContext, HttpSession, HttpConnection)} | default void connectionOpened( AsyncContext context, HttpSession session, HttpConnection connection ) {}; /** * A connection was opened. * * @param session the session for which a new connection was opened. * @param connection the connection that was just opened. * @deprecated Replaced by {@link #connectionOpened(AsyncContext, HttpSession, HttpConnection)} | /**
* A connection was opened.
*
* @param context The servlet servlet context of the BOSH request that triggered this event.
* @param session the session for which a new connection was opened.
* @param connection the connection that was just opened.
*/ | A connection was opened | connectionOpened | {
"repo_name": "speedy01/Openfire",
"path": "xmppserver/src/main/java/org/jivesoftware/openfire/http/SessionListener.java",
"license": "apache-2.0",
"size": 3261
} | [
"javax.servlet.AsyncContext"
] | import javax.servlet.AsyncContext; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 790,731 |
public List<FacesConfigApplicationType<WebFacesConfigDescriptor>> getAllApplication()
{
List<FacesConfigApplicationType<WebFacesConfigDescriptor>> list = new ArrayList<FacesConfigApplicationType<WebFacesConfigDescriptor>>();
List<Node> nodeList = model.get("application");
for(Node node: nodeList)
{
FacesConfigApplicationType<WebFacesConfigDescriptor> type = new FacesConfigApplicationTypeImpl<WebFacesConfigDescriptor>(this, "application", model, node);
list.add(type);
}
return list;
} | List<FacesConfigApplicationType<WebFacesConfigDescriptor>> function() { List<FacesConfigApplicationType<WebFacesConfigDescriptor>> list = new ArrayList<FacesConfigApplicationType<WebFacesConfigDescriptor>>(); List<Node> nodeList = model.get(STR); for(Node node: nodeList) { FacesConfigApplicationType<WebFacesConfigDescriptor> type = new FacesConfigApplicationTypeImpl<WebFacesConfigDescriptor>(this, STR, model, node); list.add(type); } return list; } | /**
* Returns all <code>application</code> elements
* @return list of <code>application</code>
*/ | Returns all <code>application</code> elements | getAllApplication | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facesconfig21/WebFacesConfigDescriptorImpl.java",
"license": "epl-1.0",
"size": 44350
} | [
"java.util.ArrayList",
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.facesconfig21.FacesConfigApplicationType",
"org.jboss.shrinkwrap.descriptor.api.facesconfig21.WebFacesConfigDescriptor",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.ArrayList; import java.util.List; import org.jboss.shrinkwrap.descriptor.api.facesconfig21.FacesConfigApplicationType; import org.jboss.shrinkwrap.descriptor.api.facesconfig21.WebFacesConfigDescriptor; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.facesconfig21.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 1,308,406 |
// -----------------------------------------------------------------------------------------------
Set<String> getHypernyms(String source); | Set<String> getHypernyms(String source); | /**
* Method that returns the hypermyms of a given term
*
* @param source
* We assume that the source has been stemmed using the stemmer
* associated with the handler
* @return
*/ | Method that returns the hypermyms of a given term | getHypernyms | {
"repo_name": "fitash/epnoi",
"path": "model/src/main/java/org/epnoi/model/KnowledgeBase.java",
"license": "apache-2.0",
"size": 1200
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,029,543 |
private SortedSet<String> getIANARootZoneDatabase() throws IOException {
final SortedSet<String> TLDs = new TreeSet<String>();
final URLConnection connection = tldFileURL.openConnection();
connection.setUseCaches(false);
connection.addRequestProperty("Cache-Control", "no-cache");
connection.connect();
tldFileLastModified = connection.getLastModified();
BufferedReader reader = new BufferedReader
(new InputStreamReader(connection.getInputStream(), "US-ASCII"));
try {
String line;
while (null != (line = reader.readLine())) {
Matcher matcher = TLD_PATTERN_1.matcher(line);
if (matcher.matches()) {
TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT));
} else {
matcher = TLD_PATTERN_2.matcher(line);
if (matcher.matches()) {
TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT));
}
}
}
} finally {
reader.close();
}
return TLDs;
}
| SortedSet<String> function() throws IOException { final SortedSet<String> TLDs = new TreeSet<String>(); final URLConnection connection = tldFileURL.openConnection(); connection.setUseCaches(false); connection.addRequestProperty(STR, STR); connection.connect(); tldFileLastModified = connection.getLastModified(); BufferedReader reader = new BufferedReader (new InputStreamReader(connection.getInputStream(), STR)); try { String line; while (null != (line = reader.readLine())) { Matcher matcher = TLD_PATTERN_1.matcher(line); if (matcher.matches()) { TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT)); } else { matcher = TLD_PATTERN_2.matcher(line); if (matcher.matches()) { TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT)); } } } } finally { reader.close(); } return TLDs; } | /**
* Downloads the IANA Root Zone Database.
* @return downcased sorted set of ASCII TLDs
* @throws java.io.IOException if there is a problem downloading the database
*/ | Downloads the IANA Root Zone Database | getIANARootZoneDatabase | {
"repo_name": "terrancesnyder/solr-analytics",
"path": "lucene/analysis/common/src/tools/java/org/apache/lucene/analysis/standard/GenerateJflexTLDMacros.java",
"license": "apache-2.0",
"size": 8035
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.net.URLConnection",
"java.util.Locale",
"java.util.SortedSet",
"java.util.TreeSet",
"java.util.regex.Matcher"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLConnection; import java.util.Locale; import java.util.SortedSet; import java.util.TreeSet; import java.util.regex.Matcher; | import java.io.*; import java.net.*; import java.util.*; import java.util.regex.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 1,320,502 |
protected void handleCancelled(final File startDirectory, final Collection<T> results,
final CancelException cancel) throws IOException {
// re-throw exception - overridable by subclass
throw cancel;
} | void function(final File startDirectory, final Collection<T> results, final CancelException cancel) throws IOException { throw cancel; } | /**
* Overridable callback method invoked when the operation is cancelled.
* The file being processed when the cancellation occurred can be
* obtained from the exception.
* <p>
* This implementation just re-throws the {@link CancelException}.
*
* @param startDirectory the directory that the walk started from
* @param results the collection of result objects, may be updated
* @param cancel the exception throw to cancel further processing
* containing details at the point of cancellation.
* @throws IOException if an I/O Error occurs
*/ | Overridable callback method invoked when the operation is cancelled. The file being processed when the cancellation occurred can be obtained from the exception. This implementation just re-throws the <code>CancelException</code> | handleCancelled | {
"repo_name": "stereokrauts/stereoscope",
"path": "org.apache.commons.io/src/main/java/org/apache/commons/io/DirectoryWalker.java",
"license": "gpl-2.0",
"size": 26008
} | [
"java.io.File",
"java.io.IOException",
"java.util.Collection"
] | import java.io.File; import java.io.IOException; import java.util.Collection; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,269,090 |
public static double getMaximumExtend( final Structure structure ) {
double[][] bounds = getAtomCoordinateBounds(structure);
double xMax = Math.abs(bounds[0][0] - bounds[1][0]);
double yMax = Math.abs(bounds[0][1] - bounds[1][1]);
double zMax = Math.abs(bounds[0][2] - bounds[1][2]);
return Math.max(xMax, Math.max(yMax, zMax));
} | static double function( final Structure structure ) { double[][] bounds = getAtomCoordinateBounds(structure); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); } | /**
* Returns the maximum extend of the structure in the x, y, or z direction.
* @param structure
* @return maximum extend
*/ | Returns the maximum extend of the structure in the x, y, or z direction | getMaximumExtend | {
"repo_name": "kumar-physics/BioJava",
"path": "biojava3-structure/src/main/java/org/biojava/bio/structure/quaternary/BioAssemblyTools.java",
"license": "lgpl-2.1",
"size": 10238
} | [
"org.biojava.bio.structure.Structure"
] | import org.biojava.bio.structure.Structure; | import org.biojava.bio.structure.*; | [
"org.biojava.bio"
] | org.biojava.bio; | 403,179 |
public void endPrefixMapping(String prefix)
throws SAXException {
this.log ("endPrefixMapping", "prefix="+prefix);
if (super.contentHandler!=null) {
super.contentHandler.endPrefixMapping(prefix);
}
} | void function(String prefix) throws SAXException { this.log (STR, STR+prefix); if (super.contentHandler!=null) { super.contentHandler.endPrefixMapping(prefix); } } | /**
* End the scope of a prefix-URI mapping.
*/ | End the scope of a prefix-URI mapping | endPrefixMapping | {
"repo_name": "apache/cocoon",
"path": "core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/LogTransformer.java",
"license": "apache-2.0",
"size": 11564
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 376,090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.